/* ============================================================
   MINDFLOW AI — Design System v2
   Inspired by Calm, Headspace, Finch — calm UX, glassmorphism,
   generous whitespace, soothing dark-first palette
   ============================================================ */

:root {
  /* LIGHT MODE */
  --color-bg: #f7f5ff;
  --color-bg-alt: #efedf9;
  --color-surface: #ffffff;
  --color-surface-2: #faf9fd;
  --color-surface-glass: rgba(255,255,255,0.72);
  --color-surface-offset: #ede8fb;
  --color-divider: #e2ddf2;
  --color-border: #d4cee8;
  --color-border-strong: #b8b0d4;
  --color-text: #18143a;
  --color-text-muted: #5c547a;
  --color-text-faint: #a49ec0;
  --color-text-inverse: #f7f5ff;
  --color-primary: #5b3fc4;
  --color-primary-hover: #4a31a3;
  --color-primary-active: #3a2682;
  --color-primary-highlight: #ede8fb;
  --color-primary-glow: rgba(91,63,196,0.18);
  --color-accent: #0fa8b2;
  --color-accent-hover: #0c8a93;
  --color-accent-highlight: #e0f7f9;
  --color-success: #16a34a;
  --color-success-bg: #dcfce7;
  --color-warning: #d97706;
  --color-warning-bg: #fef3c7;
  --color-error: #dc2626;
  --color-error-bg: #fee2e2;

  /* SPACING */
  --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;

  /* TYPE */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: clamp(1.375rem, 1.1rem + 1.1vw, 1.875rem);
  --text-2xl: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  --text-hero: clamp(2.25rem, 0.5rem + 5vw, 4.5rem);

  /* RADII */
  --radius-sm: 0.375rem; --radius-md: 0.75rem;
  --radius-lg: 1.125rem; --radius-xl: 1.5rem;
  --radius-2xl: 2rem; --radius-full: 9999px;

  /* SHADOWS */
  --shadow-xs: 0 1px 2px rgba(24,20,58,0.06);
  --shadow-sm: 0 2px 8px rgba(24,20,58,0.08);
  --shadow-md: 0 4px 20px rgba(24,20,58,0.10);
  --shadow-lg: 0 8px 40px rgba(24,20,58,0.13);
  --shadow-xl: 0 16px 64px rgba(24,20,58,0.16);
  --shadow-glow: 0 0 48px rgba(91,63,196,0.22);
  --shadow-glow-accent: 0 0 32px rgba(15,168,178,0.2);

  /* TIMING */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 380ms cubic-bezier(0.16, 1, 0.3, 1);

  /* FONTS */
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', 'Helvetica Neue', sans-serif;

  /* LAYOUT */
  --content-narrow: 600px;
  --content-default: 960px;
  --content-wide: 1200px;
  --nav-height: 64px;
  --bottom-nav-height: 68px;
}

