/**
 * StudyForge AI - Design System
 * CSS Variables for colors, typography, shadows, spacing, animations
 */

/* ==================== THEME VARIABLES ==================== */

:root {
  /* Light Theme (Default) - StudyForge AI Branding */
  --color-bg-primary: #F5F7FB;
  --color-bg-secondary: #FFFFFF;
  --color-bg-tertiary: #F1F5F9;
  --color-bg-elevated: #FFFFFF;
  
  --color-text-primary: #0F172A;
  --color-text-secondary: #64748B;
  --color-text-tertiary: #94A3B8;
  --color-text-inverse: #ffffff;
  
  --color-primary: #4F46E5;
  --color-primary-hover: #4338CA;
  --color-primary-light: rgba(79, 70, 229, 0.1);
  --color-primary-dark: #3730A3;
  
  --color-secondary: #06B6D4;
  --color-secondary-hover: #0891B2;
  
  --color-accent: #8B5CF6;
  --color-accent-hover: #7C3AED;
  
  --color-success: #22c55e;
  --color-success-bg: #dcfce7;
  --color-success-text: #15803d;
  
  --color-error: #ef4444;
  --color-error-bg: #fee2e2;
  --color-error-text: #dc2626;
  
  --color-warning: #f59e0b;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #d97706;
  
  --color-border: rgba(15, 23, 42, 0.08);
  --color-border-light: rgba(15, 23, 42, 0.04);
  --color-border-dark: rgba(15, 23, 42, 0.12);
  
  --color-surface-overlay: rgba(0, 0, 0, 0.5);
  --color-surface-backdrop: rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Dark Theme - StudyForge AI Branding */
    --color-bg-primary: #0A0F1F;
    --color-bg-secondary: #121A2B;
    --color-bg-tertiary: #1A2234;
    --color-bg-elevated: #1A2234;
    
    --color-text-primary: #F8FAFC;
    --color-text-secondary: #CBD5E1;
    --color-text-tertiary: #64748B;
    --color-text-inverse: #0F172A;
    
    --color-primary: #6366F1;
    --color-primary-hover: #818CF8;
    --color-primary-light: rgba(99, 102, 241, 0.15);
    --color-primary-dark: #4F46E5;
    
    --color-secondary: #22D3EE;
    --color-secondary-hover: #06B6D4;
    
    --color-accent: #A855F7;
    --color-accent-hover: #8B5CF6;
    
    --color-success: #4ade80;
    --color-success-bg: rgba(34, 197, 94, 0.12);
    --color-success-text: #86efac;
    
    --color-error: #f87171;
    --color-error-bg: rgba(239, 68, 68, 0.12);
    --color-error-text: #fca5a5;
    
    --color-warning: #fbbf24;
    --color-warning-bg: rgba(245, 158, 11, 0.12);
    --color-warning-text: #fcd34d;
    
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-light: rgba(255, 255, 255, 0.04);
    --color-border-dark: rgba(255, 255, 255, 0.12);
    
    --color-surface-overlay: rgba(0, 0, 0, 0.75);
    --color-surface-backdrop: rgba(15, 23, 42, 0.95);
  }
}

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

:root {
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-family-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
  
  /* Font Sizes - Modular Scale */
  --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-size-5xl: 3rem;        /* 48px */
  --font-size-6xl: 3.75rem;     /* 60px */
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;
  
  /* Letter Spacing */
  --letter-spacing-tight: -0.025em;
  --letter-spacing-normal: 0;
  --letter-spacing-wide: 0.025em;
  --letter-spacing-wider: 0.05em;
}

/* ==================== SPACING ==================== */

:root {
  --spacing-0: 0;
  --spacing-1: 0.25rem;   /* 4px */
  --spacing-2: 0.5rem;    /* 8px */
  --spacing-3: 0.75rem;   /* 12px */
  --spacing-4: 1rem;      /* 16px */
  --spacing-5: 1.25rem;   /* 20px */
  --spacing-6: 1.5rem;    /* 24px */
  --spacing-8: 2rem;      /* 32px */
  --spacing-10: 2.5rem;   /* 40px */
  --spacing-12: 3rem;     /* 48px */
  --spacing-16: 4rem;     /* 64px */
  --spacing-20: 5rem;     /* 80px */
  --spacing-24: 6rem;     /* 96px */
  --spacing-32: 8rem;     /* 128px */
}

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

: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;
}

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

:root {
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
  
  /* Colored shadows for brand elements */
  --shadow-primary: 0 10px 30px rgba(59, 130, 246, 0.35);
  --shadow-primary-light: 0 12px 30px rgba(59, 130, 246, 0.2);
}

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

:root {
  --transition-fast: 150ms;
  --transition-base: 200ms;
  --transition-slow: 300ms;
  --transition-slower: 500ms;
  
  --transition-timing: cubic-bezier(0.4, 0, 0.2, 1);
  --transition-timing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  --transition-default: all var(--transition-base) var(--transition-timing);
  --transition-smooth: all var(--transition-slow) var(--transition-timing);
}

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

:root {
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ==================== BREAKPOINTS ==================== */

:root {
  --breakpoint-sm: 640px;
  --breakpoint-md: 768px;
  --breakpoint-lg: 1024px;
  --breakpoint-xl: 1280px;
  --breakpoint-2xl: 1536px;
}

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

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

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

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

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

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

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-25%);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* ==================== UTILITY CLASSES ==================== */

/* Smooth theme transition */
* {
  transition: background-color var(--transition-slow) var(--transition-timing),
              color var(--transition-slow) var(--transition-timing),
              border-color var(--transition-slow) var(--transition-timing),
              box-shadow var(--transition-slow) var(--transition-timing);
}

/* Prevent transition on specific elements if needed */
.no-transition,
.no-transition *,
.theme-toggle,
.theme-toggle * {
  transition: none !important;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip to content for accessibility */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--spacing-3) var(--spacing-6);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-lg);
  z-index: var(--z-tooltip);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
}

.skip-to-content:focus {
  top: var(--spacing-4);
}

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