/* Child history form (accounts/_intake_body.html).
   Built from the booking dialog's own pieces: .res-question labels, .res-radio-option
   pills, .res-q-error message, .form-input fields, .button, and its radii
   (0.6 / 0.7 / 0.85rem, 999px pills) and teal tints. */

.ik-page { max-width: 980px; margin-inline: auto; }
.ik-intro { color: var(--muted); font-size: 0.9rem; line-height: 1.9; margin: 0 0 1rem; }
.ik-card {
  padding: 1.25rem; border-radius: 1.25rem; border: 1px solid rgba(37, 145, 147, 0.09);
  background: linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  box-shadow: 0 18px 40px rgba(33, 50, 58, 0.08);
}

/* Layout: section list on the right (RTL start), one section on the left */
.ik { display: flex; gap: 1.25rem; height: min(560px, 68vh); }
.ik-nav { flex: 0 0 11rem; display: flex; flex-direction: column; gap: 0.3rem; overflow-y: auto; }
.ik-nav-title { margin: 0 0 0.4rem; font-size: 0.88rem; font-weight: 700; color: var(--accent-strong); }
.ik-nav-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.55rem 0.7rem; border: 1.5px solid transparent; border-radius: 0.85rem;
  background: transparent; font: inherit; font-size: 0.88rem; color: var(--text);
  text-align: start; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.ik-nav-item:hover { background: rgba(37, 145, 147, 0.04); }
.ik-nav-item.active { border-color: var(--accent-strong); background: rgba(37, 145, 147, 0.04); font-weight: 600; }
.ik-nav-num {
  flex: 0 0 1.5rem; height: 1.5rem; display: grid; place-items: center;
  border-radius: 50%; background: rgba(30, 30, 30, 0.07); font-size: 0.75rem; font-weight: 600;
}
.ik-nav-item.done .ik-nav-num { background: var(--accent-strong); color: #fff; }
.ik-nav-item.missing .ik-nav-num { background: rgba(180, 40, 40, 0.1); color: var(--danger); }
.ik-nav-text { flex: 1; }
.ik-nav-check { opacity: 0; color: var(--accent-strong); }
.ik-nav-item.done .ik-nav-check { opacity: 1; }

.ik-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; padding-inline-end: 0.15rem; }
.ik-section { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; align-content: start; padding-bottom: 0.5rem; }
.ik-section[hidden] { display: none; }
.ik-section-title { grid-column: 1 / -1; margin: 0; font-size: 1.05rem; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; }
.ik-count { font-size: 0.8rem; font-weight: 400; color: var(--muted); }

/* One question: same rhythm as .res-question */
.ik-q { grid-column: 1 / -1; display: grid; gap: 0.45rem; align-content: start; }
.ik-q-half { grid-column: auto; }
.ik-q[hidden], .ik-detail[hidden] { display: none; }
.ik-label { font-size: 0.88rem; font-weight: 600; color: var(--text); line-height: 1.8; }
.ik-hint { font-size: 0.8rem; font-weight: 400; font-style: normal; color: var(--muted); }
.ik-sublabel { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; }
.ik-detail { margin-top: 0.1rem; }

/* Unanswered: only the label and the pills' border turn red, like .res-question.missing */
.ik-q.missing .ik-label { color: var(--danger); }
.ik-q.missing .ik-opt span { border-color: rgba(180, 40, 40, 0.45); }

