/* ExQ™ Survey Engine Styles — 8 input types + survey chrome */

/* ── Survey layout ── */
.survey-shell {
  display: flex; flex-direction: column; min-height: 100vh;
}

/* ── Survey header ── */
.survey-header {
  background: var(--n0); border-bottom: 1px solid var(--bd);
  padding: var(--sp-4) var(--sp-8);
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: var(--sp-4); position: sticky; top: 0; z-index: 40;
}
.survey-brand { font-family: var(--font-display); font-size: .95rem; font-weight: 700; color: var(--gold-l); }
.survey-counter {
  font-size: var(--text-xs); color: var(--tx-m); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
}
.survey-counter-n {
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
  color: var(--tx); line-height: 1;
}
.survey-actions { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-2); }

/* ── Clickable kbd shortcuts ── */
.kbd-btn {
  cursor: pointer; transition: background .14s, color .14s, border-color .14s;
  border: 1px solid var(--bd);
}
.kbd-btn:hover { background: var(--gold); border-color: var(--gold-text); color: var(--n0); }
.kbd-btn:active { transform: scale(.93); }
.kbd-enter { min-width: 44px; }

/* ── Survey nav dropdown ── */
.survey-menu-wrap { position: relative; }
.survey-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--n1); border: 1px solid var(--bd); border-radius: var(--r-lg);
  padding: var(--sp-2); z-index: 200; min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.survey-dd-item {
  display: block; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  color: var(--tx); text-decoration: none; font-size: .82rem;
  transition: background .14s;
}
.survey-dd-item:hover { background: var(--cd-h); }
.survey-dd-divider { border-top: 1px solid var(--bd); margin: var(--sp-1) 0; }

/* ── Domain progress strip ── */
.domain-strip {
  background: var(--n0); border-bottom: 1px solid var(--bd);
  padding: var(--sp-3) var(--sp-8);
  display: flex; align-items: center; gap: var(--sp-4);
}
.domain-tag {
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--gold-text); flex-shrink: 0;
}
.domain-name { font-size: var(--text-sm); color: var(--tx-m); }

/* ── Question stage ── */
.q-stage {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start;
  padding: var(--sp-10) var(--sp-8) var(--sp-16);
  max-width: 780px; margin: 0 auto; width: 100%;
}

/* ── Question text ── */
.q-lens-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; padding: .2rem .6rem; border-radius: var(--r-full);
  margin-bottom: var(--sp-5);
}
.q-lens-M { background: var(--gold-p); color: var(--gold-l); }
.q-lens-E { background: var(--royal-p); color: var(--royal-l); }
.q-lens-R { background: var(--ro-p); color: var(--ro); }

/* ── Lens context callout (E/R questions) ── */
.lens-ctx {
  font-size: .8rem; line-height: 1.6; text-align: center;
  border-radius: 10px; padding: .55rem 1.2rem;
  margin-bottom: var(--sp-6); max-width: 560px;
}
.lens-ctx-e {
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.25);
  color: #4338CA;
}
.lens-ctx-r {
  background: rgba(225,29,72,.08); border: 1px solid rgba(225,29,72,.2);
  color: #B91C1C;
}

.q-text {
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  line-height: 1.6; color: var(--tx); font-weight: 500;
  text-align: center; text-wrap: balance; margin-bottom: var(--sp-10);
  max-width: 680px;
}

