/* Assessment page — AESOP AI Academy dark theme */

/* ── TOKENS ────────────────────────────────────────────────────────── */
:root {
  --bg:         #080e16;
  --surface:    #0d1520;
  --surface2:   #111c28;
  --border:     #1a2738;
  --border-mid: rgba(255,255,255,0.07);
  --text:       #e8e3db;
  --text-mid:   #a89f93;
  --text-muted: #6e6861;
  --gold:       #c9a05a;
  --gold-dim:   rgba(201,160,90,0.35);
  --gold-faint: rgba(201,160,90,0.10);
  --teal:       #2ba898;
  --teal-dark:  #1e7d75;
  --teal-faint: rgba(43,168,152,0.12);
  --topbar-h:   48px;
  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-sans:  'Nunito Sans', system-ui, sans-serif;
}

/* ── RESET / BASE ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── TOPBAR ─────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: rgba(4,8,15,0.97);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.9rem;
  z-index: 200;
  backdrop-filter: blur(10px);
}

.topbar-back {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  text-decoration: none;
  transition: color 0.15s;
  flex-shrink: 0;
}
.topbar-back:hover { color: var(--gold); }

.topbar-version {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  flex-shrink: 0;
}

.topbar-sep {
  width: 1px;
  height: 14px;
  background: var(--border);
  flex-shrink: 0;
}

.topbar-title {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--gold-faint);
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── LAYOUT ─────────────────────────────────────────────────────────── */
main { padding-top: 0; }

.assessment-wrapper {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 5rem;
}

/* ── INTRO CARD ─────────────────────────────────────────────────────── */
.assessment-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.assessment-intro h2 {
  font-family: var(--font-serif);
  color: var(--text);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.65rem;
}

.assessment-intro p {
  font-family: var(--font-serif);
  color: var(--text-mid);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 0;
}

.assessment-intro .duration-note {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.35rem 1rem;
  background: var(--gold-faint);
  border: 1px solid var(--gold-dim);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
}

/* ── CHAT CONTAINER ─────────────────────────────────────────────────── */
.assessment-chat-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 460px;
}

.assessment-chat-header {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.assessment-chat-header .dot {
  width: 7px;
  height: 7px;
  background: var(--teal);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── MESSAGES ───────────────────────────────────────────────────────── */
.assessment-messages {
  flex: 1;
  min-height: 320px;
  max-height: 520px;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.assessment-msg {
  max-width: 85%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.65;
}

.assessment-msg.ai {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-mid);
}

.assessment-msg.user {
  align-self: flex-end;
  background: var(--teal-faint);
  border: 1px solid rgba(43,168,152,0.25);
  color: var(--text);
}

.assessment-msg.thinking {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

.assessment-msg.error {
  align-self: flex-start;
  background: rgba(220,38,38,0.06);
  border: 1px solid rgba(220,38,38,0.2);
  color: #f87171;
  font-size: 0.82rem;
}

/* ── INPUT AREA ─────────────────────────────────────────────────────── */
.assessment-input-area {
  padding: 1rem 1.25rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.6rem;
  align-items: flex-end;
}

#assessment-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
  resize: none;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.15s;
}

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

#assessment-input:focus {
  outline: none;
  border-color: rgba(43,168,152,0.5);
}

#assessment-send {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

#assessment-send:hover { background: var(--teal-dark); }
#assessment-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── PROGRESS INDICATOR ─────────────────────────────────────────────── */
.assessment-progress {
  padding: 0.5rem 1.25rem;
  background: var(--surface2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.assessment-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.assessment-progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

.assessment-progress-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── COMPLETION CARD ─────────────────────────────────────────────────── */
.assessment-complete {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem 2rem;
  margin-top: 1.5rem;
  text-align: center;
}

.assessment-complete.visible { display: block; }

.assessment-complete h3 {
  font-family: var(--font-serif);
  color: var(--text);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.assessment-complete .complete-sub {
  font-family: var(--font-serif);
  color: var(--text-mid);
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

/* QR code display */
.qr-display {
  display: inline-block;
  padding: 1rem;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 8px;
  margin: 1rem auto;
}

.qr-display img {
  display: block;
  width: 200px;
  height: 200px;
}

.qr-instructions {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Recovery info */
.recovery-info {
  background: var(--gold-faint);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  text-align: left;
}

.recovery-info p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-mid);
  line-height: 1.65;
}

.recovery-info code {
  background: var(--surface2);
  color: var(--teal);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8rem;
  word-break: break-all;
}

/* CTA buttons */
.assessment-cta-row {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-primary:hover { background: var(--teal-dark); }

.btn-secondary {
  display: inline-block;
  padding: 0.7rem 1.6rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.site-footer a { color: var(--gold-dim); text-decoration: none; }
.site-footer a:hover { color: var(--gold); }

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .assessment-wrapper { padding: 1.5rem 0.85rem 3rem; }
  .assessment-messages { max-height: 380px; }
  .assessment-msg { max-width: 95%; }
  .assessment-cta-row { flex-direction: column; align-items: center; }
  .btn-primary, .btn-secondary { width: 100%; max-width: 280px; text-align: center; }
}
