/*
 * Accerte - Chatbot flutuante de pre-qualificacao.
 * Carregada deferida (build.py: defer_targets). Usa os tokens de :root de critical.css.
 */

/* ---- Botao flutuante (FAB) ---- */
.acc-chat-fab {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 90;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  /* Mesma cor do CTA .hm-btn--primary (gradiente coral/Pacific Blue). */
  background: linear-gradient(120deg, var(--coral-hover) 0%, var(--coral) 100%);
  box-shadow: 0 16px 34px -12px rgba(0, 151, 178, 0.55), 0 0 0 1px rgba(0, 151, 178, 0.25);
  transition: transform 0.18s var(--ease-out-expo), background 0.18s var(--ease-out-expo);
}
.acc-chat-fab:hover { transform: translateY(-2px); background: linear-gradient(120deg, var(--coral) 0%, #00b8d4 100%); }
.acc-chat-fab svg { width: 26px; height: 26px; }
body.sticky-cta-visible .acc-chat-fab { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }

/* ---- Balao proativo (teaser) ---- */
.acc-chat-teaser {
  position: fixed;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 90;
  width: 300px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border: 1px solid var(--cinza-suave);
  border-radius: 16px;
  border-bottom-right-radius: 5px;
  padding: 14px 16px;
  box-shadow: 0 14px 34px -18px rgba(8, 39, 100, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s var(--ease-out-expo), transform 0.25s var(--ease-out-expo);
}
.acc-chat-teaser.is-visible { opacity: 1; transform: translateY(0); }
body.sticky-cta-visible .acc-chat-teaser { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
.acc-chat-teaser-name {
  font-family: var(--font-display);
  font-weight: 700; font-size: 12px;
  color: var(--azul-medio);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
}
.acc-chat-teaser-text {
  margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--azul-profundo);
}
.acc-chat-teaser-close {
  position: absolute; top: 8px; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--texto-sec-escuro); font-size: 16px; line-height: 1; opacity: 0.6;
}
.acc-chat-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--coral);
  box-shadow: 0 0 0 0 rgba(0, 151, 178, 0.45);
  animation: accChatPulse 2.4s infinite;
}
@keyframes accChatPulse {
  0%   { box-shadow: 0 0 0 0 rgba(0, 151, 178, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(0, 151, 178, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 151, 178, 0); }
}

/* ---- Painel ---- */
.acc-chat-panel {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  right: 24px;
  z-index: 9990;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 570px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.22s var(--ease-out-expo), transform 0.22s var(--ease-out-expo);
  pointer-events: none; /* so recebe clique quando aberto; senao a animacao de saida bloquearia o FAB atras */
}
.acc-chat-panel[data-open="true"] { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.acc-chat-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 18px 16px;
  background: var(--azul-deep); color: #fff;
}
.acc-chat-avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--azul-claro), var(--coral)); color: #fff;
}
.acc-chat-head-meta { min-width: 0; }
.acc-chat-eyebrow {
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--azul-claro); font-weight: 600;
}
.acc-chat-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin-top: 3px; line-height: 1.15; }
.acc-chat-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  background: none; border: none; cursor: pointer; color: #fff; opacity: 0.85;
  display: grid; place-items: center; font-size: 20px; line-height: 1;
}

.acc-chat-body {
  flex: 1; overflow-y: auto;
  padding: 20px 18px;
  display: flex; flex-direction: column; gap: 13px;
  background: var(--offwhite);
}
.acc-chat-msg { max-width: 86%; font-size: 14px; line-height: 1.5; padding: 11px 14px; }
.acc-chat-msg--bot {
  align-self: flex-start;
  background: #fff; color: var(--azul-profundo);
  border: 1px solid var(--cinza-suave); border-left: 3px solid var(--coral);
  border-radius: 4px 14px 14px 4px;
}
.acc-chat-msg--me {
  align-self: flex-end;
  background: var(--azul-profundo); color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.acc-chat-step {
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--texto-sec-escuro);
}

.acc-chat-opts { align-self: stretch; display: flex; flex-direction: column; gap: 9px; }
.acc-chat-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left;
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  color: var(--azul-profundo); background: #fff;
  border: 1px solid var(--cinza-suave); border-radius: 11px; padding: 13px 15px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.acc-chat-opt:hover { border-color: var(--azul-claro); box-shadow: 0 6px 18px -12px rgba(8, 86, 177, 0.8); }
.acc-chat-chev { color: var(--azul-medio); font-weight: 700; }

/* ---- Rodape (input arredondado da direcao A) ---- */
.acc-chat-foot {
  padding: 12px 14px; border-top: 1px solid var(--cinza-suave);
  display: flex; align-items: center; gap: 10px; background: #fff;
}
.acc-chat-input {
  flex: 1; border: 1px solid var(--cinza-suave); border-radius: 999px;
  padding: 11px 16px; font-family: inherit; font-size: 13.5px; outline: none;
  transition: border-color 0.15s;
}
.acc-chat-input:focus { border-color: var(--azul-claro); }
.acc-chat-input.is-invalid { border-color: #d14343; }
.acc-chat-skip {
  background: none; border: none; cursor: pointer;
  font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--texto-sec-escuro);
}
.acc-chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: none; flex: none;
  background: var(--coral); color: #fff; cursor: pointer;
  display: grid; place-items: center; transition: background 0.15s, transform 0.15s;
}
.acc-chat-send:hover { background: var(--coral-hover); transform: translateY(-1px); }

/* ---- Consentimento + envio ---- */
.acc-chat-consent-block { align-self: stretch; display: flex; flex-direction: column; gap: 12px; }
.acc-chat-consent {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: 11.5px; color: var(--texto-sec-escuro); line-height: 1.45;
  background: #fff; border: 1px solid var(--cinza-suave); border-radius: 10px; padding: 10px 12px;
}
.acc-chat-consent input { margin-top: 2px; }
.acc-chat-consent a { color: var(--azul-medio); }
.acc-chat-recaptcha { min-height: 78px; }
.acc-chat-submit {
  border: none; background: var(--azul-profundo); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  padding: 12px 16px; border-radius: 11px; cursor: pointer;
}
.acc-chat-submit:disabled { opacity: 0.6; cursor: default; }

.acc-chat-success {
  align-self: stretch; font-size: 12.5px; line-height: 1.5; color: var(--texto-sec-escuro);
  background: #fff; border: 1px solid var(--cinza-suave); border-radius: 10px; padding: 11px 13px;
}
.acc-chat-success a { color: var(--azul-medio); }

/* ---- Mobile (espelha o bottom-sheet da busca) ---- */
@media (max-width: 640px) {
  .acc-chat-panel {
    width: 100%; max-width: none;
    right: 0; left: 0; bottom: 0;
    height: 92vh; max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }
  .acc-chat-fab { width: 54px; height: 54px; right: 16px; }
  .acc-chat-teaser { right: 16px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .acc-chat-fab, .acc-chat-teaser, .acc-chat-panel { transition: none; }
  .acc-chat-dot { animation: none; }
}
