/* ============================================================
   CLUBE PSI QUE ENCANTA — FORMULÁRIO MULTI-ETAPAS
   Identidade Visual: Roxo · Grafite · Dourado · Creme
   Mobile First
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Botões e campos não herdam a fonte por padrão — força Montserrat em tudo */
button, input, textarea, select { font-family: inherit; }

:root {
  /* Roxo (cor principal da marca — destaques, CTA, seleção) */
  --primary:       #7B52A6;   /* Roxo Encanta */
  --primary-dark:  #5A3882;   /* Roxo Profundo */
  --primary-mid:   #9C7BC0;   /* Roxo do logo */
  --primary-light: #DCCDEB;   /* Lavanda Suave */

  /* Dourado (apenas detalhes — brilhos do logo) */
  --accent:        #E2B851;   /* Dourado */
  --accent-light:  #F6EAC4;   /* Dourado Claro */
  --accent-dark:   #B78F2F;   /* Dourado Profundo */

  /* Neutros quentes */
  --bg:            #F1ECE6;   /* Creme */
  --white:         #FFFFFF;
  --cream:         #FDFCFB;   /* Off-white (mesmo tom do rodapé da foto do hero) */
  --surface:       #F7F4F1;   /* Creme Suave */
  --border:        #E7E0DA;   /* Borda Creme */

  /* Tipografia */
  --ink:           #231F26;   /* Grafite — títulos */
  --text:          #2E2A31;   /* Grafite */
  --text-light:    #57525B;   /* Grafite Médio */
  --text-muted:    #8E8791;   /* Cinza Quente */

  /* Feedback */
  --success:       #22c55e;
  --error:         #ef4444;
  --whatsapp:      #25d366;

  /* Raios */
  --radius-sm:     8px;
  --radius-md:     14px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  /* Sombras */
  --shadow-sm:     0 2px 8px rgba(0,0,0,.04);
  --shadow-md:     0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 40px rgba(0,0,0,.10);
  --shadow-accent: 0 6px 24px rgba(90,56,130,.28);
  --shadow-primary:0 4px 24px rgba(90,56,130,.30);

  /* Fontes */
  --font-sans:     'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --transition:    .22s cubic-bezier(.4,0,.2,1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: var(--text);
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================
   WRAPPER
   ============================================================ */
.form-wrapper {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* ============================================================
   BARRA DE PROGRESSO
   ============================================================ */
.progress-bar-container {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--cream);
  padding: calc(12px + env(safe-area-inset-top)) 20px 8px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(123,82,166,.08);
}

.progress-bar-container.visible { display: flex; }

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-dark), var(--primary), var(--primary-light));
  border-radius: 100px;
  width: var(--progress, 0%);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}

.progress-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 76px;
  text-align: right;
}

/* ============================================================
   SCREENS — SISTEMA DE TRANSIÇÃO
   ============================================================ */
.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  opacity: 0;
  transform: translateX(40px);
  animation: none;
}

.screen.active {
  display: flex;
  opacity: 1;
  transform: translateX(0);
  animation: slideIn var(--transition) forwards;
}

.screen.exit {
  animation: slideOut var(--transition) forwards;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-40px); }
}

.screen.slide-back.active {
  animation: slideInBack var(--transition) forwards;
}

@keyframes slideInBack {
  from { opacity: 0; transform: translateX(-40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   HEADER DAS PERGUNTAS
   ============================================================ */
.screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 20px 0;
}

.btn-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--cream);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-back:hover { background: var(--surface); border-color: var(--primary); }
.btn-back:active { transform: scale(.93); }

.screen-step {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--surface);
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  letter-spacing: .05em;
}

/* ============================================================
   BODY DAS TELAS
   ============================================================ */
.screen-body {
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
}

.screen-body--center {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
  padding: 32px 28px calc(32px + env(safe-area-inset-bottom));
}

/* ============================================================
   TELA 0 — LANDING / HERO
   ============================================================ */
.landing-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Hero: foto + logo (arte única). Ocupa toda a largura, sem moldura; o
   rodapé da própria arte já termina em off-white, igual a --cream. */
.landing-hero {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  background: var(--cream);
  line-height: 0;
}

.landing-hero picture { display: block; }

.landing-hero-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1080 / 1246;
  /* Em celulares baixos, limita a altura para o CTA aparecer sem rolar:
     corta só o topo (fundo acima da cabeça), nunca o logo. 106vw ≈ 92% da
     altura natural (115vw) — garante que o corte máximo seja pequeno. */
  max-height: max(62svh, 106vw);
  object-fit: cover;
  object-position: 50% 100%;
}

/* Funde o rodapé da arte com o fundo, sem emenda visível */
.landing-hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6%;
  background: linear-gradient(to bottom, rgba(253,252,251,0), var(--cream));
  pointer-events: none;
}

