/* === QUIZ PAGE STYLES === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue: #1d4ed8;
  --blue-dark: #1e40af;
  --blue-light: #dbeafe;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-800: #1e293b;
  --navy: #0f172a;
  --green: #10b981;
  --green-dark: #059669;
  --white: #ffffff;
  --red: #dc2626;
}

body {
  font-family: 'Libre Franklin', system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1000px 500px at 50% -10%, #1e3a8a 0%, transparent 60%),
    linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px 40px;
}

/* Header */
.quiz-header {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 16px;
  color: white;
}

.quiz-logo {
  font-size: 22px;
  font-weight: 800;
  color: white;
  text-decoration: none;
}

.quiz-back-home {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  transition: color .2s;
}
.quiz-back-home:hover { color: white; }

/* Progress bar */
.progress-wrap {
  width: 100%;
  max-width: 560px;
  margin-bottom: 24px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label {
  font-size: 13px;
  color: rgba(255,255,255,.7);
  font-weight: 500;
}

.progress-pct {
  font-size: 13px;
  color: rgba(255,255,255,.9);
  font-weight: 700;
}

.progress-bar-bg {
  height: 6px;
  background: rgba(255,255,255,.2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #60a5fa;
  border-radius: 999px;
  transition: width .4s ease;
}

/* Quiz card */
.quiz-card {
  width: 100%;
  max-width: 560px;
  background: white;
  border-radius: 20px;
  padding: 40px 36px 32px;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}

.step { display: none; }
.step.active { display: block; }

.step-question {
  font-size: clamp(18px, 3vw, 22px);
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 8px;
  line-height: 1.3;
}

.step-sub {
  font-size: 14px;
  color: var(--gray-600);
  margin-bottom: 28px;
}

/* Radio options */
.radio-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  font-size: 15px;
  font-weight: 500;
  color: var(--gray-800);
  user-select: none;
}

.radio-option:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}

.radio-option input[type="radio"] { display: none; }

.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s;
}

.radio-option:hover .radio-dot { border-color: var(--blue); }

.radio-option.selected {
  border-color: var(--blue);
  background: var(--blue-light);
}

.radio-option.selected .radio-dot {
  border-color: var(--blue);
  background: var(--blue);
}

.radio-option.selected .radio-dot::after {
  content: '';
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* Radio icon (for insurance type step) */
.radio-icon {
  font-size: 22px;
  flex-shrink: 0;
}

/* Select dropdown */
.quiz-select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--gray-800);
  outline: none;
  transition: border-color .2s;
  margin-bottom: 10px;
  background: white;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.quiz-select:focus { border-color: var(--blue); }
.quiz-select.error { border-color: var(--red); }

/* Text / email inputs */
.quiz-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  color: var(--gray-800);
  outline: none;
  transition: border-color .2s;
  margin-bottom: 10px;
}

.quiz-input:focus { border-color: var(--blue); }
.quiz-input.error { border-color: var(--red); }

.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.field-error {
  font-size: 13px;
  color: var(--red);
  margin-bottom: 12px;
  display: none;
}

.field-error.visible { display: block; }

/* TCPA consent */
.tcpa {
  background: var(--gray-50);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.tcpa input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--blue);
}

.tcpa label {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.6;
  cursor: pointer;
}

.tcpa a { color: var(--blue); text-decoration: underline; }

/* Buttons */
.quiz-btn-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-quiz-next {
  flex: 1;
  padding: 15px 24px;
  background: var(--blue-dark);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background .2s;
}

.btn-quiz-next:hover { background: var(--navy); }
.btn-quiz-next:active { transform: scale(.98); }

.btn-quiz-back {
  padding: 15px 20px;
  background: none;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s, color .2s;
}

.btn-quiz-back:hover { border-color: var(--gray-400); color: var(--gray-800); }

.btn-full { width: 100%; }

/* Trust footer */
.quiz-trust {
  margin-top: 20px;
  text-align: center;
}

.quiz-trust-text {
  font-size: 12px;
  color: var(--gray-400);
  margin-bottom: 12px;
}

.quiz-trust-logos {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.trust-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-400);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.trust-badge:not(:last-child)::after {
  content: '·';
  margin-left: 16px;
  color: var(--gray-200);
}

.thankyou-link {
  display: inline-block;
  padding: 14px 28px;
  background: var(--blue-dark);
  color: white;
  border-radius: 6px;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background .2s;
}
.thankyou-link:hover { background: var(--navy); }

/* Loading screen */
#step-loading .loading-inner {
  text-align: center;
  padding: 20px 0;
}

.loading-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  margin-bottom: 32px;
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
  max-width: 320px;
  margin: 0 auto 32px;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  color: var(--gray-400);
  font-weight: 500;
  transition: color .3s;
}

.loading-step.done { color: var(--green); }
.loading-step.active { color: var(--blue); }

.loading-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: background .3s;
}

.loading-step.done .loading-step-icon { background: #dcfce7; }
.loading-step.active .loading-step-icon { background: #dbeafe; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Thank you screen */
#step-thankyou {
  text-align: center;
}

.thankyou-icon {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #dcfce7;
  color: var(--green-dark);
  font-size: 32px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.thankyou-title {
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 900;
  color: var(--gray-800);
  margin-bottom: 12px;
}

.thankyou-sub {
  font-size: 16px;
  color: var(--gray-600);
  line-height: 1.65;
  margin-bottom: 28px;
}

.thankyou-bullets {
  background: var(--gray-50);
  border-radius: 12px;
  padding: 20px 24px;
  text-align: left;
  margin-bottom: 28px;
}

.thankyou-bullets li {
  font-size: 14px;
  color: var(--gray-800);
  padding: 6px 0;
  padding-left: 24px;
  position: relative;
  line-height: 1.5;
}

.thankyou-bullets li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

@media (max-width: 560px) {
  .quiz-card { padding: 28px 20px 24px; border-radius: 16px; }
  .input-group { grid-template-columns: 1fr; }
}
