/* ============================================
   ALVEA DESIGN SYSTEM - SINGLE SOURCE OF TRUTH
   Award-Winning Unified Theme System
   Created: January 2025
   ============================================ */

/* ============================================
   SECTION 1: COLOR TOKENS
   Light theme is default, dark overrides below
   ============================================ */

:root {
  /* ===== SURFACE COLORS ===== */
  --color-bg-base: #FAFAFA;
  --color-bg-surface: #FFFFFF;
  --color-bg-elevated: #F4F4F5;
  --color-bg-overlay: rgba(255, 255, 255, 0.95);
  --color-bg-muted: #F4F4F5;

  /* ===== TEXT COLORS - WCAG AAA Compliant ===== */
  --color-text-primary: #09090B;      /* 17:1 contrast */
  --color-text-secondary: #3F3F46;    /* 10:1 contrast */
  --color-text-muted: #71717A;        /* 5.5:1 contrast */
  --color-text-inverted: #FAFAFA;

  /* ===== BORDER COLORS ===== */
  --color-border-default: #E4E4E7;
  --color-border-hover: #D4D4D8;
  --color-border-active: #A1A1AA;
  --color-border-subtle: #F4F4F5;

  /* ===== PRODUCT ACCENT COLORS ===== */
  /* Voice/AI Agent Features */
  --color-accent-voice: #7C3AED;
  --color-accent-voice-light: #A78BFA;
  --color-accent-voice-dark: #6D28D9;
  --color-accent-voice-glow: rgba(124, 58, 237, 0.15);

  /* CBCT/Imaging Features */
  --color-accent-cbct: #0891B2;
  --color-accent-cbct-light: #22D3EE;
  --color-accent-cbct-dark: #0E7490;
  --color-accent-cbct-glow: rgba(8, 145, 178, 0.15);

  /* Automation Categories */
  --color-accent-conversion: #2563EB;
  --color-accent-conversion-light: #60A5FA;
  --color-accent-conversion-glow: rgba(37, 99, 235, 0.15);

  --color-accent-revenue: #D97706;
  --color-accent-revenue-light: #FBBF24;
  --color-accent-revenue-glow: rgba(217, 119, 6, 0.15);

  --color-accent-retention: #059669;
  --color-accent-retention-light: #34D399;
  --color-accent-retention-glow: rgba(5, 150, 105, 0.15);

  /* ===== HERO SECTION - Theme Aware ===== */
  --color-hero-start: #FAFAFA;
  --color-hero-end: #F4F4F5;
  --color-hero-glow-opacity: 0.08;
  --color-hero-text: #09090B;
  --color-hero-text-muted: #3F3F46;

  /* ===== STATUS COLORS ===== */
  --color-success: #059669;
  --color-success-light: #D1FAE5;
  --color-warning: #D97706;
  --color-warning-light: #FEF3C7;
  --color-error: #DC2626;
  --color-error-light: #FEE2E2;
  --color-info: #0891B2;
  --color-info-light: #CFFAFE;

  /* ===== SHADOW SYSTEM ===== */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  --shadow-glow-voice: 0 0 40px rgba(124, 58, 237, 0.15);
  --shadow-glow-cbct: 0 0 40px rgba(8, 145, 178, 0.15);
}

/* ============================================
   DARK THEME OVERRIDES
   ============================================ */

[data-theme="dark"] {
  /* ===== SURFACE COLORS ===== */
  --color-bg-base: #09090B;
  --color-bg-surface: #18181B;
  --color-bg-elevated: #27272A;
  --color-bg-overlay: rgba(24, 24, 27, 0.95);
  --color-bg-muted: #27272A;

  /* ===== TEXT COLORS ===== */
  --color-text-primary: #FAFAFA;
  --color-text-secondary: #A1A1AA;
  --color-text-muted: #71717A;
  --color-text-inverted: #09090B;

  /* ===== BORDER COLORS ===== */
  --color-border-default: #27272A;
  --color-border-hover: #3F3F46;
  --color-border-active: #52525B;
  --color-border-subtle: #18181B;

  /* ===== ACCENT GLOW INTENSITIES ===== */
  --color-accent-voice-glow: rgba(124, 58, 237, 0.25);
  --color-accent-cbct-glow: rgba(8, 145, 178, 0.25);
  --color-accent-conversion-glow: rgba(37, 99, 235, 0.25);
  --color-accent-revenue-glow: rgba(217, 119, 6, 0.25);
  --color-accent-retention-glow: rgba(5, 150, 105, 0.25);

  /* ===== HERO SECTION ===== */
  --color-hero-start: #09090B;
  --color-hero-end: #18181B;
  --color-hero-glow-opacity: 0.25;
  --color-hero-text: #FAFAFA;
  --color-hero-text-muted: #A1A1AA;

  /* ===== STATUS COLORS (Adjusted for dark) ===== */
  --color-success-light: rgba(5, 150, 105, 0.15);
  --color-warning-light: rgba(217, 119, 6, 0.15);
  --color-error-light: rgba(220, 38, 38, 0.15);
  --color-info-light: rgba(8, 145, 178, 0.15);

  /* ===== SHADOW SYSTEM (Darker) ===== */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  --shadow-glow-voice: 0 0 60px rgba(124, 58, 237, 0.3);
  --shadow-glow-cbct: 0 0 60px rgba(8, 145, 178, 0.3);
}

