/* ===========================================================================
   wizard.css  -  HIPAA self-assessment drill wizard (front-end module)
   Adds ONLY new classes prefixed `wz-`. Reuses existing app classes
   (.card, .btn, .pill, .timer, .clock, .muted, .wrap, etc.) and global
   CSS custom properties (--ink, --brand, --ready, --partial, --notready ...).
   Light clinical navy/blue theme. Mobile responsive under ~620px.
   =========================================================================== */

/* ---- Progress bar -------------------------------------------------------- */
.wz-progress {
  height: 10px;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: 1 1 auto;
}
.wz-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}

/* progress row: track + percent label living side by side */
.wz-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 4px;
}
#progress-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--ink);
  min-width: 3.5ch;
  text-align: right;
}

/* ---- Header meta row (step label + autosave indicator) ------------------- */
.wz-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.wz-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .01em;
}

/* ---- Autosave status indicator ------------------------------------------ */
.wz-saved {
  font-size: 12.5px;
  color: var(--muted);
  opacity: 0;
  transition: opacity .3s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.wz-saved.show { opacity: 1; }
.wz-saved .wz-check {
  color: var(--ready);
  font-weight: 700;
}

/* ---- Dot stepper --------------------------------------------------------- */
.wz-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.wz-steps li {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--line);
  box-sizing: border-box;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.wz-steps li.is-done {
  background: var(--brand);
  border-color: var(--brand);
}
.wz-steps li.is-current {
  background: var(--card);
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(19, 102, 214, .18);
}

/* ---- Section + question rows -------------------------------------------- */
.wz-section { margin-top: 4px; }
.wz-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}
.wz-section-intro {
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.wz-q {
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.wz-q:first-of-type { border-top: none; padding-top: 6px; }
.wz-q-text {
  display: block;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.45;
}
.wz-q-hint {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---- 3-way segmented control (Yes / Partial / No) ----------------------- */
.wz-choice {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 460px;
}
/* visually hide the radio, keep it accessible + focusable */
.wz-choice input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.wz-choice label {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.wz-choice label:hover { border-color: var(--brand-2); color: var(--ink); }

/* keyboard focus ring follows the (hidden) radio onto its label */
.wz-choice input[type="radio"]:focus-visible + label {
  outline: none;
  box-shadow: 0 0 0 3px rgba(19, 102, 214, .25);
  border-color: var(--brand-2);
}

/*
   Selected coloring. Two parallel mechanisms so it works everywhere:
   - JS adds `.is-checked` to the chosen <label> (and clears siblings).
   - `:has(input:checked)` is progressive enhancement for modern browsers.
   Color is keyed off data-val on the label: yes/partial/no.
*/
.wz-choice label.is-checked[data-val="yes"],
.wz-choice label[data-val="yes"]:has(input:checked) {
  background: rgba(31, 138, 76, .12);
  border-color: var(--ready);
  color: var(--ready);
}
.wz-choice label.is-checked[data-val="partial"],
.wz-choice label[data-val="partial"]:has(input:checked) {
  background: rgba(184, 134, 11, .12);
  border-color: var(--partial);
  color: var(--partial);
}
.wz-choice label.is-checked[data-val="no"],
.wz-choice label[data-val="no"]:has(input:checked) {
  background: rgba(192, 57, 43, .10);
  border-color: var(--notready);
  color: var(--notready);
}

/* ---- Optional supporting evidence block --------------------------------- */
.wz-evidence {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.wz-evidence legend,
.wz-evidence .wz-evidence-title {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 12px;
  display: block;
}
.wz-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.wz-field:last-child { margin-bottom: 0; }
.wz-field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.wz-field input[type="text"],
.wz-field input[type="date"],
.wz-field input[type="file"] {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  max-width: 360px;
}
.wz-field input[type="text"]:focus,
.wz-field input[type="date"]:focus,
.wz-field input[type="file"]:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(19, 102, 214, .18);
}
.wz-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---- Nav footer ---------------------------------------------------------- */
.wz-nav {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding: 14px 0;
  background: linear-gradient(180deg, rgba(244, 247, 251, 0), var(--bg) 40%);
}
.wz-nav .wz-nav-spacer { flex: 1 1 auto; }

/* ---- Overview step ------------------------------------------------------- */
.wz-overview-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.wz-overview-list li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  line-height: 1.5;
}
.wz-overview-list li::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--brand-2);
}

/* ---- Review page rows ---------------------------------------------------- */
.wz-review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.wz-review-row:first-of-type { border-top: none; }
.wz-review-name {
  font-weight: 600;
  color: var(--ink);
  flex: 1 1 auto;
  min-width: 0;
}
.wz-review-row .pill { flex: 0 0 auto; }
.wz-jump {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
}
.wz-jump:hover { text-decoration: underline; }

/* ---- Responsive: single column under ~620px ----------------------------- */
@media (max-width: 620px) {
  .wz-choice { max-width: none; }
  .wz-field-grid { grid-template-columns: 1fr; }
  .wz-review-row { flex-wrap: wrap; }
  .wz-review-name { flex-basis: 100%; }
  .wz-meta { align-items: flex-start; }
}

/* ---- Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .wz-progress-fill,
  .wz-saved,
  .wz-steps li,
  .wz-choice label {
    transition: none;
  }
}

/* ---- "Not applicable" 4th option + applicability intake (added) ---- */
.wz-choice.has-na { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 560px) { .wz-choice.has-na { grid-template-columns: 1fr 1fr; } }
.wz-choice label.is-checked[data-val="na"],
.wz-choice label[data-val="na"]:has(input:checked) {
  background: #eef2f6; border-color: #94a3b8; color: #475569;
}
.ov { background: #f3f7fb; border: 1px solid #cfe0f0; border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
.ov h3 { margin: 0; font-size: 15px; color: var(--ink); }
.ov .lbl { display: block; font-weight: 600; font-size: 14px; color: var(--ink); margin: 14px 0 7px; }
.ov-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ov-opts label { display: inline-flex; align-items: center; border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s; }
.ov-opts label:hover { border-color: var(--brand-2); color: var(--ink); }
.ov-opts input { position: absolute; opacity: 0; width: 0; height: 0; }
.ov-opts label:has(input:checked) { border-color: var(--brand); color: var(--brand); background: #eaf3fc; }
.ov-opts input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 3px; }
.ov-note { font-size: 13px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
