/* Modern Design Token System - 2024 Standards */
/* This replaces the basic variables.css with a comprehensive design system */

:root {
  /* === COLOR SYSTEM === */

  /* Brand Colors - Extended Palette */
  --brand-50: #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93bbfd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;
  --brand-950: #172554;

  /* Accent Colors */
  --accent-50: #fef2f2;
  --accent-100: #fee2e2;
  --accent-200: #fecaca;
  --accent-300: #fca5a5;
  --accent-400: #f87171;
  --accent-500: #ef4444;
  --accent-600: #dc2626;
  --accent-700: #b91c1c;
  --accent-800: #991b1b;
  --accent-900: #7f1d1d;

  /* Success Colors */
  --success-50: #f0fdf4;
  --success-100: #dcfce7;
  --success-200: #bbf7d0;
  --success-300: #86efac;
  --success-400: #4ade80;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;
  --success-800: #166534;
  --success-900: #14532d;

  /* Warning Colors */
  --warning-50: #fefce8;
  --warning-100: #fef9c3;
  --warning-200: #fef08a;
  --warning-300: #fde047;
  --warning-400: #facc15;
  --warning-500: #eab308;
  --warning-600: #ca8a04;
  --warning-700: #a16207;
  --warning-800: #854d0e;
  --warning-900: #713f12;

  /* Danger Colors */
  --danger-50: #fef2f2;
  --danger-100: #fee2e2;
  --danger-200: #fecaca;
  --danger-300: #fca5a5;
  --danger-400: #f87171;
  --danger-500: #ef4444;
  --danger-600: #dc2626;
  --danger-700: #b91c1c;
  --danger-800: #991b1b;
  --danger-900: #7f1d1d;

  /* Neutral Colors */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  --neutral-950: #0a0a0a;

  /* === SEMANTIC COLORS === */

  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.5);
  --bg-backdrop: rgba(255, 255, 255, 0.8);

  /* Surfaces */
  --surface-primary: #ffffff;
  --surface-secondary: #f9fafb;
  --surface-tertiary: #f3f4f6;
  --surface-elevated: #ffffff;
  --surface-overlay: rgba(0, 0, 0, 0.05);

  /* Text */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-disabled: #9ca3af;
  --text-inverse: #ffffff;
  --text-brand: var(--brand-600);
  --text-success: var(--success-700);
  --text-warning: var(--warning-700);
  --text-danger: var(--danger-700);

  /* Borders */
  --border-primary: #e5e7eb;
  --border-secondary: #d1d5db;
  --border-tertiary: #9ca3af;
  --border-brand: var(--brand-300);
  --border-success: var(--success-300);
  --border-warning: var(--warning-300);
  --border-danger: var(--danger-300);

  /* === TYPOGRAPHY === */

  /* Font Families */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Line Heights */
  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* Font Weights */
  --font-thin: 100;
  --font-light: 300;
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
  --font-black: 900;

  /* === SPACING === */

  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;

  /* === LAYOUT === */

  /* Border Radius */
  --radius-none: 0;
  --radius-sm: 0.125rem;
  --radius-base: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows - Elevation System */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-base: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
  --shadow-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

  /* Colored Shadows */
  --shadow-brand: 0 10px 15px -3px rgb(59 130 246 / 0.2), 0 4px 6px -4px rgb(59 130 246 / 0.1);
  --shadow-success: 0 10px 15px -3px rgb(34 197 94 / 0.2), 0 4px 6px -4px rgb(34 197 94 / 0.1);
  --shadow-warning: 0 10px 15px -3px rgb(234 179 8 / 0.2), 0 4px 6px -4px rgb(234 179 8 / 0.1);
  --shadow-danger: 0 10px 15px -3px rgb(239 68 68 / 0.2), 0 4px 6px -4px rgb(239 68 68 / 0.1);

  /* === TRANSITIONS === */

  --transition-none: none;
  --transition-all: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 100ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: all 500ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Easing Functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

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

  --z-negative: -1;
  --z-0: 0;
  --z-10: 10;
  --z-20: 20;
  --z-30: 30;
  --z-40: 40;
  --z-50: 50;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-notification: 1080;

  /* === BREAKPOINTS === */

  --screen-xs: 475px;
  --screen-sm: 640px;
  --screen-md: 768px;
  --screen-lg: 1024px;
  --screen-xl: 1280px;
  --screen-2xl: 1536px;

  /* === ANIMATIONS === */

  --animation-spin: spin 1s linear infinite;
  --animation-ping: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  --animation-pulse: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  --animation-bounce: bounce 1s infinite;
  --animation-float: float 3s ease-in-out infinite;

  /* === GRADIENTS === */

  --gradient-brand: linear-gradient(135deg, var(--brand-400) 0%, var(--brand-600) 100%);
  --gradient-success: linear-gradient(135deg, var(--success-400) 0%, var(--success-600) 100%);
  --gradient-warning: linear-gradient(135deg, var(--warning-400) 0%, var(--warning-600) 100%);
  --gradient-danger: linear-gradient(135deg, var(--danger-400) 0%, var(--danger-600) 100%);
  --gradient-subtle: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);

  /* === FOCUS STYLES === */

  --focus-ring-width: 3px;
  --focus-ring-color: var(--brand-500);
  --focus-ring-offset: 2px;
  --focus-ring: 0 0 0 var(--focus-ring-offset) var(--bg-primary),
               0 0 0 calc(var(--focus-ring-offset) + var(--focus-ring-width)) var(--focus-ring-color);
}

