/* Stocker Agency | Insurance Assessment — styles */
:root {
  --sa-navy: #061531;
  --sa-navy-dark: #030b18;
  --sa-navy-line: #233149;
  --sa-blue: #061531;       /* navy — buttons, fields, progress */
  --sa-blue-light: #eef1f5; /* light navy tint for selected/hover fills */
  --sa-navy-hover: #233149;
  --sa-navy-disabled: #8a93a1;
  --sa-accent: #2e9e6b;
  --sa-amber: #b9781f;
  --sa-text: #1a2530;
  --sa-text-muted: #56636e;
  --sa-border: #d7dee4;
  --sa-bg: #f6f8fa;
  --sa-white: #ffffff;
  --sa-danger: #b3261e;
  --sa-focus: #061531;
  --sa-radius: 10px;
  --sa-font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sa-max-width: 640px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--sa-bg);
  color: var(--sa-text);
  font-family: var(--sa-font);
  line-height: 1.5;
}

/* Rounded corners + a floating card are the default (this is what most
   people see — any normal desktop browser window). Only a genuinely narrow
   phone screen goes full-bleed/edge-to-edge below. Previously this was
   inverted (square by default, rounded only above 720px), which is why the
   corners looked like they "weren't working" in an ordinary window. */
.sa-app {
  max-width: var(--sa-max-width);
  margin: 24px auto;
  /* Hug content height — page scrolls only when needed. */
  display: flex;
  flex-direction: column;
  background: var(--sa-white);
  box-shadow: 0 0 0 1px var(--sa-border), 0 4px 16px rgba(6, 21, 45, 0.06);
  border-radius: 16px;
  overflow: hidden; /* clip navy header to rounded top corners */
}

/* Header / progress */
.sa-header {
  background: var(--sa-white);
  color: var(--sa-navy-dark);
  padding: 18px 20px 16px;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  border-bottom: 1px solid var(--sa-border);
}
.sa-header__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.sa-logo {
  height: 28px;
  width: auto;
  max-width: 180px;
  display: block;
  object-fit: contain;
}
.sa-logo-text {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--sa-navy);
  letter-spacing: 0.04em;
}
.sa-progress-label {
  font-size: 12px;
  color: var(--sa-text-muted);
  margin-bottom: 6px;
}
.sa-progress-track {
  height: 6px;
  border-radius: 999px;
  background: #e8edf2;
  overflow: hidden;
}
.sa-progress-fill {
  height: 100%;
  background: var(--sa-blue);
  transition: width 0.25s ease;
}

/* Main content */
.sa-main {
  flex: 1;
  padding: 28px 20px 20px;
}
/* We focus() #sa-main on every screen change purely so screen readers
   announce the new question — not for sighted keyboard users navigating
   with Tab — so its own focus ring is suppressed. Real keyboard focus
   (Tab-ing to an option or button) still gets a visible ring via
   :focus-visible on those elements below. */
.sa-main:focus {
  outline: none;
}
.sa-step-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--sa-navy-dark);
}
.sa-step-subtext {
  font-size: 14px;
  color: var(--sa-text-muted);
  margin: -8px 0 18px;
}

/* Options */
.sa-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.sa-option {
  position: relative;
  border: 1.5px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: var(--sa-white);
  -webkit-tap-highlight-color: transparent;
}
.sa-option:hover { border-color: var(--sa-blue); }

/* Round "bubble" indicator for both single-select (radio) and multi-select
   (checkbox) options — deliberately not using the native square checkbox
   look, so every answer bubble reads the same regardless of question type. */
.sa-option input {
  appearance: none;
  -webkit-appearance: none;
  margin-top: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--sa-border);
  background: var(--sa-white);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sa-option input:hover { border-color: var(--sa-blue); }
.sa-option input:checked {
  border-color: var(--sa-blue);
  background: var(--sa-blue);
}
.sa-option input:checked::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.sa-option__label { font-size: 15px; line-height: 1.4; }
.sa-option:has(input:checked) {
  border-color: var(--sa-blue);
  background: var(--sa-blue-light);
}
.sa-option input:focus-visible {
  outline: 3px solid var(--sa-focus);
  outline-offset: 2px;
}
.sa-option:focus-within { outline: 3px solid var(--sa-focus); outline-offset: 1px; }

