/* ============================================
   Kaizen Labs - Unified Theme System
   ============================================
   Version: 2.0.0
   Created: 2025-11-22

   SINGLE SOURCE OF TRUTH for all design tokens.
   This file consolidates and replaces:
   - kaizen-labs-variables.css
   - variables.css

   ADHD-OPTIMIZED DARK THEME DESIGN SYSTEM
   ============================================ */

:root {
  /* ==========================================
     CORE BRAND COLORS
     ========================================== */

  --brand-primary: #5873CB;           /* Cool blue - focus & trust */
  --brand-primary-hover: #6b84d9;     /* Lighter for hover */
  --brand-primary-active: #4A63B8;    /* Darker for pressed */
  --brand-secondary: #367C28;         /* Success green */
  --brand-secondary-hover: #4A9E3A;
  --brand-secondary-active: #2D6B20;

  /* ==========================================
     BACKGROUND COLORS - DARK THEME DEFAULT
     ========================================== */

  /* Surface Hierarchy (Dark Mode) */
  --bg-primary: #0a0a0a;              /* Main canvas - darkest */
  --bg-secondary: #1E1E1E;            /* Cards, elevated surfaces */
  --bg-tertiary: #2A2A2A;             /* Nested components */
  --bg-surface: var(--bg-secondary);  /* Alias for semantic use */
  --bg-hover: #333333;                /* Hover state backgrounds */

  /* Opacity Overlays - For glassmorphism effects */
  --bg-white-2: rgba(255, 255, 255, 0.02);
  --bg-white-3: rgba(255, 255, 255, 0.03);
  --bg-white-4: rgba(255, 255, 255, 0.04);
  --bg-white-5: rgba(255, 255, 255, 0.05);
  --bg-white-8: rgba(255, 255, 255, 0.08);
  --bg-white-10: rgba(255, 255, 255, 0.1);
  --bg-white-15: rgba(255, 255, 255, 0.15);
  --bg-white-20: rgba(255, 255, 255, 0.2);

  --bg-black-30: rgba(0, 0, 0, 0.3);
  --bg-black-50: rgba(0, 0, 0, 0.5);
  --bg-black-70: rgba(0, 0, 0, 0.7);
  --bg-black-85: rgba(0, 0, 0, 0.85);

  /* ==========================================
     TEXT COLORS
     ========================================== */

  --text-primary: #E0E0E0;            /* Main text - high contrast */
  --text-secondary: #A0A0A0;          /* Subdued text */
  --text-tertiary: #707070;           /* Very subtle text */
  --text-muted: var(--text-secondary);/* Alias */
  --text-accent: var(--brand-primary);/* Links and accents */
  --text-inverse: #0a0a0a;            /* Text on light backgrounds */
  --text-white: #FFFFFF;              /* Pure white */

  /* Gray Scale for Text */
  --text-gray-500: #666666;
  --text-gray-600: #707070;
  --text-gray-700: #888888;
  --text-gray-800: #999999;
  --text-gray-900: #B0B0B0;

  /* ==========================================
     SEMANTIC STATUS COLORS
     Carefully chosen for ADHD accessibility
     ========================================== */

  /* Success - Achievement, completion, positive */
  --success: #4CAF50;
  --success-light: #66BB6A;
  --success-dark: #388E3C;
  --success-bg: rgba(76, 175, 80, 0.15);

  /* Warning - Caution, upcoming deadlines */
  --warning: #FF9800;
  --warning-light: #FFB74D;
  --warning-dark: #F57C00;
  --warning-bg: rgba(255, 152, 0, 0.15);

  /* Error - Errors, critical issues, destructive */
  --error: #F44336;
  --error-light: #EF5350;
  --error-dark: #D32F2F;
  --error-bg: rgba(244, 67, 54, 0.15);

  /* Info - Information, hints */
  --info: #2196F3;
  --info-light: #64B5F6;
  --info-dark: #1976D2;
  --info-bg: rgba(33, 150, 243, 0.15);

  /* ==========================================
     ADHD-SPECIFIC: TIME URGENCY COLORS
     Semantic colors for time-based perception
     ========================================== */

  --urgency-overdue: #D32F2F;         /* Red - past due, critical */
  --urgency-overdue-bg: rgba(211, 47, 47, 0.15);

  --urgency-today: #D32F2F;           /* Red - due today */
  --urgency-today-bg: rgba(211, 47, 47, 0.15);

  --urgency-tomorrow: #F57C00;        /* Orange - due tomorrow */
  --urgency-tomorrow-bg: rgba(245, 124, 0, 0.15);

  --urgency-this-week: #FBC02D;       /* Yellow - due this week */
  --urgency-this-week-bg: rgba(251, 192, 45, 0.15);

  --urgency-soon: #4CAF50;            /* Green - 1-2 weeks out */
  --urgency-soon-bg: rgba(76, 175, 80, 0.15);

  --urgency-future: #66BB6A;          /* Light green - 2+ weeks */
  --urgency-future-bg: rgba(102, 187, 106, 0.15);

  /* ==========================================
     ADHD-SPECIFIC: PRIORITY LEVELS
     ========================================== */

  --priority-critical: #F44336;       /* Red - must do immediately */
  --priority-critical-bg: rgba(244, 67, 54, 0.15);

  --priority-high: #FF9800;           /* Orange - important */
  --priority-high-bg: rgba(255, 152, 0, 0.15);

  --priority-medium: #2196F3;         /* Blue - normal */
  --priority-medium-bg: rgba(33, 150, 243, 0.15);

  --priority-low: #9E9E9E;            /* Gray - can wait */
  --priority-low-bg: rgba(158, 158, 158, 0.15);

  /* ==========================================
     ADHD-SPECIFIC: COGNITIVE LOAD / DIFFICULTY
     ========================================== */

  --difficulty-very-easy: #66BB6A;    /* Green - 1-2 */
  --difficulty-easy: #81C784;         /* Light green - 3-4 */
  --difficulty-medium: #FDD835;       /* Yellow - 5-6 */
  --difficulty-hard: #FFB74D;         /* Orange - 7-8 */
  --difficulty-very-hard: #EF5350;    /* Red - 9-10 */

  /* ==========================================
     QUEST SYSTEM COLORS
     ========================================== */

  --quest-primary: #8b5cf6;           /* Purple - quest/AI color */
  --quest-primary-light: #a78bfa;
  --quest-primary-dark: #7c3aed;

  --quest-pending: #9E9E9E;           /* Gray - not started */
  --quest-pending-bg: rgba(158, 158, 158, 0.15);

  --quest-in-progress: #2196F3;       /* Blue - working on it */
  --quest-in-progress-bg: rgba(33, 150, 243, 0.15);

  --quest-completed: #4CAF50;         /* Green - done */
  --quest-completed-bg: rgba(76, 175, 80, 0.15);

  --quest-approved: #FFD700;          /* Gold - parent approved */
  --quest-approved-bg: rgba(255, 215, 0, 0.15);

  /* ==========================================
     AI FEATURES COLORS
     ========================================== */

  --ai-primary: #8b5cf6;              /* Purple - AI-generated */
  --ai-secondary: #a78bfa;            /* Light purple - suggestions */
  --ai-accent: #7c3aed;               /* Dark purple - badges */
  --ai-bg: rgba(139, 92, 246, 0.15);

  --ai-confidence-high: #4CAF50;      /* Green - 85%+ */
  --ai-confidence-medium: #FF9800;    /* Orange - 70-85% */
  --ai-confidence-low: #F44336;       /* Red - <70% */

  /* ==========================================
     ASSIGNMENT STATUS COLORS
     ========================================== */

  --status-not-started: #9E9E9E;
  --status-not-started-bg: rgba(158, 158, 158, 0.15);

  --status-in-progress: #2196F3;
  --status-in-progress-bg: rgba(33, 150, 243, 0.15);

  --status-submitted: #4CAF50;
  --status-submitted-bg: rgba(76, 175, 80, 0.15);

  --status-graded: #8b5cf6;
  --status-graded-bg: rgba(139, 92, 246, 0.15);

  --status-missing: #F44336;
  --status-missing-bg: rgba(244, 67, 54, 0.15);

  --status-late: #FF9800;
  --status-late-bg: rgba(255, 152, 0, 0.15);

  --status-exempt: #757575;
  --status-exempt-bg: rgba(117, 117, 117, 0.15);

  /* ==========================================
     SUBJECT / COURSE COLORS
     ========================================== */

  --subject-math: #E91E63;
  --subject-science: #4CAF50;
  --subject-english: #2196F3;
  --subject-social-studies: #FF9800;
  --subject-language: #9C27B0;
  --subject-arts: #FF5722;
  --subject-pe: #00BCD4;
  --subject-elective: #607D8B;
  --subject-other: #9E9E9E;

  /* Custom Course Color Palette (16 options) */
  --course-color-1: #EC407A;          /* Hot Pink */
  --course-color-2: #AB47BC;          /* Medium Purple */
  --course-color-3: #7E57C2;          /* Deep Purple */
  --course-color-4: #5C6BC0;          /* Indigo */
  --course-color-5: #42A5F5;          /* Light Blue */
  --course-color-6: #29B6F6;          /* Sky Blue */
  --course-color-7: #26C6DA;          /* Cyan */
  --course-color-8: #26A69A;          /* Teal */
  --course-color-9: #66BB6A;          /* Light Green */
  --course-color-10: #9CCC65;         /* Lime */
  --course-color-11: #D4E157;         /* Lime Yellow */
  --course-color-12: #FFCA28;         /* Golden Yellow */
  --course-color-13: #FFA726;         /* Soft Orange */
  --course-color-14: #FF7043;         /* Coral */
  --course-color-15: #8D6E63;         /* Warm Brown */
  --course-color-16: #78909C;         /* Blue Grey */

  /* ==========================================
     GRADE COLORS
     ========================================== */

  --grade-a: #4CAF50;
  --grade-b: #2196F3;
  --grade-c: #FFC107;
  --grade-d: #FF9800;
  --grade-f: #F44336;

  /* ==========================================
     GRADIENTS
     ========================================== */

  --gradient-primary: linear-gradient(135deg, #5873CB, #4A63B8);
  --gradient-blue: var(--gradient-primary);
  --gradient-success: linear-gradient(135deg, #4CAF50, #388E3C);
  --gradient-green: var(--gradient-success);
  --gradient-warning: linear-gradient(135deg, #FF9800, #F57C00);
  --gradient-orange: var(--gradient-warning);
  --gradient-error: linear-gradient(135deg, #F44336, #D32F2F);
  --gradient-red: var(--gradient-error);
  --gradient-purple: linear-gradient(135deg, #8b5cf6, #7c3aed);
  --gradient-ai: var(--gradient-purple);
  --gradient-quest: linear-gradient(135deg, #8b5cf6, #d946ef);
  --gradient-bg: linear-gradient(135deg, #0a0a0a 0%, #1E1E1E 100%);

  /* ==========================================
     BORDER COLORS
     ========================================== */

  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-hover: rgba(255, 255, 255, 0.15);
  --border-color-focus: var(--brand-primary);
  --border-primary: #333333;
  --border-secondary: #404040;

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

  /* Font Families */
  --font-primary: 'Lexend', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  --font-system: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Font Sizes - Standardized Scale */
  --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 */

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

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

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

  /* ==========================================
     SPACING SYSTEM - 4px Base
     ========================================== */

  --space-0: 0;
  --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-16: 4rem;                   /* 64px */
  --space-20: 5rem;                   /* 80px */
  --space-24: 6rem;                   /* 96px */

  /* ==========================================
     BORDER RADIUS
     ========================================== */

  --radius-none: 0;
  --radius-xs: 2px;
  --radius-sm: 4px;
  --radius-sm-md: 6px;
  --radius-md: 8px;
  --radius-md-lg: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* ==========================================
     SHADOWS
     ========================================== */

  --shadow-none: none;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.1);

  /* Focus Ring */
  --shadow-focus: 0 0 0 3px rgba(88, 115, 203, 0.5);

  /* Glow Effects */
  --glow-primary: 0 0 20px rgba(88, 115, 203, 0.4);
  --glow-success: 0 0 20px rgba(76, 175, 80, 0.4);
  --glow-warning: 0 0 20px rgba(255, 152, 0, 0.4);
  --glow-error: 0 0 20px rgba(244, 67, 54, 0.4);
  --glow-quest: 0 0 20px rgba(139, 92, 246, 0.4);

  /* ==========================================
     TRANSITIONS & ANIMATIONS
     ========================================== */

  /* Durations */
  --duration-instant: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --duration-slower: 500ms;

  /* Easing Functions */
  --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);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

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

  --z-below: -1;
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-toast: 800;
  --z-max: 9999;
  --z-env-banner: 10000000;           /* Environment banner - always on top */

  /* ==========================================
     BREAKPOINTS (for reference in JS)
     ========================================== */

  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1400px;

  /* ==========================================
     CONTAINER & LAYOUT
     ========================================== */

  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
  --container-2xl: 1400px;
  --container-prose: 65ch;

  --grid-columns: 12;
  --grid-gutter: var(--space-6);
  --grid-margin: var(--space-8);

  /* ==========================================
     UTILITY VALUES
     ========================================== */

  /* Aspect Ratios */
  --aspect-square: 1 / 1;
  --aspect-video: 16 / 9;
  --aspect-photo: 4 / 3;
  --aspect-portrait: 3 / 4;

  /* Opacity Values */
  --opacity-0: 0;
  --opacity-10: 0.1;
  --opacity-25: 0.25;
  --opacity-50: 0.5;
  --opacity-75: 0.75;
  --opacity-90: 0.9;
  --opacity-100: 1;
}

/* ============================================
   LIGHT MODE SUPPORT (Optional)
   ============================================ */

/* Auto-detect system preference */
@media (prefers-color-scheme: light) {
  .auto-theme {
    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F5F5;
    --bg-tertiary: #E0E0E0;
    --bg-surface: var(--bg-secondary);
    --bg-hover: #EBEBEB;

    --text-primary: #212121;
    --text-secondary: #757575;
    --text-tertiary: #9E9E9E;
    --text-muted: var(--text-secondary);
    --text-inverse: #FFFFFF;

    --border-color: rgba(0, 0, 0, 0.12);
    --border-color-hover: rgba(0, 0, 0, 0.2);

    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  }
}

/* Explicit light mode class */
.light-mode,
:root[data-theme="light"],
[data-theme="light"] {
  /* Surface hierarchy */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F5F5F5;
  --bg-tertiary: #E8E8E8;
  --bg-surface: var(--bg-secondary);
  --bg-hover: #E0E0E0;

  /* Text hierarchy */
  --text-primary: #1A1A1A;
  --text-secondary: #555555;
  --text-tertiary: #888888;
  --text-muted: var(--text-secondary);
  --text-inverse: #FFFFFF;
  --text-white: #1A1A1A;

  /* Gray scale for text (inverted for light) */
  --text-gray-500: #888888;
  --text-gray-600: #777777;
  --text-gray-700: #666666;
  --text-gray-800: #555555;
  --text-gray-900: #444444;

  /* Borders */
  --border-color: rgba(0, 0, 0, 0.12);
  --border-color-hover: rgba(0, 0, 0, 0.2);
  --border-primary: #D0D0D0;
  --border-secondary: #C0C0C0;

  /* Opacity overlays - inverted for light mode */
  --bg-white-2: rgba(0, 0, 0, 0.02);
  --bg-white-3: rgba(0, 0, 0, 0.03);
  --bg-white-4: rgba(0, 0, 0, 0.04);
  --bg-white-5: rgba(0, 0, 0, 0.05);
  --bg-white-8: rgba(0, 0, 0, 0.06);
  --bg-white-10: rgba(0, 0, 0, 0.08);
  --bg-white-15: rgba(0, 0, 0, 0.10);
  --bg-white-20: rgba(0, 0, 0, 0.12);

  /* Shadows for light mode */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Gradients for light mode */
  --gradient-bg: linear-gradient(135deg, #FFFFFF 0%, #F5F5F5 100%);
}

/* Explicit dark mode class (default values) */
.dark-mode,
[data-theme="dark"] {
  /* Uses default :root values - no overrides needed */
}

/* ============================================
   BACKWARDS COMPATIBILITY ALIASES
   For gradual migration from old variable names
   ============================================ */

:root {
  /* Old aliases pointing to new standardized names */
  --accent-blue: var(--brand-primary);
  --accent-green: var(--success);
  --accent-orange: var(--warning);
  --accent-red: var(--error);
  --accent-purple: var(--quest-primary);
  --accent-yellow: #FBC02D;

  /* Primary color opacity variants */
  --primary-5: rgba(88, 115, 203, 0.05);
  --primary-10: rgba(88, 115, 203, 0.1);
  --primary-15: rgba(88, 115, 203, 0.15);
  --primary-20: rgba(88, 115, 203, 0.2);
  --primary-30: rgba(88, 115, 203, 0.3);

  /* Alert background alias */
  --alert-bg: rgba(217, 107, 138, 0.15);
  --alert-bg-10: rgba(217, 107, 138, 0.1);
}
