/* Phone first: most respondents scan the flyer and answer standing in a corridor, many of
   them older patients. Large type, whole-row tap targets, nothing that needs a mouse. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6575;
  --border: #d5dae2;
  --accent: #1f5f8b;
  --accent-text: #ffffff;
  --accent-soft: #e6f0f7;
  --error: #b42318;
  --error-soft: #fdecea;
  --review: #7a4b00;
  --review-soft: #fff4dc;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e8ecf1;
    --muted: #a3adbb;
    --border: #333c48;
    --accent: #6fb3e0;
    --accent-text: #0d1720;
    --accent-soft: #1c3142;
    --error: #ff8a80;
    --error-soft: #3a1e1c;
    --review: #ffd28a;
    --review-soft: #3a2c12;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.page { max-width: 42rem; margin: 0 auto; padding: 1rem 1rem 3rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.2rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--accent); }

.eyebrow { color: var(--muted); font-size: 0.9rem; margin: 0; }
.muted { color: var(--muted); font-size: 0.95rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0 0 1rem;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.6rem 1.4rem;
  border-radius: var(--radius);
  border: 2px solid var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button.primary { background: var(--accent); color: var(--accent-text); }
.button.secondary { background: transparent; color: var(--accent); }
.button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.start { margin-top: 1.25rem; }
.start .button { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0 0 1rem; }

/* «Siguiente» is first in the page (Enter means forward); show «Anterior» on the left. */
.nav { display: flex; flex-direction: row-reverse; justify-content: space-between; gap: 0.75rem; margin-top: 1.5rem; }
.nav .button { flex: 1 1 0; }

/* The honeypot: present for scripts, invisible and unreachable for people. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ── Section header ──────────────────────────────────────────────────────── */

.section-header { margin-bottom: 1rem; }
.progress-label { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.35rem; }
progress {
  width: 100%;
  height: 0.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  appearance: none;
  -webkit-appearance: none;
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
.legend { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ── Items ───────────────────────────────────────────────────────────────── */

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  margin: 0 0 1rem;
  min-width: 0;
}
.item[hidden] { display: none; }
.item.has-error { border-color: var(--error); box-shadow: 0 0 0 1px var(--error); }
.item-info { background: var(--accent-soft); border-color: transparent; }

legend { padding: 0; margin-bottom: 0.6rem; font-weight: 600; float: left; width: 100%; }
legend + * { clear: both; }
.num { color: var(--accent); margin-right: 0.35rem; }
.req { color: var(--error); margin-left: 0.1rem; }
.help { color: var(--muted); font-size: 0.95rem; clear: both; }

.options { display: grid; gap: 0.5rem; clear: both; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option input { width: 1.35rem; height: 1.35rem; margin: 0.12rem 0 0; flex: none; accent-color: var(--accent); }
.option:has(input:disabled:not(:checked)) { opacity: 0.55; }

input[type="text"], input[type="email"], textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
textarea { min-height: 7rem; resize: vertical; clear: both; display: block; }
.other { margin: -0.1rem 0 0.2rem 2.4rem; width: calc(100% - 2.4rem); }
.other[hidden] { display: none; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.5rem; clear: both; }
.scale-point {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
.scale-point:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.scale-point input { width: 1.35rem; height: 1.35rem; margin: 0; accent-color: var(--accent); }
.anchors { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 0; }

.error { color: var(--error); font-weight: 600; clear: both; }
.alert {
  background: var(--error-soft);
  color: var(--error);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-weight: 600;
}
.alert[hidden] { display: none; }
.save-status { color: var(--muted); font-size: 0.9rem; text-align: center; min-height: 1.4em; margin-top: 0.75rem; }

/* ── Review mode ─────────────────────────────────────────────────────────── */

.review-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: var(--review-soft);
  color: var(--review);
  border-bottom: 2px solid var(--review);
  padding: 0.55rem 1rem;
  font-size: 0.95rem;
}
.review-banner a { color: var(--review); font-weight: 600; white-space: nowrap; }

.review-tabs { display: flex; gap: 0.5rem; margin: 0 0 1rem; flex-wrap: wrap; }
.review-tabs a {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
}
.review-tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.rule { clear: both; color: var(--review); font-size: 0.92rem; margin: 0 0 0.6rem; }
.badge {
  display: inline-block;
  background: var(--review-soft);
  color: var(--review);
  border: 1px solid var(--review);
  border-radius: 999px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.section-list li { margin-bottom: 0.4rem; }

.print-section { break-inside: auto; margin-top: 1.5rem; }

@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .review-banner, .no-print, .nav, .review-tabs { display: none !important; }
  .page { max-width: none; padding: 0; }
  .item, .card { border: 1px solid #999; break-inside: avoid; box-shadow: none; }
  .option { border: 0; padding: 0.15rem 0; }
  .option:has(input:checked) { background: none; }
  .rule, .badge { color: #000; border-color: #000; background: none; }
}
