/* ============================================================
   Heritage Financial Associates / HFA Insurance
   Auto Insurance Intake Form
   Brand: Blue #051d40 (primary)  •  Red #7a0000 (accent)
   ============================================================ */

:root {
  --blue:        #051d40;
  --blue-700:    #0a2c5c;
  --blue-100:    #e7edf6;
  --red:         #7a0000;
  --red-600:     #9a1010;
  --ink:         #1b2431;
  --muted:       #5b6675;
  --line:        #d9dee6;
  --bg:          #f4f6fa;
  --card:        #ffffff;
  --ok:          #1a7f4b;
  --err:         #b3261e;
  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 2px 4px rgba(5,29,64,.05), 0 10px 30px rgba(5,29,64,.07);
  --serif:       Georgia, "Times New Roman", serif;
  --sans:        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ---------------- Header ---------------- */
.site-header {
  background: #fff;
  color: var(--blue);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 1px 0 var(--line), 0 4px 14px rgba(5,29,64,.10);
  border-bottom: 3px solid var(--blue);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-crest { width: 34px; height: 40px; flex: none; }
.logo-img { height: 46px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 3px;
  color: #fff;
  font-weight: 700;
}
.brand-sub {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 1px;
  color: #c9d4e6;
  margin-top: 3px;
}
.header-tag {
  font-size: 13px;
  color: var(--blue);
  font-weight: 600;
  border-left: 2px solid var(--red);
  padding-left: 12px;
}

/* ---------------- Progress ---------------- */
.progress-bar {
  position: sticky;
  top: 68px;
  height: 4px;
  background: var(--blue-100);
  z-index: 25;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--red), var(--red-600));
  transition: width .35s ease;
}

/* ---------------- Intro ---------------- */
.intro { padding: 34px 20px 10px; text-align: center; }
.intro h1 {
  font-family: var(--serif);
  color: var(--blue);
  font-size: 30px;
  margin: 0 0 10px;
}
.intro-lead { color: var(--muted); max-width: 560px; margin: 0 auto 12px; font-size: 16px; }
.intro-lead strong { color: var(--ink); }
.req-mark { color: var(--red); font-weight: 700; }
.intro-trust { font-size: 14px; color: var(--ok); margin: 0; }

/* ---------------- Stepper ---------------- */
.stepper {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 4px;
  padding: 18px 0 4px;
  margin: 0 auto;
  max-width: 640px;
}
.step-dot {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  cursor: default;
}
.step-dot .dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--line);
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s, border-color .2s, color .2s;
  z-index: 1;
}
.step-dot::before {
  content: "";
  position: absolute;
  top: 16px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
}
.step-dot:first-child::before { display: none; }
.step-dot .step-label { font-size: 12px; color: var(--muted); font-weight: 600; }

.step-dot.active .dot {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(5,29,64,.14);
}
.step-dot.active .step-label { color: var(--blue); }
.step-dot.done .dot {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.step-dot.done { cursor: pointer; }
.step-dot.done::before, .step-dot.active::before { background: var(--red); }

/* ---------------- Wizard steps & nav ---------------- */
.card[data-section] { display: none; }
.card[data-section].step-active {
  display: block;
  animation: stepIn .3s ease;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.wizard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
  padding: 4px 0 10px;
}
.step-count { font-size: 13px; color: var(--muted); font-weight: 600; }
.btn-next {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 28px;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 16px rgba(122,0,0,.26);
  transition: background .15s, transform .1s;
}
.btn-next:hover { background: var(--red-600); }
.btn-next:active { transform: translateY(1px); }
.btn-back {
  background: #fff;
  color: var(--blue);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-back:hover { border-color: var(--blue); background: var(--blue-100); }
.btn-back[hidden], .btn-next[hidden] { display: none; }

/* ---------------- Cards / Sections ---------------- */
form { padding-bottom: 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px;
  margin: 20px auto;
  max-width: 780px;
}
.section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 0 0 18px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--blue-100);
  float: left; /* legend fix */
}
.section-num {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  box-shadow: inset 0 0 0 2px var(--red);
}
.section-title { display: block; font-family: var(--serif); color: var(--blue); font-size: 20px; font-weight: 700; }
.section-desc  { display: block; color: var(--muted); font-size: 14px; margin-top: 3px; }

/* ---------------- Grid & Fields ---------------- */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; clear: both; }
.field { display: flex; flex-direction: column; min-width: 0; }
.col-2 { grid-column: 1 / -1; }

label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.opt { font-weight: 400; color: var(--muted); font-size: 12.5px; }

