/* ─── PsyChat Analyzer – Design System ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --bg-base:       #080b14;
  --bg-surface:    #0d1120;
  --bg-card:       rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --border:        rgba(255,255,255,0.08);
  --border-glow:   rgba(139,92,246,0.4);

  --accent:        #8b5cf6;
  --accent-light:  #a78bfa;
  --accent-dark:   #6d28d9;
  --cyan:          #06b6d4;
  --pink:          #ec4899;
  --green:         #10b981;
  --orange:        #f59e0b;
  --red:           #ef4444;

  --grad-hero:     linear-gradient(135deg, #8b5cf6 0%, #06b6d4 50%, #ec4899 100%);
  --grad-card:     linear-gradient(145deg, rgba(139,92,246,0.15), rgba(6,182,212,0.08));
  --grad-btn:      linear-gradient(135deg, #8b5cf6, #6d28d9);

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #475569;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-pill:9999px;

  --shadow-glow: 0 0 40px rgba(139,92,246,0.25);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --transition:  0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── Background mesh ────────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139,92,246,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(6,182,212,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 50% 30% at 50% 50%, rgba(236,72,153,0.06) 0%, transparent 60%);
}

/* ─── Typography ─────────────────────────────────────────────────────────────── */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--text-secondary); }

.gradient-text {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.container { max-width: 900px; margin: 0 auto; padding: 0 1.25rem; }
.container--wide { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }

/* ─── Nav ────────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8,11,20,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.25rem;
}
.nav__inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav__logo {
  font-size: 1.25rem; font-weight: 800;
  text-decoration: none; color: var(--text-primary);
  display: flex; align-items: center; gap: 0.5rem;
}
.nav__logo span { font-size: 1.5rem; }
.nav__links { display: flex; align-items: center; gap: 0.5rem; }
.nav__credits-badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem; font-weight: 600;
  color: var(--accent-light);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none; border-radius: var(--radius-pill);
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn--primary {
  background: var(--grad-btn);
  color: #fff;
  box-shadow: 0 4px 20px rgba(139,92,246,0.4);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.6);
}
.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.btn--sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn--lg { padding: 0.85rem 2rem; font-size: 1.05rem; }
.btn--full { width: 100%; justify-content: center; }

.btn--cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #fff;
  box-shadow: 0 4px 20px rgba(6,182,212,0.35);
}
.btn--cyan:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(6,182,212,0.55); }

.btn:disabled { opacity: 0.5; pointer-events: none; }

/* ─── Card / Glass ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  transition: var(--transition);
}
.card:hover { border-color: var(--border-glow); box-shadow: var(--shadow-glow); }

.card--glow {
  background: var(--grad-card);
  border-color: rgba(139,92,246,0.25);
}

/* ─── Form elements ──────────────────────────────────────────────────────────── */
.label {
  display: block; margin-bottom: 0.4rem;
  font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.input, .textarea, .select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.95rem;
  padding: 0.75rem 1rem;
  transition: var(--transition);
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.2);
  background: rgba(255,255,255,0.06);
}
.textarea { resize: vertical; min-height: 200px; line-height: 1.7; }
.select { cursor: pointer; }
.select option { background: var(--bg-surface); }

