/* =====================================================================
   FIORIN IMÓVEIS — Formulário de Qualificação (Imóveis Prontos)
   Mobile-first • CSS puro • sem frameworks
   ---------------------------------------------------------------------
   ⚠️  TROCAR CORES AQUI:  edite as variáveis em :root abaixo.
   ===================================================================== */

:root {
  /* ===== CORES PRINCIPAIS (editar aqui) ===== */
  --azul-primario: #0B5FFF;   /* azul royal — botões, destaques */
  --azul-escuro:   #0A2540;   /* azul escuro — títulos, base */
  --azul-claro:    #E8F0FF;   /* azul bem claro — fundos suaves */
  --branco:        #FFFFFF;
  --cinza-claro:   #F4F6FA;   /* fundo de apoio */
  --cinza-borda:   #DDE3EC;
  --cinza-texto:   #5B6776;   /* texto secundário */
  --verde-whats:   #25D366;   /* botão WhatsApp */
  --verde-whats-d: #1EBE5A;

  /* ===== Derivados ===== */
  --azul-grad: linear-gradient(135deg, var(--azul-primario) 0%, #0A47C2 100%);
  --sombra-btn: 0 8px 20px rgba(11, 95, 255, 0.28);
  --sombra-card: 0 12px 40px rgba(10, 37, 64, 0.10);
  --raio: 16px;
  --raio-btn: 14px;

  --fonte: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== Reset básico ===== */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--fonte);
  color: var(--azul-escuro);
  background: var(--branco);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }

/* Garante que o atributo [hidden] funcione mesmo em elementos com display custom */
[hidden] { display: none !important; }

/* Emojis em imagem (assets/emoji-*.png) usados dentro de textos */
.emoji {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  object-fit: contain;
  vertical-align: -0.18em;   /* alinha com a linha do texto */
  margin-right: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Foco visível (acessibilidade) */
:focus-visible {
  outline: 3px solid var(--azul-primario);
  outline-offset: 2px;
}

/* =====================================================================
   LAYOUT BASE — container centralizado, mobile-first
   ===================================================================== */
.app {
  width: 100%;
  max-width: 520px;          /* limite confortável no desktop */
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px 18px 32px;
  display: flex;
  flex-direction: column;
}

/* ===== Telas (cada bloco) ===== */
.tela { display: none; flex-direction: column; flex: 1; }
.tela.is-active {
  display: flex;
  animation: fadeIn 0.45s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   BOTÕES
   ===================================================================== */
.btn {
  font-family: inherit;
  font-weight: 600;
  border: none;
  cursor: pointer;
  border-radius: var(--raio-btn);
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }

/* CTA principal */
.btn--cta {
  width: 100%;
  background: var(--azul-grad);
  color: var(--branco);
  font-size: 1.06rem;
  font-weight: 700;
  padding: 17px 20px;
  box-shadow: var(--sombra-btn);
  letter-spacing: 0.2px;
}
.btn--cta:hover { box-shadow: 0 10px 26px rgba(11,95,255,0.38); transform: translateY(-2px); }
.btn--cta:active { transform: translateY(0) scale(0.98); }
.btn--cta:disabled {
  background: var(--cinza-borda);
  color: #9AA6B5;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

/* Botões de opção (Sim/Não) */
.opcoes { display: flex; flex-direction: column; gap: 12px; }
.btn--opcao {
  width: 100%;
  background: var(--branco);
  color: var(--azul-escuro);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 20px;
  border: 2px solid var(--cinza-borda);
  box-shadow: 0 4px 14px rgba(10,37,64,0.05);
  text-align: center;
}
.btn--opcao:hover { border-color: var(--azul-primario); background: var(--azul-claro); }
.btn--opcao.is-selected {
  border-color: var(--azul-primario);
  background: var(--azul-claro);
  color: var(--azul-primario);
  box-shadow: var(--sombra-btn);
}

.btn--continuar { margin-top: 26px; }

/* ===== Pulsação das CTAs da capa e da conclusão ===== */
@keyframes pulsar {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.035); }
  100% { transform: scale(1); }
}
#btnIniciar,
#btnWhatsapp {
  animation: pulsar 1.8s ease-in-out infinite;
}
/* Pausa a pulsação ao passar o mouse/tocar para o hover/tap funcionar bem */
#btnIniciar:hover,
#btnWhatsapp:hover,
#btnIniciar:active,
#btnWhatsapp:active {
  animation-play-state: paused;
}

/* =====================================================================
   BLOCO 1 — CAPA
   ===================================================================== */
.capa__topo { display: flex; justify-content: center; margin-bottom: 16px; }
.capa__logo { height: 48px; width: auto; }

.carrossel {
  position: relative;
  border-radius: var(--raio);
  overflow: hidden;
  box-shadow: var(--sombra-card);
  background: var(--cinza-claro);
}
.carrossel__track {
  display: flex;
  transition: transform 0.5s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.carrossel__slide {
  min-width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--azul-claro);
}
.carrossel__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Setas */
.carrossel__seta {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.86);
  color: var(--azul-escuro);
  font-size: 1.6rem;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10,37,64,0.18);
  transition: background 0.2s ease, transform 0.12s ease;
}
.carrossel__seta:hover { background: var(--branco); }
.carrossel__seta:active { transform: translateY(-50%) scale(0.9); }
.carrossel__seta--prev { left: 10px; }
.carrossel__seta--next { right: 10px; }

/* Dots */
.carrossel__dots {
  position: absolute;
  bottom: 12px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 8px;
}
.carrossel__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}
.carrossel__dot.is-active {
  width: 22px;
  border-radius: 5px;
  background: var(--branco);
}

