/* ============================================================
   Botão flutuante de WhatsApp + painel de contato
   ------------------------------------------------------------
   Fica fora de @layer de propósito, como o banner de cookies: aparece
   por cima de qualquer página e não pode ser alterado por uma regra solta
   de `button`, `label` ou `input` de uma delas.

   Prefixo `wa-`. Camadas (z-index): abaixo do banner de cookies
   (2147483000) e dos modais do Bootstrap (1055), acima do conteúdo.

   Verde: o do WhatsApp escurecido para #098443. Com o verde original
   (#25D366) o ícone branco ficava com contraste 2:1; assim passa de 4,5:1.
   ============================================================ */

.wa {
  --wa-verde: #098443;
  --wa-verde-escuro: #07703a;
  --wa-tinta: #1d1b3a;
  --wa-texto: #475467;
  --wa-suave: #667085;
  --wa-borda: #d0d5dd;
  --wa-erro: #b42318;
  --wa-roxo: #6e00ff;

  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wa *,
.wa *::before,
.wa *::after {
  box-sizing: border-box;
}

.wa [hidden] {
  display: none !important;
}

/* ---------- Botão flutuante ---------- */

.wa-fab {
  position: fixed;
  z-index: 1030;
  right: 24px;
  bottom: 24px;
  /* Só o ícone, em círculo (pedido do usuário em 05/10/2026). O texto
     "Fale com o comercial" continua no HTML, escondido, para leitor de tela. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--wa-verde);
  color: #fff;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 12px 28px -8px rgba(9, 132, 67, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.wa-fab svg {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
}

.wa-fab__rotulo {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.wa-fab:hover {
  background: var(--wa-verde-escuro);
  transform: translateY(-2px);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12), 0 16px 32px -8px rgba(9, 132, 67, 0.6);
}

.wa-fab:active {
  transform: translateY(0);
}

.wa-fab:focus-visible {
  outline: 3px solid rgba(9, 132, 67, 0.4);
  outline-offset: 3px;
}

/* ---------- Painel ---------- */

.wa-painel {
  position: fixed;
  z-index: 1035;
  right: 24px;
  bottom: 96px;
  width: 392px;
  max-width: calc(100vw - 32px);
  /* 96px de baixo (botão + respiro) e 94px de cima: a barra fixa do menu
     tem mais z-index que o painel, então ele não pode subir até ela. */
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 20px 16px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 24px 56px -12px rgba(29, 27, 58, 0.32);
  color: var(--wa-texto);
  animation: wa-subir 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes wa-subir {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wa-topo {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.wa-avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(9, 132, 67, 0.1);
  color: var(--wa-verde);
}

.wa-topo__texto {
  flex: 1 1 auto;
  min-width: 0;
}

.wa-titulo {
  margin: 0 0 2px;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--wa-tinta);
}

.wa-sub {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--wa-suave);
}

.wa-fechar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -4px -6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--wa-suave);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.wa-fechar:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--wa-tinta);
}

.wa-fechar:focus-visible {
  outline: 3px solid rgba(110, 0, 255, 0.35);
  outline-offset: 1px;
}

/* ---------- Campos ---------- */

.wa-form {
  display: block;
}

.wa-campo {
  margin-bottom: 10px;
  min-width: 0;
}

.wa-campo label {
  display: block;
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--wa-tinta);
}

.wa-campo input,
.wa-campo select {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--wa-borda);
  border-radius: 12px;
  background: #fff;
  color: var(--wa-tinta);
  font: inherit;
  /* 16px: abaixo disso o Safari do iPhone dá zoom ao tocar no campo. */
  font-size: 1rem;
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wa-campo select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 8 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  cursor: pointer;
}

.wa-campo input::placeholder {
  color: #98a2b3;
}

.wa-campo input:hover,
.wa-campo select:hover {
  border-color: #98a2b3;
}

