/* ============================================================
   LITEMIND — Design System
   Core tokens, typography, reset & utility classes
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* ============================================================
   COLOR THEMES — CSS Custom Properties
   ============================================================ */

/* Night Theme (Default) */
:root {
  /* Core palette */
  --primary:          #B39DDB;
  --primary-light:    #D1C4E9;
  --primary-dark:     #7E57C2;
  --primary-glow:     rgba(179, 157, 219, 0.3);

  /* Surface colors */
  --bg-primary:       #0F0F1A;
  --bg-secondary:     #16162A;
  --bg-tertiary:      #1A1A2E;
  --bg-card:          rgba(26, 26, 46, 0.7);
  --bg-glass:         rgba(26, 26, 46, 0.5);

  /* Chat bubbles */
  --bubble-ai:        #1A1A2E;
  --bubble-user:      #16213E;

  /* Text */
  --text-primary:     #E8E8F0;
  --text-secondary:   #A8A8C0;
  --text-muted:       #6B6B8D;
  --text-inverse:     #0F0F1A;

  /* Chips & accents */
  --chip-bg:          #3D3D6B;
  --chip-text:        #D1C4E9;
  --accent-orange:    #FF9F43;
  --accent-blue:      #4FC3F7;
  --accent-teal:      #80CBC4;
  --accent-pink:      #F48FB1;

  /* Borders & shadows */
  --border-subtle:    rgba(179, 157, 219, 0.12);
  --border-medium:    rgba(179, 157, 219, 0.2);
  --shadow-sm:        0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:        0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:        0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow:      0 0 40px rgba(179, 157, 219, 0.15);

  /* Gradients */
  --gradient-hero:    linear-gradient(135deg, #0F0F1A 0%, #1A1A2E 50%, #16213E 100%);
  --gradient-card:    linear-gradient(135deg, rgba(26,26,46,0.8) 0%, rgba(22,33,62,0.6) 100%);
  --gradient-cta:     linear-gradient(135deg, #7E57C2 0%, #B39DDB 50%, #4FC3F7 100%);
  --gradient-text:    linear-gradient(135deg, #B39DDB 0%, #4FC3F7 100%);
  --gradient-orb-1:   radial-gradient(circle, rgba(179,157,219,0.15) 0%, transparent 70%);
  --gradient-orb-2:   radial-gradient(circle, rgba(79,195,247,0.1) 0%, transparent 70%);
  --gradient-orb-3:   radial-gradient(circle, rgba(244,143,177,0.08) 0%, transparent 70%);

  /* Misc */
  --backdrop-blur:    blur(20px);
  --transition-fast:  150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:  300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Morning Theme */
[data-theme="morning"] {
  --primary:          #FF9F43;
  --primary-light:    #FFCC80;
  --primary-dark:     #E65100;
  --primary-glow:     rgba(255, 159, 67, 0.3);

  --bg-primary:       #FFF8E7;
  --bg-secondary:     #FFF3E0;
  --bg-tertiary:      #FFE0B2;
  --bg-card:          rgba(255, 243, 224, 0.9);
  --bg-glass:         rgba(255, 248, 231, 0.7);

  --bubble-ai:        #FFF3E0;
  --bubble-user:      #FFE0B2;

  --text-primary:     #3E2723;
  --text-secondary:   #5D4037;
  --text-muted:       #8D6E63;
  --text-inverse:     #FFF8E7;

  --chip-bg:          #FFCC80;
  --chip-text:        #3E2723;

  --border-subtle:    rgba(255, 159, 67, 0.15);
  --border-medium:    rgba(255, 159, 67, 0.25);
  --shadow-sm:        0 2px 8px rgba(62, 39, 35, 0.08);
  --shadow-md:        0 4px 16px rgba(62, 39, 35, 0.12);
  --shadow-lg:        0 8px 32px rgba(62, 39, 35, 0.16);
  --shadow-glow:      0 0 40px rgba(255, 159, 67, 0.15);

  --gradient-hero:    linear-gradient(135deg, #FFF8E7 0%, #FFF3E0 50%, #FFE0B2 100%);
  --gradient-card:    linear-gradient(135deg, rgba(255,243,224,0.9) 0%, rgba(255,224,178,0.7) 100%);
  --gradient-cta:     linear-gradient(135deg, #E65100 0%, #FF9F43 50%, #FFCC80 100%);
  --gradient-text:    linear-gradient(135deg, #E65100 0%, #FF9F43 100%);
}

/* Afternoon Theme */
[data-theme="afternoon"] {
  --primary:          #4FC3F7;
  --primary-light:    #81D4FA;
  --primary-dark:     #0277BD;
  --primary-glow:     rgba(79, 195, 247, 0.3);

  --bg-primary:       #F5F9FC;
  --bg-secondary:     #E1F5FE;
  --bg-tertiary:      #B3E5FC;
  --bg-card:          rgba(225, 245, 254, 0.9);
  --bg-glass:         rgba(245, 249, 252, 0.7);

  --bubble-ai:        #E1F5FE;
  --bubble-user:      #B3E5FC;

  --text-primary:     #1A237E;
  --text-secondary:   #283593;
  --text-muted:       #5C6BC0;
  --text-inverse:     #F5F9FC;

  --chip-bg:          #81D4FA;
  --chip-text:        #1A237E;

  --border-subtle:    rgba(79, 195, 247, 0.15);
  --border-medium:    rgba(79, 195, 247, 0.25);
  --shadow-sm:        0 2px 8px rgba(26, 35, 126, 0.06);
  --shadow-md:        0 4px 16px rgba(26, 35, 126, 0.1);
  --shadow-lg:        0 8px 32px rgba(26, 35, 126, 0.14);
  --shadow-glow:      0 0 40px rgba(79, 195, 247, 0.15);

  --gradient-hero:    linear-gradient(135deg, #F5F9FC 0%, #E1F5FE 50%, #B3E5FC 100%);
  --gradient-card:    linear-gradient(135deg, rgba(225,245,254,0.9) 0%, rgba(179,229,252,0.7) 100%);
  --gradient-cta:     linear-gradient(135deg, #0277BD 0%, #4FC3F7 50%, #81D4FA 100%);
  --gradient-text:    linear-gradient(135deg, #0277BD 0%, #4FC3F7 100%);
}

/* Emergency/Calm Theme */
[data-theme="emergency"] {
  --primary:          #80CBC4;
  --primary-light:    #B2DFDB;
  --primary-dark:     #00695C;
  --primary-glow:     rgba(128, 203, 196, 0.3);

  --bg-primary:       #F0FAFA;
  --bg-secondary:     #E0F2F1;
  --bg-tertiary:      #B2DFDB;
  --bg-card:          rgba(224, 242, 241, 0.9);
  --bg-glass:         rgba(240, 250, 250, 0.7);

  --bubble-ai:        #E0F2F1;
  --bubble-user:      #B2DFDB;

  --text-primary:     #004D40;
  --text-secondary:   #00695C;
  --text-muted:       #4DB6AC;
  --text-inverse:     #F0FAFA;

  --chip-bg:          #B2DFDB;
  --chip-text:        #004D40;

  --border-subtle:    rgba(128, 203, 196, 0.15);
  --border-medium:    rgba(128, 203, 196, 0.25);
  --shadow-sm:        0 2px 8px rgba(0, 77, 64, 0.06);
  --shadow-md:        0 4px 16px rgba(0, 77, 64, 0.1);
  --shadow-lg:        0 8px 32px rgba(0, 77, 64, 0.14);
  --shadow-glow:      0 0 40px rgba(128, 203, 196, 0.15);

  --gradient-hero:    linear-gradient(135deg, #F0FAFA 0%, #E0F2F1 50%, #B2DFDB 100%);
  --gradient-card:    linear-gradient(135deg, rgba(224,242,241,0.9) 0%, rgba(178,223,219,0.7) 100%);
  --gradient-cta:     linear-gradient(135deg, #00695C 0%, #80CBC4 50%, #B2DFDB 100%);
  --gradient-text:    linear-gradient(135deg, #00695C 0%, #80CBC4 100%);
}

/* ============================================================
   SPACING SCALE (4px base)
   ============================================================ */
:root {
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;
  --space-12:  48px;
  --space-16:  64px;
  --space-20:  80px;
  --space-24:  96px;
  --space-32:  128px;
}

/* ============================================================
   BORDER RADIUS
   ============================================================ */
:root {
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  16px;
  --radius-lg:  24px;
  --radius-xl:  32px;
  --radius-2xl: 48px;
  --radius-full: 9999px;
}

/* ============================================================
   TYPOGRAPHY SCALE
   ============================================================ */
:root {
  --font-body:     'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading:  'Outfit', 'Inter', sans-serif;

  --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 */
  --text-6xl:   3.75rem;    /* 60px */
  --text-7xl:   4.5rem;     /* 72px */

  --leading-tight:   1.15;
  --leading-snug:    1.3;
  --leading-normal:  1.5;
  --leading-relaxed: 1.7;

  --tracking-tight:  -0.02em;
  --tracking-normal: 0;
  --tracking-wide:   0.02em;
  --tracking-wider:  0.05em;
}

/* ============================================================
   MODERN CSS RESET
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

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

@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-xl);  }
}

p {
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover {
  color: var(--primary-light);
}

img, video, svg {
  display: block;
  max-width: 100%;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  outline: none;
  background: none;
}

button {
  cursor: pointer;
}

ul, ol {
  list-style: none;
}

::selection {
  background-color: var(--primary);
  color: var(--text-inverse);
}

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

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

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

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
}

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

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

/* Glass card */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Button base */
.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-heading);
  font-weight: 600;
  font-size: var(--text-base);
  border-radius: var(--radius-full);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-cta);
  color: #fff;
  box-shadow: var(--shadow-md), 0 0 20px var(--primary-glow);
  background-size: 200% 200%;
  animation: gradient-shift 4s ease infinite;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 40px var(--primary-glow);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-secondary:hover {
  background: var(--bg-glass);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}

/* Visibility for animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.stagger-children .reveal:nth-child(1) { transition-delay: 0ms; }
.stagger-children .reveal:nth-child(2) { transition-delay: 100ms; }
.stagger-children .reveal:nth-child(3) { transition-delay: 200ms; }
.stagger-children .reveal:nth-child(4) { transition-delay: 300ms; }
.stagger-children .reveal:nth-child(5) { transition-delay: 400ms; }
.stagger-children .reveal:nth-child(6) { transition-delay: 500ms; }

/* 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-width: 0;
}
