/* WP Formulário Simples — estilos do formulário conversacional */

.wpfs-wrap {
  /* Variáveis sobrescritas inline pelas Configurações */
  --wpfs-accent: #2E4BE8;
  --wpfs-accent-dark: #2138B8;
  --wpfs-bg: #FBFBFA;
  --wpfs-ink: #101218;
  --wpfs-ink-soft: #5C6070;
  --wpfs-btn-ink: #FFFFFF;
  --wpfs-radius: 12px;
  --wpfs-height: 620px;

  /* Fallbacks para navegadores antigos (sobrescritos abaixo quando color-mix existe) */
  --wpfs-line: #E4E5EC;
  --wpfs-card: #FFFFFF;
  --wpfs-tint: #EEF1FD;
  --wpfs-accent-border: #C6CFF5;
  --wpfs-line: color-mix(in srgb, var(--wpfs-ink) 12%, var(--wpfs-bg));
  --wpfs-card: color-mix(in srgb, #fff 92%, var(--wpfs-bg));
  --wpfs-tint: color-mix(in srgb, var(--wpfs-accent) 8%, var(--wpfs-bg));
  --wpfs-accent-border: color-mix(in srgb, var(--wpfs-accent) 30%, var(--wpfs-bg));
  --wpfs-error: #D64545;
  --wpfs-ok: #17A56C;
  --wpfs-spring: cubic-bezier(.34, 1.3, .44, 1);

  position: relative;
  min-height: var(--wpfs-height);
  background: var(--wpfs-bg);
  color: var(--wpfs-ink);
  border-radius: var(--wpfs-radius);
  overflow: hidden;
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
}

/* Imagem de fundo do formulário */
.wpfs-wrap--bgimage::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--wpfs-bg-image);
  background-size: cover;
  background-position: center;
  z-index: 0;
  opacity: 1;
}
.wpfs-wrap--bgimage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--wpfs-bg);
  opacity: .82;
  z-index: 0;
}
.wpfs-wrap--bgimage > * { position: relative; z-index: 1; }

/* Logo centralizada, acima do conteúdo de cada tela */
.wpfs-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}
.wpfs-logo img {
  max-height: 60px;
  max-width: 240px;
  width: auto;
  display: block;
}
@media (max-width: 640px) {
  .wpfs-logo img { max-height: 46px; }
  .wpfs-logo { margin-bottom: 16px; }
}

/* Botão Retornar ao site */
.wpfs-wrap .wpfs-voltar {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  color: var(--wpfs-ink-soft);
  background: color-mix(in srgb, var(--wpfs-bg) 80%, transparent);
  border: 1px solid var(--wpfs-line);
  border-radius: var(--wpfs-radius);
  padding: 8px 15px;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s;
  backdrop-filter: blur(4px);
}
.wpfs-wrap .wpfs-voltar:hover {
  color: var(--wpfs-accent);
  border-color: var(--wpfs-accent);
}
.wpfs-voltar svg { width: 15px; height: 15px; }
@media (max-width: 640px) {
  .wpfs-voltar span, .wpfs-voltar { font-size: 13px; padding: 7px 12px; }
  .wpfs-logo img { max-height: 40px; }
}
.wpfs-wrap *, .wpfs-wrap *::before, .wpfs-wrap *::after { box-sizing: border-box; }

/* ---------- Progresso ---------- */
.wpfs-progress {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 4px;
  background: var(--wpfs-line);
  z-index: 5;
}
.wpfs-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--wpfs-accent);
  transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ---------- Palco ---------- */
.wpfs-stage {
  position: relative;
  min-height: var(--wpfs-height);
  width: 100%;
}

.wpfs-step {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 28px 80px;
  opacity: 0;
  transform: translateY(60px);
  transition: opacity .5s ease, transform .55s cubic-bezier(.3, .9, .3, 1);
  pointer-events: none;
  visibility: hidden;
  margin: 0;
}
.wpfs-step.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  visibility: visible;
}
.wpfs-step.is-above { transform: translateY(-60px); }

.wpfs-step__inner { width: 100%; max-width: 640px; }