/* ─── Tabs ───────────────────────────────────────────────────────────────────── */
.tabs { display: flex; background: var(--bg-card); border-radius: var(--radius-pill); padding: 4px; gap: 4px; }
.tab {
  flex: 1; padding: 0.55rem 1rem; border: none; border-radius: var(--radius-pill);
  background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: var(--transition); text-align: center;
}
.tab.active { background: var(--accent); color: #fff; box-shadow: 0 2px 10px rgba(139,92,246,0.4); }

/* ─── Toggle (Person Selector) ───────────────────────────────────────────────── */
.person-toggle { display: flex; gap: 0.75rem; }
.person-btn {
  flex: 1; padding: 0.75rem 1rem; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: var(--transition); text-align: center;
}
.person-btn.active {
  background: rgba(139,92,246,0.2);
  border-color: var(--accent);
  color: var(--accent-light);
}

/* ─── Spinner ────────────────────────────────────────────────────────────────── */
.spinner-wrap {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; gap: 1rem; padding: 3rem;
}
.spinner-wrap.active { display: flex; }
.spinner {
  width: 52px; height: 52px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.spinner-text { color: var(--text-secondary); font-size: 0.9rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Accordion ──────────────────────────────────────────────────────────────── */
.accordion { display: flex; flex-direction: column; gap: 0.75rem; }
.accordion-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
}
.accordion-item:hover { border-color: rgba(139,92,246,0.3); }
.accordion-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer; user-select: none;
  background: transparent; border: none; width: 100%;
  color: var(--text-primary); font-family: inherit;
  text-align: left;
}
.accordion-header:hover { background: rgba(255,255,255,0.03); }
.accordion-icon {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 700;
  background: rgba(139,92,246,0.15); color: var(--accent-light);
  flex-shrink: 0;
}
.accordion-title { font-weight: 600; font-size: 0.95rem; flex: 1; margin: 0 0.75rem; }
.accordion-chevron {
  color: var(--text-muted); transition: transform var(--transition);
  flex-shrink: 0;
}
.accordion-item.open .accordion-chevron { transform: rotate(180deg); }
.accordion-body {
  max-height: 0; overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4,0,0.2,1);
}
.accordion-body.open { max-height: 2000px; }
.accordion-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary); font-size: 0.9rem;
  line-height: 1.8; white-space: pre-wrap;
}

/* ─── Score Bar ──────────────────────────────────────────────────────────────── */
.score-bar-wrap { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.score-row { display: flex; align-items: center; gap: 0.75rem; }
.score-label { min-width: 80px; font-size: 0.8rem; color: var(--text-muted); }
.score-track {
  flex: 1; height: 6px; background: rgba(255,255,255,0.06);
  border-radius: 99px; overflow: hidden;
}
.score-fill {
  height: 100%; border-radius: 99px;
  background: var(--grad-hero);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.8s cubic-bezier(0.4,0,0.2,1) 0.2s;
}
.score-fill.animated { transform: scaleX(1); }
.score-value { font-size: 0.8rem; font-weight: 700; color: var(--accent-light); min-width: 24px; }

/* ─── Response Cards ─────────────────────────────────────────────────────────── */
.response-cards { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }
.response-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.response-card__label {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.response-card--safe   .response-card__label { color: var(--green); }
.response-card--firm   .response-card__label { color: var(--cyan); }
.response-card--detach .response-card__label { color: var(--orange); }
.response-card__text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; }
.response-card__copy {
  margin-top: 0.5rem; padding: 0.3rem 0.75rem;
  font-size: 0.75rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: transparent;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
  font-family: inherit;
}
.response-card__copy:hover { color: var(--text-primary); border-color: var(--accent); }

/* ─── Risk Badge ─────────────────────────────────────────────────────────────── */
.risk-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.8rem; border-radius: var(--radius-pill);
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 0.75rem;
}
.risk-badge--low    { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.risk-badge--medium { background: rgba(245,158,11,0.15); color: var(--orange); border: 1px solid rgba(245,158,11,0.3); }
.risk-badge--high   { background: rgba(239,68,68,0.15);  color: var(--red);    border: 1px solid rgba(239,68,68,0.3); }

/* ─── Alert ──────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius-md);
  font-size: 0.9rem; display: flex; align-items: flex-start; gap: 0.5rem;
  margin-bottom: 1rem;
}
.alert--error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.3);  color: #fca5a5; }
.alert--success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: #6ee7b7; }
.alert--info    { background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.3); color: var(--accent-light); }

/* ─── Hero Section ───────────────────────────────────────────────────────────── */
.hero {
  text-align: center; padding: 6rem 1.25rem 4rem;
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(139,92,246,0.1); border: 1px solid rgba(139,92,246,0.3);
  color: var(--accent-light); border-radius: var(--radius-pill);
  padding: 0.3rem 1rem; font-size: 0.8rem; font-weight: 600;
  margin-bottom: 1.5rem; text-transform: uppercase; letter-spacing: 0.08em;
}
.hero__title { margin-bottom: 1rem; }
.hero__subtitle { max-width: 560px; margin: 0 auto 2.5rem; font-size: 1.1rem; }
.hero__cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ─── Features Grid ──────────────────────────────────────────────────────────── */
.features { padding: 4rem 0; }
.features__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.feature-card { padding: 1.5rem; }
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { margin-bottom: 0.4rem; font-size: 1rem; }

/* ─── Pricing ────────────────────────────────────────────────────────────────── */
.pricing { padding: 4rem 0; }
.pricing__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; max-width: 640px; margin: 0 auto; }
.price-card { text-align: center; padding: 2rem 1.5rem; }
.price-card--featured { border-color: rgba(139,92,246,0.4); background: var(--grad-card); }
.price-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.2rem 0.6rem; border-radius: var(--radius-pill); margin-bottom: 0.75rem; }
.price { font-size: 3rem; font-weight: 800; line-height: 1; margin: 0.75rem 0; }
.price span { font-size: 1.2rem; font-weight: 400; color: var(--text-muted); }
.price-desc { font-size: 0.9rem; margin-bottom: 1.5rem; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.footer { text-align: center; padding: 2.5rem 1.25rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }

/* ─── Section Titles ─────────────────────────────────────────────────────────── */
.section-title { margin-bottom: 2rem; text-align: center; }
.section-title h2 { margin-bottom: 0.5rem; }

/* ─── Upload Zone ────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-md);
  padding: 1rem 1.5rem; text-align: center; cursor: pointer;
  transition: var(--transition); color: var(--text-muted); font-size: 0.85rem;
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent-light); }
.upload-zone input[type="file"] { display: none; }

/* ─── History List ───────────────────────────────────────────────────────────── */
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }
.history-item {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  transition: var(--transition);
}
.history-item:hover { border-color: rgba(139,92,246,0.3); }
.history-meta { flex: 1; }
.history-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.2rem; }
.history-preview { font-size: 0.85rem; color: var(--text-secondary); }
.history-role {
  background: rgba(139,92,246,0.15); color: var(--accent-light);
  border-radius: var(--radius-pill); padding: 0.2rem 0.6rem; font-size: 0.75rem; font-weight: 700;
}