input, select, textarea {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(5,29,64,.12);
}
input:hover, select:hover, textarea:hover { border-color: #b9c1cd; }

.help  { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.error { font-size: 12.5px; color: var(--err); margin: 6px 0 0; min-height: 0; }
.field.invalid input,
.field.invalid select,
.field.invalid textarea { border-color: var(--err); box-shadow: 0 0 0 3px rgba(179,38,30,.12); }
.field.valid input,
.field.valid select { border-color: var(--ok); }

.inline-pair { display: flex; gap: 8px; }
.inline-pair input { flex: 1 1 auto; }
.inline-pair select { flex: 0 0 44%; }

.sensitive {
  background: #fbf7f7;
  border: 1px dashed #e2cccc;
  border-radius: var(--radius-sm);
  padding: 14px;
}

/* ---------------- Tooltip ---------------- */
.tip {
  flex: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--blue-100);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  cursor: help;
  position: relative;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.tip:hover, .tip:focus { background: var(--blue); color: #fff; outline: none; }
.tip-bubble {
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%);
  width: 230px;
  background: var(--blue);
  color: #fff;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.4;
  padding: 9px 11px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s;
  z-index: 40;
  text-align: left;
  pointer-events: none;
}
.tip-bubble::after {
  content: "";
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--blue);
}
.tip:hover .tip-bubble, .tip:focus .tip-bubble { opacity: 1; visibility: visible; }

/* ---------------- Repeatable rows ---------------- */
.subrow {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 14px;
  background: #fbfcfe;
  position: relative;
}
.subrow-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.subrow-title { font-weight: 700; color: var(--blue); font-size: 14px; }
.remove-row {
  background: none; border: none; color: var(--red);
  font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.remove-row:hover { text-decoration: underline; }
.vehicle-primary .remove-row { display: none; }

/* ---------------- Buttons ---------------- */
.btn-secondary {
  background: #fff;
  color: var(--blue);
  border: 1.5px dashed var(--blue);
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--blue-100); }

.consent { background: #f7f9fc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px; }
.check { display: flex; width: 100%; box-sizing: border-box; gap: 12px; align-items: flex-start; font-weight: 400; font-size: 14.5px; line-height: 1.55; cursor: pointer; }
.check input { width: 20px; height: 20px; flex: none; margin-top: 2px; accent-color: var(--blue); cursor: pointer; }
.check span { flex: 1; min-width: 0; }
.consent .help { margin-top: 12px; }

.form-error { font-size: 14px; text-align: center; margin: 14px 0 0; }

.submit-row { text-align: center; margin-top: 22px; }
.btn-primary {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 15px 34px;
  font-size: 16.5px;
  font-weight: 700;
  cursor: pointer;
  min-width: 260px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(122,0,0,.28);
  transition: transform .1s, background .15s, box-shadow .15s;
}
.btn-primary:hover { background: var(--red-600); box-shadow: 0 8px 22px rgba(122,0,0,.34); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .7; cursor: default; box-shadow: none; }
.submit-note { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }
.submit-note strong { color: var(--ink); }

.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Footer ---------------- */
.site-footer {
  background: var(--blue);
  color: #c9d4e6;
  padding: 26px 0;
  font-size: 13px;
  text-align: center;
}
.site-footer p { margin: 4px 0; }
.footer-fine { color: #8ea3c2; font-size: 12px; }

/* ---------------- Confirmation ---------------- */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(5,29,64,.6);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
  animation: fade .25s ease;
}
.confirm-overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.confirm-card {
  background: #fff;
  border-radius: var(--radius);
  max-width: 460px;
  padding: 40px 30px 34px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: pop .3s cubic-bezier(.2,.8,.3,1.2);
}
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.confirm-check {
  width: 62px; height: 62px; margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 34px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.confirm-card h2 { font-family: var(--serif); color: var(--blue); font-size: 25px; margin: 0 0 12px; }
.confirm-card p { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.confirm-next { background: var(--blue-100); color: var(--ink) !important; border-radius: 10px; padding: 12px 14px; font-size: 14px !important; }
.confirm-ref { font-size: 13px !important; color: var(--muted); }

/* ---------------- Responsive ---------------- */
@media (max-width: 620px) {
  .grid { grid-template-columns: 1fr; }
  .intro h1 { font-size: 25px; }
  .header-tag { display: none; }
  .card { padding: 22px 16px; border-radius: 12px; margin: 14px auto; }
  .wrap { padding: 0 14px; }
  .btn-primary { width: 100%; }
  .brand-name { font-size: 19px; letter-spacing: 2px; }
  .tip-bubble { width: 190px; }
  .progress-bar { top: 60px; }
  .site-header .header-inner { min-height: 60px; }
  .logo-img { height: 38px; }
  .stepper { padding: 12px 0 0; }
  .step-dot .dot { width: 28px; height: 28px; font-size: 13px; }
  .step-dot .step-label { font-size: 10.5px; }
  .step-dot::before { top: 14px; }
  .wizard-nav { flex-wrap: wrap; padding: 0 0 14px; }
  .step-count { order: -1; width: 100%; text-align: center; }
  .btn-back, .btn-next { flex: 1 1 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto; }
}