/* Conteúdo da capa */
.capa__conteudo {
  text-align: center;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.capa__selo {
  display: inline-block;
  background: var(--azul-claro);
  color: var(--azul-primario);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.capa__titulo {
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.2;
  color: var(--azul-escuro);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
.capa__descricao {
  font-size: 1rem;
  color: var(--cinza-texto);
  max-width: 40ch;
  margin-bottom: 20px;
}

/* Bloco de prova / autoridade — grade 2×2 de stat cards */
.capa__provas {
  list-style: none;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.prova {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  background: var(--branco);
  border: 1px solid var(--cinza-borda);
  border-radius: 14px;
  padding: 16px 12px;
  box-shadow: 0 4px 14px rgba(10, 37, 64, 0.05);
}
.prova__icone {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 2px;
}
.prova__valor {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--azul-escuro);
  line-height: 1.15;
  letter-spacing: -0.3px;
}
.prova__label {
  font-size: 0.76rem;
  color: var(--cinza-texto);
  line-height: 1.3;
}
.capa__conteudo .btn--cta { margin-top: 4px; }
.capa__tempo {
  font-size: 0.86rem;
  color: var(--cinza-texto);
  margin-top: 14px;
}

/* =====================================================================
   BLOCO 2 — QUIZ
   ===================================================================== */
.quiz__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  min-height: 32px;
}
.quiz__voltar {
  background: none;
  border: none;
  color: var(--cinza-texto);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  visibility: hidden;        /* escondido na etapa 1; JS controla */
}
.quiz__voltar span { font-size: 1.3rem; line-height: 1; }
.quiz__voltar:hover { color: var(--azul-primario); }
.quiz__contador {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--azul-primario);
}

.progresso {
  width: 100%;
  height: 8px;
  background: var(--cinza-claro);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 36px;
}
.progresso__barra {
  height: 100%;
  width: 20%;
  background: var(--azul-grad);
  border-radius: 999px;
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
}

.quiz__corpo { position: relative; flex: 1; }

/* Etapas */
.etapa { display: none; }
.etapa.is-active {
  display: block;
  animation: slideIn 0.4s ease both;
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.etapa__pergunta {
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--azul-escuro);
  margin-bottom: 8px;
  letter-spacing: -0.3px;
}
.etapa__ajuda {
  font-size: 0.92rem;
  color: var(--cinza-texto);
  margin-bottom: 22px;
}
.etapa__pergunta + .opcoes { margin-top: 26px; }

/* Campos de input */
.campo__label {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--azul-escuro);
  margin-bottom: 8px;
}
.campo__input {
  width: 100%;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--azul-escuro);
  padding: 16px;
  border: 2px solid var(--cinza-borda);
  border-radius: var(--raio-btn);
  background: var(--branco);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.campo__input::placeholder { color: #9AA6B5; }
.campo__input:focus {
  outline: none;
  border-color: var(--azul-primario);
  box-shadow: 0 0 0 3px rgba(11,95,255,0.15);
}
.campo__input--solo { margin-top: 26px; }

/* Campo moeda (parcela) */
.campo-condicional {
  margin-top: 22px;
  animation: revelar 0.35s ease both;
}
@keyframes revelar {
  from { opacity: 0; transform: translateY(-8px); max-height: 0; }
  to   { opacity: 1; transform: translateY(0); max-height: 200px; }
}
.campo__moeda { position: relative; display: flex; align-items: center; }
.campo__prefixo {
  position: absolute;
  left: 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cinza-texto);
  pointer-events: none;
}
.campo__moeda .campo__input { padding-left: 44px; }

/* =====================================================================
   BLOCO 3 — CONCLUSÃO
   ===================================================================== */
.tela--final { justify-content: center; text-align: center; align-items: center; }
.final__loading,
.final__pronto {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 40ch;
  margin: 0 auto;
  animation: fadeIn 0.5s ease both;
}

.spinner {
  width: 56px; height: 56px;
  border: 5px solid var(--azul-claro);
  border-top-color: var(--azul-primario);
  border-radius: 50%;
  animation: girar 0.9s linear infinite;
  margin-bottom: 26px;
}
@keyframes girar { to { transform: rotate(360deg); } }

.final__check {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--azul-grad);
  color: var(--branco);
  font-size: 2.2rem;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 22px;
  box-shadow: var(--sombra-btn);
  animation: pop 0.5s cubic-bezier(.2,1.4,.5,1) both;
}
@keyframes pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.final__titulo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--azul-escuro);
  margin-bottom: 14px;
  letter-spacing: -0.3px;
}
.final__texto {
  font-size: 1rem;
  color: var(--cinza-texto);
  margin-bottom: 14px;
}
.final__texto--destaque { color: var(--azul-escuro); font-weight: 600; }

.btn--whatsapp {
  background: linear-gradient(135deg, var(--verde-whats) 0%, var(--verde-whats-d) 100%);
  box-shadow: 0 8px 20px rgba(37,211,102,0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}
.btn--whatsapp:hover { box-shadow: 0 10px 26px rgba(37,211,102,0.45); }
/* Ícone do WhatsApp é um PNG preto; o filtro inverte para branco (cor da CTA) */
.btn__icone {
  width: 22px;
  height: 22px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.final__seguranca {
  font-size: 0.82rem;
  color: var(--cinza-texto);
  margin-top: 18px;
}

/* =====================================================================
   DESKTOP / TELAS MAIORES (adaptação a partir do mobile-first)
   ===================================================================== */
@media (min-width: 720px) {
  .app { padding-top: 36px; }
  .capa__logo { height: 56px; }
  .capa__titulo { font-size: 2rem; }
  .etapa__pergunta { font-size: 1.7rem; }
  .carrossel__slide { aspect-ratio: 16 / 10; }
}

/* Respeita preferência por menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