/* Conteúdo da landing */
.landing-content {
  padding: 4px 24px calc(28px + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Headline principal */
.landing-title {
  font-family: var(--font-sans);
  font-size: clamp(21px, 6.6vw, 30px);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: .01em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* Subheadline */
.landing-sub {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-light);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 360px;
}

/* ============================================================
   QUESTÕES
   ============================================================ */
.question-hint {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-bottom: 8px;
}

.question-title {
  font-family: var(--font-sans);
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.32;
  margin-bottom: 24px;
  letter-spacing: -.01em;
}

.question-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -16px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ============================================================
   OPÇÕES — LISTA (coluna única)
   ============================================================ */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.option-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-align: left;
  user-select: none;
  -webkit-user-select: none;
  width: 100%;
}

.option-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}

.option-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
}

.option-card:hover {
  border-color: var(--primary);
  background: rgba(123,82,166,.08);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.option-card:active {
  opacity: .75;
}

/* Em dispositivos touch, desativa hover com transform para evitar
   conflito com detecção toque-vs-scroll do iOS Safari */
@media (hover: none) {
  .option-card:hover {
    transform: none;
    box-shadow: none;
  }
}

.option-card.selected {
  border-color: var(--primary-dark);
  background: linear-gradient(135deg, rgba(123,82,166,.12) 0%, rgba(156,123,192,.05) 100%);
  box-shadow: 0 0 0 3px rgba(123,82,166,.18), var(--shadow-sm);
}

.option-card.selected .option-label {
  color: var(--primary-dark);
  font-weight: 600;
}

/* Animação de seleção */
.option-card.selecting {
  animation: selectPulse .3s ease-out;
}

@keyframes selectPulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(.96); }
  100% { transform: scale(1); }
}

/* ============================================================
   INPUTS
   ============================================================ */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.text-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 16px; /* >=16px evita zoom automático ao focar em iOS Safari */
  font-family: var(--font-sans);
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
}

.text-area {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
  font-family: var(--font-sans);
}

.text-input::placeholder { color: var(--text-muted); font-weight: 400; }

.text-input:focus {
  border-color: var(--primary);
  background: var(--cream);
  box-shadow: 0 0 0 3px rgba(123,82,166,.20);
}

.text-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(239,68,68,.12);
}

.input-error {
  font-size: 12px;
  font-weight: 500;
  color: var(--error);
  display: none;
  align-items: center;
  gap: 4px;
}

.input-error.visible { display: flex; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn-primary {
  width: 100%;
  padding: 17px 24px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .06em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  box-shadow: var(--shadow-accent);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.18) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 30px rgba(90,56,130,.38); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

/* Spinner */
.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* Botão WhatsApp */
.btn-whatsapp {
  width: 100%;
  max-width: 300px;
  padding: 17px 24px;
  background: var(--whatsapp);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .03em;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(37,211,102,.35);
  -webkit-tap-highlight-color: transparent;
}

.btn-whatsapp:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-whatsapp:active { transform: scale(.97); }

/* Nota de privacidade */
.privacy-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

/* ============================================================
   TELA DE SUCESSO
   ============================================================ */
#successContent {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.success-animation { margin-bottom: 4px; }

.success-circle {
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.checkmark {
  width: 80px;
  height: 80px;
}

.checkmark-circle {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-miterlimit: 10;
  animation: stroke .6s cubic-bezier(.65,0,.45,1) forwards;
}

.checkmark-check {
  stroke: var(--success);
  stroke-width: 2;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: stroke .3s cubic-bezier(.65,0,.45,1) .5s forwards;
}

@keyframes stroke { 100% { stroke-dashoffset: 0; } }

.success-title {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-dark);
  letter-spacing: -.02em;
}

.success-text {
  font-size: 15px;
  color: var(--text-light);
  line-height: 1.65;
  max-width: 290px;
}

.redirect-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.loader-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  animation: bounce 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: .2s; }
.dot:nth-child(3) { animation-delay: .4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(.8); opacity: .4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.redirect-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   LANDING — AJUSTES FINAIS
   ============================================================ */
.landing-content .btn-primary {
  max-width: 100%;
}

/* ============================================================
   MENSAGEM DE ERRO NO ENVIO
   ============================================================ */
.submit-error {
  margin-top: 14px;
  padding: 14px 16px;
  background: rgba(239,68,68,.08);
  border: 1.5px solid rgba(239,68,68,.30);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: #b91c1c;
  line-height: 1.55;
  text-align: center;
}

/* ============================================================
   UTILS
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVO — Desktop
   ============================================================ */
@media (min-width: 480px) {
  body {
    align-items: center;
    padding: 32px 16px;
    background: var(--bg);
  }

  .form-wrapper {
    min-height: auto;
    border-radius: var(--radius-xl);
    box-shadow: 0 12px 48px rgba(90,56,130,.10), 0 4px 16px rgba(0,0,0,.05);
    overflow: hidden;
  }

  .landing-hero-img { max-height: none; }
  .landing-body { min-height: auto; }
}

@media (min-width: 768px) {
  .question-title   { font-size: 24px; }
  .success-title    { font-size: 30px; }
}

/* Celulares estreitos (≤359px): mantém o CTA em uma linha */
@media (max-width: 359px) {
  .btn-primary {
    font-size: 13px;
    letter-spacing: .04em;
    padding: 17px 16px;
    gap: 8px;
  }
}
