/**
 * Design System - CSS Custom Properties
 * Theme variables for light and dark modes
 * MODIFIED: Improved --text-tertiary contrast in dark mode
 */

:root {
  /* Colors - Light Theme */
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-secondary: #64748b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-info: #06b6d4;
  
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  /* Text Colors */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Border Colors */
  --border-color: #e2e8f0;
  --border-color-hover: #cbd5e1;
  
  /* Shadow */
  --shadow-sm: 0 1px 2px 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);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  
  /* Spacing Scale */
  --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 */
  
  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-base: 200ms ease-in-out;
  --transition-slow: 300ms ease-in-out;
  
  /* Z-index Scale */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-toast: 1060;
  
  /* Layout */
  --navbar-height: 64px;
  --footer-height: 80px;
  --container-max-width: 1280px;
  --sidebar-width: 280px;
  
  /* Breakpoints (for reference in JS) */
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  
  /* Status Colors */
  --status-pending: #f59e0b;
  --status-in-progress: #3b82f6;
  --status-completed: #10b981;
  
  /* Type Colors */
  --type-book: #8b5cf6;
  --type-film: #ef4444;
  --type-series: #f59e0b;
  --type-videogame: #10b981;
  --type-paper: #06b6d4;
  --type-podcast: #ec4899;

  /* Type Colors — Subtle backgrounds (alpha: works in light + dark without separate override) */
  --type-book-subtle:       rgba(139, 92, 246, 0.10);
  --type-film-subtle:       rgba(239, 68, 68,  0.10);
  --type-series-subtle:     rgba(245, 158, 11, 0.10);
  --type-videogame-subtle:  rgba(16, 185, 129, 0.10);
  --type-paper-subtle:      rgba(6, 182, 212,  0.10);
  --type-podcast-subtle:    rgba(236, 72, 153, 0.10);

  /* Type Colors — Borders */
  --type-book-border:       rgba(139, 92, 246, 0.30);
  --type-film-border:       rgba(239, 68, 68,  0.30);
  --type-series-border:     rgba(245, 158, 11, 0.30);
  --type-videogame-border:  rgba(16, 185, 129, 0.30);
  --type-paper-border:      rgba(6, 182, 212,  0.30);
  --type-podcast-border:    rgba(236, 72, 153, 0.30);

  /* Display font */
  --font-display: 'Fraunces', Georgia, serif;

  /* Animation */
  --anim-enter:        250ms ease-out;
  --anim-micro:        150ms ease-out;
  --anim-stagger-step: 40ms;
}

/* Dark Theme */
[data-theme="dark"] {
  /* Colors */
  --color-primary: #60a5fa;
  --color-primary-hover: #3b82f6;
  --color-secondary: #94a3b8;
  
  /* Background Colors */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #475569;
  
  /* Text Colors */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;  /* IMPROVED: Better contrast than #64748b */
  --text-inverse: #0f172a;
  
  /* Border Colors */
  --border-color: #334155;
  --border-color-hover: #475569;
  
  /* Shadows (darker) */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* Media Query Helpers (CSS Only) */
@media (max-width: 768px) {
  :root {
    --navbar-height: 56px;
    --space-container: var(--space-4);
  }
}

@media (min-width: 1024px) {
  :root {
    --space-container: var(--space-8);
  }
}

/* Accessibility - Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --transition-fast: 0ms;
    --transition-base: 0ms;
    --transition-slow: 0ms;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border-color: #000000;
    --text-secondary: var(--text-primary);
  }
  
  [data-theme="dark"] {
    --border-color: #ffffff;
  }
}
