/* ====================================
   CSS Variables - OPTIMIZED & COMPLETE
   REDitors - Professional Design System
   Production-Ready Variable System
   ==================================== */

:root {
    /* ========== COLOR SYSTEM ========== */
    
    /* === Background Palette === */
    --bg: #050505;
    --bg-secondary: #0a0a0a;
    --bg-tertiary: #1a1a1a;
    --bg-elevated: #0f0f0f;
    --input-bg: #0a0a0a;
    --card-bg: #0a0a0a;
    
    /* === Text Palette === */
    --text: #ffffff;
    --text-secondary: #e0e0e0;
    --text-dim: #999999;
    --text-muted: #666666;
    --text-disabled: #444444;
    --foreground: #ffffff;
    --muted-foreground: #999999;
    
    /* === Accent & Brand === */
    --accent: #ffffff;
    --accent-hover: #e5e5e5;
    --accent-active: #cccccc;
    --accent-rgb: 255, 255, 255;
    --primary: #ffffff;
    --primary-hover: #e5e5e5;
    --primary-light: rgba(255, 255, 255, 0.1);
    --primary-dark: #cccccc;
    
    /* === Border Palette === */
    --border: #222222;
    --border-light: #333333;
    --border-dark: #1a1a1a;
    --border-focus: #ffffff;
    
    /* === Semantic Colors === */
    --success: #22c55e;
    --success-light: #4ade80;
    --success-dark: #16a34a;
    --error: #ef4444;
    --error-light: #f87171;
    --error-dark: #dc2626;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --warning-dark: #d97706;
    --info: #3b82f6;
    --info-light: #60a5fa;
    --info-dark: #2563eb;
    --destructive: #ef4444;
    
    /* === Gray Scale (Extended) === */
    --gray-50: #f9f9f9;
    --gray-100: #e0e0e0;
    --gray-200: #c0c0c0;
    --gray-300: #999999;
    --gray-400: #666666;
    --gray-500: #444444;
    --gray-600: #333333;
    --gray-700: #2a2a2a;
    --gray-800: #1a1a1a;
    --gray-900: #0a0a0a;
    --gray: #1a1a1a;
    --gray-light: #2a2a2a;
    --muted: #1a1a1a;
    
    /* === Overlay Palette === */
    --overlay: rgba(0, 0, 0, 0.8);
    --overlay-light: rgba(0, 0, 0, 0.6);
    --overlay-dark: rgba(0, 0, 0, 0.95);
    --overlay-subtle: rgba(0, 0, 0, 0.4);
    --backdrop: rgba(0, 0, 0, 0.5);
    
    /* === Gradients === */
    --gradient-primary: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    --gradient-secondary: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    --gradient-accent: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
    --gradient-radial: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.6) 100%);
    --gradient-shine: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    
    /* === Glassmorphism === */
    --glass-bg: rgba(20, 20, 20, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-blur: blur(20px);
    
    /* ========== TYPOGRAPHY SYSTEM ========== */
    
    /* === Font Families === */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    --font-display: 'Inter', system-ui, sans-serif;
    
    /* === Font Sizes (Fluid & Responsive) === */
    --text-xs: clamp(0.7rem, 0.65vw + 0.6rem, 0.75rem);      /* 12px */
    --text-sm: clamp(0.8rem, 0.75vw + 0.7rem, 0.875rem);     /* 14px */
    --text-base: clamp(0.9rem, 0.85vw + 0.8rem, 1rem);       /* 16px */
    --text-lg: clamp(1rem, 1vw + 0.85rem, 1.125rem);         /* 18px */
    --text-xl: clamp(1.1rem, 1.15vw + 0.9rem, 1.25rem);      /* 20px */
    --text-2xl: clamp(1.3rem, 1.4vw + 1rem, 1.5rem);         /* 24px */
    --text-3xl: clamp(1.6rem, 1.8vw + 1.2rem, 1.875rem);     /* 30px */
    --text-4xl: clamp(1.9rem, 2.2vw + 1.4rem, 2.25rem);      /* 36px */
    --text-5xl: clamp(2.4rem, 3vw + 1.8rem, 3rem);           /* 48px */
    --text-6xl: clamp(3rem, 4vw + 2.2rem, 3.75rem);          /* 60px */
    --text-7xl: clamp(3.6rem, 5vw + 2.6rem, 4.5rem);         /* 72px */
    
    /* === Font Weights === */
    --font-thin: 100;
    --font-extralight: 200;
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;
    
    /* === 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-tighter: -0.05em;
    --tracking-tight: -0.025em;
    --tracking-normal: 0;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
    --tracking-widest: 0.1em;
    
    /* ========== SPACING SYSTEM ========== */
    
    /* === Base Spacing === */
    --spacing-xs: 0.5rem;    /* 8px */
    --spacing-sm: 1rem;      /* 16px */
    --spacing-md: 2rem;      /* 32px */
    --spacing-lg: 4rem;      /* 64px */
    --spacing-xl: 6rem;      /* 96px */
    --spacing-2xl: 8rem;     /* 128px */
    
    /* === Detailed Space Scale === */
    --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-11: 2.75rem;     /* 44px */
    --space-12: 3rem;        /* 48px */
    --space-14: 3.5rem;      /* 56px */
    --space-16: 4rem;        /* 64px */
    --space-20: 5rem;        /* 80px */
    --space-24: 6rem;        /* 96px */
    --space-28: 7rem;        /* 112px */
    --space-32: 8rem;        /* 128px */
    
    /* ========== BORDER RADIUS ========== */
    --radius-none: 0;
    --radius-xs: 0.25rem;    /* 4px */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-base: 0.5rem;   /* 8px */
    --radius-md: 0.625rem;   /* 10px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-3xl: 2rem;      /* 32px */
    --radius-full: 9999px;
    
    /* ========== SHADOWS (Layered) ========== */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.5);
    --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 12px -2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.6);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    --shadow-3xl: 0 35px 60px -15px rgba(0, 0, 0, 0.8);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.1);
    --shadow-glow-md: 0 0 30px rgba(255, 255, 255, 0.15);
    --shadow-glow-lg: 0 0 40px rgba(255, 255, 255, 0.2);
    --shadow-none: none;
    
    /* ========== Z-INDEX SYSTEM ========== */
    --z-base: 1;
    --z-below: -1;
    --z-dropdown: 100;
    --z-sticky: 500;
    --z-nav: 1000;
    --z-modal: 1000;
    --z-popover: 1010;
    --z-sidebar: 900;
    --z-tooltip: 2000;
    --z-notification: 1030;
    --z-cursor: 10000;
    --z-max: 9999;
    
    /* ========== TRANSITIONS & ANIMATIONS ========== */
    
    /* === Durations === */
    --duration-instant: 0ms;
    --duration-fast: 150ms;
    --duration-base: 300ms;
    --duration-slow: 500ms;
    --duration-slower: 700ms;
    --duration-slowest: 1000ms;
    
    /* === Legacy Support === */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* === 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-sharp: cubic-bezier(0.4, 0, 0.6, 1);
    --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
    
    /* ========== LAYOUT SYSTEM ========== */
    
    /* === Container Sizes === */
    --container-xs: 480px;
    --container-sm: 640px;
    --container-md: 768px;
    --container-lg: 1024px;
    --container-xl: 1280px;
    --container-2xl: 1400px;
    --container-max: 1600px;
    
    /* === Component Heights === */
    --header-height: 80px;
    --header-height-mobile: 60px;
    --footer-height: 400px;
    
    /* === Sidebar Widths === */
    --sidebar-width: 280px;
    --sidebar-width-collapsed: 60px;
    --sidebar-width-mobile: 320px;
    
    /* === Content Widths === */
    --prose-width: 65ch;
    --content-narrow: 640px;
    --content-medium: 768px;
    --content-wide: 1024px;
    
    /* ========== BREAKPOINTS (For JS) ========== */
    --breakpoint-xs: 480px;
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
    
    /* ========== MISC VALUES ========== */
    
    /* === Blur === */
    --blur-sm: 4px;
    --blur-base: 8px;
    --blur-md: 12px;
    --blur-lg: 16px;
    --blur-xl: 24px;
    --blur-2xl: 40px;
    --blur-3xl: 64px;
    
    /* === Opacity === */
    --opacity-0: 0;
    --opacity-10: 0.1;
    --opacity-20: 0.2;
    --opacity-30: 0.3;
    --opacity-40: 0.4;
    --opacity-50: 0.5;
    --opacity-60: 0.6;
    --opacity-70: 0.7;
    --opacity-80: 0.8;
    --opacity-90: 0.9;
    --opacity-100: 1;
}

