/* Design Tokens - CSS Custom Properties */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ============================================================================
   DARK THEME (Default)
   ============================================================================ */
:root {
  /* Color Scheme Indicator */
  color-scheme: dark;

  /* Base Colors */
  --bg-app: #080a0e;
  --bg-primary: #0c0f14;
  --bg-secondary: #12161c;
  --bg-tertiary: #1e293b;
  --bg-hover: rgba(255, 255, 255, 0.02);

  /* Border Colors */
  --border-color: #1e293b;
  --border-light: #334155;
  --border-hover: #475569;

  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* Accent Colors */
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-light: #60a5fa;
  --accent-muted: rgba(59, 130, 246, 0.15);
  --accent-bg: #1e3a5f;

  /* Semantic Colors */
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, 0.15);
  --success-bg: #14532d;
  --success-text: #4ade80;

  --warning: #f59e0b;
  --warning-light: rgba(251, 191, 36, 0.15);
  --warning-bg: #78350f;
  --warning-text: #fcd34d;

  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.15);
  --danger-bg: #7f1d1d;
  --danger-text: #fca5a5;

  --info: #3b82f6;
  --info-light: rgba(59, 130, 246, 0.15);

  /* Tag/Pill Colors */
  --purple-bg: #3b0764;
  --purple-border: #7c3aed;
  --purple-text: #a78bfa;

  --amber-bg: #451a03;
  --amber-border: #d97706;
  --amber-text: #fbbf24;

  --green-bg: #14532d;
  --green-border: #16a34a;
  --green-text: #4ade80;

  --blue-bg: #1e3a5f;
  --blue-border: #2563eb;
  --blue-text: #60a5fa;

  --gray-bg: #1e293b;
  --gray-border: #475569;
  --gray-text: #94a3b8;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.4);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.4);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.5);

  /* ========================
     TYPOGRAPHY
     ======================== */

  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Monaco, monospace;

  /* Type Scale */
  --text-2xs:  0.5625rem;  /* 9px */
  --text-xs:   0.6875rem;  /* 11px */
  --text-sm:   0.75rem;    /* 12px */
  --text-base: 0.8125rem;  /* 13px */
  --text-md:   0.875rem;   /* 14px */
  --text-lg:   1rem;       /* 16px */
  --text-xl:   1.25rem;    /* 20px */
  --text-2xl:  2rem;       /* 32px */

  /* Font Weights */
  --font-normal:   400;
  --font-medium:   500;
  --font-semibold: 600;
  --font-bold:     700;

  /* Line Heights */
  --leading-tight:   1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.625;

  /* Letter Spacing */
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.03em;
  --tracking-wider: 0.05em;

  /* ========================
     SPACING
     ======================== */

  --space-1:  0.25rem;  /* 4px */
  --space-2:  0.5rem;   /* 8px */
  --space-3:  0.75rem;  /* 12px */
  --space-4:  1rem;     /* 16px */
  --space-5:  1.25rem;  /* 20px */
  --space-6:  1.5rem;   /* 24px */
  --space-8:  2rem;     /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* ========================
     LAYOUT
     ======================== */

  --sidebar-width: 220px;

  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;

  --touch-target-min: 44px;
  --mobile-header-height: 56px;

  /* Border Radius */
  --radius-sm:  4px;
  --radius:     6px;
  --radius-md:  6px;
  --radius-lg:  8px;
  --radius-xl:  10px;
  --radius-full: 9999px;

  /* ========================
     TRANSITIONS
     ======================== */

  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0.0, 0, 0.2, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);

  --duration-fast:   150ms;
  --duration-normal: 200ms;
  --duration-slow:   300ms;

  /* ========================
     Z-INDEX SCALE
     ======================== */

  --z-base:     0;
  --z-above:    10;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    300;
  --z-toast:    400;
  --z-tooltip:  500;

  /* ========================
     LEGACY ALIASES
     ======================== */

  --bg: var(--bg-primary);
  --surface: var(--bg-secondary);
  --border: var(--border-color);
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

/* ============================================================================
   LIGHT THEME
   ============================================================================ */
[data-theme="light"] {
  color-scheme: light;

  /* Base Colors */
  --bg-app: #f8fafc;
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-hover: rgba(0, 0, 0, 0.02);

  /* Border Colors */
  --border-color: #e2e8f0;
  --border-light: #cbd5e1;
  --border-hover: #94a3b8;

  /* Text Colors - higher contrast for readability */
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-tertiary: #475569;
  --text-muted: #64748b;

  /* Accent Colors */
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #3b82f6;
  --accent-muted: rgba(37, 99, 235, 0.1);
  --accent-bg: #dbeafe;

  /* Semantic Colors */
  --success: #16a34a;
  --success-light: rgba(22, 163, 74, 0.1);
  --success-bg: #dcfce7;
  --success-text: #15803d;

  --warning: #d97706;
  --warning-light: rgba(217, 119, 6, 0.1);
  --warning-bg: #fef3c7;
  --warning-text: #b45309;

  --danger: #dc2626;
  --danger-light: rgba(220, 38, 38, 0.1);
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;

  --info: #2563eb;
  --info-light: rgba(37, 99, 235, 0.1);

  /* Tag/Pill Colors */
  --purple-bg: #f3e8ff;
  --purple-border: #a855f7;
  --purple-text: #7c3aed;

  --amber-bg: #fef3c7;
  --amber-border: #f59e0b;
  --amber-text: #b45309;

  --green-bg: #dcfce7;
  --green-border: #22c55e;
  --green-text: #15803d;

  --blue-bg: #dbeafe;
  --blue-border: #3b82f6;
  --blue-text: #1d4ed8;

  --gray-bg: #f1f5f9;
  --gray-border: #64748b;
  --gray-text: #334155;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:  0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg:  0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl:  0 20px 25px rgba(0, 0, 0, 0.15);

  /* Legacy Aliases */
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

/* ============================================================================
   THEME TOGGLE BUTTON
   ============================================================================ */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  font-size: 16px;
}

.theme-toggle:hover {
  background: var(--border-light);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Icon states - hide both by default */
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

/* Dark mode: show sun icon (to switch to light) */
[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

/* Light mode: show moon icon (to switch to dark) */
[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Hide label by default (icon-only mode) */
.theme-toggle__label {
  display: none;
}

/* Sidebar variant - full width with label */
.theme-toggle--sidebar {
  width: 100%;
  height: 40px;
  justify-content: flex-start;
  gap: 8px;
  padding: 0 12px;
}

.theme-toggle--sidebar .theme-toggle__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}
