/* StorySongfy — quiz (create-your-song) styles
   Structurally mirrors the unique-song.com Tally quiz design system:
   centered single-column flow, white pill option cards with a filled
   accent state, bottom-right Next button, "← Back" link, slide transitions. */

.quiz-shell {
  background: var(--cream);
  min-height: calc(100vh - 60px);
}

/* Header simples e centralizado — mesmo tratamento da wait.php, sem nav
   nem botão de CTA, pra não competir com o próprio quiz (que já é o CTA). */
.quiz-header {
  display: flex; align-items: center; justify-content: center;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.quiz-header a { display: inline-flex; }
.quiz-header img { height: 54px; width: auto; display: block; margin: 0 auto; }

.quiz-page {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px 100px;
  display: none;
  flex-direction: column;
  min-height: calc(100vh - 160px);
  justify-content: center;
}
.quiz-page.is-active { display: flex; }

.quiz-page.rh-slide-right { animation: rh-slide-in-right 0.3s ease-out both; }
.quiz-page.rh-slide-left { animation: rh-slide-in-left 0.3s ease-out both; }
@keyframes rh-slide-in-right { from { opacity: 0; transform: translateX(40px);} to { opacity: 1; transform: translateX(0);} }
@keyframes rh-slide-in-left  { from { opacity: 0; transform: translateX(-40px);} to { opacity: 1; transform: translateX(0);} }

.quiz-back {
  align-self: flex-start;
  font-size: 14px;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 4px 0;
  margin-bottom: 8px;
  cursor: pointer;
  font-family: inherit;
}
.quiz-back:hover { color: var(--ink); }

.quiz-h1 {
  font-family: 'Playfair Display', Georgia, serif;
  text-align: center;
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 6px;
}
.quiz-sub {
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 0 22px;
}

.quiz-label {
  font-weight: 700;
  color: var(--ink);
  font-size: 20px;
  margin: 18px 0 10px;
}
.quiz-label:first-of-type { margin-top: 0; }

.quiz-tip {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 8px;
}

.quiz-options { display: flex; flex-direction: column; gap: 6px; }

.quiz-label-center { text-align: center; }

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
}
.quiz-options-grid .quiz-option { padding: 10px 12px; font-size: 14px; }
.quiz-options-grid .quiz-badge { width: 17px; height: 17px; min-width: 17px; margin-right: 9px; }
.quiz-option-full { grid-column: 1 / -1; }

.quiz-other-wrap { margin-top: 8px; display: none; }
.quiz-other-wrap.is-open { display: block; }
.quiz-other-wrap .quiz-input { padding: 11px 14px; font-size: 15px; }

/* Compact page-1 spacing so the "who's this for" + name fit one screen on most phones */
.quiz-page.quiz-page-compact { padding: 22px 20px 20px; }
.quiz-page-compact .quiz-h1 { font-size: clamp(22px, 4vw, 30px); margin-bottom: 4px; }
.quiz-page-compact .quiz-sub { margin-bottom: 14px; font-size: 14.5px; }
.quiz-page-compact .quiz-label { margin: 14px 0 8px; font-size: 18px; }
.quiz-page-compact .quiz-label:first-of-type { margin-top: 0; }
.quiz-page-compact .quiz-tip { margin-top: 5px; font-size: 12px; }
.quiz-page-compact .quiz-nav { margin-top: 16px; }

