/* Interview Ready - candidate PWA styles. Mobile-first, card-styled. */
:root {
  /* The Appointment Firm brand kit - all overridable at runtime by the admin
     Brand page (applyBranding() sets these from /api/reference). */
  --accent: #D8327C;      /* one per view */
  --accent-ink: #1e232b;  /* headings / brand text */
  --ground: #FAFAFA;
  --bg: #FAFAFA;
  --card: #FFFFFF;
  --ink: #1e232b;
  --muted: #666666;
  --line: #cccccc;
  --warm: #cab6a1;
  --warm-tint: #e0dad2;
  --ok: #16A34A;
  --err: #DC2626;
  --bg-landing: #1e232b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(30, 35, 43, 0.08);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-heading: 'League Spartan', var(--font);
  --font-body: 'Montserrat', var(--font);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand, .qtext { font-family: var(--font-heading); letter-spacing: -0.01em; }
#app { min-height: 100vh; }

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
  min-height: 100vh;
}
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Landing ---- */
.landing {
  background: var(--bg-landing);
  color: #fff; gap: 6px;
}
.landing .logo {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center; font-size: 30px; margin: 10px 0 30px;
  background: var(--accent);
  box-shadow: 0 12px 30px rgba(216, 50, 124, 0.4);
}
.landing .logo-img { width: 140px; max-width: 74%; height: auto; padding: 18px; margin: 10px 0 34px; }
.landing .product { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; margin: 0 0 2px; color: #fff; }
.landing h1 { font-size: 30px; margin: 8px 0 2px; letter-spacing: -0.5px; }
.landing .tagline { color: rgba(255, 255, 255, 0.6); margin: 0 0 26px; }
.code-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 10px; }
.code-form label { text-align: left; font-size: 13px; color: #CBD5E1; }
.code-form input {
  width: 100%; padding: 15px 16px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 18px; text-align: center;
  letter-spacing: 2px; text-transform: uppercase;
}
.code-form input:focus { outline: none; border-color: var(--accent); }
.landing .fine { color: #64748B; font-size: 12px; margin-top: 20px; max-width: 320px; }
/* The register form reuses .code-form layout but its name/email fields are
   ordinary text - undo the code-entry uppercase/spacing/centering. */
.reg-form input { text-transform: none; letter-spacing: normal; text-align: left; font-size: 16px; }
.reg-form select {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 16px; appearance: none; cursor: pointer;
}
.reg-form select:focus { outline: none; border-color: var(--accent); }
.reg-form select option { color: #111; }
.code-badge {
  font-family: var(--font); font-weight: 700; font-size: 26px; letter-spacing: 3px;
  color: #fff; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px; padding: 16px 22px; margin-top: 4px;
}
.landing .err { color: #FCA5A5; font-size: 13px; }

/* ---- Buttons ---- */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 13px 18px; border-radius: 14px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 9px 13px; font-size: 13px; border-radius: 11px; }
.btn:disabled { opacity: 0.6; }

/* ---- Top bar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 2px 14px;
}
.topbar .icon-btn { flex: none; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.4px; color: var(--accent-ink); }
.home .topbar { align-items: flex-start; }
.home-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; flex: 1 1 auto; min-width: 0; max-width: 100%; }
.topbar-logo { max-width: 100%; height: auto; display: block; }
/* Placeholder shown until a logo is uploaded on the Brand page — sized by the same slider. */
.topbar-logo-ph {
  max-width: 100%; height: 60px; box-sizing: border-box; padding: 0 12px;
  border: 2px dashed var(--line); border-radius: 12px;
  display: grid; place-items: center; background: rgba(0, 0, 0, 0.015);
  color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
}
.topbar-product { font-family: var(--font-heading); font-weight: 700; font-size: 16px; color: var(--ink); }
.home-credit { text-align: center; color: var(--muted); font-size: 12px; margin-top: 22px; }
.brand.small { font-size: 15px; color: var(--ink); font-weight: 700; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
  background: #fff; font-size: 20px; cursor: pointer; color: var(--ink);
}

/* ---- Home ---- */
.hero h2 { font-size: 24px; margin: 6px 0 4px; letter-spacing: -0.4px; }
.hero .sub { color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.seniority-row {
  display: flex; align-items: center; gap: 12px; margin-bottom: 6px;
  background: #fff; border: 2px solid var(--accent); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 6px 18px rgba(216, 50, 124, 0.14);
}
.seniority-row .label { font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.seniority-select {
  flex: 1; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 15px; font-weight: 600; color: var(--ink);
}
/* Draw the eye to the level picker until the candidate chooses one. */
.seniority-row.needs-choice { animation: levelPulse 1.8s ease-in-out infinite; }
@keyframes levelPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(216, 50, 124, 0.14); }
  50%      { box-shadow: 0 6px 24px rgba(216, 50, 124, 0.42); }
}
.filters, .topics { margin-top: 20px; }
.filter-head { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip.on { background: var(--accent); color: #fff; border-color: transparent; }
/* Single column - this is a phone-first PWA; full-width tiles are easier to tap. */
.topic-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.topic-tile {
  text-align: left; border: 1px solid var(--line); background: #fff; cursor: pointer;
  border-radius: var(--radius); padding: 14px; display: flex; align-items: center; gap: 12px;
  border-left: 4px solid var(--accent); box-shadow: var(--shadow);
  transition: border-color 0.12s ease, background 0.12s ease;
}
.topic-tile.selected { border-color: var(--accent); background: var(--warm-tint); }
.topic-check {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff; background: transparent;
}
.topic-tile.selected .topic-check { background: var(--accent); border-color: var(--accent); }
.topic-body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-width: 0; }
.topic-name { font-weight: 700; font-size: 15px; }
.topic-tag { font-size: 12px; color: var(--muted); line-height: 1.3; }
/* Live question count for the topic at the current level + difficulty. */
.topic-count { flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.05; padding-left: 6px; }
.topic-count b { font-size: 19px; font-weight: 800; color: var(--ink); }
.topic-count small { font-size: 9.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.3px; }
.topic-tile.noq { opacity: 0.6; }
.topic-tile.noq .topic-count b { color: var(--muted); }
.muted-sm { font-size: 11px; font-weight: 500; color: var(--muted); text-transform: none; letter-spacing: 0; margin-left: 6px; }
.home-actions { margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }

/* ---- Deck ---- */
.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12px; color: var(--muted); }
.progress .bar { flex: 1; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--accent); transition: width 0.25s ease; }

.qcard {
  background: var(--card); border-radius: var(--radius); padding: 20px 20px 18px;
  box-shadow: var(--shadow); border-top: 4px solid var(--topic, var(--accent));
}
/* The meta pills are supporting context — kept small and muted so the question
   leads. */
.qcard-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; background: #F0EEEA; color: var(--muted); }
.pill.soft { background: #F0EEEA; color: var(--muted); }
.pill.fw { cursor: pointer; background: #F0EEEA; color: var(--muted); border: 1px solid var(--line); letter-spacing: 0.5px; }
.bm { margin-left: auto; border: none; background: none; font-size: 22px; cursor: pointer; color: var(--light-grey, #cbb); line-height: 1; }
.bm.on { color: var(--accent); }
/* The question is the hero of the card: larger, darker, with room to breathe. */
.qtext { font-size: 25px; line-height: 1.32; margin: 6px 0 16px; letter-spacing: -0.3px; color: var(--ink); font-weight: 700; }
.timebox { display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0 0 18px; }
.followups { margin: 4px 0 16px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; background: #FBFAF8; }
.followups-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 6px; }
.followups ul { margin: 0; padding-left: 18px; }
.followups li { font-size: 14px; line-height: 1.5; color: var(--ink); margin-bottom: 3px; }

.card-secs { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.card-sec { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sec-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: #FAFAFA; border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
}
.sec-title { text-align: left; }
/* Plain grey expand controls — deliberately understated so they don't compete
   with the question. */
.toggle-circle {
  width: 22px; height: 22px; border-radius: 50%; background: transparent; color: var(--muted);
  border: 1.5px solid var(--line);
  display: grid; place-items: center; font-size: 15px; font-weight: 700; flex: none;
}
.card-sec.open .sec-toggle { color: var(--ink); }
.sec-body { padding: 0 14px 14px; font-size: 14px; line-height: 1.5; color: #3f434a; }

.answer { margin-bottom: 12px; }
.answer label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); }
.answer textarea, .modal textarea {
  width: 100%; margin-top: 6px; padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  font-family: var(--font); font-size: 15px; line-height: 1.5; resize: vertical; color: var(--ink);
}
.answer textarea:focus, .modal textarea:focus { outline: none; border-color: var(--accent); }
.answer-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.save-state { font-size: 13px; color: var(--muted); }
.save-state.ok { color: var(--ok); }
.save-state.err { color: var(--err); }

.card-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.card-foot .spacer { flex: 1; }

/* ---- Empty / done ---- */
.empty { text-align: center; padding: 48px 20px; }
.empty-emoji { font-size: 44px; }
.empty h3 { margin: 10px 0 6px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 320px; margin: 0 auto 18px; }

/* ---- My Answers ---- */
.answer-list { display: flex; flex-direction: column; gap: 10px; }
.answer-row {
  text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; cursor: pointer; box-shadow: var(--shadow);
}
.ar-q { font-weight: 600; font-size: 15px; line-height: 1.35; }
.ar-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---- Modal ---- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50; padding: 0;
}
.modal {
  background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow);
}
.modal h3 { margin: 0 0 12px; }
.modal p { color: var(--muted); font-size: 14px; }
.modal .btn.block { margin-top: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.err { color: var(--err); }

@media (min-width: 620px) {
  .modal-wrap { align-items: center; }
  .modal { border-radius: 22px; margin: 0 16px; }
}