/* ============================================
   SECTION 2: TYPOGRAPHY SYSTEM
   ============================================ */

:root {
  /* ===== FONT FAMILIES ===== */
  --font-display: 'Clash Display', system-ui, -apple-system, sans-serif;
  --font-body: 'General Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Azeret Mono', ui-monospace, monospace;

  /* ===== 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: 2rem;        /* 32px */
  --text-4xl: 2.5rem;      /* 40px */
  --text-5xl: 3.5rem;      /* 56px */
  --text-6xl: 4.5rem;      /* 72px */
  --text-hero: clamp(2.5rem, 6vw, 5rem);

  /* ===== LINE HEIGHTS ===== */
  --leading-none: 1;
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  /* ===== LETTER SPACING ===== */
  --tracking-tighter: -0.03em;
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;
  --tracking-widest: 0.1em;

  /* ===== FONT WEIGHTS ===== */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;
}

/* ============================================
   SECTION 3: SPACING SYSTEM
   ============================================ */

:root {
  --space-0: 0;
  --space-px: 1px;
  --space-0-5: 0.125rem;   /* 2px */
  --space-1: 0.25rem;      /* 4px */
  --space-1-5: 0.375rem;   /* 6px */
  --space-2: 0.5rem;       /* 8px */
  --space-2-5: 0.625rem;   /* 10px */
  --space-3: 0.75rem;      /* 12px */
  --space-3-5: 0.875rem;   /* 14px */
  --space-4: 1rem;         /* 16px */
  --space-5: 1.25rem;      /* 20px */
  --space-6: 1.5rem;       /* 24px */
  --space-7: 1.75rem;      /* 28px */
  --space-8: 2rem;         /* 32px */
  --space-9: 2.25rem;      /* 36px */
  --space-10: 2.5rem;      /* 40px */
  --space-12: 3rem;        /* 48px */
  --space-14: 3.5rem;      /* 56px */
  --space-16: 4rem;        /* 64px */
  --space-20: 5rem;        /* 80px */
  --space-24: 6rem;        /* 96px */
  --space-32: 8rem;        /* 128px */

  /* ===== BORDER RADIUS ===== */
  --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;
}

/* ============================================
   SECTION 4: ANIMATION & TRANSITIONS
   Butter-smooth is the mandate
   ============================================ */

:root {
  /* ===== EASING FUNCTIONS ===== */
  --ease-linear: linear;
  --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-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);

  /* ===== DURATIONS ===== */
  --duration-instant: 0ms;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 700ms;
  --duration-theme: 400ms;
}

/* ===== GLOBAL THEME TRANSITIONS ===== */
*,
*::before,
*::after {
  transition-property: color, background-color, border-color, box-shadow, opacity;
  transition-duration: var(--duration-theme);
  transition-timing-function: var(--ease-in-out);
}

/* Exclude elements that shouldn't transition */
input,
textarea,
select,
button,
a,
.no-transition {
  transition-property: color, background-color, border-color, box-shadow, opacity, transform;
  transition-duration: var(--duration-normal);
}

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

/* ============================================
   SECTION 5: BASE STYLES
   ============================================ */

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: var(--color-bg-base);
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

/* ===== HEADINGS ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

h1 { font-size: var(--text-5xl); font-weight: var(--font-bold); }
h2 { font-size: var(--text-4xl); font-weight: var(--font-bold); }
h3 { font-size: var(--text-3xl); font-weight: var(--font-semibold); }
h4 { font-size: var(--text-2xl); font-weight: var(--font-semibold); }
h5 { font-size: var(--text-xl); font-weight: var(--font-semibold); }
h6 { font-size: var(--text-lg); font-weight: var(--font-semibold); }

/* ===== PARAGRAPHS ===== */
p {
  color: var(--color-text-secondary);
  margin: 0;
}

/* ===== LINKS ===== */
a {
  color: var(--color-accent-voice);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent-voice-dark);
}

/* ============================================
   SECTION 6: COMPONENT PRIMITIVES
   ============================================ */

/* ===== CARDS ===== */
.card {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition:
    transform var(--duration-normal) var(--ease-out),
    box-shadow var(--duration-normal) var(--ease-out),
    border-color var(--duration-normal) var(--ease-out);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border-hover);
}

.card-featured {
  border-color: var(--color-accent-voice);
  box-shadow: var(--shadow-glow-voice);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: 1;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-accent-voice);
  color: white;
  border: none;
}

.btn-primary:hover {
  background: var(--color-accent-voice-dark);
  box-shadow: var(--shadow-glow-voice);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-default);
}

.btn-secondary:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border: none;
  padding: var(--space-2) var(--space-3);
}

.btn-ghost:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text-primary);
}

/* Button Sizes */
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  border-radius: var(--radius-full);
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
}

