/* NovaResp-aligned theme: clean clinical healthcare look — deep navy + a
   vivid medical blue accent on white, generous whitespace, modern sans-serif,
   structured (lightly rounded) elements. */
:root {
  /* Exact NovaResp brand colors, sampled from the logo (logo.svg) */
  --navy: #193068;        /* headings / primary brand (wordmark navy) */
  --navy-deep: #0f1f47;
  --blue: #3b83c4;        /* primary accent / CTA (mid brand blue) */
  --blue-bright: #60c7ef; /* bright brand cyan */
  --blue-tint: #e7f4fc;   /* selected / track fills (from the cyan) */
  --ink: #1b2742;
  --muted: #5a6b7e;
  --bg: #f4f8fc;          /* cool, near-white page */
  --card: #ffffff;
  --border: #dbe6f1;
  --ok: #1f9d6b;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(25, 48, 104, 0.08), 0 8px 24px rgba(25, 48, 104, 0.07);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Progress bar ---------- */
.progress-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 52px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-top: env(safe-area-inset-top);
}
/* A slim fill stripe along the top edge; the label sits below it on the white
   header, so the text is always navy-on-white and never overlaps the fill. */
.progress-fill {
  position: absolute;
  left: 0;
  top: env(safe-area-inset-top);
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--blue-bright));
  border-radius: 0 999px 999px 0;
  transition: width 0.45s cubic-bezier(.22, .61, .36, 1);
}
.progress-label {
  position: relative;
  z-index: 1;
  width: 100%;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: .2px;
  color: var(--navy);
}

/* ---------- Layout ---------- */
.survey {
  max-width: 600px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}
.survey-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 12px 4px 8px;
}
.survey-intro { color: var(--muted); margin: 0 4px 24px; font-size: 1rem; }

/* Info banner up top: which night the survey covers + the midnight deadline. */
.survey-meta {
  background: var(--blue-tint);
  border: 1px solid #c4e6f8;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 4px 22px;
}
.survey-meta-night { margin: 0; color: var(--navy); font-weight: 600; font-size: 0.95rem; }
.survey-meta-deadline { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; }

/* ---------- Weekly date picker ---------- */
/* The weekly link shows the week's nights; the patient taps one to report on.
   Passed nights are tappable pills; future nights are greyed and disabled. */
.date-picker { margin: 0 4px 22px; }
.date-picker-label { margin: 0 0 10px; color: var(--navy); font-weight: 600; font-size: 0.95rem; }
.date-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.date-pill {
  flex: 1 0 auto;
  min-width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.date-pill:hover { border-color: var(--blue); }
.date-pill-dow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.date-pill-day { font-size: 0.95rem; font-weight: 600; color: var(--navy); }
.date-pill.selected {
  border-color: var(--blue);
  background: var(--blue-tint);
  box-shadow: inset 0 0 0 1px var(--blue);
}
.date-pill.disabled {
  background: #f0f3f8;
  border-color: var(--border);
  cursor: not-allowed;
  opacity: 0.55;
}
.date-pill.disabled .date-pill-day { color: var(--muted); }
.date-picker-hint { color: var(--muted); font-size: 0.9rem; margin: 4px 4px 0; }
.thanks-again { margin-top: 18px; }
.thanks-again a { color: var(--blue); text-decoration: none; font-weight: 600; }
.thanks-again a:hover { text-decoration: underline; }

/* ---------- Brand logo ---------- */
.brand { display: flex; justify-content: center; margin: 4px 0 18px; }
.brand img { height: 38px; width: auto; }
.thanks .brand { margin: 0 0 24px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 8px;
  margin-bottom: 18px;
}
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--blue);
  margin: 0 0 8px;
}

