/**
 * Design System - Unified Theme Variables
 * Enterprise-grade documentation platform
 */

/* ============================================
   LIGHT THEME (Default)
   ============================================ */
:root,
[data-theme="light"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f7f7f5;
  --bg-elevated: #ffffff;
  --bg-hover: #f5f5f4;
  --bg-code: #f7f6f3;

  /* Text Colors - Fixed contrast for better readability */
  --text-primary: #37352f;
  --text-secondary: #55534e;
  --text-muted: #9b9a97;
  --text-inverse: #ffffff;

  /* Accent Colors */
  --accent-primary: #2383e2;
  --accent-primary-hover: #1a6ec7;
  --accent-soft: #e8f3fc;

  /* Semantic Colors */
  --success: #0f7b6c;
  --success-soft: #e6f7f5;
  --warning: #f59e0b;
  --warning-soft: #fef3c7;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --info: #2383e2;
  --info-soft: #e8f3fc;
  --important: #7c3aed;
  --important-soft: #ede9fe;

  /* Border Colors */
  --border-light: #f1f1ef;
  --border-medium: #e9e9e7;
  --border-dark: #d9d9d7;

  /* Shadow Colors */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.15);

  /* Overlay */
  --overlay: rgba(0, 0, 0, 0.5);

  /* Premium Gradients - From Landing Page */
  --gradient-primary: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  --gradient-secondary: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
  --gradient-accent: linear-gradient(135deg, #7209b7 0%, #f72585 100%);
  --gradient-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-warm: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-cool: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-ocean: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-blur: blur(12px);

  /* Premium Shadows */
  --shadow-premium: 0 10px 30px rgba(67, 97, 238, 0.3);
  --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.15);
  --shadow-glow-primary: 0 0 40px rgba(67, 97, 238, 0.4);
  --shadow-deep: 0 50px 100px rgba(0, 0, 0, 0.2);
}

/* ============================================
   DARK THEME
   ============================================ */
[data-theme="dark"] {
  /* Background Colors */
  --bg-primary: #191919;
  --bg-secondary: #2f2f2f;
  --bg-elevated: #252525;
  --bg-hover: #3a3a3a;
  --bg-code: #1e1e1e;

  /* Text Colors */
  --text-primary: #ffffff;
  --text-secondary: #b4b4b4;
  --text-muted: #7c7c7c;
  --text-inverse: #191919;

  /* Accent Colors */
  --accent-primary: #3b9eff;
  --accent-primary-hover: #5aadff;
  --accent-soft: #1a3a52;

  /* Semantic Colors */
  --success: #10b981;
  --success-soft: #1a3a2e;
  --warning: #f59e0b;
  --warning-soft: #3a2e1a;
  --error: #ef4444;
  --error-soft: #3a1a1a;
  --info: #3b9eff;
  --info-soft: #1a3a52;
  --important: #a78bfa;
  --important-soft: #2e1a3a;

  /* Border Colors */
  --border-light: #2a2a2a;
  --border-medium: #3a3a3a;
  --border-dark: #4a4a4a;

  /* Shadow Colors */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);

  /* Overlay */
  --overlay: rgba(0, 0, 0, 0.7);

  /* Premium Gradients - Dark theme versions */
  --gradient-primary: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
  --gradient-secondary: linear-gradient(135deg, #4cc9f0 0%, #4361ee 100%);
  --gradient-accent: linear-gradient(135deg, #7209b7 0%, #f72585 100%);
  --gradient-success: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-warm: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --gradient-cool: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-sunset: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-ocean: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

  /* Glassmorphism - Dark */
  --glass-bg: rgba(25, 25, 25, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px);

  /* Premium Shadows - Dark */
  --shadow-premium: 0 10px 30px rgba(59, 158, 255, 0.2);
  --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.4);
  --shadow-glow-primary: 0 0 40px rgba(59, 158, 255, 0.3);
  --shadow-deep: 0 50px 100px rgba(0, 0, 0, 0.6);
}

/* ============================================
   PREMIUM THEME (Notion-inspired)
   ============================================ */
