/**
 * Lecture Mind - Design Token System
 *
 * Premium tech-forward design inspired by EdgeVec aesthetic
 * Implements: Design tokens, typography scale, spacing, motion
 *
 * IMPORTANT: Respects prefers-reduced-motion for accessibility
 */

/* ============================================
   COLOR TOKENS - Premium Dark Theme
   ============================================ */
:root {
  /* Primitive Colors */
  --color-white: #ffffff;
  --color-black: #000000;

  /* Brand Colors - Cyan/Blue Tech Palette */
  --color-primary-50: #ecfeff;
  --color-primary-100: #cffafe;
  --color-primary-200: #a5f3fc;
  --color-primary-300: #67e8f9;
  --color-primary-400: #22d3ee;
  --color-primary-500: #06b6d4;
  --color-primary-600: #0891b2;
  --color-primary-700: #0e7490;
  --color-primary-800: #155e75;
  --color-primary-900: #164e63;

  /* Accent - Electric Indigo */
  --color-accent-400: #818cf8;
  --color-accent-500: #6366f1;
  --color-accent-600: #4f46e5;

  /* Success - Emerald */
  --color-success-400: #34d399;
  --color-success-500: #10b981;
  --color-success-600: #059669;

  /* Warning - Amber */
  --color-warning-400: #fbbf24;
  --color-warning-500: #f59e0b;

  /* Error - Rose */
  --color-error-400: #fb7185;
  --color-error-500: #f43f5e;
  --color-error-600: #e11d48;

  /* Neutral - Slate */
  --color-neutral-50: #f8fafc;
  --color-neutral-100: #f1f5f9;
  --color-neutral-200: #e2e8f0;
  --color-neutral-300: #cbd5e1;
  --color-neutral-400: #94a3b8;
  --color-neutral-500: #64748b;
  --color-neutral-600: #475569;
  --color-neutral-700: #334155;
  --color-neutral-800: #1e293b;
  --color-neutral-900: #0f172a;
  --color-neutral-950: #020617;
}

/* ============================================
   SEMANTIC COLOR TOKENS
   ============================================ */
:root {
  /* Light Mode (default) */
  --background: var(--color-neutral-50);
  --background-subtle: var(--color-neutral-100);
  --foreground: var(--color-neutral-900);
  --foreground-muted: var(--color-neutral-600); /* WCAG AA compliant - 7:1 contrast */

  --surface: var(--color-white);
  --surface-elevated: var(--color-white);
  --surface-overlay: rgba(255, 255, 255, 0.8);

  --border: var(--color-neutral-200);
  --border-subtle: var(--color-neutral-100);
  --border-focus: var(--color-primary-500);

  --primary: var(--color-primary-600);
  --primary-hover: var(--color-primary-700);
  --primary-foreground: var(--color-white);

  --accent: var(--color-accent-500);
  --accent-hover: var(--color-accent-600);
  --accent-foreground: var(--color-white);

  --success: var(--color-success-500);
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: var(--color-warning-500);
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error: var(--color-error-500);
  --error-bg: rgba(244, 63, 94, 0.1);

  --ring: var(--color-primary-500);
  --ring-offset: var(--background);

  /* Glow effects - subtle for premium feel */
  --glow-primary: rgba(6, 182, 212, 0.12);
  --glow-accent: rgba(99, 102, 241, 0.12);
  --glow-success: rgba(16, 185, 129, 0.12);

  /* HSL values for alpha transparency support */
  --primary-hsl: 187 94% 43%;
  --accent-hsl: 239 84% 67%;
  --success-hsl: 160 84% 39%;
  --warning-hsl: 38 92% 50%;
  --error-hsl: 350 89% 60%;
}

/* Dark Mode */
.dark {
  --background: var(--color-neutral-950);
  --background-subtle: var(--color-neutral-900);
  --foreground: var(--color-neutral-50);
  --foreground-muted: var(--color-neutral-300); /* Better dark mode contrast */

  --surface: var(--color-neutral-900);
  --surface-elevated: var(--color-neutral-800);
  --surface-overlay: rgba(15, 23, 42, 0.9);

  --border: var(--color-neutral-700); /* Improved visibility */
  --border-subtle: var(--color-neutral-800);
  --border-focus: var(--color-primary-400);

  --primary: var(--color-primary-400);
  --primary-hover: var(--color-primary-300);
  --primary-foreground: var(--color-neutral-950);

  --accent: var(--color-accent-400);
  --accent-hover: var(--color-accent-300);

  --ring: var(--color-primary-400);
  --ring-offset: var(--background);

  /* Enhanced glow for dark mode - subtle for premium feel */
  --glow-primary: rgba(34, 211, 238, 0.15);
  --glow-accent: rgba(129, 140, 248, 0.15);
}

/* ============================================
   TYPOGRAPHY TOKENS
   ============================================ */
:root {
  /* Font Families */
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo,
               Consolas, monospace;
  --font-display: 'Inter', var(--font-sans);

  /* Font Sizes - Fluid Typography */
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */

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

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

  /* Letter Spacing */
  --tracking-tighter: -0.05em;
  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;
}

/* ============================================
   SPACING TOKENS (4px base)
   ============================================ */
