/* quiz-overlay.css
   Supplements /_global/styles.css for the Angi quiz funnel.
   styles.css loads first; this file overrides intentionally.
   Covers: quiz shell, progress header, all 6 screens, form inputs,
   ping overlay, submit overlay, modal system, did-you-mean banner,
   sticky mobile CTA bar, mobile fold constraint.
*/

/* ── 1. QUIZ SHELL (full-screen fixed overlay) ───────── */
#quizShell {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #fff;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
#quizShell.active {
  display: flex;
  transform: translateY(0);
}
@media (min-width: 768px) {
  #quizShell {
    transform: none;
    opacity: 0;
    transition: opacity 0.25s ease;
  }
  #quizShell.active {
    opacity: 1;
  }
}

/* ── 2. QUIZ HEADER (sticky, close btn + logo + progress) */
.qoh-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border, #E5E7EB);
  padding: 12px 16px 0;
  flex-shrink: 0;
}
.qoh-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.qoh-header__logo img {
  height: 26px;
  width: auto;
}
.qoh-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 50%;
  color: var(--text-secondary, #475569);
  font-size: 18px;
  transition: background 0.15s;
}
.qoh-close:hover { background: var(--border-light, #F1F3F7); }

.qoh-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
}
.qoh-back {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #475569);
  border: none;
  background: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s;
  visibility: hidden;
}
.qoh-back.visible { visibility: visible; }
.qoh-back:hover { color: var(--primary, #1B6FE8); }

.qoh-track {
  flex: 1;
  height: 6px;
  background: var(--border, #E5E7EB);
  border-radius: 999px;
  overflow: hidden;
}
.qoh-fill {
  height: 100%;
  background: var(--primary, #1B6FE8);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0%;
}
.qoh-step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary, #1B6FE8);
  white-space: nowrap;
}

/* ── 3. SCREEN CONTAINER ─────────────────────────────── */
.qoh-screens { flex: 1; }

.qoh-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
  min-height: calc(100vh - 90px);
  min-height: calc(100dvh - 90px);
}
.qoh-screen.is-active {
  display: flex;
  animation: qohFadeSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes qohFadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.qoh-screen__inner {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── 4. QUESTION HEADER ──────────────────────────────── */
.qoh-question { text-align: center; }
.qoh-question h2 {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 5vw, 1.75rem);
  color: var(--text-dark, #0F172A);
  margin: 0 0 8px;
  line-height: 1.3;
}
.qoh-question p {
  font-size: 15px;
  color: var(--text-secondary, #475569);
  margin: 0;
  line-height: 1.5;
}

/* ── 5. SOCIAL PROOF PILL ────────────────────────────── */
.qoh-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--green-light, #E6F4F0);
  color: var(--green-valid, #05855F);
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  align-self: center;
}
.qoh-pill__dot {
  width: 7px;
  height: 7px;
  background: var(--green-valid, #05855F);
  border-radius: 50%;
  animation: qohPulse 2s ease-in-out infinite;
}
@keyframes qohPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── 6. OPTION CARDS (single-select) ─────────────────── */
.qoh-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.qoh-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border: 2px solid var(--border, #E5E7EB);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  text-align: left;
  width: 100%;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}
.qoh-option:hover {
  border-color: var(--primary, #1B6FE8);
  box-shadow: 0 0 0 3px rgba(27, 111, 232, 0.08);
}
.qoh-option:active { transform: scale(0.98); }
.qoh-option.is-selected {
  border-color: var(--primary, #1B6FE8);
  background: #EEF5FF;
  box-shadow: 0 0 0 3px rgba(27, 111, 232, 0.10);
}

.qoh-option__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--border-light, #F1F3F7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.qoh-option.is-selected .qoh-option__icon { background: #D5E8FF; }

.qoh-option__text { flex: 1; }
.qoh-option__label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark, #0F172A);
  line-height: 1.3;
}
.qoh-option__sub {
  font-size: 13px;
  color: var(--text-secondary, #475569);
  margin-top: 3px;
  line-height: 1.4;
}

.qoh-option__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary, #1B6FE8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.18s, transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
  color: #fff;
  font-size: 11px;
}
.qoh-option.is-selected .qoh-option__check {
  opacity: 1;
  transform: scale(1);
}

/* Material screen: 2×2 grid on mobile, single row on desktop */
.qoh-options--grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qoh-options--grid .qoh-option {
  flex-direction: column;
  align-items: flex-start;
  padding: 14px 12px;
  gap: 8px;
}
.qoh-options--grid .qoh-option__icon {
  width: 36px;
  height: 36px;
  font-size: 18px;
}
.qoh-options--grid .qoh-option__check {
  position: absolute;
  top: 10px;
  right: 10px;
}
@media (min-width: 600px) {
  .qoh-options--grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Sub-options (material "Other" expansion) */
.qoh-sub-options {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #E5E7EB);
  animation: qohFadeSlideUp 0.22s ease-out;
}
.qoh-sub-options.visible { display: flex; }

.qoh-sub-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary, #475569);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.qoh-sub-option {
  display: flex;
  align-items: center;
  padding: 13px 14px;
  border: 2px solid var(--border, #E5E7EB);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark, #0F172A);
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  width: 100%;
}
.qoh-sub-option:hover {
  border-color: var(--primary, #1B6FE8);
  background: #EEF5FF;
}

/* Renter inline message */
.qoh-renter-msg {
  display: none;
  padding: 12px 14px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  font-size: 13.5px;
  color: #92400E;
  line-height: 1.5;
  animation: qohFadeSlideUp 0.22s ease-out;
}
.qoh-renter-msg.visible { display: block; }

/* ── 7. FORM SCREENS (5-7) ───────────────────────────── */
.qoh-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.qoh-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.qoh-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid, #2D3748);
}
.qoh-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px; /* 16px prevents iOS auto-zoom */
  font-family: 'Inter', sans-serif;
  border: 2px solid var(--border, #E5E7EB);
  border-radius: 10px;
  background: #fff;
  color: var(--text-dark, #0F172A);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  box-sizing: border-box;
}
.qoh-input:focus {
  border-color: var(--primary, #1B6FE8);
  box-shadow: 0 0 0 3px rgba(27, 111, 232, 0.10);
}
.qoh-input.is-valid { border-color: var(--green-valid, #05855F); }
.qoh-input.is-invalid {
  border-color: #E53E3E;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.08);
}
.qoh-field-error {
  font-size: 12.5px;
  color: #E53E3E;
  display: none;
}
.qoh-field-error.visible { display: block; }
.qoh-field-error.is-visible { display: block; }

/* Two-column name layout */
.qoh-form--two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 400px) {
  .qoh-form--two-col { grid-template-columns: 1fr; }
}

/* Address sub-row: city / state / zip */
.qoh-address-subrow {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 10px;
}
@media (max-width: 600px) {
  .qoh-address-subrow {
    grid-template-columns: 1fr 1fr;
  }
  .qoh-address-subrow > .qoh-field:first-child {
    grid-column: 1 / -1;
  }
}

/* ── 8. CONTINUE BUTTON ──────────────────────────────── */
.qoh-continue {
  width: 100%;
  padding: 16px 24px;
  font-size: 17px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: #fff;
  background: var(--cta-bg, var(--primary, #1B6FE8));
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: filter 0.15s, opacity 0.15s, transform 0.1s;
  letter-spacing: -0.01em;
}
.qoh-continue:hover:not(:disabled) { filter: brightness(1.08); }
.qoh-continue:active:not(:disabled) { transform: scale(0.98); }
.qoh-continue:disabled { opacity: 0.45; cursor: not-allowed; }

.qoh-continue--submit {
  padding: 18px 24px;
  font-size: 18px;
}

/* ── 9. TCPA + CCPA BLOCKS ───────────────────────────── */
.qoh-tcpa {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted, #6B7280);
  line-height: 1.65;
  text-align: center;
  margin: 0;
}
.qoh-tcpa a {
  color: var(--primary, #1B6FE8);
  text-decoration: underline;
}
.qoh-ccpa {
  font-size: 11px;
  color: var(--text-muted, #6B7280);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}
.qoh-ccpa a { color: var(--primary, #1B6FE8); }

/* ── 10. PING OVERLAY (3-dot animation) ──────────────── */
#qohPingOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
}
#qohPingOverlay.active { display: flex; }

.qoh-ping-dots {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}
.qoh-ping-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary, #1B6FE8);
  animation: qohDotBounce 1.2s ease-in-out infinite;
}
.qoh-ping-dot:nth-child(1) { animation-delay: 0s; }
.qoh-ping-dot:nth-child(2) { animation-delay: 0.2s; }
.qoh-ping-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes qohDotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-14px); opacity: 1; }
}

.qoh-ping-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark, #0F172A);
  margin: 0 0 10px;
}
.qoh-ping-subtitle {
  font-size: 15px;
  color: var(--text-secondary, #475569);
  margin: 0 0 24px;
}
.qoh-ping-reassurance {
  font-size: 13px;
  color: var(--text-muted, #6B7280);
}

/* ── 11. SUBMIT OVERLAY ──────────────────────────────── */
#qohSubmitOverlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
}
#qohSubmitOverlay.active { display: flex; }

.qoh-submit-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border, #E5E7EB);
  border-top-color: var(--primary, #1B6FE8);
  border-radius: 50%;
  animation: qohSpin 0.8s linear infinite;
  margin-bottom: 28px;
}
@keyframes qohSpin { to { transform: rotate(360deg); } }

.qoh-submit-title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-dark, #0F172A);
  margin: 0 0 10px;
}
.qoh-submit-subtitle {
  font-size: 15px;
  color: var(--text-secondary, #475569);
  margin: 0;
  min-height: 20px;
  transition: opacity 0.3s ease;
}

/* Animated progress bar — makes a longer LeadsPedia wait feel like active work. */
.qoh-submit-progress {
  width: min(300px, 78vw);
  height: 6px;
  margin: 26px auto 0;
  background: var(--border, #E5E7EB);
  border-radius: 999px;
  overflow: hidden;
}
.qoh-submit-progress-bar {
  height: 100%;
  width: 6%;
  background: var(--primary, #1B6FE8);
  border-radius: 999px;
  /* Decelerating ease-out: crawls toward ~92% over ~18s so it never looks stuck at 100%. */
  transition: width 18s cubic-bezier(0.12, 0.7, 0.1, 1);
}
.qoh-submit-progress-bar.is-complete {
  transition: width 0.45s ease;
  width: 100%;
}

/* ── 12. MODAL SYSTEM ────────────────────────────────── */
#qohModalBackdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 30vh 16px 0;
}
#qohModalBackdrop.active {
  display: flex;
  animation: qohFadeIn 0.2s ease;
}
@keyframes qohFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.qoh-modal {
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  animation: qohModalIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
@keyframes qohModalIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.qoh-modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted, #6B7280);
  border-radius: 50%;
  font-size: 16px;
}
.qoh-modal__close:hover { background: var(--border-light, #F1F3F7); }

.qoh-modal__icon { font-size: 32px; margin-bottom: 12px; }
.qoh-modal__title {
  font-family: 'Merriweather', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark, #0F172A);
  margin: 0 0 10px;
  line-height: 1.35;
}
.qoh-modal__body {
  font-size: 14px;
  color: var(--text-secondary, #475569);
  line-height: 1.55;
  margin: 0 0 20px;
}
.qoh-modal__cta {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--primary, #1B6FE8);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 8px;
  font-family: 'Inter', sans-serif;
}
.qoh-modal__secondary {
  width: 100%;
  padding: 11px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary, #475569);
  background: none;
  border: 2px solid var(--border, #E5E7EB);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.qoh-modal__fallback-phone {
  margin-top: 14px;
  font-size: 13px;
  color: var(--text-muted, #6B7280);
}
.qoh-modal__fallback-phone a {
  color: var(--primary, #1B6FE8);
  font-weight: 600;
}

/* ── 13. DID-YOU-MEAN BANNER ─────────────────────────── */
#qohDidYouMean {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: #EEF5FF;
  border-bottom: 2px solid var(--primary, #1B6FE8);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
#qohDidYouMean.visible { transform: translateY(0); }

.qoh-dym-text { flex: 1; font-size: 14px; color: var(--text-dark, #0F172A); }
.qoh-dym-suggestion { font-weight: 700; }
.qoh-dym-use {
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--primary, #1B6FE8);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.qoh-dym-dismiss {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary, #475569);
  font-size: 18px;
  flex-shrink: 0;
}

/* ── 14. STICKY MOBILE CTA BAR ───────────────────────── */
#sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background: #fff;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.10);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 8px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
#sticky-cta.visible { transform: translateY(0); }
#sticky-cta input {
  flex: 1;
  padding: 12px 14px;
  font-size: 16px;
  border: 2px solid var(--border, #E5E7EB);
  border-radius: 10px;
  outline: none;
  font-family: 'Inter', sans-serif;
}
#sticky-cta input:focus { border-color: var(--primary, #1B6FE8); }
#sticky-cta button {
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--cta-bg, var(--primary, #1B6FE8));
  border: none;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
/* Hide sticky CTA when quiz overlay is active */
body.quiz-overlay-active #sticky-cta { display: none !important; }
/* Hide sticky CTA on desktop always */
@media (min-width: 769px) { #sticky-cta { display: none !important; } }

/* ── 15. MOBILE FOLD CONSTRAINT (580px safe zone) ─────── */
/* Every quiz screen initial render must fit within 580px height. */
@media (max-height: 680px) {
  .qoh-screen { padding: 16px 16px 24px; }
  .qoh-question h2 { font-size: 1.15rem; }
  .qoh-options { gap: 8px; }
  .qoh-option { padding: 12px 14px; }
  .qoh-option__icon { width: 36px; height: 36px; font-size: 18px; }
  .qoh-form { gap: 10px; }
  .qoh-input { padding: 11px 14px; }
  .qoh-continue { padding: 14px 20px; font-size: 15px; }
}

/* ── 16. DESKTOP OVERRIDES ───────────────────────────── */
@media (min-width: 768px) {
  .qoh-screen {
    padding: 28px 24px 56px;
    align-items: center;
    justify-content: flex-start;
  }
  .qoh-screen__inner { max-width: 620px; }
  .qoh-question h2 { font-size: 1.9rem; }
  .qoh-option { padding: 20px 18px; }
  .qoh-option__label { font-size: 16px; }
  .qoh-option__sub { font-size: 14px; }
  #qohModalBackdrop { padding-top: 20vh; }
}