.wa-campo input:focus,
.wa-campo select:focus {
  outline: none;
  border-color: var(--wa-roxo);
  box-shadow: 0 0 0 4px rgba(110, 0, 255, 0.14);
}

.wa-campo.is-invalido input,
.wa-campo.is-invalido select {
  border-color: var(--wa-erro);
}

.wa-campo.is-invalido input:focus,
.wa-campo.is-invalido select:focus {
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.14);
}

.wa-erro {
  margin: 4px 0 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--wa-erro);
}

.wa-erro:empty {
  display: none;
}

.wa-linha {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

/* Isca para robô: fora da tela, não de display:none, que alguns robôs
   já reconhecem e pulam. */
.wa-isca {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Botões ---------- */

.wa-enviar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  margin-top: 4px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--wa-verde);
  color: #fff;
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.wa-enviar:hover {
  background: var(--wa-verde-escuro);
  color: #fff;
}

.wa-enviar:active {
  transform: translateY(1px);
}

.wa-enviar:focus-visible {
  outline: 3px solid rgba(9, 132, 67, 0.4);
  outline-offset: 3px;
}

.wa-enviar:disabled {
  background: #6bb88a;
  cursor: progress;
}

.wa-enviar.is-enviando span::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 10px;
  vertical-align: -2px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wa-giro 0.7s linear infinite;
}

@keyframes wa-giro {
  to { transform: rotate(360deg); }
}

.wa-nota {
  margin: 10px 0 0;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--wa-suave);
}

.wa-nota a {
  color: var(--wa-tinta);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.wa-nota a:hover {
  color: var(--wa-roxo);
}

/* ---------- Depois de enviar ---------- */

.wa-ok {
  padding: 8px 0 2px;
  text-align: center;
}

.wa-ok__icone {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: rgba(9, 132, 67, 0.1);
  color: var(--wa-verde);
}

.wa-ok__titulo {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--wa-tinta);
}

.wa-ok__titulo:focus {
  outline: none;
}

.wa-ok__texto {
  margin: 0 0 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--wa-suave);
}

.wa-ok__fechar {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 6px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--wa-texto);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.wa-ok__fechar:hover {
  background: rgba(15, 23, 42, 0.05);
}

.wa-ok__fechar:focus-visible {
  outline: 3px solid rgba(110, 0, 255, 0.35);
  outline-offset: 1px;
}

/* ---------- Fundo (só no celular) ---------- */

.wa-fundo {
  display: none;
}

body.wa-travado {
  overflow: hidden;
}

/* ---------- Celular: o painel vira uma folha na base da tela ---------- */

@media (max-width: 640px) {
  .wa-fab {
    right: 16px;
    bottom: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    width: 56px;
    height: 56px;
  }

  .wa-fab svg {
    width: 28px;
    height: 28px;
  }

  .wa-fundo {
    display: block;
    position: fixed;
    inset: 0;
    /* Acima da barra do menu (1040), que senão ficaria clara por cima do
       fundo escuro; abaixo dos modais do Bootstrap (1050/1055). */
    z-index: 1045;
    background: rgba(15, 23, 42, 0.5);
    animation: wa-surgir 0.2s ease;
  }

  .wa-painel {
    z-index: 1046;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 20px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 24px 24px 0 0;
    animation: wa-folha 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .wa-topo {
    margin-bottom: 16px;
  }
}

/* Em telas muito estreitas, cargo e cidade empilham: o nome da cidade não cabe ao lado. */
@media (max-width: 400px) {
  .wa-linha {
    grid-template-columns: 1fr;
  }
}

@keyframes wa-surgir {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes wa-folha {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wa-fab,
  .wa-fechar,
  .wa-enviar,
  .wa-campo input,
  .wa-campo select {
    transition: none;
  }

  .wa-painel,
  .wa-fundo {
    animation: none;
  }

  .wa-enviar.is-enviando span::after {
    animation-duration: 1.6s;
  }
}

/* Impressão: nada de botão por cima da página. */
@media print {
  .wa {
    display: none !important;
  }
}