[data-theme='dark'] {
  --color-bg: #0b0916;
  --color-bg-alt: #0f0c1e;
  --color-surface: #14112a;
  --color-surface-2: #1a1633;
  --color-surface-glass: rgba(20,17,42,0.82);
  --color-surface-offset: #1e1a38;
  --color-divider: #231f40;
  --color-border: #2e2952;
  --color-border-strong: #413b68;
  --color-text: #ece8ff;
  --color-text-muted: #9b95bf;
  --color-text-faint: #514b78;
  --color-text-inverse: #0b0916;
  --color-primary: #9c82f0;
  --color-primary-hover: #b49af5;
  --color-primary-active: #cbb8fa;
  --color-primary-highlight: #1e1a38;
  --color-primary-glow: rgba(156,130,240,0.22);
  --color-accent: #2dd4df;
  --color-accent-hover: #4de0ea;
  --color-accent-highlight: #0d2f32;
  --color-success: #4ade80;
  --color-success-bg: #14532d;
  --color-warning: #fbbf24;
  --color-warning-bg: #451a03;
  --color-error: #f87171;
  --color-error-bg: #7f1d1d;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.42);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 64px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 60px rgba(156,130,240,0.28);
  --shadow-glow-accent: 0 0 40px rgba(45,212,223,0.22);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --color-bg: #0b0916; --color-bg-alt: #0f0c1e;
    --color-surface: #14112a; --color-surface-2: #1a1633;
    --color-surface-glass: rgba(20,17,42,0.82);
    --color-surface-offset: #1e1a38;
    --color-divider: #231f40; --color-border: #2e2952;
    --color-border-strong: #413b68;
    --color-text: #ece8ff; --color-text-muted: #9b95bf;
    --color-text-faint: #514b78; --color-text-inverse: #0b0916;
    --color-primary: #9c82f0; --color-primary-hover: #b49af5;
    --color-primary-active: #cbb8fa; --color-primary-highlight: #1e1a38;
    --color-primary-glow: rgba(156,130,240,0.22);
    --color-accent: #2dd4df; --color-accent-hover: #4de0ea;
    --color-accent-highlight: #0d2f32;
    --color-success: #4ade80; --color-success-bg: #14532d;
    --color-error: #f87171; --color-error-bg: #7f1d1d;
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.35);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.42);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --shadow-xl: 0 16px 64px rgba(0,0,0,0.6);
    --shadow-glow: 0 0 60px rgba(156,130,240,0.28);
  }
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; scroll-padding-top: var(--nav-height); }
body { font-family: var(--font-body); font-size: var(--text-base); color: var(--color-text); background-color: var(--color-bg); line-height: 1.6; min-height: 100dvh; }
img, svg { display: block; max-width: 100%; height: auto; }
ul, ol { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { text-wrap: balance; line-height: 1.2; font-family: var(--font-display); }
p, li { text-wrap: pretty; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.container { width: 100%; max-width: var(--content-wide); margin-inline: auto; padding-inline: clamp(var(--space-4), 5vw, var(--space-12)); }
.container--narrow { max-width: var(--content-narrow); }
.container--default { max-width: var(--content-default); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: 0.75rem 1.5rem;
  border-radius: var(--radius-full); font-size: var(--text-sm);
  font-weight: 600; letter-spacing: 0.01em;
  transition: all var(--transition); white-space: nowrap;
  cursor: pointer; border: none; position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--color-primary); color: #fff;
  box-shadow: 0 2px 12px var(--color-primary-glow);
}
.btn-primary:hover { background: var(--color-primary-hover); box-shadow: 0 4px 24px var(--color-primary-glow); transform: translateY(-1px); }
.btn-hero {
  background: linear-gradient(135deg, var(--color-primary) 0%, #7c4dff 100%);
  color: #fff; padding: 1rem 2rem; font-size: var(--text-base);
  box-shadow: 0 4px 32px var(--color-primary-glow); width: 100%;
}
.btn-hero:hover { box-shadow: 0 8px 40px var(--color-primary-glow); transform: translateY(-2px); }
.btn-outline {
  border: 1.5px solid var(--color-border); color: var(--color-text);
  background: transparent;
}
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-highlight); }
.btn-ghost { color: var(--color-text-muted); background: transparent; }
.btn-ghost:hover { color: var(--color-text); background: var(--color-surface-offset); }
.btn-accent { background: var(--color-accent); color: #fff; box-shadow: 0 2px 12px var(--shadow-glow-accent); }
.btn-accent:hover { background: var(--color-accent-hover); transform: translateY(-1px); }
.btn-sm { padding: 0.5rem 1rem; font-size: var(--text-xs); }
.btn-lg { padding: 1rem 2rem; font-size: var(--text-base); }
.btn-full { width: 100%; }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── NAV ─────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100; height: var(--nav-height);
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-divider);
}
.nav {
  display: flex; align-items: center; gap: var(--space-4);
  height: 100%; max-width: var(--content-wide); margin: 0 auto;
  padding-inline: clamp(var(--space-4), 5vw, var(--space-12));
}
.logo { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text); flex-shrink: 0; }
.logo-text {
  font-family: var(--font-display); font-size: 1.25rem;
  letter-spacing: -0.02em; color: var(--color-text);
}
.logo-text .ai {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-spacer { flex: 1; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted); transition: all var(--transition);
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-offset); }

/* ── FORMS ───────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label { font-size: var(--text-sm); font-weight: 500; color: var(--color-text); }
.form-input {
  padding: 0.75rem 1rem; border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg); background: var(--color-surface);
  color: var(--color-text); font-size: var(--text-base);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%; outline: none;
  -webkit-appearance: none; appearance: none;
}
.form-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 4px var(--color-primary-glow); }
.form-input::placeholder { color: var(--color-text-faint); }
.form-input.error { border-color: var(--color-error); }
.form-hint { font-size: var(--text-xs); color: var(--color-text-muted); }
.form-error { font-size: var(--text-xs); color: var(--color-error); display: flex; align-items: center; gap: var(--space-1); }

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--color-surface); border: 1px solid var(--color-divider);
  border-radius: var(--radius-2xl); padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}
.card-glass {
  background: var(--color-surface-glass);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-2xl);
}

/* ── BADGES ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 0.25rem 0.625rem; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em;
}
.badge-pro { background: linear-gradient(135deg, var(--color-primary), #7c4dff); color: #fff; }
.badge-trial { background: var(--color-accent-highlight); color: var(--color-accent); border: 1px solid var(--color-accent); }
.badge-dot { width: 7px; height: 7px; background: #4ade80; border-radius: 50%; box-shadow: 0 0 8px #4ade80; animation: pulse 2.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ── UTILITIES ────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.spinner { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gradient-text {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── LOGO SVG ─────────────────────────────────────────────────── */
.logo-svg path, .logo-svg circle, .logo-svg line { stroke: currentColor; }

/* ── MODAL/OVERLAY ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(11,9,22,0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4); opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl); padding: var(--space-8);
  max-width: 420px; width: 100%;
  transform: translateY(12px); transition: transform var(--transition);
  box-shadow: var(--shadow-xl);
}
.modal-overlay.active .modal-box { transform: translateY(0); }
.modal-icon { width: 56px; height: 56px; border-radius: var(--radius-xl); background: var(--color-primary-highlight); display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-5); }
.modal-title { font-family: var(--font-display); font-size: var(--text-xl); text-align: center; margin-bottom: var(--space-2); }
.modal-desc { font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; margin-bottom: var(--space-6); line-height: 1.6; }
.modal-actions { display: flex; flex-direction: column; gap: var(--space-3); }
