/* ============================================================================
 * ZÉ ENXADA — ESTILOS
 * ----------------------------------------------------------------------------
 * Cores tiradas do próprio site do Ademir (ademirsantostv.com.br):
 *   verde escuro  #052e1f   verde  #006842   verde claro  #00a551
 *   dourado       #FDBE10   branco #ffffff
 * Fontes do site: Bebas Neue (títulos) e Inter (texto).
 *
 * DECISÕES DE ACESSIBILIDADE (público mais velho):
 *   • Texto grande (17px) e alto contraste — fundo claro, letra escura.
 *   • Botões com 50px de altura mínima: fácil de acertar com o dedo.
 *   • Nada de cinza claro sobre branco. Nada de letra fina.
 *   • No celular a conversa ocupa a tela inteira.
 * As cores podem ser trocadas nas configurações do plugin.
 * ========================================================================== */

#zex-chat {
  --zex-verde-escuro: #052e1f;
  --zex-verde: #006842;
  --zex-verde-claro: #00a551;
  --zex-dourado: #FDBE10;
  --zex-fundo: #ffffff;
  --zex-superficie: #f1f4f0;
  --zex-borda: #d8ded6;
  --zex-texto: #17251f;
  --zex-texto-suave: #5b6b62;
  --zex-sobre-verde: #ffffff;
  --zex-raio: 18px;
  --zex-fonte-titulo: "Bebas Neue", "Inter", system-ui, sans-serif;
  --zex-fonte: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  position: fixed;
  z-index: 99990;
  bottom: 24px;
  font-family: var(--zex-fonte);
  line-height: 1.5;
  font-size: 17px;
}

#zex-chat, #zex-chat *, #zex-chat *::before, #zex-chat *::after { box-sizing: border-box; }

#zex-chat[data-posicao="direita"]  { right: 24px; }
#zex-chat[data-posicao="esquerda"] { left: 24px; }

.zex-oculto {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ------------------------------------------------------------------ BOLHA */

#zex-chat .zex-bolha {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px; height: 68px;
  border-radius: 50%;
  background: var(--zex-verde);
  color: var(--zex-sobre-verde);
  box-shadow: 0 10px 30px rgba(5, 46, 31, .35);
  cursor: pointer;
  transition: transform .25s cubic-bezier(.16,1,.3,1), background .2s;
}
#zex-chat[data-posicao="direita"] .zex-bolha { margin-left: auto; }

#zex-chat .zex-bolha:hover { transform: scale(1.06); background: var(--zex-verde-claro); }
#zex-chat .zex-bolha:focus-visible { outline: 3px solid var(--zex-dourado); outline-offset: 3px; }
#zex-chat .zex-bolha svg { width: 31px; height: 31px; display: block; }

#zex-chat .zex-ping {
  position: absolute; top: 3px; right: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--zex-dourado);
  border: 3px solid #fff;
}
#zex-chat[data-aberto="1"] .zex-ping { display: none; }

/* --------------------------------------------------------------- CHAMADA */

#zex-chat .zex-chamada {
  position: absolute;
  bottom: 14px;
  /* O #zex-chat só tem a largura da bolha, então sem "max-content" o balão
     esmaga e sai uma palavra por linha. */
  width: max-content;
  max-width: min(240px, calc(100vw - 130px));
  padding: 13px 16px;
  border-radius: 16px;
  background: #fff;
  color: var(--zex-texto);
  border: 2px solid var(--zex-verde);
  box-shadow: 0 10px 28px rgba(5, 46, 31, .2);
  font-size: 15.5px;
  font-weight: 500;
  cursor: pointer;
  animation: zex-surge .4s cubic-bezier(.16,1,.3,1);
}
#zex-chat[data-posicao="direita"]  .zex-chamada { right: 84px; }
#zex-chat[data-posicao="esquerda"] .zex-chamada { left: 84px; }
#zex-chat[data-aberto="1"] .zex-chamada { display: none; }

#zex-chat .zex-chamada-x {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  position: absolute; top: -10px; right: -10px;
  width: 26px; height: 26px;
  line-height: 24px; text-align: center;
  border-radius: 50%;
  background: #fff; color: var(--zex-texto-suave);
  border: 1px solid var(--zex-borda);
  font-size: 14px; cursor: pointer;
}
#zex-chat .zex-chamada-x:focus-visible { outline: 2px solid var(--zex-verde); }

/* ---------------------------------------------------------------- JANELA */

