/* Error/validation visual overrides */
.landing-form-page,
.landing-form-page .sticky-header {
  /* Ensure no gap above header */
  margin-top: 0 !important;
}
.validation-error {
  /* red text only */
  background: none;
  padding: 0;
  border-left: 0;
  border-radius: 0;
  color: var(--error-red);
  margin-top: .25rem;
}

/* Landing form hero: single, clear styles via clamp() */
body.landing-form-page #quote-start .primary-headline {
  padding: 0;
  margin: 0 0 .75rem 0;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--primary-navy);
  text-align: center;
  text-shadow: 0 1px 2px rgba(27, 54, 93, .08);
  font-size: clamp(1.9rem, 4.5vw, 2.4rem);
  line-height: 1.18;
}
/* Tighten spacing above the hero headline */
body.landing-form-page #quote-start {
  padding-top: 0.75rem !important; /* override inline or base padding */
}

body.landing-form-page #quote-start .benefit-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: .25rem 0 1rem;
  align-items: center;
}

body.landing-form-page #quote-start .benefit-list li {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  line-height: 1.45;
  font-weight: 600;
  color: var(--primary-navy);
}

body.landing-form-page #quote-start .benefit-list li:before {
  color: var(--primary-gold);
  font-weight: 800;
}

/* Tighten paragraph spacing in the landing form */
body.landing-form-page #quote-start p {
  line-height: 1.35;
  margin: 0.25rem 0 0.5rem;
}

/* Subtitle examples under step headers */
body.landing-form-page #quote-start p.subtitle {
  line-height: 1.3 !important;
  margin-bottom: 0.75rem !important; /* override inline 1.5rem */
}

/* Completion message paragraph near final submit */
body.landing-form-page .completion-message p {
  line-height: 1.35;
  margin: 0.25rem 0 0.75rem;
}

/* Helper and reassurance copy */
body.landing-form-page .otp-helper,
body.landing-form-page .phone-reassurance,
body.landing-form-page .consent-text {
  line-height: 1.35 !important; /* defeat any inline line-height */
  margin-top: 0.4rem;
  margin-bottom: 0.5rem !important;
}

/* Mobile: slightly tighter for limited space */
@media (max-width: 768px) {
  body.landing-form-page #quote-start p,
  body.landing-form-page .completion-message p,
  body.landing-form-page .otp-helper,
  body.landing-form-page .phone-reassurance,
  body.landing-form-page .consent-text {
    line-height: 1.3 !important;
    margin-top: 0.25rem;
    margin-bottom: 0.45rem !important;
  }
}

/* Inputs/selects: red outline, no glow */
.form-input.error {
  box-shadow: none;
  border-color: transparent; /* avoid double border + outline */
  outline: 2px solid var(--error-red);
  outline-offset: 2px;
  margin-bottom: .25rem; /* tighten gap to message */
}

/* Single-choice groups: red outline on container */
.gender-buttons.error,
.options-group.error {
  outline: 2px solid var(--error-red);
  outline-offset: 4px;
  border-radius: .75rem;
  margin-bottom: .25rem; /* tighter spacing above message */
}

/* OTP inputs: single red outline only */
.otp-input.error {
  box-shadow: none;
  border-color: transparent;
  outline: 2px solid var(--error-red);
  outline-offset: 2px;
  margin-bottom: .25rem;
}

/* Header badges: compact, non-interactive */
.sticky-header .header-badges {
  gap: .5rem;
  margin: 0;
  padding: 0;
  flex-wrap: nowrap;
  align-items: center;
}
/* Extra specificity to defeat base wrap rules and lock to one row */
body.landing-form-page .sticky-header .header-content--landing .header-center .header-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}
.sticky-header .header-badges .trust-badge {
  border: none;
  padding: .25rem .5rem;
  min-height: auto;
  cursor: default;
  flex: 0 0 auto; /* keep each badge on one line */
  white-space: nowrap;
}
.sticky-header .header-badges .trust-badge:hover {
  transform: none;
  box-shadow: none;
  border-color: transparent;
}
.sticky-header .header-badges .badge-content { white-space: nowrap; }
.sticky-header .header-badges .google-icon,
.sticky-header .header-badges .icon {
  width: 22px;
  height: 22px;
}
.sticky-header .header-badges .badge-rating {
  font-size: .8rem;
}
.sticky-header .header-badges .badge-label {
  font-size: .7rem;
}