/* ── Input: Rating (1-5 stars) ── */
.input-rating { display: flex; gap: var(--sp-3); justify-content: center; }
.star-btn {
  font-size: 2.4rem; background: none; border: none; cursor: pointer;
  color: var(--tx-d); transition: color var(--dur-fast), transform var(--dur-fast);
  padding: var(--sp-2); border-radius: var(--r-sm);
  line-height: 1;
}
.star-btn:hover, .star-btn.lit { color: var(--gold-l); }
.star-btn.lit { transform: scale(1.1); }
.star-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Input: NPS (0-10) ── */
.input-nps { width: 100%; }
.nps-scale { display: flex; gap: var(--sp-1); justify-content: center; flex-wrap: wrap; }
.nps-btn {
  width: 52px; height: 52px; border-radius: var(--r);
  font-size: var(--text-base); font-weight: 600;
  border: 2px solid var(--bd); background: var(--cd);
  color: var(--tx-m); cursor: pointer;
  transition: all var(--dur);
}
.nps-btn:hover { background: var(--cd-h); border-color: rgba(255,255,255,.15); color: var(--tx); }
.nps-btn.selected-detractor { border-color: var(--ro); background: var(--ro-p); color: var(--ro); }
.nps-btn.selected-passive   { border-color: var(--am); background: var(--am-p); color: var(--am); }
.nps-btn.selected-promoter  { border-color: var(--em); background: var(--em-p); color: var(--em); }
.nps-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nps-labels {
  display: flex; justify-content: space-between; margin-top: var(--sp-3);
  font-size: var(--text-xs); color: var(--tx-d);
}
.nps-zones {
  display: flex; gap: var(--sp-2); justify-content: center; margin-top: var(--sp-3);
}
.nps-zone {
  font-size: var(--text-xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; padding: .15rem .5rem; border-radius: var(--r-full);
}
.zone-d { background: var(--ro-p);  color: var(--ro); }
.zone-p { background: var(--am-p);  color: var(--am); }
.zone-pr{ background: var(--em-p);  color: var(--em); }

/* ── Input: CSAT (1-10 emoji) ── */
.input-csat { width: 100%; }
.csat-scale { display: flex; gap: 0; border: 1px solid var(--bd); border-radius: var(--r-lg); overflow: hidden; }
.csat-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  padding: var(--sp-3) var(--sp-1); cursor: pointer; background: var(--cd);
  border: none; border-left: 1px solid var(--bd); color: var(--tx-m);
  transition: background var(--dur), color var(--dur);
  min-width: 0;
}
.csat-btn:first-child { border-left: none; }
.csat-btn .csat-emoji { font-size: 1.4rem; margin-bottom: .2rem; }
.csat-btn .csat-n { font-size: var(--text-xs); font-weight: 700; color: var(--tx-d); }
.csat-btn:hover { background: var(--cd-h); }
.csat-btn.selected { background: var(--gold-p); color: var(--gold-l); }
.csat-btn.selected .csat-n { color: var(--gold-text); }
.csat-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.csat-labels { display: flex; justify-content: space-between; margin-top: var(--sp-3); font-size: var(--text-xs); color: var(--tx-d); }

/* ── Input: CES (1-7 effort) ── */
.input-ces { width: 100%; }
.ces-scale { display: flex; gap: var(--sp-2); justify-content: center; }
.ces-btn {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-1);
  background: var(--cd); border: 2px solid var(--bd);
  border-radius: var(--r); padding: var(--sp-3) var(--sp-4);
  cursor: pointer; transition: all var(--dur); color: var(--tx-m); flex: 1;
  max-width: 80px;
}
.ces-btn-n { font-size: var(--text-lg); font-weight: 700; line-height: 1; }
.ces-btn-l { font-size: .6rem; text-align: center; line-height: 1.3; }
.ces-btn:hover { background: var(--cd-h); border-color: rgba(255,255,255,.15); color: var(--tx); }
.ces-btn.selected { border-color: var(--royal); background: var(--royal-p); color: var(--royal-l); }
.ces-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Input: Likert (1-5 with context labels) ── */
.input-likert { width: 100%; }
.likert-scale { display: flex; flex-direction: column; gap: var(--sp-2); }
.likert-btn {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--cd); border: 2px solid var(--bd); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5); cursor: pointer; text-align: left;
  transition: all var(--dur); color: var(--tx-m); width: 100%;
}
.likert-num {
  font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700;
  color: var(--tx-d); flex-shrink: 0; width: 28px; text-align: center;
  transition: color var(--dur);
}
.likert-label { font-size: var(--text-base); flex: 1; transition: color var(--dur); }
.likert-btn:hover { background: var(--cd-h); border-color: rgba(255,255,255,.15); color: var(--tx); }
.likert-btn:hover .likert-num { color: var(--gold-text); }
.likert-btn.selected { border-color: var(--gold-text); background: var(--gold-p); color: var(--tx); }
.likert-btn.selected .likert-num { color: var(--gold-l); }
.likert-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Input: Maturity 1-7 (special Likert for maturity lens) ── */
.maturity-scale { display: flex; flex-direction: column; gap: var(--sp-2); }
.maturity-btn {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--cd); border: 2px solid var(--bd); border-radius: var(--r-lg);
  padding: var(--sp-3) var(--sp-5); cursor: pointer; text-align: left;
  transition: all var(--dur); color: var(--tx-m); width: 100%;
}
.mat-level {
  font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700;
  width: 24px; text-align: center; flex-shrink: 0; color: var(--tx-d);
}
.mat-name { font-size: var(--text-base); font-weight: 600; flex-shrink: 0; min-width: 110px; }
.mat-desc { font-size: var(--text-sm); color: var(--tx-m); line-height: 1.4; }
.maturity-btn:hover { background: var(--cd-h); border-color: rgba(255,255,255,.15); }
.maturity-btn:hover .mat-level { color: var(--gold-text); }
.maturity-btn.selected { border-color: var(--gold-text); background: var(--gold-p); }
.maturity-btn.selected .mat-level { color: var(--gold-l); }
.maturity-btn.selected .mat-name { color: var(--gold-l); }
.maturity-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Level-specific accent lines */
.maturity-btn[data-v="1"].selected { border-color: var(--ro);  background: var(--ro-p);  }
.maturity-btn[data-v="2"].selected { border-color: var(--ro);  background: var(--ro-p);  }
.maturity-btn[data-v="3"].selected { border-color: var(--am);  background: var(--am-p);  }
.maturity-btn[data-v="4"].selected { border-color: var(--am);  background: var(--am-p);  }
.maturity-btn[data-v="5"].selected { border-color: var(--em);  background: var(--em-p);  }
.maturity-btn[data-v="6"].selected { border-color: var(--em);  background: var(--em-p);  }
.maturity-btn[data-v="7"].selected { border-color: var(--gold-text);background: var(--gold-p); }