.question { padding: 16px 0 20px; border-top: 1px solid #eef3f9; }
.question:first-of-type { border-top: none; }
/* Conditionally-shown questions (data-show-if-*) stay hidden until their trigger
   value is selected; survey.js toggles this class. */
.question.conditional-hidden { display: none; }
.question-label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.question-help { margin: 0 0 8px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Sliders ---------- */
.slider-wrap { padding-top: 6px; }
.slider-value {
  display: inline-block;
  background: var(--blue-tint);
  color: var(--blue);
  font-weight: 700;
  border: 1px solid #c4e6f8;
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}
.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--blue-tint);
  outline: none;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue);
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(59,131,196,.38);
  cursor: pointer;
}
.slider::-moz-range-thumb {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue);
  border: 4px solid #fff;
  box-shadow: 0 2px 8px rgba(59,131,196,.38);
  cursor: pointer;
}
.slider-ends {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 8px;
}
/* Un-touched slider: a muted "pending" state so a value is never implied
   before the patient places the thumb. Cleared on first input (see survey.js). */
.slider-unset .slider-value {
  background: #f0f3f8;
  color: var(--muted);
  border-color: var(--border);
}
.slider-unset .slider { background: #e9eef4; }
.slider-unset .slider::-webkit-slider-thumb {
  background: #fff;
  border-color: #cdd8e6;
  box-shadow: 0 1px 5px rgba(25, 48, 104, 0.15);
}
.slider-unset .slider::-moz-range-thumb {
  background: #fff;
  border-color: #cdd8e6;
  box-shadow: 0 1px 5px rgba(25, 48, 104, 0.15);
}

/* ---------- Choice & checkbox (big tap targets) ---------- */
.choices, .checks { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.choice, .check {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  min-height: 52px;
}
.choice input, .check input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.choice span, .check span { font-weight: 500; color: var(--ink); }
.choice.selected, .check.selected {
  border-color: var(--blue);
  background: var(--blue-tint);
  box-shadow: inset 0 0 0 1px var(--blue);
}

/* ---------- Notes ---------- */
.notes {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font: inherit;
  color: var(--ink);
  resize: vertical;
}
.notes:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px var(--blue-tint); }

/* ---------- Submit ---------- */
.submit-btn {
  width: 100%;
  border: none;
  background: var(--blue);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-top: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59,131,196,.30);
  transition: background .15s;
}
.submit-btn:hover { background: #336fa6; }
.submit-btn:active { background: var(--navy); }
.footnote { color: var(--muted); font-size: 0.78rem; text-align: center; margin-top: 16px; }

.question.missing .question-label { color: #c0392b; }
.question.missing .choices, .question.missing .checks { outline: 2px solid #f3c3bd; border-radius: var(--radius-sm); }
.question.missing .slider-value { background: #fdecea; color: #c0392b; border-color: #f3c3bd; }
.question.missing::after {
  content: "Please answer this to continue.";
  display: block;
  color: #c0392b;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 10px;
}

/* ---------- Thank-you / invalid pages ---------- */
.thanks {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #fff 0%, var(--bg) 100%);
}
.thanks-card {
  background: var(--card);
  max-width: 480px;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 40px 30px;
  text-align: center;
}
.thanks-card h1 { color: var(--navy); margin: 10px 0 12px; letter-spacing: -0.01em; }
.thanks-lead { font-size: 1.12rem; font-weight: 600; color: var(--ink); }
.thanks-card p { color: var(--muted); }
.thanks-sign { color: var(--navy) !important; font-weight: 600; margin-top: 18px; }

/* ---------- Legal footer (Terms / Privacy on every patient page) ---------- */
.legal-footer { text-align: center; font-size: 0.78rem; color: var(--muted); margin: 22px 0 28px; }
.legal-footer a { color: var(--blue); text-decoration: none; }
.legal-footer a:hover { text-decoration: underline; }
.legal-footer .sep { margin: 0 8px; color: var(--border); }
/* Inside the centered thank-you/invalid card, sit snug under the message. */
.thanks-card .legal-footer { margin: 24px 0 0; }