/* Entrada em cascata */
.wpfs-step__inner > * { opacity: 0; transform: translateY(14px); }
.wpfs-step.is-active .wpfs-step__inner > * { animation: wpfsRise .5s var(--wpfs-spring) both; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(1) { animation-delay: .08s; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(2) { animation-delay: .15s; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(3) { animation-delay: .22s; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(4) { animation-delay: .29s; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(5) { animation-delay: .36s; }
.wpfs-step.is-active .wpfs-step__inner > *:nth-child(6) { animation-delay: .43s; }
@keyframes wpfsRise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Pergunta ---------- */
.wpfs-step__index {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--wpfs-accent);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}
.wpfs-step__index svg { width: 13px; height: 13px; }

.wpfs-wrap .wpfs-question {
  font-size: clamp(22px, 3.4vw, 32px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
  color: var(--wpfs-ink);
}
.wpfs-req { color: var(--wpfs-accent); }
.wpfs-echo { color: var(--wpfs-accent); }
.wpfs-hint .wpfs-echo { color: inherit; font-weight: 600; }

.wpfs-hint {
  color: var(--wpfs-ink-soft);
  font-size: 16px;
  margin: 0 0 24px;
}
.wpfs-opt {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--wpfs-ink-soft);
  background: var(--wpfs-line);
  border-radius: 99px;
  padding: 3px 10px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---------- Campos ---------- */
.wpfs-field { position: relative; }
.wpfs-wrap .wpfs-input {
  width: 100%;
  font-size: clamp(18px, 2.6vw, 24px);
  color: var(--wpfs-ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--wpfs-line);
  border-radius: 0;
  padding: 8px 2px 12px;
  outline: none;
  box-shadow: none;
  caret-color: var(--wpfs-accent);
  font-family: inherit;
}
.wpfs-wrap .wpfs-input::placeholder { color: color-mix(in srgb, var(--wpfs-ink-soft) 55%, var(--wpfs-bg)); }
.wpfs-wrap .wpfs-textarea { resize: vertical; min-height: 90px; line-height: 1.4; }
.wpfs-field::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 2px;
  background: var(--wpfs-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}
.wpfs-field:focus-within::after { transform: scaleX(1); }

.wpfs-error {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 14px 0 0;
  color: var(--wpfs-error);
  font-size: 14px;
  font-weight: 500;
}
.wpfs-step.has-error .wpfs-error { display: flex; animation: wpfsShake .4s ease; }
.wpfs-step.has-error .wpfs-input { border-bottom-color: var(--wpfs-error); }
.wpfs-error--submit { display: none; }
.wpfs-step.has-submit-error .wpfs-error--submit { display: flex; animation: wpfsShake .4s ease; }
@keyframes wpfsShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- Opções ---------- */
.wpfs-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 8px;
  max-width: 460px;
}
.wpfs-wrap .wpfs-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  background: var(--wpfs-card);
  border: 1px solid var(--wpfs-line);
  border-radius: var(--wpfs-radius);
  font-size: 16px;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  user-select: none;
  text-align: left;
  width: 100%;
  color: var(--wpfs-ink);
  font-family: inherit;
}
.wpfs-wrap .wpfs-option:hover {
  background: var(--wpfs-tint);
  border-color: var(--wpfs-accent);
}
.wpfs-option.is-selected {
  background: var(--wpfs-tint);
  border-color: var(--wpfs-accent);
  box-shadow: inset 0 0 0 1px var(--wpfs-accent);
  animation: wpfsPop .35s var(--wpfs-spring);
}
@keyframes wpfsPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.wpfs-option__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px; height: 25px;
  border: 1px solid var(--wpfs-accent-border);
  border-radius: 6px;
  background: var(--wpfs-card);
  font-size: 12px;
  font-weight: 700;
  color: var(--wpfs-accent);
  flex-shrink: 0;
  transition: all .18s;
}
.wpfs-option.is-selected .wpfs-option__key {
  background: var(--wpfs-accent);
  border-color: var(--wpfs-accent);
  color: var(--wpfs-btn-ink);
}
.wpfs-option__label { flex: 1; font-weight: 500; }
.wpfs-option__desc {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--wpfs-ink-soft);
  margin-top: 2px;
}
.wpfs-option__check {
  width: 18px; height: 18px;
  color: var(--wpfs-accent);
  opacity: 0;
  transform: scale(.5);
  transition: opacity .18s, transform .25s var(--wpfs-spring);
  flex-shrink: 0;
}
.wpfs-option__check svg { width: 100%; height: 100%; display: block; }
.wpfs-option.is-selected .wpfs-option__check { opacity: 1; transform: scale(1); }

/* ---------- Botões ---------- */
.wpfs-actions {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.wpfs-wrap .wpfs-btn {
  font-size: 16px;
  font-weight: 700;
  color: var(--wpfs-btn-ink);
  background: var(--wpfs-accent);
  border: none;
  border-radius: var(--wpfs-radius);
  padding: 12px 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .18s;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
}
.wpfs-wrap .wpfs-btn:hover {
  background: var(--wpfs-accent-dark);
  color: var(--wpfs-btn-ink);
}
.wpfs-btn svg { width: 15px; height: 15px; }
.wpfs-btn--big { padding: 14px 32px; font-size: 18px; }
.wpfs-btn.is-loading { opacity: .7; pointer-events: none; }

.wpfs-enter-hint { font-size: 13px; color: var(--wpfs-ink-soft); }
.wpfs-key {
  display: inline-block;
  font-weight: 600;
  color: var(--wpfs-ink);
  background: var(--wpfs-card);
  border: 1px solid var(--wpfs-line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  margin: 0 2px;
}
/* =========================================================
   Mobile — refinamentos para telas pequenas
   ========================================================= */
@media (max-width: 640px) {
  /* Dica de teclado não faz sentido no toque */
  .wpfs-enter-hint { display: none; }

  /* Mais respiro proporcional; espaço no rodapé para a navegação */
  .wpfs-step { padding: 26px 18px 92px; align-items: flex-start; }
  .wpfs-step__inner { max-width: 100%; }

  /* Perguntas e textos com tamanho confortável de leitura */
  .wpfs-question { font-size: clamp(21px, 6vw, 27px); }
  .wpfs-wrap .wpfs-welcome .wpfs-question { font-size: clamp(25px, 7.5vw, 34px); }
  .wpfs-hint { font-size: 15px; }

  /* Campos: 16px evita o zoom automático do iOS ao focar */
  .wpfs-wrap .wpfs-input { font-size: 18px; padding: 10px 2px 12px; }
  .wpfs-wrap .wpfs-textarea { min-height: 110px; }

  /* Botões principais ocupam a largura toda: alvo de toque grande */
  .wpfs-actions { width: 100%; }
  .wpfs-wrap .wpfs-btn {
    width: 100%;
    justify-content: center;
    padding: 15px 22px;
    font-size: 17px;
  }
  .wpfs-wrap .wpfs-btn--big { padding: 16px 24px; font-size: 18px; }

  /* Opções de múltipla escolha: alvos maiores e mais espaçados */
  .wpfs-options { gap: 10px; max-width: 100%; }
  .wpfs-wrap .wpfs-option { padding: 15px 16px; font-size: 16px; }

  /* Logo e botão retornar no topo com espaçamento seguro */
  .wpfs-logo { margin-bottom: 18px; }
  .wpfs-wrap .wpfs-voltar { top: 14px; right: 14px; }

  /* Marca inferior não briga com a navegação */
  .wpfs-brand { bottom: auto; top: 16px; left: 16px; }

  /* Formulário incorporado: altura adaptável (sem espaço morto), mas sem cortar conteúdo */
  body:not(.wpfs-page) .wpfs-wrap {
    --wpfs-height: auto;
  }
  body:not(.wpfs-page) .wpfs-stage {
    min-height: min(78vh, 560px);
  }
}

/* Telas bem estreitas */
@media (max-width: 400px) {
  .wpfs-step { padding: 22px 14px 88px; }
  .wpfs-question { font-size: clamp(20px, 6.4vw, 24px); }
  .wpfs-wrap .wpfs-option { padding: 14px 14px; }
  .wpfs-nav__count { display: none; } /* prioriza os botões de navegação */
}

/* ---------- Boas-vindas ---------- */
.wpfs-welcome .wpfs-question { font-size: clamp(27px, 4.4vw, 42px); font-weight: 800; }

/* ---------- Revisão ---------- */
.wpfs-summary {
  margin: 0 0 4px;
  background: var(--wpfs-card);
  border: 1px solid var(--wpfs-line);
  border-radius: var(--wpfs-radius);
  padding: 4px 18px;
  font-size: 15px;
  max-width: 500px;
  max-height: 280px;
  overflow-y: auto;
}
.wpfs-summary > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.wpfs-summary > div + div { border-top: 1px solid var(--wpfs-line); }
.wpfs-summary dt { color: var(--wpfs-ink-soft); flex-shrink: 0; margin: 0; }
.wpfs-summary dd { font-weight: 600; text-align: right; word-break: break-word; margin: 0; white-space: pre-line; }

/* ---------- Sucesso ---------- */
.wpfs-success-icon {
  width: 66px; height: 66px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--wpfs-ok) 14%, var(--wpfs-bg));
  color: var(--wpfs-ok);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 24px;
}
.wpfs-step.is-active .wpfs-success-icon { animation: wpfsIconPop .6s var(--wpfs-spring) .15s both; }
@keyframes wpfsIconPop {
  0% { opacity: 0; transform: scale(.3) rotate(-12deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.wpfs-success-icon svg { width: 30px; height: 30px; }

.wpfs-redirect {
  margin: 16px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--wpfs-accent);
}
.wpfs-redirect[hidden] { display: none; }

/* ---------- Toast de erro de envio ---------- */
.wpfs-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) translateY(8px);
  background: var(--wpfs-error);
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 9;
  max-width: 90%;
  text-align: center;
}
.wpfs-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.wpfs-confetti {
  position: absolute;
  top: -14px;
  width: 8px; height: 13px;
  border-radius: 2px;
  z-index: 8;
  pointer-events: none;
  animation: wpfsFall linear forwards;
}
@keyframes wpfsFall {
  to { transform: translateY(calc(var(--wpfs-height) + 60px)) rotate(720deg); opacity: .7; }
}

/* ---------- Navegação ---------- */
.wpfs-nav {
  position: absolute;
  bottom: 18px;
  right: 18px;
  left: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
  z-index: 6;
}
.wpfs-nav > * { pointer-events: auto; }

/* Botão "Voltar" à esquerda, sempre claro */
.wpfs-wrap .wpfs-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--wpfs-card);
  color: var(--wpfs-ink);
  border: 1px solid var(--wpfs-line);
  border-radius: calc(var(--wpfs-radius) * 0.85);
  padding: 9px 16px 9px 13px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.wpfs-wrap .wpfs-nav__back:hover {
  border-color: var(--wpfs-accent);
  color: var(--wpfs-accent);
}
.wpfs-nav__back svg { width: 16px; height: 16px; }