/* Landing header layout: center badges, flag right */
body.landing-form-page .header-content--landing {
  display: flex;
  align-items: center;
}
body.landing-form-page .header-content--landing .header-left { flex: 0 0 auto; }
body.landing-form-page .header-content--landing .header-center { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
body.landing-form-page .header-content--landing .header-right { flex: 1 1 0; display: flex; justify-content: flex-end; }
body.landing-form-page .usa-flag { width: 48px; height: 48px; }

/* Progressive hiding to keep badges single-row */
@media (max-width: 820px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(1) { display: none; }
}
@media (max-width: 700px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(2) { display: none; }
}
@media (max-width: 600px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(3) { display: none; }
}
@media (max-width: 520px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(4) { display: none; }
}
@media (max-width: 460px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(5) { display: none; }
}

/* Earlier, smoother hide steps to avoid any wrap */
@media (max-width: 1100px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(1) { display: none; }
}
@media (max-width: 980px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(2) { display: none; }
}
@media (max-width: 880px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(3) { display: none; }
}
@media (max-width: 780px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(4) { display: none; }
}
@media (max-width: 680px) {
  body.landing-form-page .header-badges .trust-badge:nth-last-child(5) { display: none; }
}

/* Keep landing header visible on mobile despite base CSS hiding it */
@media (max-width: 768px) {
  body.landing-form-page .sticky-header {
    display: block;
  }
  body.landing-form-page .sticky-header .header-content {
    display: flex;
  }
  body.landing-form-page .header-content--landing {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: .5rem;
  }
  /* Remove body bottom padding on landing form (no mobile sticky CTA here) */
  body.landing-form-page {
    padding-bottom: 0 !important;
  }
}

/* Consistent side spacing for the form between 480px–768px */
@media (min-width: 480px) and (max-width: 768px) {
  body.landing-form-page #quote-start {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  body.landing-form-page .container {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
  body.landing-form-page .quote-card {
    margin-left: auto;
    margin-right: auto;
  }
}

/* Prevent brand wrapping */
body.landing-form-page .header-brand {
  white-space: nowrap;
}

/* ---- Accessible Form UI Upgrades (Trust Blue Theme) ---- */
:root {
  /* Map form accents to site primary colors */
  --brand-blue-500: var(--primary-navy); /* #1B365D */
  --brand-blue-600: #163056; /* darker navy for hover */
  --brand-blue-700: #0F2747; /* darkest navy for active */
  --brand-blue-100: #E6ECF7; /* subtle navy tint bg */
  --brand-focus-ring: 0 0 0 3px rgba(27, 54, 93, .35);
  --field-border: #CBD5E1; /* slate-300 */
  --field-border-strong: #94A3B8; /* slate-400 */
  --error-red-600: #D32F2F;
  --success-green-600: #1E8449;
}

/* Inputs and selects: larger tap targets, strong focus, consistent radius */
input.form-input,
select.form-input,
.form-input {
  min-height: 52px; /* >=48px for WCAG touch targets */
  border-color: var(--field-border);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  font-size: 1.05rem; /* readable for seniors */
  background-color: #fff;
  color: var(--primary-navy);
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease;
}

input.form-input:hover,
select.form-input:hover,
.form-input:hover {
  border-color: var(--field-border-strong);
}

input.form-input:focus,
select.form-input:focus,
.form-input:focus {
  outline: none;
  border-color: var(--brand-blue-500) !important;
  box-shadow: var(--brand-focus-ring);
}

/* Success and error with clear contrast */
.form-input.success,
.otp-input.success {
  border-color: var(--success-green-600) !important;
  box-shadow: 0 0 0 3px rgba(30, 132, 73, .28);
}

.form-input.error,
.otp-input.error {
  border-color: var(--error-red-600) !important;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, .28);
  outline: none !important; /* override earlier no-glow outline rule */
}

/* Dropdowns: accessible custom arrow, clear affordance */
select.form-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%231B365D' d='M5.8 7.5a1 1 0 0 1 1.4 0L10 10.3l2.8-2.8a1 1 0 1 1 1.4 1.4l-3.5 3.6a1 1 0 0 1-1.4 0L5.8 8.9a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 18px 18px;
  padding-right: 2.75rem; /* space for arrow */
}
select.form-input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23163056' d='M5.8 7.5a1 1 0 0 1 1.4 0L10 10.3l2.8-2.8a1 1 0 1 1 1.4 1.4l-3.5 3.6a1 1 0 0 1-1.4 0L5.8 8.9a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
}
select.form-input::-ms-expand { display: none; }

/* Option and gender buttons: strong contrast, obvious selected state */
.option-button,
.gender-button {
  position: relative;
  border: 2px solid #C7D2E8; /* light navy-tinted outline */
  background: #fff;
  color: var(--primary-navy);
  border-radius: 12px;
  min-height: 56px; /* comfy */
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background-color .15s ease, color .15s ease;
}

.option-button:hover,
.gender-button:hover {
  border-color: var(--primary-gold);
  box-shadow: 0 6px 20px rgba(26, 115, 232, .12);
  transform: translateY(-2px);
}

.option-button:focus,
.gender-button:focus {
  outline: none;
  border-color: var(--primary-gold);
  box-shadow: var(--brand-focus-ring);
}

