/* Quiz Treino Combinado — design system reusa tokens do /site */

:root {
  --fundo: #FFFFFF;
  --superficie: #F4F4F6;
  --card: #FFFFFF;
  --card-2: #F8F8FA;
  --borda: #E5E5EA;
  --borda-forte: #D1D1D8;

  --texto: #18181D;
  --texto-sec: #6B6B7A;

  --acento: #4071FF;
  --acento-hover: #305AE0;
  --acento-suave: rgba(64, 113, 255, .08);

  --sucesso: #22c55e;
  --erro: #ef4444;

  --progress-fill: linear-gradient(92deg, #4071FF 0%, #6FA8FF 100%);

  --radius-card: 16px;
  --radius-btn: 12px;
}

html[data-gender="fem"] {
  --acento: #FF4D8F;
  --acento-hover: #E03A78;
  --acento-suave: rgba(255, 77, 143, .08);
  --progress-fill: linear-gradient(92deg, #FF4D8F 0%, #FFA0C2 100%);
}

html[data-gender="masc"] {
  --acento: #4071FF;
  --acento-hover: #305AE0;
  --acento-suave: rgba(64, 113, 255, .08);
  --progress-fill: linear-gradient(92deg, #4071FF 0%, #6FA8FF 100%);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--superficie);
  color: var(--texto);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input { font-family: inherit; }

/* Layout principal */
.shell {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 20px 32px;
  background: var(--fundo);
  display: flex;
  flex-direction: column;
}

/* Topo: voltar + progress */
.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 36px;
}

.back-btn {
  background: transparent;
  border: 0;
  color: var(--texto-sec);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  visibility: hidden;
}
.back-btn:hover, .back-btn:focus-visible {
  background: var(--superficie);
  color: var(--texto);
}

.progress-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress {
  flex: 1;
  height: 6px;
  background: var(--borda);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--progress-fill);
  width: 0%;
  border-radius: 999px;
  transition: width 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-text {
  font-size: 0.7rem;
  color: var(--texto-sec);
  font-weight: 600;
  min-width: 28px;
  text-align: right;
}

/* Step container */
.stage { flex: 1; display: flex; flex-direction: column; }

.step {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.fade-in { animation: fadeIn 220ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Imagem de step (topo) */
.step-image {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--superficie);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Result e loading: imagem aparece 100% sem crop nem altura fixa (deixa container seguir foto) */
.step-result .step-image,
.step-loading .step-image {
  aspect-ratio: auto;
  height: auto;
  background: transparent;
}
.step-result .step-image img,
.step-loading .step-image img {
  height: auto;
  width: 100%;
  max-height: none;
}

/* Texto */
.headline {
  font-family: 'Anton', 'Inter', sans-serif;
  font-size: clamp(1.5rem, 7vw, 2rem);
  line-height: 1.1;
  font-weight: 400;
  margin: 0;
  letter-spacing: 0.5px;
}
.headline-form {
  font-size: clamp(1.25rem, 5.5vw, 1.5rem);
  font-weight: 800;
  margin: 0;
  line-height: 1.2;
}
.subheadline {
  font-size: 0.95rem;
  color: var(--texto-sec);
  line-height: 1.5;
  margin: 0;
}
.question {
  font-size: clamp(1.15rem, 5vw, 1.4rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.3;
}
.hint {
  font-size: 0.85rem;
  color: var(--texto-sec);
  margin: -8px 0 0 0;
}

/* Botões */
.btn-primary {
  background: var(--acento);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  border: 0;
  border-radius: var(--radius-btn);
  padding: 14px 20px;
  cursor: pointer;
  transition: background 150ms, transform 100ms;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 4px;
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--acento-hover);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }

.btn-secondary {
  background: var(--superficie);
  color: var(--texto);
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--borda);
  border-radius: var(--radius-btn);
  padding: 12px 18px;
  cursor: pointer;
}

.arrow { font-weight: 600; }

/* Opções de choice texto */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option {
  background: var(--card);
  color: var(--texto);
  border: 1px solid var(--borda);
  border-radius: var(--radius-btn);
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: all 150ms;
}
@media (hover: hover) {
  .option:hover {
    border-color: var(--acento);
    background: var(--acento-suave);
  }
}
.option:focus-visible {
  border-color: var(--acento);
  background: var(--acento-suave);
}
.option:active { transform: scale(0.98); }

/* Opções visuais (com imagem) */
.options-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.option-visual {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--radius-card);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 150ms;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.3;
  color: var(--texto);
}
@media (hover: hover) {
  .option-visual:hover {
    border-color: var(--acento);
    background: var(--acento-suave);
  }
}
.option-visual:focus-visible {
  border-color: var(--acento);
  background: var(--acento-suave);
}
.option-visual:active { transform: scale(0.98); }

.option-visual[data-gender-preview="fem"] {
  border-color: #FF4D8F;
  color: #FF4D8F;
  background: rgba(255, 77, 143, .06);
}
.option-visual[data-gender-preview="masc"] {
  border-color: #4071FF;
  color: #4071FF;
  background: rgba(64, 113, 255, .06);
}
@media (hover: hover) {
  .option-visual[data-gender-preview="fem"]:hover {
    border-color: #E03A78;
    background: rgba(255, 77, 143, .14);
  }
  .option-visual[data-gender-preview="masc"]:hover {
    border-color: #305AE0;
    background: rgba(64, 113, 255, .14);
  }
}
.option-image {
  width: 100%;
  aspect-ratio: 1/1;
  background: var(--superficie);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.option-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.option-label {
  padding: 4px 4px 6px;
  color: var(--acento);
  font-weight: 700;
}

/* Trust badges */
.trust-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--texto-sec);
}
.badge { line-height: 1.4; }

/* Loading */
.step-loading {
  align-items: center;
  text-align: center;
  padding: 40px 0;
}
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--borda);
  border-top-color: var(--acento);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg {
  font-size: 1rem;
  color: var(--texto);
  font-weight: 600;
  transition: opacity 150ms;
}
.loading-msg.fade-out { opacity: 0; }

/* Result */
.step-result {
  gap: 12px;
  padding-bottom: 96px; /* reserva espaço pro CTA sticky */
}
.result-header { display: flex; flex-direction: column; gap: 8px; }
.result-body { display: flex; flex-direction: column; gap: 12px; }
.result-cta-sticky {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(255,255,255,0.0) 0%, rgba(255,255,255,0.95) 30%, #fff 100%);
  display: flex;
  justify-content: center;
  z-index: 50;
}
.result-cta-sticky .btn-primary {
  width: 100%;
  max-width: 420px;
  font-size: 1.05rem;
  padding: 16px 20px;
  box-shadow: 0 6px 20px rgba(64,113,255,0.35);
}
.result-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--texto-sec);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.result-name {
  font-family: 'Anton', 'Inter', sans-serif;
  font-size: clamp(1.7rem, 8vw, 2.2rem);
  font-weight: 400;
  margin: 0;
  line-height: 1.1;
  background: var(--progress-fill);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.5px;
}
.pitch-paragraph {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--texto);
  margin: 0;
}
.bullets {
  background: var(--superficie);
  border-radius: var(--radius-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.bullets-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--texto-sec);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.bullet { font-size: 0.9rem; line-height: 1.4; color: var(--texto); }

/* Form (capture) */
.step-form { gap: 12px; }
.capture-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texto);
}
.field input {
  background: var(--card);
  border: 1px solid var(--borda);
  border-radius: var(--radius-btn);
  padding: 12px 14px;
  font-size: 1rem;
  color: var(--texto);
  transition: border-color 150ms;
}
.field input:focus {
  outline: none;
  border-color: var(--acento);
  background: #fff;
}
.field input[aria-invalid="true"] { border-color: var(--erro); }
.field-error {
  color: var(--erro);
  font-size: 0.8rem;
  min-height: 1em;
}
/* Feedback positivo (ex.: CPF válido) — sobrescreve o vermelho do .field-error */
.field-error.field-ok {
  color: #1a7f37;
}
.field-help {
  font-size: 0.68rem;
  color: var(--texto-sec);
  line-height: 1.35;
  margin-top: 2px;
}