#zex-chat .zex-janela {
  position: absolute;
  bottom: 86px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 610px;
  max-height: calc(100vh - 140px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--zex-fundo);
  color: var(--zex-texto);
  border-radius: var(--zex-raio);
  box-shadow: 0 26px 70px rgba(5, 46, 31, .32);
}
#zex-chat[data-posicao="direita"]  .zex-janela { right: 0; }
#zex-chat[data-posicao="esquerda"] .zex-janela { left: 0; }
#zex-chat[data-aberto="1"] .zex-janela {
  display: flex;
  animation: zex-abre .3s cubic-bezier(.16,1,.3,1);
}

@keyframes zex-abre { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes zex-surge { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- CABEÇALHO */

#zex-chat .zex-topo {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 14px 15px 17px;
  background: linear-gradient(135deg, var(--zex-verde-escuro), var(--zex-verde));
  color: #fff;
  flex: 0 0 auto;
}

#zex-chat .zex-avatar {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--zex-dourado);
  color: var(--zex-verde-escuro);
  font-family: var(--zex-fonte-titulo);
  font-size: 21px;
  letter-spacing: 1px;
  overflow: hidden;
}
#zex-chat .zex-avatar img { width: 100%; height: 100%; object-fit: cover; }

#zex-chat .zex-identidade { flex: 1 1 auto; min-width: 0; }
#zex-chat .zex-nome {
  font-family: var(--zex-fonte-titulo);
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: .5px;
}
#zex-chat .zex-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 13.5px;
  opacity: .92;
}
#zex-chat .zex-status::before {
  content: ""; width: 8px; height: 8px; flex: 0 0 8px;
  border-radius: 50%; background: #6ee7a4;
}

#zex-chat .zex-acao-topo {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  width: 40px; height: 40px; flex: 0 0 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: #fff; opacity: .85;
  font-size: 19px; cursor: pointer;
}
#zex-chat .zex-acao-topo:hover { opacity: 1; background: rgba(255,255,255,.16); }
#zex-chat .zex-acao-topo:focus-visible { outline: 2px solid var(--zex-dourado); outline-offset: -2px; opacity: 1; }

/* -------------------------------------------------------------- MENSAGENS */

#zex-chat .zex-corpo {
  position: relative;     /* referência para a rolagem calcular a posição */
  flex: 1 1 auto;
  min-height: 0;          /* sem isto o flex não deixa a área rolar */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background: var(--zex-fundo);
}
#zex-chat .zex-corpo::-webkit-scrollbar { width: 10px; }
#zex-chat .zex-corpo::-webkit-scrollbar-thumb { background: var(--zex-borda); border-radius: 10px; }

#zex-chat .zex-msg {
  flex: 0 0 auto;         /* senão o balão encolhe e some quando a conversa cresce */
  max-width: 88%;
  padding: 13px 16px;
  font-size: 17px;
  border-radius: 16px;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  animation: zex-surge .26s cubic-bezier(.16,1,.3,1);
}
#zex-chat .zex-msg strong { font-weight: 700; }
#zex-chat .zex-msg small  { font-size: 14.5px; color: var(--zex-texto-suave); }

#zex-chat .zex-msg.bot {
  align-self: flex-start;
  background: var(--zex-superficie);
  color: var(--zex-texto);
  border-bottom-left-radius: 5px;
}
#zex-chat .zex-msg.eu {
  align-self: flex-end;
  background: var(--zex-verde);
  color: var(--zex-sobre-verde);
  border-bottom-right-radius: 5px;
  font-weight: 500;
}
#zex-chat .zex-msg.aviso {
  align-self: center;
  max-width: 100%;
  background: #fff8e1;
  border: 1px solid #f3e0a8;
  color: #6b5a1c;
  font-size: 14px;
  padding: 10px 14px;
  text-align: center;
}

#zex-chat .zex-pontos { display: flex; gap: 5px; padding: 4px 2px; }
#zex-chat .zex-pontos span {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--zex-verde);
  opacity: .45;
  animation: zex-pulo 1.3s infinite ease-in-out;
}
#zex-chat .zex-pontos span:nth-child(2) { animation-delay: .18s; }
#zex-chat .zex-pontos span:nth-child(3) { animation-delay: .36s; }
@keyframes zex-pulo {
  0%, 60%, 100% { transform: translateY(0);    opacity: .45; }
  30%           { transform: translateY(-6px); opacity: 1;   }
}

/* ------------------------------------------------------ BOTÕES DE RESPOSTA */

/* Ficam dentro da área que rola, logo depois da última fala do Zé. */
#zex-chat .zex-opcoes {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  flex: 0 0 auto;
  padding: 3px 0 6px;
}
#zex-chat .zex-opcoes:empty { display: none; }

