/* ============================================
   NarrateAI Design System
   Core variables, tokens, and utilities
   ============================================ */

:root {
    /* ===== Color Palette ===== */
    
    /* Primary Brand Colors */
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-light: #8b9ff5;
    --primary-dark: #5568d3;
    
    /* Accent Colors */
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-pink: #ec4899;
    
    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* Neutral Palette */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --black: #000000;
    
    /* Surface Colors */
    --surface: rgba(255, 255, 255, 0.95);
    --surface-light: #f8f9fa;
    --surface-elevated: rgba(255, 255, 255, 0.98);
    --surface-overlay: rgba(0, 0, 0, 0.5);

    /* Semantic Surface Tokens */
    --surface-background: var(--white);
    --surface-card: var(--white);
    --surface-card-hover: #eef1ff;
    --surface-muted: var(--gray-50);
    --surface-subtle: var(--gray-100);
    --surface-border: #e9ecef;
    --surface-contrast: var(--gray-900);
    --surface-overlay-strong: rgba(0, 0, 0, 0.7);
    --surface-overlay-weak: rgba(0, 0, 0, 0.1);

    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-inverse: #ffffff;
    --text-muted-strong: #495057;
    --text-muted: #6c757d;

    /* Semantic Accent Tokens */
    --accent-dialogue: #e74c3c;
    --accent-narration: #3498db;
    --accent-lilac: #8b5cf6;
    --success-strong: #065f46;
    --warning-strong: #92400e;
    --error-strong: #991b1b;
    --info-strong: #1e40af;
    
    /* ===== Typography ===== */
    
    /* Font Families */
    --font-primary: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
    
    /* Font Sizes */
    --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 */
    --text-6xl: 3.75rem;     /* 60px */
    --text-7xl: 4.5rem;      /* 72px */
    
    /* Font Weights */
    --font-light: 300;
    --font-normal: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    
    /* Line Heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    --leading-loose: 2;
    
    /* ===== 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 */
    --space-20: 5rem;     /* 80px */
    --space-24: 6rem;     /* 96px */
    --space-32: 8rem;     /* 128px */
    
    /* ===== Border Radius ===== */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;
    
    /* ===== Shadows ===== */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-base: 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);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);
    --shadow-glow-lg: 0 0 40px rgba(102, 126, 234, 0.4);
    
    /* ===== Transitions ===== */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* ===== Z-Index Scale ===== */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* ===== Breakpoints (for reference in JS) ===== */
    --breakpoint-sm: 640px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 1024px;
    --breakpoint-xl: 1280px;
    --breakpoint-2xl: 1536px;
    
    /* ===== Gradients ===== */
    --gradient-primary: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    --gradient-primary-hover: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-start) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-pink) 100%);
    --gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-ocean: linear-gradient(135deg, #667eea 0%, #06b6d4 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* ===== Global Resets & Base Styles ===== */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--font-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--surface-background);
}

/* ===== Typography Utilities ===== */

.heading-1 {
    font-family: var(--font-heading);
    font-size: var(--text-5xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

.heading-2 {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
}

.heading-3 {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
    color: var(--text-primary);
}

.heading-4 {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
    color: var(--text-primary);
}

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Utility Classes ===== */

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

.container-wide {
    max-width: 1536px;
}

.container-narrow {
    max-width: 768px;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Flexbox utilities */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.gap-8 {
    gap: var(--space-8);
}

/* ===== Animations ===== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

.animate-fade-in-up {
    animation: fadeInUp var(--transition-slow) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-base) ease-out;
}

/* ===== Responsive Typography ===== */

@media (max-width: 1024px) {
    .heading-1 {
        font-size: var(--text-4xl);
    }
    
    .heading-2 {
        font-size: var(--text-3xl);
    }
    
    .heading-3 {
        font-size: var(--text-2xl);
    }
}

@media (max-width: 768px) {
    html {
        font-size: 15px;
    }
    
    .heading-1 {
        font-size: var(--text-3xl);
    }
    
    .heading-2 {
        font-size: var(--text-2xl);
    }
    
    .heading-3 {
        font-size: var(--text-xl);
    }
    
    .container {
        padding: 0 var(--space-4);
    }
}

@media (max-width: 640px) {
    .heading-1 {
        font-size: var(--text-2xl);
    }
}

/* ===== Theme Modes ===== */

:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface-background: #050b1a;
    --surface: rgba(15, 23, 42, 0.85);
    --surface-light: rgba(30, 41, 59, 0.9);
    --surface-elevated: rgba(15, 23, 42, 0.95);
    --surface-card: #16213b;
    --surface-card-hover: #1f2d4b;
    --surface-muted: #0f172a;
    --surface-subtle: #172037;
    --surface-border: rgba(148, 163, 184, 0.22);
    --surface-contrast: #0b1120;
    --surface-overlay: rgba(4, 6, 15, 0.65);
    --surface-overlay-strong: rgba(4, 6, 15, 0.82);
    --surface-overlay-weak: rgba(148, 163, 184, 0.14);

    --text-primary: #e2e8f0;
    --text-secondary: #cbd5f5;
    --text-tertiary: #94a3b8;
    --text-muted-strong: #d2d9e6;
    --text-muted: #94a3b8;

    --success-light: rgba(16, 185, 129, 0.18);
    --warning-light: rgba(245, 158, 11, 0.2);
    --error-light: rgba(239, 68, 68, 0.22);
    --info-light: rgba(59, 130, 246, 0.2);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme-mode="user"]) {
        color-scheme: dark;
        --surface-background: #050b1a;
        --surface: rgba(15, 23, 42, 0.85);
        --surface-light: rgba(30, 41, 59, 0.9);
        --surface-elevated: rgba(15, 23, 42, 0.95);
        --surface-card: #16213b;
        --surface-card-hover: #1f2d4b;
        --surface-muted: #0f172a;
        --surface-subtle: #172037;
        --surface-border: rgba(148, 163, 184, 0.22);
        --surface-contrast: #0b1120;
        --surface-overlay: rgba(4, 6, 15, 0.65);
        --surface-overlay-strong: rgba(4, 6, 15, 0.82);
        --surface-overlay-weak: rgba(148, 163, 184, 0.14);
        --text-primary: #e2e8f0;
        --text-secondary: #cbd5f5;
        --text-tertiary: #94a3b8;
        --text-muted-strong: #d2d9e6;
        --text-muted: #94a3b8;

        --success-light: rgba(16, 185, 129, 0.18);
        --warning-light: rgba(245, 158, 11, 0.2);
        --error-light: rgba(239, 68, 68, 0.22);
        --info-light: rgba(59, 130, 246, 0.2);
    }
}