/* Thanks */
.step-thanks {
  align-items: center;
  text-align: center;
  padding-top: 40px;
}
.thanks-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--sucesso);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tablet+: container um pouco mais largo */
@media (min-width: 640px) {
  .shell { max-width: 480px; padding: 24px 24px 40px; }
}

/* === Cover (start) === */
.shell:has(.step-cover) .top-bar { display: none; }
.shell:has(.step-cover) { padding: 0 0 24px; }

.step-cover {
  gap: 20px;
  align-items: stretch;
}

.cover-image {
  width: 100%;
  line-height: 0;
  border-radius: 0 0 18px 18px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: block;
  outline: none;
}
.cover-image:active { transform: scale(0.995); }
.cover-image:focus,
.cover-image:focus-visible { outline: none; box-shadow: none; }
.cover-image img {
  width: 100%;
  height: auto;
  display: block;
}

.btn-cta-cover {
  position: relative;
  margin: 4px 20px 0;
  padding: 20px 24px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #18a532 0%, #1ec040 50%, #18a532 100%);
  color: #fff;
  font-family: 'Anton', 'Inter', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 0 0 0 rgba(30, 192, 64, 0.6),
    0 12px 28px -8px rgba(24, 165, 50, 0.55),
    inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  animation: ctaPulse 1.4s ease-in-out infinite, ctaBounce 2.2s ease-in-out infinite;
  transition: transform 120ms;
}
.btn-cta-cover:hover,
.btn-cta-cover:focus-visible {
  outline: none;
  filter: brightness(1.05);
}
.btn-cta-cover:active {
  transform: scale(0.97);
  animation-play-state: paused;
}

.btn-cta-cover-label {
  position: relative;
  z-index: 2;
  display: inline-block;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.btn-cta-cover-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 80%
  );
  transform: skewX(-20deg);
  animation: ctaShine 2.4s ease-in-out infinite;
  pointer-events: none;
  z-index: 1;
}

@keyframes ctaPulse {
  0%, 100% {
    box-shadow:
      0 0 0 0 rgba(30, 192, 64, 0.55),
      0 12px 28px -8px rgba(24, 165, 50, 0.55),
      inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 14px rgba(30, 192, 64, 0),
      0 16px 32px -8px rgba(24, 165, 50, 0.7),
      inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  }
}

@keyframes ctaBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-4px) scale(1.025); }
}

@keyframes ctaShine {
  0%   { left: -60%; }
  60%  { left: 120%; }
  100% { left: 120%; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-cta-cover,
  .btn-cta-cover-shine { animation: none; }
}
