/* ChatBot do site — ícone no canto inferior direito e painel de conversa. */
.chatbot-widget { position: fixed; right: 20px; bottom: 20px; z-index: 600; font-family: inherit; }
.chatbot-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.chatbot-mascote {
  width: 104px; height: 104px; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
  background: #ba0000; box-shadow: 0 8px 22px rgba(186, 0, 0, .35);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  float: right;
}
.chatbot-mascote:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 12px 28px rgba(186, 0, 0, .45); }
.chatbot-mascote:focus-visible { outline: 3px solid #ffc400; outline-offset: 3px; }
.chatbot-mascote picture, .chatbot-mascote img { display: block; width: 104px; height: 104px; }
.chatbot-mascote { background: transparent; box-shadow: none; }
.chatbot-mascote:hover { box-shadow: none; }

.chatbot-balao {
  position: absolute; right: 118px; bottom: 36px; white-space: nowrap;
  background: #fff; color: #2b2f36; border: 1px solid #e6e6ea; border-radius: 14px;
  min-height: 56px; padding: 16px 20px 16px 22px; font-size: 16px; font-weight: 600;
  box-shadow: 0 8px 20px rgba(30, 30, 40, .14);
  display: flex; align-items: center; gap: 10px;
  animation: chatbot-entrar .5s ease both;
}
.chatbot-balao::after {
  content: ""; position: absolute; right: -8px; bottom: 24px; width: 12px; height: 12px;
  background: #fff; border-right: 1px solid #e6e6ea; border-top: 1px solid #e6e6ea; transform: rotate(45deg);
}
.chatbot-balao-fechar {
  border: 0; background: none; color: #6b7078; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.chatbot-balao[hidden] { display: none; }

.chatbot-painel {
  position: absolute; right: 0; bottom: 116px; width: min(370px, calc(100vw - 32px)); height: min(520px, calc(100vh - 140px));
  background: #fff; color: #1c1c1c; border-radius: 16px; border: 1px solid #e6e6ea;
  box-shadow: 0 18px 46px rgba(30, 30, 40, .22); display: flex; flex-direction: column; overflow: hidden;
  animation: chatbot-entrar .25s ease both;
}
.chatbot-painel[hidden] { display: none; }
.chatbot-painel-topo {
  background: linear-gradient(120deg, #ba0000, #7d0000); color: #fff;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; font-size: 17px;
}
.chatbot-painel-fechar { border: 0; background: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; }

.chatbot-mensagens { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f7f7f9; }
.chatbot-msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.chatbot-msg-bot { align-self: flex-start; background: #fff; border: 1px solid #e6e6ea; border-bottom-left-radius: 4px; }
.chatbot-msg-user { align-self: flex-end; background: #ba0000; color: #fff; border-bottom-right-radius: 4px; }
.chatbot-digitando { align-self: flex-start; background: #fff; border: 1px solid #e6e6ea; padding: 12px 14px; border-radius: 14px; display: inline-flex; gap: 5px; }
.chatbot-digitando span { width: 7px; height: 7px; border-radius: 50%; background: #9aa0a8; animation: chatbot-pontos 1s infinite ease-in-out; }
.chatbot-digitando span:nth-child(2) { animation-delay: .15s; }
.chatbot-digitando span:nth-child(3) { animation-delay: .3s; }

.chatbot-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e6e6ea; background: #fff; }
.chatbot-form input {
  flex: 1; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid #d5d7dc; border-radius: 8px;
  font-size: 16px; font-family: inherit; color: #1c1c1c; background: #fff;
}
.chatbot-form input:focus { outline: none; border-color: #ba0000; }
.chatbot-form button {
  height: 44px; padding: 0 16px; border: 0; border-radius: 8px; background: #ba0000; color: #fff;
  font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit;
}
.chatbot-form button:disabled { opacity: .55; cursor: wait; }

@keyframes chatbot-entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes chatbot-pontos { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .chatbot-balao, .chatbot-painel, .chatbot-digitando span { animation: none; } }
@media (max-width: 600px) {
  .chatbot-widget { right: 16px; bottom: 16px; }
  .chatbot-balao { right: 112px; bottom: 30px; }
  .chatbot-painel { right: 0; bottom: 112px; }
}
.chatbot-msg a { color: inherit; text-decoration: underline; font-weight: 700; word-break: break-all; }
.chatbot-msg-bot a { color: #ba0000; }
.chatbot-botoes { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; }
.chatbot-botao-link {
  display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid #ba0000;
  color: #ba0000; background: #fff; font-size: 15px; font-weight: 700; text-decoration: none;
}
.chatbot-botao-link:hover, .chatbot-botao-link:focus-visible { background: #ba0000; color: #fff; outline: none; }
.chatbot-contato { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid #e6e6ea; border-radius: 12px; padding: 14px; align-self: stretch; }
.chatbot-contato-rotulo { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 700; color: #2b2f36; }
.chatbot-contato input[type="text"], .chatbot-contato input[type="tel"], .chatbot-contato textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid #d5d7dc; border-radius: 8px;
  font-size: 16px; font-family: inherit; color: #1c1c1c; background: #fff; box-sizing: border-box;
}
.chatbot-contato textarea { resize: vertical; }
.chatbot-contato input:focus, .chatbot-contato textarea:focus { outline: none; border-color: #ba0000; }
.chatbot-contato-aut { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 400; color: #2b2f36; line-height: 1.4; }
.chatbot-contato-aut input { margin-top: 3px; }
.chatbot-contato-erro { margin: 0; color: #ba0000; font-size: 14px; font-weight: 600; }
.chatbot-contato-enviar { height: 44px; border: 0; border-radius: 8px; background: #178a63; color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; font-family: inherit; }
.chatbot-contato-enviar:disabled { opacity: .55; cursor: wait; }

/* Chamada suave do Visconde quando ninguém abriu a conversa: ciclo de 20s
   (respiração, anel, aceno, anel, pulinho, respiração), um efeito por vez. Pausa com mouse/foco e com a
   conversa aberta; some para quem marcou "reduzir movimento". */
.chatbot-mascote { position: relative; isolation: isolate; }
.chatbot-mascote::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: -1; pointer-events: none;
  animation: chatbot-halo 20s ease-out infinite;
}
.chatbot-mascote img { animation: chatbot-visconde 20s ease-in-out infinite; transform-origin: 50% 80%; }
.chatbot-mascote:hover img, .chatbot-mascote:focus-visible img,
.chatbot-mascote:hover::before, .chatbot-mascote:focus-visible::before { animation-play-state: paused; }
.chatbot-widget:has(.chatbot-painel:not([hidden])) .chatbot-mascote img,
.chatbot-widget:has(.chatbot-painel:not([hidden])) .chatbot-mascote::before { animation: none; }

@keyframes chatbot-visconde {
  0%, 4%, 8%, 25%, 30.5%, 55%, 61%, 70%, 78%, 100% { transform: none; }
  4% { transform: scale(1.04); }
  26% { transform: rotate(-4deg); }
  27.5% { transform: rotate(4deg); }
  29% { transform: rotate(-2deg); }
  58% { transform: translateY(-6px); }
  74% { transform: scale(1.04); }
}
@keyframes chatbot-halo {
  0%, 39%, 49%, 100% { box-shadow: 0 0 0 0 transparent; }
  40% { box-shadow: 0 0 0 0 rgba(186, 0, 0, .5); }
  48% { box-shadow: 0 0 0 18px rgba(186, 0, 0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .chatbot-mascote img, .chatbot-mascote::before { animation: none; }
}
[data-movimento="reduzido"] .chatbot-mascote img, [data-movimento="reduzido"] .chatbot-mascote::before { animation: none; }

/* Balão em sanfona: abre da direita para a esquerda, fica aberto e fecha. */
.chatbot-balao.sanfona {
  transform-origin: right center; transform: scaleX(0); opacity: 0; pointer-events: none;
  animation: none; transition: transform .5s ease, opacity .5s ease;
}
.chatbot-balao.sanfona.aberto { transform: scaleX(1); opacity: 1; pointer-events: auto; }
.chatbot-balao.sanfona span { opacity: 0; transition: opacity .3s ease; }
.chatbot-balao.sanfona.aberto span { opacity: 1; transition-delay: .3s; }
@media (prefers-reduced-motion: reduce) {
  .chatbot-balao.sanfona, .chatbot-balao.sanfona span { transition: none; transform: none; }
  .chatbot-balao.sanfona:not(.aberto) { opacity: 0; }
}
[data-movimento="reduzido"] .chatbot-balao.sanfona { transition: none; transform: none; }