[data-theme="premium"] {
  /* Background Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #fbfbfa;
  --bg-elevated: #ffffff;
  --bg-hover: #f7f6f3;
  --bg-code: #f7f6f3;

  /* Text Colors */
  --text-primary: #37352f;
  --text-secondary: #787774;
  --text-muted: #9b9a97;
  --text-inverse: #ffffff;

  /* Accent Colors - Warmer, Notion-like */
  --accent-primary: #eb5757;
  --accent-primary-hover: #d84545;
  --accent-soft: #fdeaea;

  /* Semantic Colors */
  --success: #0f7b6c;
  --success-soft: #ddedea;
  --warning: #f2994a;
  --warning-soft: #fdeee0;
  --error: #eb5757;
  --error-soft: #fdeaea;
  --info: #2f80ed;
  --info-soft: #e0eef9;
  --important: #9b51e0;
  --important-soft: #f2e9f8;

  /* Border Colors */
  --border-light: #f1f1ef;
  --border-medium: #e9e9e7;
  --border-dark: #d9d9d7;

  /* Shadow Colors - Softer */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 3px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.1);

  /* Overlay */
  --overlay: rgba(0, 0, 0, 0.45);
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
:root {
  /* Font Families */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', 'Courier New', monospace;
  --font-serif: 'Georgia', 'Times New Roman', serif;

  /* 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 */

  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 1.75;
  --leading-comfortable: 1.7;
}

/* ============================================
   SPACING SCALE
   ============================================ */
:root {
  --space-0: 0;
  --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 */
}

/* ============================================
   BORDER RADIUS
   ============================================ */
:root {
  --radius-none: 0;
  --radius-sm: 0.25rem;
  /* 4px */
  --radius-md: 0.5rem;
  /* 8px */
  --radius-lg: 0.75rem;
  /* 12px */
  --radius-xl: 1rem;
  /* 16px */
  --radius-2xl: 1.5rem;
  /* 24px */
  --radius-full: 9999px;
}

/* ============================================
   TRANSITIONS
   ============================================ */
:root {
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Z-INDEX SCALE
   ============================================ */
:root {
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ============================================
   GLOBAL STYLES
   ============================================ */
* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-comfortable);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  margin: 0;
  padding: 0;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Text Utilities */
.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-inverse {
  color: var(--text-inverse);
}

/* Background Utilities */
.bg-primary {
  background-color: var(--bg-primary);
}

.bg-secondary {
  background-color: var(--bg-secondary);
}

.bg-elevated {
  background-color: var(--bg-elevated);
}

/* Shadow Utilities */
.shadow-sm {
  box-shadow: var(--shadow-sm);
}

.shadow-md {
  box-shadow: var(--shadow-md);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-xl {
  box-shadow: var(--shadow-xl);
}

/* Border Utilities */
.border-light {
  border-color: var(--border-light);
}

.border-medium {
  border-color: var(--border-medium);
}

.border-dark {
  border-color: var(--border-dark);
}

/* Radius Utilities */
.rounded-sm {
  border-radius: var(--radius-sm);
}

.rounded-md {
  border-radius: var(--radius-md);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-2xl {
  border-radius: var(--radius-2xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

/* Transition Utilities */
.transition-fast {
  transition: all var(--transition-fast);
}

.transition-base {
  transition: all var(--transition-base);
}

.transition-slow {
  transition: all var(--transition-slow);
}

/* Hover Effects */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Focus Styles */
.focus-ring:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent-primary);
}

/* Loading Skeleton */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-secondary) 0%,
      var(--bg-hover) 50%,
      var(--bg-secondary) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

/* Fade In Animation */
.fade-in {
  animation: fadeIn var(--transition-slow) ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth Scroll */
html {
  scroll-behavior: smooth;
}

/* Selection */
::selection {
  background-color: var(--accent-soft);
  color: var(--text-primary);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-dark);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */
/* 
  Mobile: < 640px
  Tablet: 640px - 1024px
  Desktop: > 1024px
  Wide: > 1280px
*/