/* ── Input: Binary (Yes/No) ── */
.input-binary { display: flex; gap: var(--sp-4); justify-content: center; }
.binary-btn {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  background: var(--cd); border: 2px solid var(--bd); border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-12); cursor: pointer;
  transition: all var(--dur); color: var(--tx-m); min-width: 140px;
}
.binary-icon { font-size: 2.4rem; }
.binary-label { font-size: var(--text-lg); font-weight: 700; }
.binary-key { font-size: var(--text-xs); color: var(--tx-d); margin-top: var(--sp-1); }
.binary-btn.yes:hover { border-color: var(--em); background: var(--em-p); color: var(--em); }
.binary-btn.no:hover  { border-color: var(--ro); background: var(--ro-p); color: var(--ro); }
.binary-btn.yes.selected { border-color: var(--em); background: var(--em-p); color: var(--em); }
.binary-btn.no.selected  { border-color: var(--ro); background: var(--ro-p); color: var(--ro); }
.binary-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Input: MCQ ── */
.input-mcq { width: 100%; }
.mcq-options { display: flex; flex-direction: column; gap: var(--sp-2); }
.mcq-btn {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--cd); border: 2px solid var(--bd); border-radius: var(--r-lg);
  padding: var(--sp-4) var(--sp-5); cursor: pointer; text-align: left;
  transition: all var(--dur); color: var(--tx-m); width: 100%;
}
.mcq-letter {
  width: 28px; height: 28px; border-radius: var(--r-sm); flex-shrink: 0;
  background: var(--n3); border: 1px solid var(--bd);
  font-size: var(--text-xs); font-weight: 800; display: flex;
  align-items: center; justify-content: center; color: var(--tx-d);
  transition: all var(--dur);
}
.mcq-text { font-size: var(--text-base); }
.mcq-btn:hover { background: var(--cd-h); border-color: rgba(255,255,255,.15); color: var(--tx); }
.mcq-btn.selected { border-color: var(--royal); background: var(--royal-p); color: var(--tx); }
.mcq-btn.selected .mcq-letter { background: var(--royal); color: white; border-color: var(--royal); }
.mcq-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ── Input: Open Text ── */
.input-text { width: 100%; }
.text-area {
  width: 100%; background: var(--cd); border: 2px solid var(--bd);
  border-radius: var(--r-lg); color: var(--tx);
  font-family: var(--font-body); font-size: var(--text-base);
  padding: var(--sp-4) var(--sp-5); resize: vertical; min-height: 140px;
  transition: border-color var(--dur);
  line-height: 1.65;
}
.text-area::placeholder { color: var(--tx-d); }
.text-area:focus { outline: none; border-color: var(--royal); background: var(--cd-h); }
.text-counter {
  display: flex; justify-content: flex-end; margin-top: var(--sp-2);
  font-size: var(--text-xs); color: var(--tx-d);
}
.text-counter.warn { color: var(--am); }

/* ── Navigation bar ── */
.survey-nav {
  position: sticky; bottom: 0; background: var(--n0);
  border-top: 1px solid var(--bd); padding: var(--sp-4) var(--sp-8);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); z-index: 30;
}
.survey-nav-center {
  display: flex; align-items: center; gap: var(--sp-3); font-size: var(--text-xs); color: var(--tx-d);
}

/* ── Keyboard hint strip ── */
.kbd-hints {
  display: flex; gap: var(--sp-4); justify-content: center;
  flex-wrap: wrap; padding: var(--sp-3) var(--sp-8);
  background: var(--n0); border-top: 1px solid var(--bd);
  font-size: var(--text-xs); color: var(--tx-d);
}
.kbd-hint { display: flex; align-items: center; gap: var(--sp-2); }