/* Answer pills = .res-radio-option */
.ik-opts { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.ik-opt { position: relative; }
.ik-opt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.ik-opt span {
  display: inline-flex; align-items: center; padding: 0.3rem 0.7rem; border-radius: 999px;
  border: 1px solid rgba(37, 145, 147, 0.2); background: #fff; font-size: 0.82rem;
  transition: background 0.12s, border-color 0.12s;
}
.ik-opt input:checked + span { background: rgba(37, 145, 147, 0.1); border-color: var(--accent-strong); color: var(--accent-strong); font-weight: 600; }
.ik-opt input:focus-visible + span { outline: 2px solid var(--accent-strong); outline-offset: 2px; }
.ik-count-input { width: 5rem; min-height: 2.2rem; padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.ik-sib { display: grid; grid-template-columns: 1.3fr 0.6fr 0.8fr 1.6fr; gap: 0.4rem; }
.ik-sib-head { font-size: 0.78rem; color: var(--muted); }

/* Message above the section = .res-q-error */
.ik-status {
  position: sticky; top: 0; z-index: 2; margin-bottom: 0.9rem;
  font-size: 0.83rem; line-height: 1.7; color: var(--danger);
  background: #fbeeee; border: 1px solid rgba(180, 40, 40, 0.15);
  border-radius: 0.6rem; padding: 0.6rem 0.85rem;
}

/* Buttons = .res-footer */
.ik-actions {
  position: sticky; bottom: 0; margin-top: auto; padding: 0.9rem 0 0;
  display: flex; gap: 0.75rem; justify-content: space-between;
  border-top: 1px solid rgba(37, 145, 147, 0.07); background: #fbfaf7;
}
.ik-actions .button { min-width: 8rem; }
.ik-choose { padding: 1.5rem; }

/* Inside the booking dialog: a fixed-height window, the form fills it and
   scrolls inside so the dialog never scrolls. */
.res-dialog.res-dialog-wide { width: min(880px, 100%); height: min(680px, calc(100vh - 5rem)); height: min(680px, calc(100dvh - 5rem)); max-height: none; }
.res-dialog-wide .res-box { height: 100%; max-height: none; overflow: hidden; }
.res-dialog-wide .res-header { display: none; }
.res-dialog-wide #res-s2 { flex: 1; min-height: 0; padding: 1.25rem 1.5rem 1rem; display: flex; flex-direction: column; gap: 0; }
.res-dialog-wide #res-intake { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.res-dialog-wide #res-intake .res-title { margin: 0 0 0.9rem; }
.res-dialog-wide #res-intake-body { flex: 1; min-height: 0; }
.res-dialog-wide .ik { height: 100%; min-height: 0; }

@media (max-width: 720px) {
  .ik { flex-direction: column; height: calc(100vh - 11rem); height: calc(100dvh - 11rem); min-height: 420px; gap: 0.75rem; }
  .ik-nav { flex: 0 0 auto; flex-direction: row; gap: 0.4rem; overflow-x: auto; overflow-y: hidden; padding-bottom: 0.2rem; scrollbar-width: none; }
  .ik-nav::-webkit-scrollbar { display: none; }
  .ik-nav-title, .ik-nav-check { display: none; }
  .ik-nav-item { width: auto; flex: 0 0 auto; padding: 0.3rem 0.7rem 0.3rem 0.5rem; border-radius: 999px; border-width: 1px; border-color: rgba(37, 145, 147, 0.2); background: #fff; white-space: nowrap; font-size: 0.82rem; }
  .ik-nav-item.active { background: rgba(37, 145, 147, 0.1); border-color: var(--accent-strong); color: var(--accent-strong); }
  .ik-nav-num { flex-basis: 1.3rem; height: 1.3rem; font-size: 0.7rem; }
  .ik-section { grid-template-columns: 1fr; gap: 1.1rem; }
  .ik-section-title { display: none; }
  .ik-q-half { grid-column: 1 / -1; }
  .ik-hint { display: block; }
  .ik-sib { grid-template-columns: 1fr 1fr; }
  .ik-sib-head { display: none; }
  .ik-input, .ik-count-input { font-size: 16px; }
  .ik-actions { padding-bottom: max(0.2rem, env(safe-area-inset-bottom)); }
  .ik-actions .button { flex: 1; min-width: 0; }
  .ik-card { padding: 0.9rem; }

  /* In the booking dialog: still a popup (rounded, backdrop around it, close
     button above), just as large as the phone allows. */
  .res-backdrop:has(.res-dialog-wide) { padding: 3.6rem 0.6rem 0.6rem; }
  .res-dialog.res-dialog-wide { width: 100%; height: calc(100vh - 4.2rem); height: calc(100dvh - 4.2rem); }
  .res-dialog-wide #res-s2 { padding: 0.9rem 1rem 0; }
}

/* The doctor's read-out (partials/intake_report.html) */
.intake-report { display: grid; gap: 0.55rem; line-height: 2; }
.intake-report-head { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: baseline; }
.intake-report-flag { color: var(--danger); font-size: 0.85rem; }
.intake-report-date { color: var(--muted); font-size: 0.8rem; margin-inline-start: auto; }
.intake-report-row { margin: 0; padding: 0.55rem 0.8rem; border-radius: 0.7rem; background: rgba(37, 145, 147, 0.06); }
.intake-report-row strong { color: var(--accent-strong); }
