/* Design System - CSS Variables and Base Styles */

/* CSS Variables based on design system */
:root {
  /* Light theme colors */
  --primary: #6c5ce7;
  --secondary: #192a3d;
  --accent: #757c88;
  --background: #f8fafc;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text: #0f172a;
  --text-muted: #757c88;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --gradient-primary: linear-gradient(135deg, #7c5cff, #5dd6ff);
  
  /* Shadows for light theme */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-xl: 0 6px 18px rgba(16,24,40,0.06);
}

/* Dark theme */
[data-theme="dark"] {
  --primary: #8c7eff;
  --secondary: #1c2235;
  --accent: #9da3b5;
  --background: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --text: #f5f7fa;
  --text-muted: #9da3b5;
  --success: #34d399;
  --warning: #fbbf24;
  --error: #f87171;
  --gradient-primary: linear-gradient(135deg, #8c7eff, #4db8ff);
  
  /* Shadows for dark theme */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.7);
  --shadow-xl: 0 6px 18px rgba(0,0,0,0.6);
}

/* Auto theme based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --primary: #8c7eff;
    --secondary: #1c2235;
    --accent: #9da3b5;
    --background: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #f5f7fa;
    --text-muted: #9da3b5;
    --success: #34d399;
    --warning: #fbbf24;
    --error: #f87171;
    --gradient-primary: linear-gradient(135deg, #8c7eff, #4db8ff);
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.7);
    --shadow-xl: 0 6px 18px rgba(0,0,0,0.6);
  }
}

/* Typography */
:root {
  --font-primary: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-secondary: 'Walsheim', var(--font-primary);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  
  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  
  /* Layout */
  --max-width: 1100px;
  --gutter: 24px;
  --section-gap: 48px;
  
  /* Transitions */
  --transition-fast: 0.15s ease-out;
  --transition-normal: 0.3s ease-out;
  --transition-slow: 0.5s ease-out;
  --transition-theme: 0.3s ease-in-out;
}

/* Reset and base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes ripple {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

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

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

.pulse {
  animation: pulse 2s infinite;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles */
.btn:focus,
input:focus,
textarea:focus,
details summary:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
}
