/* ACCESS to Pharmacy Care — intake form styles.
   Palette + treatment matched to the live NCPA Programs portal (programs.ncpa.org):
   vertical gradient navy #162b56 -> blue #3574BA -> white, transparent header that
   blends into the navy top (no seam), rounded secondary-blue buttons. Brand assets
   under /static/img are the real logos. */
:root {
  --navy: #162b56;      /* portal gradient top / headings */
  --blue: #3574BA;      /* portal gradient mid / primary action */
  --blue-dark: #2a5c95;
  --ink: #1a1a1a;
  --muted: #5a6472;
  --line: #d7dce3;
  --card: #ffffff;
  --ok: #1b7a43;
  --red: #c8102e;
  --warn-bg: #fff6e5;
  --warn-border: #e0a800;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;            /* never allow the whole page to scroll sideways */
  overflow-wrap: break-word;     /* long NPIs/emails wrap instead of forcing width */
  /* Portal signature: white at the bottom fading up smoothly through blue to navy.
     Navy holds at the very top so the transparent header/logo always sits on dark. */
  background: linear-gradient(to top, #ffffff 10%, var(--blue) 55%, var(--navy) 90%);
  background-attachment: fixed;
}

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 100; }

/* Header takes normal layout space (so the body flows below it) but has no
   background/border/shadow of its own — it lets the page gradient show through, so the
   navy top of the gradient is the header background and there's no hard seam. */
.site-header {
  position: relative; z-index: 12;
  background: transparent;
}
.header-inner {
  max-width: 860px; margin: auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
/* Match the prominent logo sizing on programs.ncpa.org (desktop ~300px wide). */
.logo { display: block; width: 300px; max-width: 70vw; height: auto; }
.wordmark { font-size: 1.25rem; font-weight: 700; color: #fff; }
.tagline { font-size: .9rem; color: #fff; opacity: .9; }

.container { max-width: 860px; margin: 8px auto 28px; padding: 0 20px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px; margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(11, 30, 60, .10);
}
h1 { color: var(--navy); margin-top: 0; }
h2, legend { color: var(--navy); }
.lead { font-size: 1.05rem; color: var(--muted); }

label { display: block; font-weight: 600; margin: 14px 0 4px; }
input, select {
  width: 100%; padding: 10px 12px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
input:focus, select:focus, button:focus, a:focus {
  outline: 3px solid var(--blue); outline-offset: 1px;
}
.checkbox, .radio { font-weight: 400; display: flex; gap: 8px; align-items: flex-start; }
.checkbox input, .radio input { width: auto; margin-top: 4px; }

/* Section fieldsets render as clean cards. The legend becomes a full-width navy
   heading bar; body content sits in a padded area below it. No floats (floats were
   throwing the radio groups off to the side). */
fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  margin: 0 0 22px; padding: 0 20px 18px;
}
fieldset > legend {
  display: block; width: calc(100% + 40px);
  margin: 0 -20px 18px; padding: 12px 20px;
  background: var(--navy); color: #fff;
  font-size: 1.15rem; font-weight: 700; letter-spacing: .01em;
  border-radius: var(--radius) var(--radius) 0 0;
}

.banner {
  background: #eef4fb; border-left: 4px solid var(--blue);
  padding: 10px 14px; border-radius: 4px;
}

.btn {
  display: inline-block; padding: 11px 20px; font-size: 1rem; cursor: pointer;
  border: 1px solid var(--blue); background: #fff; color: var(--blue);
  border-radius: 10px; text-decoration: none; margin: 12px 8px 0 0; font-weight: 600;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.link { border: none; background: none; color: var(--blue); text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error { color: var(--red); font-weight: 600; }
.warning {
  background: var(--warn-bg); border: 1px solid var(--warn-border);
  padding: 12px 14px; border-radius: 6px; margin: 12px 0;
}
.confirm-card {
  border: 2px solid var(--blue); border-radius: var(--radius);
  padding: 16px; margin-top: 16px;
}
.ok { color: var(--ok); }

.checklist { list-style: none; padding: 0; }
.checklist li { padding: 10px 0; border-bottom: 1px solid var(--line); }
details summary { cursor: pointer; color: var(--blue); margin-top: 4px; }

table { border-collapse: collapse; width: 100%; margin: 8px 0; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; word-break: break-word; }

/* Wrap wide data tables so they scroll within their own box, never the whole page. */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.repeat-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px;
  margin: 12px 0; background: #fafbfd;
}
.repeat-head { display: flex; justify-content: space-between; align-items: center; }
.repeat-title { font-weight: 700; color: var(--navy); }
.icon-btn {
  border: 1px solid var(--line); background: #fff; color: var(--red);
  border-radius: 6px; width: 34px; height: 34px; font-size: 1rem; cursor: pointer;
  line-height: 1; padding: 0;
}
.icon-btn:hover { background: #fdecee; border-color: var(--red); }
.ph-verified { color: var(--ok); background: #eef8f0; border: 1px solid #bfe3ca;
  padding: 8px 10px; border-radius: 6px; }
.repeat-item.row-invalid { border-color: var(--red); background: #fdf2f4; }

.skip-block { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.review-section { margin-bottom: 18px; }
.review-section h3 { color: var(--navy); margin: 0 0 6px; border-bottom: 2px solid var(--line); padding-bottom: 4px; }
.review-row { display: flex; gap: 10px; padding: 3px 0; }
.review-row .rl { flex: 0 0 160px; color: var(--muted); font-weight: 600; }
.review-row .rv { flex: 1; min-width: 0; overflow-wrap: break-word; }

/* NPI lookup row: input + button side by side. */
.npi-entry-row { display: flex; gap: 10px; align-items: stretch; }
.npi-entry-row input { flex: 1; }
.npi-entry-row .btn { margin-top: 0; white-space: nowrap; }

.help-note { color: var(--muted); font-size: .9rem; margin-top: 18px; }
.req { color: var(--red); }
.spam-note {
  background: #eef4fb; border-left: 4px solid var(--blue);
  padding: 10px 14px; border-radius: 4px; font-size: .9rem; margin: 14px 0 0;
}

.actions { margin-top: 12px; }

/* [hidden] must always win over display rules below (fixes spinner showing at rest). */
[hidden] { display: none !important; }

/* Radios/checkboxes stacked vertically with consistent spacing. */
.radio-group { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.radio-group .radio { margin: 0; }

/* Loading spinner shown while the NPPES lookup is in flight. */
.spinner-row { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--blue);
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

.site-footer {
  max-width: 860px; margin: 20px auto 40px; padding: 20px;
  color: var(--navy); font-size: .85rem; text-align: center;
}
.site-footer .footer-lockup { max-width: 320px; height: auto; margin: 0 auto 8px; display: block; }
.site-footer a { color: var(--navy); }

@media (max-width: 480px) {
  .card { padding: 18px; }
  .header-inner { gap: 8px; padding: 12px 16px; }
  .logo { width: 220px; }

  /* Review: stack label above value so nothing is pushed off-screen. */
  .review-row { flex-direction: column; gap: 0; padding: 6px 0; border-bottom: 1px solid #eef1f5; }
  .review-row .rl { flex: none; }

  /* Data tables: smaller text + horizontal scroll contained to the table box. */
  table { font-size: .9rem; }
  th, td { padding: 5px 6px; }

  /* Full-width action buttons stack cleanly on small screens. */
  .btn { display: block; width: 100%; margin: 10px 0 0; text-align: center; }
  .npi-entry-row { flex-direction: column; }
  .npi-entry-row .btn { width: 100%; }
}