/* Error */
.sa-error {
  color: var(--sa-danger);
  font-size: 13.5px;
  margin: -8px 0 14px;
  display: none;
}
.sa-error.is-visible { display: block; }
.sa-field-error {
  color: var(--sa-danger);
  font-size: 12.5px;
  margin: 6px 0 0;
  display: none;
  line-height: 1.35;
}
.sa-field-error.is-visible { display: block; }
.sa-field input[aria-invalid="true"] {
  border-color: var(--sa-danger) !important;
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.12);
}
[aria-invalid="true"] { border-color: var(--sa-danger) !important; }

/* Footer / nav controls */
.sa-footer {
  padding: 14px 20px 20px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--sa-border);
}
.sa-btn {
  appearance: none;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 18px;
  cursor: pointer;
  font-family: inherit;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.sa-btn:focus-visible { outline: 3px solid var(--sa-focus); outline-offset: 2px; }
.sa-btn--primary { background: var(--sa-blue); color: #fff; flex: 1; }
.sa-btn--primary:hover { background: var(--sa-navy-hover); }
.sa-btn--primary:disabled { background: var(--sa-navy-disabled); cursor: not-allowed; }
.sa-btn--secondary { background: var(--sa-white); color: var(--sa-navy); border: 1.5px solid var(--sa-navy); }
.sa-btn--secondary:hover { background: var(--sa-blue-light); }

/* Welcome screen */
.sa-welcome { text-align: center; padding-top: 12px; padding-bottom: 8px; }
.sa-welcome h1 { font-size: 26px; line-height: 1.2; color: var(--sa-navy-dark); margin: 4px 0 12px; }
.sa-welcome p { color: var(--sa-text-muted); font-size: 15.5px; line-height: 1.55; margin-bottom: 26px; }

/* A light, non-overwhelming feature strip that fills the space below the
   Start button on desktop instead of leaving it empty, and reinforces what
   the assessment covers before someone commits to starting. */
.sa-welcome-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 30px;
  padding-top: 26px;
  border-top: 1px solid var(--sa-border);
  text-align: center;
}
.sa-welcome-feature__icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: var(--sa-blue-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.sa-welcome-feature__icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--sa-blue);
}
.sa-welcome-feature__img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}
.sa-welcome-feature__label {
  font-size: 13px;
  font-weight: 600;
  color: var(--sa-navy-dark);
}
.sa-welcome-meta {
  margin-top: 22px;
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--sa-text-muted);
}
.sa-welcome-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sa-welcome-meta svg {
  width: 14px;
  height: 14px;
  stroke: var(--sa-text-muted);
  flex-shrink: 0;
}

/* Lead form */
.sa-field { margin-bottom: 16px; }
.sa-field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--sa-navy-dark); }
.sa-field input[type="text"], .sa-field input[type="email"], .sa-field input[type="tel"] {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--sa-border); border-radius: 8px; font-size: 16px; font-family: inherit;
  color: var(--sa-navy-dark);
}
.sa-field input:hover { border-color: var(--sa-navy-line); }
.sa-field input:focus,
.sa-field input:focus-visible {
  outline: none;
  border-color: var(--sa-navy);
  box-shadow: 0 0 0 3px rgba(6, 21, 49, 0.12);
}
.sa-consent { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--sa-text-muted); margin: 18px 0; }
.sa-consent input { margin-top: 3px; accent-color: var(--sa-navy); min-width: 18px; min-height: 18px; }

/* Results */
.sa-results-card {
  border: 1.5px solid var(--sa-border);
  border-radius: var(--sa-radius);
  padding: 18px;
  margin-bottom: 14px;
}
.sa-results-card--strength { border-left: 5px solid var(--sa-accent); }
.sa-results-card--opportunity { border-left: 5px solid var(--sa-amber); }
.sa-results-card--next { border-left: 5px solid var(--sa-blue); background: var(--sa-blue-light); }
.sa-results-eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sa-text-muted); margin-bottom: 6px; }
.sa-results-headline { font-size: 17px; font-weight: 700; margin: 0 0 6px; color: var(--sa-navy-dark); }
.sa-results-body { font-size: 14.5px; color: var(--sa-text); margin: 0; }
.sa-cta {
  display: block; text-align: center; text-decoration: none;
  background: var(--sa-blue); color: #fff; font-weight: 700; font-size: 16px;
  padding: 15px; border-radius: 8px; margin-top: 22px;
  min-height: 48px; box-sizing: border-box;
}
.sa-cta:hover { background: var(--sa-navy-hover); }

