/* =========================================================
   Quiz Funnel Builder — Public Quiz Styles
   ========================================================= */

.qfb-quiz-container {
  --qfb-primary: #6366f1;
  --qfb-btn: #6366f1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
  max-width: 560px;
  margin: 0 auto;
  box-sizing: border-box;
}

.qfb-quiz-container * { box-sizing: border-box; }

/* ── Quiz Card Shell ───────────────────────────────────── */
.qfb-quiz-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
}

/* ── Progress Bar ──────────────────────────────────────── */
.qfb-progress-wrap { height: 5px; background: #f1f5f9; }
.qfb-progress-bar {
  height: 100%; background: var(--qfb-primary);
  transition: width .4s cubic-bezier(.4,0,.2,1);
  border-radius: 0 3px 3px 0;
}

/* ── Screens ───────────────────────────────────────────── */
.qfb-screen { padding: 36px 32px; animation: qfbFadeIn .3s ease; }
@keyframes qfbFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Cover */
.qfb-cover { text-align: center; }
.qfb-cover__img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-bottom: 20px; }
.qfb-cover__title { font-size: 1.6rem; font-weight: 800; color: #1e293b; margin: 0 0 10px; line-height: 1.2; }
.qfb-cover__desc { color: #64748b; font-size: 1rem; margin: 0 0 24px; line-height: 1.6; }

/* Question */
.qfb-question__progress-text { font-size: 12px; color: #94a3b8; margin-bottom: 10px; font-weight: 500; }
.qfb-question__img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 10px; margin-bottom: 16px; }
.qfb-question__text { font-size: 1.2rem; font-weight: 700; color: #1e293b; margin: 0 0 6px; line-height: 1.35; }
.qfb-question__desc { font-size: 0.9rem; color: #64748b; margin: 0 0 20px; }

/* Answers */
.qfb-answers { display: flex; flex-direction: column; gap: 10px; }
.qfb-answer {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 10px;
  border: 2px solid #e2e8f0; cursor: pointer;
  transition: all .15s; background: #fff;
  font-size: 14px; font-weight: 500; color: #1e293b;
  text-align: left;
}
.qfb-answer:hover { border-color: var(--qfb-primary); background: color-mix(in srgb, var(--qfb-primary) 5%, white); }
.qfb-answer.is-selected { border-color: var(--qfb-primary); background: color-mix(in srgb, var(--qfb-primary) 8%, white); }
.qfb-answer__check {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.qfb-answer.is-selected .qfb-answer__check { background: var(--qfb-primary); border-color: var(--qfb-primary); }
.qfb-answer__check-dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0; transition: opacity .15s; }
.qfb-answer.is-selected .qfb-answer__check-dot { opacity: 1; }
.qfb-answer__img { width: 60px; height: 45px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.qfb-answer__text { flex: 1; }

/* Image grid layout */
.qfb-answers--image { flex-direction: row; flex-wrap: wrap; }
.qfb-answers--image .qfb-answer { flex-direction: column; text-align: center; width: calc(50% - 5px); padding: 12px; }
.qfb-answers--image .qfb-answer__img { width: 100%; height: 90px; margin-bottom: 8px; }

/* Scale */
.qfb-scale-wrap { padding: 8px 0; }
.qfb-scale-labels { display: flex; justify-content: space-between; font-size: 11px; color: #94a3b8; margin-bottom: 10px; }
.qfb-scale-buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.qfb-scale-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid #e2e8f0; background: #fff; cursor: pointer;
  font-size: 14px; font-weight: 700; color: #64748b; transition: all .15s;
}
.qfb-scale-btn:hover, .qfb-scale-btn.is-selected { background: var(--qfb-primary); border-color: var(--qfb-primary); color: #fff; }

/* Text input */
.qfb-text-answer {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 2px solid #e2e8f0; font-size: 14px; color: #1e293b;
  transition: border .15s; resize: none; min-height: 90px;
}
.qfb-text-answer:focus { outline: none; border-color: var(--qfb-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--qfb-primary) 15%, transparent); }

/* Navigation */
.qfb-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; gap: 12px; }
.qfb-nav .qfb-btn-next { margin-left: auto; }

/* ── Main Button ───────────────────────────────────────── */
.qfb-btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 13px 28px; border-radius: 10px;
  background: var(--qfb-btn); color: #fff;
  font-size: 15px; font-weight: 700; border: none; cursor: pointer;
  transition: filter .15s, transform .1s;
  text-decoration: none; line-height: 1;
}
.qfb-btn-primary:hover { filter: brightness(1.1); }
.qfb-btn-primary:active { transform: scale(.97); }
.qfb-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.qfb-btn-back {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 16px; border-radius: 10px;
  background: transparent; color: #64748b;
  font-size: 14px; font-weight: 500; border: 1px solid #e2e8f0; cursor: pointer;
  transition: all .15s;
}
.qfb-btn-back:hover { background: #f8fafc; color: #1e293b; }

/* ── Lead Capture Screen ───────────────────────────────── */
.qfb-lead { text-align: center; }
.qfb-lead__title { font-size: 1.4rem; font-weight: 800; color: #1e293b; margin: 0 0 8px; }
.qfb-lead__desc { color: #64748b; margin: 0 0 24px; }
.qfb-lead__form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.qfb-lead__input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 2px solid #e2e8f0; font-size: 14px; color: #1e293b;
  transition: border .15s;
}
.qfb-lead__input:focus { outline: none; border-color: var(--qfb-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--qfb-primary) 15%, transparent); }
.qfb-lead__gdpr { font-size: 11px; color: #94a3b8; line-height: 1.5; margin-top: 4px; }
.qfb-lead__skip { background: none; border: none; color: #94a3b8; cursor: pointer; font-size: 12px; margin-top: 10px; text-decoration: underline; display: block; width: 100%; text-align: center; }
.qfb-lead__skip:hover { color: #64748b; }

/* ── Result Screen ─────────────────────────────────────── */
.qfb-result { text-align: center; }
.qfb-result__badge { display: inline-block; padding: 4px 14px; border-radius: 20px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--qfb-primary) 12%, white); color: var(--qfb-primary); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 12px; }
.qfb-result__img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; margin-bottom: 20px; }
.qfb-result__title { font-size: 1.5rem; font-weight: 800; color: #1e293b; margin: 0 0 10px; }
.qfb-result__desc { color: #64748b; line-height: 1.7; margin: 0 0 24px; font-size: 0.95rem; }
.qfb-result__cta-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qfb-result__retake { background: none; border: none; color: #94a3b8; font-size: 13px; cursor: pointer; text-decoration: underline; }
.qfb-result__retake:hover { color: #64748b; }
.qfb-result__embed { margin-top: 20px; }

/* ── Loading ────────────────────────────────────────────── */
.qfb-loading { text-align: center; padding: 48px; color: #94a3b8; }
.qfb-spinner {
  width: 32px; height: 32px; border: 3px solid #e2e8f0;
  border-top-color: var(--qfb-primary); border-radius: 50%;
  animation: qfbSpin .7s linear infinite; margin: 0 auto 12px;
}
@keyframes qfbSpin { to { transform: rotate(360deg); } }

/* ── Error ──────────────────────────────────────────────── */
.qfb-error { text-align: center; padding: 36px; color: #ef4444; }