/* Selected/active: filled blue with white text, very clear */
.option-button.selected,
.option-button[aria-checked="true"],
.gender-button.selected,
.gender-button[aria-checked="true"] {
  background: var(--primary-navy);
  border-color: var(--brand-blue-600);
  color: #fff;
  box-shadow: 0 8px 24px rgba(26, 115, 232, .20);
}

/* Add a subtle check indicator for selected options */
.option-button.selected::after,
.option-button[aria-checked="true"]::after,
.gender-button.selected::after,
.gender-button[aria-checked="true"]::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='white' d='M8.3 13.3 4.9 9.9l1.4-1.4 2 2 4.4-4.4 1.4 1.4z'/%3E%3C/svg%3E");
  background-size: 18px 18px;
  background-repeat: no-repeat;
}

/* Submit/primary next button: trust-blue theme, full-width */
#submitButton,
.next-button {
  background: linear-gradient(180deg, var(--primary-navy), var(--brand-blue-600));
  border: 2px solid var(--brand-blue-600) !important;
  color: #fff !important;
  font-weight: 700;
  letter-spacing: .2px;
  min-height: 56px;
  box-shadow: 0 8px 24px rgba(26, 115, 232, .25);
}

#submitButton:hover,
.next-button:hover {
  background: linear-gradient(180deg, var(--brand-blue-600), var(--brand-blue-700));
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(26, 115, 232, .32);
}

#submitButton:active,
.next-button:active {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(26, 115, 232, .28);
}

#submitButton:focus,
.next-button:focus {
  outline: none;
  box-shadow: var(--brand-focus-ring), 0 8px 24px rgba(26, 115, 232, .25);
}

.next-button:disabled,
#submitButton:disabled {
  background: #CBD5E1;
  border-color: #CBD5E1 !important;
  color: #6B7280 !important;
  box-shadow: none;
}

/* OTP buttons (Send Verification Code / Verify): match CTA gradient */
.otp-button {
  background: linear-gradient(180deg, var(--primary-navy), var(--brand-blue-600)) !important;
  border: 2px solid var(--brand-blue-600) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 12px;
  min-height: 52px;
  box-shadow: 0 8px 24px rgba(26, 115, 232, .25);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.otp-button:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--brand-blue-600), var(--brand-blue-700)) !important;
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(26, 115, 232, .32);
}
.otp-button:active:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(26, 115, 232, .28);
}
.otp-button:focus {
  outline: none;
  box-shadow: var(--brand-focus-ring), 0 8px 24px rgba(26, 115, 232, .25) !important;
}
.otp-button:disabled {
  background: #CBD5E1 !important;
  border-color: #CBD5E1 !important;
  color: #6B7280 !important;
  box-shadow: none !important;
}

/* Ensure any .cta-button used with form actions inherits the same gradient */
.cta-button {
  background: linear-gradient(180deg, var(--primary-navy), var(--brand-blue-600));
  border: 2px solid var(--brand-blue-600);
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
}
.cta-button:hover { background: linear-gradient(180deg, var(--brand-blue-600), var(--brand-blue-700)); }

/* Consent checkbox and label: larger click target */
.consent-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}
.consent-label {
  gap: .6rem;
  line-height: 1.4;
}

/* Spacing between stacked fields for readability */
.quiz-content .form-input + .form-input { margin-top: .5rem; }
.quiz-content .options-group { margin-top: .5rem; margin-bottom: 0; }

/* Remove extra gap below single-choice button groups */
.quiz-content .gender-buttons { margin-bottom: 0 !important; }
.quiz-content .coverage-options { margin-bottom: 0 !important; }

/* Ensure option groups get a clear error ring */
.gender-buttons.error,
.options-group.error {
  outline: 2px solid var(--error-red-600);
  outline-offset: 4px;
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .option-button,
  .gender-button,
  .next-button {
    transition: none;
  }
}

/* -------- Step Transition Animations (lightweight, professional) -------- */
@keyframes stepEnter {
  from {
    opacity: 0;
    transform: translateX(14px) scale(.995);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

/* Make entering steps feel snappy and clear */
.form-step {
  will-change: opacity, transform;
  transition: none !important; /* avoid conflict with base transition */
}
.form-step.active {
  animation: stepEnter .28s cubic-bezier(.2,.8,.2,1) both !important;
}

/* Slight emphasis on progress movement without being flashy */
.progress-bar {
  position: relative;
  transition: transform .35s ease, box-shadow .2s ease;
}
.progress-bar:after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, rgba(255,255,255,.0), rgba(255,255,255,.3), rgba(255,255,255,.0));
  opacity: .0;
  transition: opacity .2s ease;
}
.progress-bar[style*="--progress-factor"]:after,
.progress-bar[style*="width"]:after {
  opacity: .35; /* brief glint when value changes */
}

@media (prefers-reduced-motion: reduce) {
  .form-step.active { animation: none; }
  .progress-bar { transition: none; }
  .progress-bar:after { display: none; }
}