.sa-visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.sa-config-error {
  border: 1.5px solid var(--sa-danger);
  background: #fdecea;
  border-radius: var(--sa-radius);
  padding: 16px;
  font-size: 14px;
}

/* ---------- Mobile / tablet ---------- */
@media (max-width: 768px) {
  .sa-app {
    margin: 16px;
    border-radius: 14px;
  }

  .sa-header {
    padding: 16px 16px 14px;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
  }

  .sa-main {
    padding: 22px 16px 16px;
  }

  .sa-footer {
    padding: 12px 16px 16px;
  }

  .sa-welcome h1 {
    font-size: 22px;
  }

  .sa-welcome p {
    font-size: 14.5px;
    margin-bottom: 22px;
  }

  .sa-step-title {
    font-size: 18px;
  }

  .sa-welcome-features {
    margin-top: 24px;
    padding-top: 20px;
    gap: 8px;
  }

  .sa-welcome-meta {
    gap: 12px 14px;
  }
}

@media (max-width: 480px) {
  .sa-app {
    margin: 12px;
    margin-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-radius: 12px;
    box-shadow: 0 0 0 1px var(--sa-border), 0 2px 12px rgba(6, 21, 45, 0.06);
  }

  .sa-header {
    padding: 14px 14px 12px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
  }

  .sa-logo {
    height: 22px;
  }

  .sa-main {
    padding: 18px 14px 14px;
  }

  .sa-footer {
    padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }

  .sa-btn {
    padding: 12px 14px;
    font-size: 14.5px;
  }

  .sa-btn--secondary {
    flex: 0 0 auto;
    min-width: 88px;
  }

  .sa-welcome h1 {
    font-size: 20px;
  }

  .sa-welcome p {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .sa-welcome-features {
    margin-top: 20px;
    padding-top: 18px;
  }

  .sa-welcome-feature__icon {
    width: 36px;
    height: 36px;
  }

  .sa-welcome-feature__img {
    width: 20px;
    height: 20px;
  }

  .sa-welcome-feature__label {
    font-size: 12px;
  }

  .sa-welcome-meta {
    margin-top: 18px;
    gap: 10px 12px;
    font-size: 12px;
  }

  .sa-option {
    padding: 13px 14px;
    min-height: 48px;
    align-items: center;
  }

  .sa-option__label {
    font-size: 14.5px;
  }

  .sa-results-card {
    padding: 14px;
  }

  .sa-results-headline {
    font-size: 16px;
  }
}

@media (max-width: 360px) {
  .sa-welcome-meta {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .sa-welcome-feature__label {
    font-size: 11px;
  }

  .sa-footer {
    flex-direction: column-reverse;
  }

  .sa-btn--secondary,
  .sa-btn--primary {
    width: 100%;
  }
}

/* ---------- Popup modal ---------- */
.sa-popup {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
}

.sa-popup[hidden] {
  display: none !important;
}

.sa-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 21, 49, 0.62);
  cursor: pointer;
}

.sa-popup__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 680px;
  max-height: min(92vh, 900px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 16px;
  outline: none;
}

.sa-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: #f0f3f6;
  color: var(--sa-navy);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.sa-popup__close:hover,
.sa-popup__close:focus-visible {
  background: var(--sa-blue-light);
  color: var(--sa-navy-dark);
  outline: none;
}

.sa-popup #sa-app-root {
  min-height: 0;
}

.sa-popup .sa-app {
  margin: 0;
  max-width: none;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(6, 21, 45, 0.28);
}

.sa-popup .sa-header {
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding-right: 52px; /* room for close button */
}

body.sa-popup-open {
  overflow: hidden;
}

@media (max-width: 480px) {
  .sa-popup {
    padding: 0;
    align-items: stretch;
  }

  .sa-popup__dialog {
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
  }

  .sa-popup .sa-app {
    border-radius: 0;
    min-height: 100%;
    box-shadow: none;
  }

  .sa-popup .sa-header {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .sa-popup__close {
    top: 8px;
    right: 8px;
  }
}