/* ========== LIGHT THEME ========== */
[data-theme="light"] {
    /* Background Colors */
    --bg: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e5e5e5;
    --bg-elevated: #fafafa;
    --input-bg: #f9f9f9;
    --card-bg: #ffffff;
    
    /* Text Colors */
    --text: #0a0a0a;
    --text-secondary: #1a1a1a;
    --text-dim: #666666;
    --text-muted: #999999;
    --text-disabled: #cccccc;
    --foreground: #0a0a0a;
    --muted-foreground: #666666;
    
    /* Accent Colors */
    --accent: #0a0a0a;
    --accent-hover: #1a1a1a;
    --accent-active: #333333;
    --accent-rgb: 10, 10, 10;
    --primary: #0a0a0a;
    --primary-hover: #1a1a1a;
    --primary-light: rgba(10, 10, 10, 0.1);
    --primary-dark: #000000;
    
    /* Border Colors */
    --border: #e0e0e0;
    --border-light: #d0d0d0;
    --border-dark: #c0c0c0;
    --border-focus: #0a0a0a;
    
    /* Gray Scale */
    --gray: #e5e5e5;
    --gray-light: #f0f0f0;
    --muted: #f5f5f5;
    
    /* Overlay Colors */
    --overlay: rgba(255, 255, 255, 0.8);
    --overlay-light: rgba(255, 255, 255, 0.6);
    --overlay-dark: rgba(255, 255, 255, 0.95);
    --overlay-subtle: rgba(255, 255, 255, 0.4);
    --backdrop: rgba(255, 255, 255, 0.5);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    --gradient-secondary: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    --gradient-accent: linear-gradient(90deg, var(--accent) 0%, transparent 100%);
    --gradient-radial: radial-gradient(ellipse at center, transparent 0%, rgba(255,255,255,0.6) 100%);
    --gradient-shine: linear-gradient(90deg, transparent, rgba(0,0,0,0.1), transparent);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 6px 12px -2px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px -10px rgba(0, 0, 0, 0.2);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-3xl: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px rgba(0, 0, 0, 0.05);
    --shadow-glow-md: 0 0 30px rgba(0, 0, 0, 0.08);
    --shadow-glow-lg: 0 0 40px rgba(0, 0, 0, 0.1);
}

/* ========== BASE STYLES ========== */
body {
    font-family: var(--font-primary);
    background-color: var(--bg);
    color: var(--text);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ========== HIGH CONTRAST MODE ========== */
@media (prefers-contrast: high) {
    :root {
        --border: #ffffff;
        --border-light: #ffffff;
        --text-dim: #ffffff;
        --text-muted: #cccccc;
    }
    
    [data-theme="light"] {
        --border: #000000;
        --border-light: #000000;
        --text-dim: #000000;
        --text-muted: #333333;
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    :root {
        --bg: white;
        --text: black;
        --border: #cccccc;
    }
}