/* Contador + setas à direita */
.wpfs-nav__arrows {
  display: flex;
  align-items: stretch;
  border-radius: calc(var(--wpfs-radius) * 0.85);
  overflow: hidden;
}
.wpfs-nav__count {
  display: flex;
  align-items: center;
  background: var(--wpfs-accent-dark);
  color: var(--wpfs-btn-ink);
  font-size: 12px;
  font-weight: 700;
  padding: 0 12px;
  letter-spacing: .03em;
  border-radius: calc(var(--wpfs-radius) * 0.85);
  margin-right: 8px;
}
.wpfs-wrap .wpfs-nav__arrows button {
  background: var(--wpfs-accent);
  color: var(--wpfs-btn-ink);
  border: none;
  border-radius: 0;
  width: 42px; height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter .15s;
  padding: 0;
}
.wpfs-wrap .wpfs-nav__arrows button:hover { filter: brightness(1.14); }
.wpfs-wrap .wpfs-nav__arrows button:disabled { opacity: .4; cursor: default; }
.wpfs-nav__arrows button + button { border-left: 1px solid color-mix(in srgb, var(--wpfs-btn-ink) 25%, transparent) !important; }
.wpfs-nav svg { width: 17px; height: 17px; }

@media (max-width: 640px) {
  .wpfs-nav { left: 14px; right: 14px; bottom: 14px; }
  /* Botão Voltar mantém o texto, com alvo de toque confortável */
  .wpfs-wrap .wpfs-nav__back { padding: 11px 16px; font-size: 14px; }
  .wpfs-wrap .wpfs-nav__arrows button { width: 46px; height: 44px; }
}
@media (max-width: 380px) {
  .wpfs-nav__back span { display: none; } /* só o ícone quando muito estreito */
  .wpfs-wrap .wpfs-nav__back { padding: 11px 13px; }
}