:root {
  --space-0: 0;
  --space-px: 1px;
  --space-0_5: 0.125rem;   /* 2px */
  --space-1: 0.25rem;      /* 4px */
  --space-1_5: 0.375rem;   /* 6px */
  --space-2: 0.5rem;       /* 8px */
  --space-2_5: 0.625rem;   /* 10px */
  --space-3: 0.75rem;      /* 12px */
  --space-3_5: 0.875rem;   /* 14px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-7: 1.75rem;      /* 28px */
  --space-8: 2rem;         /* 32px */
  --space-9: 2.25rem;      /* 36px */
  --space-10: 2.5rem;      /* 40px */
  --space-12: 3rem;        /* 48px */
  --space-14: 3.5rem;      /* 56px */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */
}

/* ============================================
   BORDER RADIUS TOKENS
   ============================================ */
:root {
  --radius-none: 0;
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.375rem;   /* 6px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-3xl: 1.5rem;    /* 24px */
  --radius-full: 9999px;
}

/* ============================================
   SHADOW TOKENS
   ============================================ */
:root {
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);

  /* Glow shadows for dark mode */
  --shadow-glow-sm: 0 0 10px var(--glow-primary);
  --shadow-glow-md: 0 0 20px var(--glow-primary);
  --shadow-glow-lg: 0 0 30px var(--glow-primary);
}

.dark {
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
}

/* ============================================
   MOTION TOKENS
   ============================================ */
:root {
  /* Durations */
  --duration-instant: 0ms;
  --duration-fast: 100ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;

  /* Easing - Standard */
  --ease-linear: linear;
  --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);

  /* Easing - Spring (using linear() for smooth spring physics) */
  --ease-spring: linear(
    0, 0.006, 0.025, 0.056, 0.1, 0.157, 0.225, 0.306, 0.4, 0.506,
    0.625, 0.756, 0.9, 1.013, 1.094, 1.145, 1.167, 1.163, 1.136,
    1.09, 1.029, 0.96, 0.89, 0.825, 0.77, 0.727, 0.697, 0.683,
    0.681, 0.692, 0.714, 0.746, 0.785, 0.829, 0.876, 0.924, 0.969,
    1.01, 1.044, 1.069, 1.084, 1.09, 1.087, 1.077, 1.062, 1.044,
    1.025, 1.007, 0.991, 0.978, 0.969, 0.965, 0.965, 0.969, 0.977,
    0.988, 1
  );

  /* Easing - Bounce */
  --ease-bounce: linear(
    0, 0.004, 0.016, 0.035, 0.063, 0.098, 0.141, 0.191, 0.25, 0.316,
    0.391, 0.473, 0.563, 0.66, 0.766, 0.879, 1, 0.925, 0.865, 0.82,
    0.79, 0.775, 0.775, 0.79, 0.82, 0.865, 0.925, 1, 0.965, 0.945,
    0.94, 0.95, 0.975, 1
  );

  /* Premium Spring Curves - Apple/Pixar inspired */
  --spring-bounce-1: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-bounce-2: cubic-bezier(0.22, 1.36, 0.36, 1);
  --spring-snappy: cubic-bezier(0.17, 0.89, 0.32, 1.28);
  --spring-smooth: cubic-bezier(0.22, 0.61, 0.36, 1);
  --spring-gentle: cubic-bezier(0.16, 1, 0.3, 1);

  /* Premium durations */
  --duration-micro: 150ms;
  --duration-small: 250ms;
  --duration-medium: 400ms;
  --duration-large: 600ms;
  --duration-xl: 1000ms;
}

/* Reduced motion - disable animations */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-instant: 0ms;
    --duration-fast: 0ms;
    --duration-normal: 0ms;
    --duration-slow: 0ms;
    --duration-slower: 0ms;

    --ease-spring: linear;
    --ease-bounce: linear;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   Z-INDEX TOKENS
   ============================================ */
:root {
  --z-hide: -1;
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;
  --z-popover: 60;
  --z-tooltip: 70;
  --z-toast: 80;
}

/* ============================================
   COMPONENT TOKENS
   ============================================ */
:root {
  /* Button */
  --btn-height-sm: 2rem;       /* 32px */
  --btn-height-md: 2.5rem;     /* 40px */
  --btn-height-lg: 2.75rem;    /* 44px */

  /* Input */
  --input-height: 2.5rem;      /* 40px */
  --input-height-sm: 2rem;     /* 32px */
  --input-height-lg: 3rem;     /* 48px */

  /* Card */
  --card-padding: var(--space-6);
  --card-radius: var(--radius-xl);

  /* Header */
  --header-height: 4rem;       /* 64px */
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Spin */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Shimmer (for skeleton loading) */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Bounce */
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* Typing Cursor */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Glow Pulse (for dark mode emphasis) */
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 5px var(--glow-primary), 0 0 10px var(--glow-primary);
  }
  50% {
    box-shadow: 0 0 10px var(--glow-primary), 0 0 20px var(--glow-primary);
  }
}

/* ============================================
   UTILITY ANIMATION CLASSES
   ============================================ */
.animate-fadeIn {
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.animate-fadeInUp {
  animation: fadeInUp var(--duration-slow) var(--ease-spring) forwards;
}

.animate-fadeInDown {
  animation: fadeInDown var(--duration-slow) var(--ease-spring) forwards;
}

.animate-scaleIn {
  animation: scaleIn var(--duration-normal) var(--ease-spring) forwards;
}

.animate-slideInRight {
  animation: slideInRight var(--duration-slow) var(--ease-spring) forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

.animate-bounce {
  animation: bounce 1s var(--ease-bounce) infinite;
}

/* Stagger delays for list animations */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
.stagger-5 { animation-delay: 250ms; }
.stagger-6 { animation-delay: 300ms; }