.badge-voice {
  background: var(--color-accent-voice-glow);
  color: var(--color-accent-voice);
}

.badge-cbct {
  background: var(--color-accent-cbct-glow);
  color: var(--color-accent-cbct);
}

.badge-success {
  background: var(--color-success-light);
  color: var(--color-success);
}

/* ===== INPUTS ===== */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  outline: none;
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
}

.input:focus {
  border-color: var(--color-accent-voice);
  box-shadow: 0 0 0 3px var(--color-accent-voice-glow);
}

.input::placeholder {
  color: var(--color-text-muted);
}

/* ============================================
   SECTION 7: HERO SECTIONS
   Theme-aware, no more hardcoded dark
   ============================================ */

.hero {
  background: linear-gradient(
    to bottom,
    var(--color-hero-start),
    var(--color-hero-end)
  );
  color: var(--color-hero-text);
  position: relative;
  overflow: hidden;
}

.hero-text {
  color: var(--color-hero-text);
}

.hero-text-muted {
  color: var(--color-hero-text-muted);
}

/* Hero glow effects */
.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -25%;
  width: 150%;
  height: 150%;
  background: radial-gradient(
    ellipse at center,
    var(--color-accent-voice-glow) 0%,
    transparent 70%
  );
  opacity: var(--color-hero-glow-opacity);
  pointer-events: none;
}

/* ============================================
   SECTION 8: SECTION TRANSITIONS
   Butter-smooth, no jarring jumps
   ============================================ */

.section {
  background: var(--color-bg-base);
  padding: var(--space-20) 0;
  position: relative;
}

.section-alt {
  background: var(--color-bg-surface);
}

.section-elevated {
  background: var(--color-bg-elevated);
}

/* Gradient fade between sections */
.section-transition::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(
    to bottom,
    transparent,
    var(--color-bg-surface)
  );
  pointer-events: none;
  z-index: 1;
}

.section-transition-reverse::after {
  background: linear-gradient(
    to bottom,
    transparent,
    var(--color-bg-base)
  );
}

/* ============================================
   SECTION 9: CONTAINER & LAYOUT
   ============================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }

/* ===== GRID SYSTEM ===== */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================
   SECTION 10: RESPONSIVE BREAKPOINTS
   iPhone → iPad → Desktop
   ============================================ */

/* Mobile First: Base styles are for mobile */

/* Tablet (iPad) */
@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-8);
  }

  .section {
    padding: var(--space-24) 0;
  }

  h1 { font-size: var(--text-6xl); }
  h2 { font-size: var(--text-5xl); }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-6);
  }
}

/* Mobile overrides */
@media (max-width: 767px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }

  .btn {
    width: 100%;
    justify-content: center;
  }

  /* Touch-friendly targets */
  .btn,
  .input,
  a {
    min-height: 44px;
  }
}

/* iPad specific */
@media (min-width: 768px) and (max-width: 1023px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   SECTION 11: UTILITY CLASSES
   ============================================ */

/* Text Colors */
.text-primary { color: var(--color-text-primary) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-voice { color: var(--color-accent-voice) !important; }
.text-cbct { color: var(--color-accent-cbct) !important; }

/* Background Colors */
.bg-base { background-color: var(--color-bg-base) !important; }
.bg-surface { background-color: var(--color-bg-surface) !important; }
.bg-elevated { background-color: var(--color-bg-elevated) !important; }

/* Spacing Utilities */
.mt-0 { margin-top: 0 !important; }
.mt-4 { margin-top: var(--space-4) !important; }
.mt-8 { margin-top: var(--space-8) !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: var(--space-4) !important; }
.mb-8 { margin-bottom: var(--space-8) !important; }

.p-0 { padding: 0 !important; }
.p-4 { padding: var(--space-4) !important; }
.p-8 { padding: var(--space-8) !important; }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Visibility */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ============================================
   SECTION 12: ANIMATIONS LIBRARY
   Premium micro-interactions
   ============================================ */

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

/* Stagger children */
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.30s; }

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

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

/* Glow */
@keyframes glow {
  0%, 100% { box-shadow: var(--shadow-glow-voice); }
  50% { box-shadow: 0 0 60px rgba(124, 58, 237, 0.4); }
}

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

/* Float */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

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

/* Shimmer (for loading states) */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-shimmer {
  background: linear-gradient(
    90deg,
    var(--color-bg-elevated) 0%,
    var(--color-bg-surface) 50%,
    var(--color-bg-elevated) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s var(--ease-linear) infinite;
}

/* ============================================
   LOGO STYLING - SINGLE SOURCE OF TRUTH
   Must be identical on ALL pages - DO NOT OVERRIDE
   ============================================ */
.nav-logo-text,
.nav-sig-logo-text {
  font-family: 'Clash Display', var(--font-display), system-ui, sans-serif !important;
  font-size: 1.1rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.22em !important;
  text-transform: uppercase !important;
}

/* ============================================
   END OF DESIGN SYSTEM
   All pages must use these tokens.
   No hardcoded colors. No overrides.
   ============================================ */