/* ─── Credits Box ────────────────────────────────────────────────────────────── */
.credits-box { text-align: center; padding: 2rem; }
.credits-number { font-size: 4rem; font-weight: 800; line-height: 1; }
.credits-label { color: var(--text-secondary); margin-top: 0.25rem; }

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }

/* ─── Char Counter ───────────────────────────────────────────────────────────── */
.char-counter { font-size: 0.75rem; color: var(--text-muted); text-align: right; margin-top: 0.25rem; }
.char-counter.warning { color: var(--orange); }
.char-counter.danger  { color: var(--red); }

/* ─── Back Button ────────────────────────────────────────────────────────────── */
.back-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  color: var(--text-muted); font-size: 0.85rem; text-decoration: none;
  transition: var(--transition); margin-bottom: 1.5rem;
}
.back-link:hover { color: var(--accent-light); }

/* ─── Divider ────────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.85rem; }
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.gap-1       { gap: 0.5rem; }
.gap-2       { gap: 1rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mt-3  { margin-top: 1.5rem; }
.mb-1  { margin-bottom: 0.5rem; }
.mb-2  { margin-bottom: 1rem; }
.mb-3  { margin-bottom: 1.5rem; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ─── Page wrapper ───────────────────────────────────────────────────────────── */
.page { min-height: calc(100vh - 60px); padding: 2rem 0 4rem; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 4rem 1.25rem 2.5rem; }
  .nav__links .btn--ghost { display: none; }
  .price { font-size: 2.5rem; }
  .features__grid, .pricing__grid { grid-template-columns: 1fr; }
  .person-toggle { flex-direction: column; }
}
