/* ============================================================
   SOLM8.AI Design System
   Apple-Grade Enterprise Design Tokens & Foundation
   ============================================================ */

/* ============================================================
   CSS Variables - Core Design Tokens
   ============================================================ */
:root {
  /* Color System */
  --color-primary: #FF6B9D;
  --color-primary-dark: #E85588;
  --color-primary-light: #FFB3CD;
  --color-secondary: #C06CFF;
  --color-secondary-dark: #A852FF;
  --color-secondary-light: #D99FFF;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #FF6B9D 0%, #C06CFF 100%);
  --gradient-secondary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-success: linear-gradient(135deg, #36d399 0%, #10b981 100%);
  --gradient-warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --gradient-error: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  --gradient-dark: linear-gradient(135deg, #0a0a0f 0%, #1a0a2e 100%);

  /* Neutral Colors */
  --color-background: #0a0a0f;
  --color-background-secondary: #1a0a2e;
  --color-surface: rgba(255, 255, 255, 0.02);
  --color-surface-hover: rgba(255, 255, 255, 0.04);
  --color-surface-active: rgba(255, 255, 255, 0.06);

  /* Glass Morphism */
  --glass-background: rgba(255, 255, 255, 0.05);
  --glass-background-hover: rgba(255, 255, 255, 0.08);
  --glass-background-active: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-border-hover: rgba(255, 255, 255, 0.2);
  --glass-blur: blur(40px);
  --glass-blur-intense: blur(80px);

  /* Text Colors */
  --text-primary: rgba(255, 255, 255, 0.95);
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  --text-disabled: rgba(255, 255, 255, 0.3);

  /* Typography Scale */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;

  /* Font Sizes - Fluid Typography */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);
  --text-3xl: clamp(1.875rem, 1.65rem + 1.125vw, 2.25rem);
  --text-4xl: clamp(2.25rem, 1.9rem + 1.75vw, 3rem);
  --text-5xl: clamp(3rem, 2.4rem + 3vw, 4rem);

  /* Font Weights */
  --font-light: 300;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  /* Spacing System (4px base) */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px -1px rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -2px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(255, 107, 157, 0.3);
  --shadow-glow-intense: 0 0 80px rgba(192, 108, 255, 0.4);

  /* Animation */
  --duration-instant: 50ms;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;
  --duration-slowest: 1000ms;

  /* Easing Curves */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-overlay: 30;
  --z-modal: 40;
  --z-popover: 50;
  --z-tooltip: 60;
  --z-notification: 70;

  /* Layout */
  --container-max: 1280px;
  --container-padding: var(--space-6);
  --header-height: 64px;
  --sidebar-width: 280px;
  --sidebar-collapsed: 64px;
}

/* Dark Mode (default) */
[data-theme="dark"] {
  color-scheme: dark;
}

/* Light Mode Variables */
[data-theme="light"] {
  --color-background: #ffffff;
  --color-background-secondary: #f9fafb;
  --color-surface: rgba(0, 0, 0, 0.02);
  --color-surface-hover: rgba(0, 0, 0, 0.04);
  --color-surface-active: rgba(0, 0, 0, 0.06);

  --glass-background: rgba(0, 0, 0, 0.03);
  --glass-background-hover: rgba(0, 0, 0, 0.05);
  --glass-background-active: rgba(0, 0, 0, 0.08);
  --glass-border: rgba(0, 0, 0, 0.1);
  --glass-border-hover: rgba(0, 0, 0, 0.15);

  --text-primary: rgba(0, 0, 0, 0.9);
  --text-secondary: rgba(0, 0, 0, 0.7);
  --text-tertiary: rgba(0, 0, 0, 0.5);
  --text-disabled: rgba(0, 0, 0, 0.3);

  --shadow-glow: 0 0 40px rgba(255, 107, 157, 0.2);
  --shadow-glow-intense: 0 0 80px rgba(192, 108, 255, 0.3);
}

/* ============================================================
   Base Styles & Reset
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--gradient-dark);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Selection Colors */
::selection {
  background: var(--color-primary);
  color: white;
}

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

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================================
   Typography Classes
   ============================================================ */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
.text-5xl { font-size: var(--text-5xl); }

.font-light { font-weight: var(--font-light); }
.font-regular { font-weight: var(--font-regular); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }
.font-extrabold { font-weight: var(--font-extrabold); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-disabled { color: var(--text-disabled); }

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

/* ============================================================
   Layout Utilities
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ============================================================
   Glass Morphism Base
   ============================================================ */
.glass {
  background: var(--glass-background);
  backdrop-filter: var(--glass-blur) saturate(180%);
  -webkit-backdrop-filter: var(--glass-blur) saturate(180%);
  border: 1px solid var(--glass-border);
  transition: all var(--duration-normal) var(--ease-default);
}

.glass:hover {
  background: var(--glass-background-hover);
  border-color: var(--glass-border-hover);
}

.glass-intense {
  backdrop-filter: var(--glass-blur-intense) saturate(200%);
  -webkit-backdrop-filter: var(--glass-blur-intense) saturate(200%);
}

/* ============================================================
   Animation Classes
   ============================================================ */
.transition-all {
  transition: all var(--duration-normal) var(--ease-default);
}

.transition-colors {
  transition: color var(--duration-normal) var(--ease-default),
              background-color var(--duration-normal) var(--ease-default),
              border-color var(--duration-normal) var(--ease-default);
}

.transition-transform {
  transition: transform var(--duration-normal) var(--ease-default);
}

.scale-hover:hover {
  transform: scale(1.02);
}

.lift-hover:hover {
  transform: translateY(-2px);
}

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

/* Pulse Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.animate-pulse {
  animation: pulse 2s var(--ease-in-out) infinite;
}

/* Glow Animation */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
  }
  50% {
    box-shadow: 0 0 40px rgba(255, 107, 157, 0.8), 0 0 60px rgba(192, 108, 255, 0.5);
  }
}

.animate-glow {
  animation: glow 3s var(--ease-in-out) infinite;
}

/* ============================================================
   Responsive Breakpoints
   ============================================================ */
@media (min-width: 640px) {
  :root {
    --container-padding: var(--space-8);
  }
}

@media (min-width: 768px) {
  :root {
    --container-padding: var(--space-10);
  }
}

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

/* ============================================================
   Accessibility
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-secondary: rgba(255, 255, 255, 0.85);
  }
}

/* ============================================================
   Print Styles
   ============================================================ */
@media print {
  body {
    background: white;
    color: black;
  }

  .no-print {
    display: none !important;
  }
}