/* ── Review modal table ── */
.review-list { display: flex; flex-direction: column; gap: var(--sp-3); max-height: 60vh; overflow-y: auto; }
.review-item {
  display: grid; grid-template-columns: auto 1fr auto;
  gap: var(--sp-3); align-items: center;
  background: var(--cd); border-radius: var(--r); padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
}
.review-num { font-family: var(--font-display); font-weight: 700; color: var(--tx-d); font-size: var(--text-xs); }
.review-q { color: var(--tx-m); }
.review-a { font-weight: 700; color: var(--gold-l); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .survey-header { grid-template-columns: 1fr auto; }
  .survey-brand { display: none; }
  .q-stage { padding: var(--sp-6) var(--sp-4) var(--sp-12); }
  .ces-scale { flex-wrap: wrap; }
  .binary-btn { min-width: 120px; padding: var(--sp-6) var(--sp-8); }
  .survey-nav { padding: var(--sp-3) var(--sp-4); }
  .kbd-hints { display: none; }
  .csat-scale { overflow-x: auto; }
}

/* ─────────────────────────────────────────
   QBank loading animation
   ───────────────────────────────────────── */
.qload-screen {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 3rem 2rem; gap: 2rem;
  width: 100%; max-width: 400px; margin: 2rem auto;
}

/* Spinner ring */
.qload-spinner {
  position: relative; width: 72px; height: 72px; flex-shrink: 0;
}
.qload-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2.5px solid transparent;
  border-top-color: var(--gold-text);
  animation: qload-spin 1.1s linear infinite;
}
.qload-ring-2 {
  inset: 11px;
  border-top-color: rgba(200,146,58,.28);
  animation-duration: .72s;
  animation-direction: reverse;
}
@keyframes qload-spin { to { transform: rotate(360deg); } }

.qload-center-icon {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
}

/* Heading */
.qload-heading { text-align: center; }
.qload-heading-main {
  font-size: 1.05rem; font-weight: 700; color: var(--tx); margin-bottom: .3rem;
}
.qload-heading-sub {
  font-size: .78rem; color: var(--tx-d);
  transition: opacity .3s;
}

/* Step list */
.qload-steps {
  display: flex; flex-direction: column;
  gap: .55rem; width: 100%; max-width: 300px;
}
.ql-step {
  display: flex; align-items: center; gap: .65rem;
  font-size: .8rem; color: var(--tx-d);
  transition: color .3s;
}
.ql-step.ql-done { color: var(--gold-l); }
.ql-step.ql-active { color: var(--tx); font-weight: 600; }

.ql-step-dot {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 1.5px solid var(--bd);
  display: flex; align-items: center; justify-content: center;
  font-size: .6rem; transition: all .3s;
}
.ql-step.ql-done .ql-step-dot {
  background: var(--gold-p); border-color: var(--gold-b);
  color: var(--gold-l); font-size: .75rem; font-weight: 700;
}
.ql-step.ql-active .ql-step-dot {
  background: var(--n3); border-color: var(--gold-b);
}
.ql-step.ql-active .ql-step-dot::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: ql-dot-pulse 1s ease-in-out infinite alternate;
}
@keyframes ql-dot-pulse {
  from { opacity: .35; transform: scale(.6); }
  to   { opacity: 1;   transform: scale(1);  }
}

/* Progress bar */
.qload-bar-wrap {
  width: 100%; max-width: 240px;
  height: 2px; background: var(--bd); border-radius: 999px; overflow: hidden;
}
.qload-bar-inner {
  height: 100%; background: var(--gold); border-radius: 999px;
  width: 0%; transition: width .5s ease;
}

/* ── Error state (replaces loading screen on failure) ── */
.qload-error {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 3.5rem 2rem; gap: .75rem;
  max-width: 380px; margin: 0 auto;
}
.qload-error-icon {
  font-size: 2.2rem; color: var(--ro); margin-bottom: .25rem;
}
.qload-error-title {
  font-size: 1rem; font-weight: 700; color: var(--ro);
}
.qload-error-sub {
  font-size: .82rem; color: var(--tx-m); line-height: 1.6;
}

/* ── Question slide-in animation ── */
@keyframes q-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.q-stage.q-enter {
  animation: q-enter .24s ease forwards;
}

/* ── Phase banner (accreditation mode) ── */
.phase-banner {
  display: flex; align-items: center; gap: .75rem;
  background: var(--n2); border: 1px solid var(--bd);
  border-left: 3px solid var(--gold); border-radius: var(--r-lg);
  padding: .7rem 1.2rem; margin-bottom: var(--sp-6); width: 100%;
}
.phase-banner-pill {
  font-size: .62rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: .1em; color: var(--gold-text); background: var(--gold-p);
  padding: .15rem .55rem; border-radius: var(--r-full); flex-shrink: 0;
}
.phase-banner-name { font-weight: 700; font-size: .88rem; color: var(--tx); }
.phase-banner-desc { font-size: .72rem; color: var(--tx-d); }