#zex-chat .zex-opcao {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  /* Um botão por linha, ocupando tudo: é o formato mais fácil de acertar
     e de ler para quem tem mais idade ou enxerga menos. */
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.25;
  border-radius: 999px;
  background: #fff;
  color: var(--zex-verde);
  border: 2px solid var(--zex-verde);
  cursor: pointer;
  transition: background .16s, color .16s, transform .16s;
  animation: zex-surge .28s cubic-bezier(.16,1,.3,1);
}
#zex-chat .zex-opcao:hover {
  background: var(--zex-verde);
  color: #fff;
  transform: translateY(-1px);
}
#zex-chat .zex-opcao:focus-visible { outline: 3px solid var(--zex-dourado); outline-offset: 2px; }
#zex-chat .zex-opcao.voltar {
  border-color: var(--zex-borda);
  color: var(--zex-texto-suave);
  font-weight: 500;
}
#zex-chat .zex-opcao.voltar:hover { background: var(--zex-texto-suave); border-color: var(--zex-texto-suave); color: #fff; }
#zex-chat .zex-opcao.externo { border-color: var(--zex-dourado); color: #8a6a00; }
#zex-chat .zex-opcao.externo:hover { background: var(--zex-dourado); color: var(--zex-verde-escuro); }

/* ---------------------------------------------------------- CAIXA DE TEXTO */

#zex-chat .zex-rodape {
  flex: 0 0 auto;
  border-top: 1px solid var(--zex-borda);
  background: var(--zex-superficie);
}
#zex-chat .zex-linha {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 11px 13px 7px;
}

#zex-chat .zex-campo {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  flex: 1 1 auto;
  min-width: 0;
  /* Altura fixa de uma linha, igual à do botão de enviar. O JS só aumenta
     quando o texto passa de uma linha. Sem isto o textarea escolhe sozinho
     uma altura estranha depois do "all: unset". */
  height: 50px;
  max-height: 96px;
  padding: 11px 15px;
  font-family: inherit;
  font-size: 16px;              /* 16px evita o zoom automático do iPhone */
  line-height: 1.4;
  color: var(--zex-texto);
  background: #fff;
  border: 2px solid var(--zex-borda);
  border-radius: 14px;
  resize: none;
  overflow-y: auto;
}
#zex-chat .zex-campo::placeholder { color: var(--zex-texto-suave); opacity: 1; }
#zex-chat .zex-campo:focus { border-color: var(--zex-verde); }

#zex-chat .zex-enviar {
  all: unset;
  box-sizing: border-box;   /* o "all: unset" apaga o border-box; devolve */
  width: 50px; height: 50px; flex: 0 0 50px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px;
  background: var(--zex-verde);
  color: #fff;
  cursor: pointer;
  transition: background .18s, transform .18s;
}
#zex-chat .zex-enviar:hover { background: var(--zex-verde-claro); transform: translateY(-1px); }
#zex-chat .zex-enviar:focus-visible { outline: 3px solid var(--zex-dourado); outline-offset: 2px; }
#zex-chat .zex-enviar svg { width: 21px; height: 21px; }

#zex-chat .zex-assinatura {
  padding: 0 16px 10px;
  font-size: 12px;
  color: var(--zex-texto-suave);
  text-align: center;
}

/* campo anti-robô: invisível pra gente, visível pra robô burro */
#zex-chat .zex-mel {
  position: absolute !important;
  left: -9999px !important;
  width: 1px; height: 1px; opacity: 0;
}

/* ------------------------------------------------------------- EMBUTIDO */

#zex-chat.zex-inline { position: relative; inset: auto; width: 100%; max-width: 420px; margin: 0 auto; }
#zex-chat.zex-inline .zex-bolha,
#zex-chat.zex-inline .zex-chamada { display: none; }
#zex-chat.zex-inline .zex-janela {
  position: relative;
  display: flex;
  inset: auto;
  width: 100%;
  max-width: 100%;
  height: 700px;          /* embutido tem espaço: cabe a saudação + os 5 botões */
  max-height: 85vh;
  animation: none;
  border: 1px solid var(--zex-borda);
}

/* ------------------------------------------------------------- CELULAR */

@media (max-width: 520px) {
  #zex-chat { bottom: 18px; font-size: 17px; }
  #zex-chat[data-posicao="direita"]  { right: 18px; }
  #zex-chat[data-posicao="esquerda"] { left: 18px; }

  #zex-chat[data-aberto="1"]:not(.zex-inline) .zex-janela {
    position: fixed;
    inset: 0;
    width: 100vw; max-width: 100vw;
    height: 100dvh; max-height: none;
    border-radius: 0;
  }
  #zex-chat[data-aberto="1"]:not(.zex-inline) .zex-bolha { display: none; }

  #zex-chat .zex-chamada { max-width: 195px; font-size: 14.5px; }
  #zex-chat .zex-msg { max-width: 92%; }
  #zex-chat .zex-opcao { width: 100%; justify-content: center; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  #zex-chat *, #zex-chat *::before, #zex-chat *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