/* Botão "Retornar ao site" na tela de sucesso */
.wpfs-wrap a.wpfs-success-voltar {
  text-decoration: none;
}

.wpfs-brand {
  position: absolute;
  bottom: 24px;
  left: 22px;
  font-size: 13px;
  font-weight: 700;
  color: var(--wpfs-ink-soft);
  z-index: 6;
}

/* ---------- Honeypot ---------- */
.wpfs-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px;
  opacity: 0;
}

/* ---------- Página exclusiva (link direto, tela cheia) ---------- */
body.wpfs-page {
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
body.wpfs-page .wpfs-wrap {
  --wpfs-height: 100dvh !important;
  min-height: 100vh;
  min-height: 100dvh;
  border-radius: 0;
}
body.wpfs-page .wpfs-stage {
  min-height: 100vh;
  min-height: 100dvh;
}

/* Página exclusiva no mobile: respeita notch e barra do sistema (safe-area) */
@media (max-width: 640px) {
  body.wpfs-page .wpfs-step {
    padding-left: calc(18px + env(safe-area-inset-left));
    padding-right: calc(18px + env(safe-area-inset-right));
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  body.wpfs-page .wpfs-nav {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }
  body.wpfs-page .wpfs-logo,
  body.wpfs-page .wpfs-wrap .wpfs-voltar {
    margin-top: env(safe-area-inset-top);
  }
}

/* Espaço no topo quando há botão retornar (a logo agora fica no fluxo) */
.wpfs-wrap:has(.wpfs-voltar) .wpfs-step {
  padding-top: 84px;
}
body.wpfs-page .wpfs-wrap:has(.wpfs-voltar) .wpfs-step {
  padding-top: 92px;
}

@media (prefers-reduced-motion: reduce) {
  .wpfs-wrap *, .wpfs-wrap *::before, .wpfs-wrap *::after {
    animation: none !important;
    transition: none !important;
  }
  .wpfs-step__inner > * { opacity: 1; transform: none; }
}
