/**
 * Skills Manager Styles
 * Custom styles extending Tailwind CSS
 */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
  /* Colors */
  --color-primary: #9333ea;       /* Purple 600 */
  --color-primary-hover: #a855f7; /* Purple 500 */
  --color-primary-light: #c084fc; /* Purple 400 */

  --color-success: #22c55e;       /* Green 500 */
  --color-error: #ef4444;         /* Red 500 */
  --color-warning: #eab308;       /* Yellow 500 */
  --color-info: #3b82f6;          /* Blue 500 */

  --color-bg-primary: #111827;    /* Gray 900 */
  --color-bg-secondary: #1f2937; /* Gray 800 */
  --color-bg-tertiary: #374151;  /* Gray 700 */

  --color-text-primary: #ffffff;
  --color-text-secondary: #d1d5db; /* Gray 300 */
  --color-text-muted: #9ca3af;    /* Gray 400 */
  --color-text-disabled: #6b7280; /* Gray 500 */

  --color-border: #374151;        /* Gray 700 */
  --color-border-hover: #4b5563;  /* Gray 600 */

  /* Spacing */
  --spacing-xs: 0.25rem;  /* 4px */
  --spacing-sm: 0.5rem;   /* 8px */
  --spacing-md: 1rem;     /* 16px */
  --spacing-lg: 1.5rem;   /* 24px */
  --spacing-xl: 2rem;     /* 32px */

  /* Border Radius */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 200ms ease;
  --transition-slow: 300ms ease;

  /* Z-Index Scale */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-popover: 60;
  --z-toast: 100;
}


/* ============================================
   Base Styles
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  line-height: 1.5;
}

/* Focus visible styles for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}


/* ============================================
   Typography
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
}

p {
  margin: 0;
}

a {
  color: var(--color-primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

code {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace;
  font-size: 0.875em;
}


/* ============================================
   Layout Components
   ============================================ */

.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

@media (min-width: 640px) {
  .container {
    padding: 0 var(--spacing-lg);
  }
}


/* ============================================
   Header Styles
   ============================================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  backdrop-filter: blur(8px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: var(--spacing-md);
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text-primary);
}

.app-logo svg {
  width: 32px;
  height: 32px;
  color: var(--color-primary);
}


/* ============================================
   Status Indicator
   ============================================ */

.status-indicator {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.status-indicator.online {
  background-color: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.status-indicator.offline {
  background-color: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-indicator.online .status-dot {
  background-color: #22c55e;
}

.status-indicator.offline .status-dot {
  background-color: #ef4444;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}


/* ============================================
   Button Styles
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
}

.btn-secondary {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.btn-danger {
  background-color: transparent;
  color: #f87171;
}

.btn-danger:hover:not(:disabled) {
  background-color: var(--color-error);
  color: white;
}

.btn-icon {
  padding: var(--spacing-sm);
}


/* ============================================
   Form Controls
   ============================================ */

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-disabled);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
  outline: none;
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.form-help {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--color-text-disabled);
}

.form-error {
  margin-top: var(--spacing-xs);
  font-size: 0.75rem;
  color: var(--color-error);
}


/* ============================================
   Skill Card Styles
   ============================================ */

.skill-card {
  background-color: rgba(31, 41, 55, 0.5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--spacing-md);
  transition: all var(--transition-normal);
}

.skill-card:hover {
  border-color: rgba(147, 51, 234, 0.5);
  background-color: var(--color-bg-secondary);
}

.skill-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.skill-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-card-description {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-card-footer {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-sm);
  border-top: 1px solid var(--color-border);
  margin-top: var(--spacing-sm);
}


/* ============================================
   Category Badges
   ============================================ */

.category-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid;
}

.category-badge.development {
  background-color: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.category-badge.documentation {
  background-color: rgba(34, 197, 94, 0.2);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

.category-badge.forms {
  background-color: rgba(147, 51, 234, 0.2);
  color: #c4b5fd;
  border-color: rgba(147, 51, 234, 0.3);
}

.category-badge.building {
  background-color: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  border-color: rgba(249, 115, 22, 0.3);
}

.category-badge.visual {
  background-color: rgba(236, 72, 153, 0.2);
  color: #f9a8d4;
  border-color: rgba(236, 72, 153, 0.3);
}

.category-badge.other {
  background-color: rgba(107, 114, 128, 0.2);
  color: #d1d5db;
  border-color: rgba(107, 114, 128, 0.3);
}


/* ============================================
   Modal Styles
   ============================================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  pointer-events: none;
}

.modal-content {
  width: 100%;
  background-color: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  pointer-events: auto;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--spacing-md) var(--spacing-lg);
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: var(--spacing-md) var(--spacing-lg);
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}


/* ============================================
   Toast Styles
   ============================================ */

#toast-container {
  position: fixed;
  bottom: var(--spacing-md);
  right: var(--spacing-md);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  transform: translateX(100%);
  opacity: 0;
  transition: transform var(--transition-slow), opacity var(--transition-slow);
}

.toast.translate-x-0 {
  transform: translateX(0);
}

.toast.opacity-100 {
  opacity: 1;
}


/* ============================================
   Loading Spinner
   ============================================ */

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}


/* ============================================
   Skeleton Loading
   ============================================ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-border-hover) 50%,
    var(--color-bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}


/* ============================================
   Console Styles
   ============================================ */

.console-output {
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background-color: var(--color-bg-primary);
  border-radius: var(--radius-md);
}

.console-line {
  white-space: pre-wrap;
  word-break: break-word;
}


/* ============================================
   Utility Classes
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}


/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 640px) {
  .header-content {
    height: 56px;
  }

  .app-logo span {
    display: none;
  }

  .modal-content {
    margin: var(--spacing-sm);
    max-height: calc(100vh - var(--spacing-md));
  }

  .skill-card {
    padding: var(--spacing-sm);
  }
}


/* ============================================
   Print Styles
   ============================================ */

@media print {
  .app-header,
  .modal,
  #toast-container,
  button {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}