.quiz-option {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--white);
  border: none;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s ease;
}
.quiz-option:hover { background: #F5EDE4; }
.quiz-option.is-selected { background: var(--terracotta); color: #fff; font-weight: 600; }

.quiz-badge {
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid var(--terracotta);
  border-radius: 50%;
  margin-right: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.quiz-option.is-selected .quiz-badge {
  background: #fff; border-color: #fff;
}
.quiz-option.is-selected .quiz-badge::after {
  content: '✓'; font-size: 12px; font-weight: 700; color: var(--terracotta);
}

.quiz-input, .quiz-textarea, .quiz-select {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  box-sizing: border-box;
}
.quiz-textarea { min-height: 110px; resize: vertical; }
.quiz-input::placeholder, .quiz-textarea::placeholder { color: rgba(36,28,21,0.35); }
.quiz-input:focus, .quiz-textarea:focus, .quiz-select:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(224,122,95,0.15);
}

.quiz-label-optional { font-weight: 500; font-size: 13.5px; color: var(--ink-soft); margin-left: 4px; }

/* ── Seletor de país do telefone — pill leve, sem lib externa (ver
   comentário no create-your-song.php): botão de bandeira + "+" fixo +
   input livre pro código/número, com um painel de busca que abre por
   cima ao clicar na bandeira. ── */
.phone-field {
  position: relative; display: flex; align-items: center;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px;
  padding: 0 14px; box-sizing: border-box;
}
.phone-field:focus-within { border-color: var(--terracotta); box-shadow: 0 0 0 3px rgba(224,122,95,0.15); }
.phone-cc-btn {
  display: flex; align-items: center; gap: 5px; background: none; border: none;
  cursor: pointer; padding: 15px 8px 15px 0; font-family: inherit; flex-shrink: 0;
}
.phone-cc-flag { display: inline-flex; align-items: center; }
.phone-cc-flag img { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(36,28,21,0.12); }
.phone-cc-caret { color: var(--ink-soft); flex-shrink: 0; }
.phone-plus { color: var(--ink-soft); font-size: 16px; padding-right: 3px; }
.phone-number-input {
  flex: 1; min-width: 0; border: none; outline: none; background: none;
  font-family: inherit; font-size: 16px; color: var(--ink); padding: 15px 0 15px 3px;
}
.phone-number-input::placeholder { color: rgba(36,28,21,0.35); }

.phone-cc-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  width: min(320px, 90vw); max-height: 280px;
  background: var(--white); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(36,28,21,0.14); display: flex; flex-direction: column; overflow: hidden;
}
.phone-cc-panel[hidden] { display: none; }
.phone-cc-search {
  border: none; border-bottom: 1px solid var(--line); padding: 12px 14px; font-size: 14px;
  font-family: inherit; outline: none; flex-shrink: 0;
}
.phone-cc-list { overflow-y: auto; }
.phone-cc-divider { height: 1px; background: var(--line); margin: 4px 0; }
.phone-cc-option {
  display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none;
  padding: 9px 14px; font-size: 14px; font-family: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.phone-cc-option:hover { background: #F5EDE4; }
.phone-cc-option-flag { display: inline-flex; align-items: center; flex-shrink: 0; }
.phone-cc-option-flag img { display: block; border-radius: 2px; box-shadow: 0 0 0 1px rgba(36,28,21,0.12); }
.phone-cc-option-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-cc-option-dial { color: var(--ink-soft); flex-shrink: 0; }

.quiz-nav { display: flex; justify-content: flex-end; margin-top: 26px; }
.quiz-next {
  background: var(--terracotta);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 34px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.quiz-next:hover { background: #cc6b52; }
.quiz-next[disabled] { opacity: 0.5; cursor: not-allowed; }

.quiz-error {
  color: #B20110;
  font-size: 13px;
  font-weight: 500;
  margin-top: 6px;
  display: none;
}
.quiz-error.is-visible { display: block; }

/* Page 6 review line */
.quiz-review {
  font-size: 15px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 22px;
}
.quiz-review strong { color: var(--ink); }

/* Submit / redirect overlay */
#quizOverlay {
  position: fixed; inset: 0;
  background: var(--cream);
  z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
#quizOverlay.is-active { opacity: 1; pointer-events: auto; }
#quizOverlay .spinner {
  width: 38px; height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--terracotta);
  border-radius: 50%;
  animation: quiz-spin 0.8s linear infinite;
}
#quizOverlay .spinner-text { font-size: 15px; font-weight: 600; color: var(--ink); }
@keyframes quiz-spin { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .quiz-page { padding: 32px 18px 80px; }
  .quiz-h1 { font-size: 26px; }
}
