/* APSEA Community Health Screening — volunteer app theme.
   Clean, flat, modern: solid APSEA red as the single accent, no gradients, neutral
   hairline borders, and soft neutral shadows only where they aid hierarchy. */
:root {
  --apsea: #c0142c;
  --apsea-dark: #8e0f20;
  --apsea-tint: #fdf2f4;
  --ink: #16202a;
  --muted: #5b6770;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e4e8ec;
  --ok: #1c7c4a;
  --ok-bg: #edf7f1;
  --ok-line: #cde9d8;
  --warn-bg: #fff7e6;
  --warn-line: #f3d99b;
  --radius: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 560px; margin: 0 auto; padding: 14px 14px 64px; }

/* Hero header — solid, flat */
.hero {
  background: var(--apsea);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px;
  margin: 6px 0 16px;
}
.hero h1 { font: 800 23px/1.18 "Inter", sans-serif; margin: 0; letter-spacing: -0.01em; }
.hero p { margin: 8px 0 0; font-size: 14px; opacity: 0.92; font-weight: 500; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  padding: 18px 16px;
  margin: 12px 0;
}

/* Section headers within a form */
.section {
  color: var(--ink);
  border-left: 3px solid var(--apsea);
  padding: 2px 0 2px 12px;
  font: 700 16px/1.25 "Inter", sans-serif;
  margin: 24px 0 8px;
}
.section:first-child { margin-top: 4px; }

/* Fields */
.field { margin: 14px 0; }
.field > label.q {
  display: block;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
}
.field .req { color: var(--apsea); margin-left: 3px; }
.field .note { color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 4px; }

input[type="text"], input[type="number"], input[type="tel"], input[type="email"],
input[type="date"], input[type="password"], select, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 46px;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
}
/* Keep native date/time text left-aligned and contained on iOS Safari. */
input[type="date"] { display: block; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
/* Custom chevron, since appearance:none removes the native one. */
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235b6770' stroke-width='1.8' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
}
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  border-color: var(--apsea);
  box-shadow: 0 0 0 3px rgba(192, 20, 44, 0.12);
  outline: none;
}
input.invalid, select.invalid { border-color: var(--apsea); background: var(--apsea-tint); }
.field-error { color: var(--apsea); font-size: 13px; margin-top: 5px; font-weight: 600; }

/* Choice lists (radio / checkbox) */
.choices { display: flex; flex-direction: column; gap: 6px; }
.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choice:has(input:checked) { border-color: var(--apsea); background: var(--apsea-tint); }
.choice input[type="radio"], .choice input[type="checkbox"] {
  width: 22px; height: 22px; accent-color: var(--apsea); margin: 0; flex: none;
}
.choice span { font-size: 16px; }

/* Buttons — flat, solid */
.btn {
  display: block;
  width: 100%;
  background: var(--apsea);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font: 700 17px/1 "Inter", sans-serif;
  padding: 15px 22px;
  cursor: pointer;
  margin-top: 14px;
  transition: background-color 0.12s ease;
}
.btn:hover { background: var(--apsea-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.secondary {
  background: #fff;
  color: var(--apsea);
  border: 1px solid var(--apsea);
}
.btn.secondary:hover { background: var(--apsea-tint); }
.btn.ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn.ghost:hover { background: transparent; color: var(--ink); }

/* Top bar: language selector + logout */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.topbar .spacer { flex: 1; }
.topbar select { width: auto; min-height: 38px; padding: 4px 10px; font-size: 14px; }
.topbar .link { color: var(--muted); font-size: 14px; background: none; border: none; cursor: pointer; }
.topbar .link:hover { color: var(--ink); }

/* Masked identity confirm */
.identity {
  font: 700 19px/1.4 "Inter", sans-serif;
  background: var(--apsea-tint);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  letter-spacing: 0.3px;
}
.identity .meta { display: block; font-weight: 500; font-size: 15px; color: var(--muted); margin-top: 6px; }

/* Alerts (reproduce the removed REDCap banners) */
.alert-critical {
  background: var(--apsea);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  margin: 12px 0;
}
.alert-critical .title { font-size: 22px; font-weight: 900; letter-spacing: 0.4px; }
.alert-critical .detail { font-size: 14px; font-weight: 500; margin-top: 6px; opacity: 0.95; }
.alert-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left: 3px solid #d99b1c;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-weight: 600;
  margin: 10px 0;
}

/* Live panels: alerts stay pinned on screen while the volunteer keeps typing;
   "results so far" sits at the top of the form and updates as values are entered. */
.live-alerts {
  position: sticky;
  top: 8px;
  z-index: 20;
}
.live-alerts > :first-child { margin-top: 0; }
.live-results { margin: 0 0 6px; }
.live-results .section:first-child { margin-top: 0; }

/* Results table */
.results { width: 100%; border-collapse: collapse; margin-top: 8px; }
.results th, .results td { text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line); font-size: 15px; }
.results th { color: var(--muted); font-weight: 600; width: 55%; }

.banner-ok {
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-line);
  border-radius: var(--radius-sm); padding: 14px; font-weight: 700; text-align: center; margin: 6px 0 12px;
}
.msg { color: var(--muted); font-size: 14px; margin: 8px 0; }
.error-text { color: var(--apsea); font-weight: 600; margin: 8px 0; }
.hidden { display: none !important; }

.turnstile { margin: 12px 0; min-height: 65px; }