/* === DARK THEME === */

:root[data-theme="dark"] {
  /* Backgrounds */
  --bg-primary: #0a0a0a;
  --bg-secondary: #171717;
  --bg-tertiary: #262626;
  --bg-elevated: #1a1a1a;
  --bg-overlay: rgba(255, 255, 255, 0.1);
  --bg-backdrop: rgba(0, 0, 0, 0.8);

  /* Surfaces */
  --surface-primary: #171717;
  --surface-secondary: #262626;
  --surface-tertiary: #404040;
  --surface-elevated: #2a2a2a;
  --surface-overlay: rgba(255, 255, 255, 0.05);

  /* Text */
  --text-primary: #fafafa;
  --text-secondary: #d4d4d4;
  --text-tertiary: #a3a3a3;
  --text-disabled: #737373;
  --text-inverse: #0a0a0a;
  --text-brand: var(--brand-400);
  --text-success: var(--success-400);
  --text-warning: var(--warning-400);
  --text-danger: var(--danger-400);

  /* Borders */
  --border-primary: #404040;
  --border-secondary: #525252;
  --border-tertiary: #737373;
  --border-brand: var(--brand-700);
  --border-success: var(--success-700);
  --border-warning: var(--warning-700);
  --border-danger: var(--danger-700);

  /* Shadows - Darker for dark mode */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
  --shadow-base: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
  --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.8);

  /* Colored Shadows for Dark Mode */
  --shadow-brand: 0 10px 15px -3px rgb(59 130 246 / 0.4), 0 4px 6px -4px rgb(59 130 246 / 0.2);
  --shadow-success: 0 10px 15px -3px rgb(34 197 94 / 0.4), 0 4px 6px -4px rgb(34 197 94 / 0.2);
  --shadow-warning: 0 10px 15px -3px rgb(234 179 8 / 0.4), 0 4px 6px -4px rgb(234 179 8 / 0.2);
  --shadow-danger: 0 10px 15px -3px rgb(239 68 68 / 0.4), 0 4px 6px -4px rgb(239 68 68 / 0.2);

  /* Focus Ring for Dark Mode */
  --focus-ring-color: var(--brand-400);
}

/* === AUTO DARK MODE === */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Copy all dark theme variables here */
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --bg-tertiary: #262626;
    --bg-elevated: #1a1a1a;
    --bg-overlay: rgba(255, 255, 255, 0.1);
    --bg-backdrop: rgba(0, 0, 0, 0.8);

    --surface-primary: #171717;
    --surface-secondary: #262626;
    --surface-tertiary: #404040;
    --surface-elevated: #2a2a2a;
    --surface-overlay: rgba(255, 255, 255, 0.05);

    --text-primary: #fafafa;
    --text-secondary: #d4d4d4;
    --text-tertiary: #a3a3a3;
    --text-disabled: #737373;
    --text-inverse: #0a0a0a;
    --text-brand: var(--brand-400);
    --text-success: var(--success-400);
    --text-warning: var(--warning-400);
    --text-danger: var(--danger-400);

    --border-primary: #404040;
    --border-secondary: #525252;
    --border-tertiary: #737373;

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.3);
    --shadow-base: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
    --shadow-2xl: 0 35px 60px -15px rgba(0, 0, 0, 0.8);

    --focus-ring-color: var(--brand-400);
  }
}

/* === HIGH CONTRAST MODE === */

@media (prefers-contrast: high) {
  :root {
    --focus-ring-width: 4px;
    --border-primary: currentColor;
    --text-primary: #000000;
    --bg-primary: #ffffff;
  }

  :root[data-theme="dark"] {
    --text-primary: #ffffff;
    --bg-primary: #000000;
  }
}

/* === REDUCED MOTION === */

@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-none: none;
    --transition-all: none;
    --transition-fast: none;
    --transition-base: none;
    --transition-slow: none;
    --transition-slower: none;

    --animation-spin: none;
    --animation-ping: none;
    --animation-pulse: none;
    --animation-bounce: none;
    --animation-float: none;
  }
}

/* === PRINT STYLES === */

@media print {
  :root {
    --bg-primary: #ffffff;
    --text-primary: #000000;
    --shadow-none: none;
    --shadow-xs: none;
    --shadow-sm: none;
    --shadow-base: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: none;
    --shadow-2xl: none;
  }
}