/* ========================================================
   CHAT WIDGET , Zapito · RotaZapZap
   Full-screen SaaS premium (padrao Intercom/Santander/Drift)
   Identidade dark + acento laranja RotaZapZap
   Safe-area iOS aware · viewport dinamico (dvh/svh)
======================================================== */

/* -- Trigger button (avatar Zapito flutuante, sem moldura)
   2026-05-24: aumentado 46->56 (mobile) / 56->64 (tablet+) pra maior presenca
   estrategica na home. Welcome bubble (#rzz-chat-welcome) acompanha do lado. */
#rzz-chat-trigger {
  position: fixed;
  /* v3.304: +28px (era +16) pra liberar espaco abaixo do trigger pro chip "Posso ajudar?" */
  bottom: calc(var(--nav-h, 48px) + env(safe-area-inset-bottom, 0px) + 28px);
  right: 18px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 8800;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.25s ease;
  animation: rzz-chat-glow 2.6s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Picture wrapper dentro do trigger */
#rzz-chat-trigger picture {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  overflow: hidden;
}

/* Halo de ping pulsando ao redor do avatar (padrao SaaS premium) */
#rzz-chat-trigger::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.55);
  animation: rzz-chat-ping 2.6s cubic-bezier(0, 0, 0.2, 1) infinite;
  pointer-events: none;
}

#rzz-chat-trigger img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

#rzz-chat-trigger:hover,
#rzz-chat-trigger:active {
  transform: scale(1.08);
}

#rzz-chat-trigger.rzz-chat-open {
  transform: scale(0.94);
  animation: none;
  filter: saturate(1.05);
}

#rzz-chat-trigger.rzz-chat-open::after {
  animation: none;
  box-shadow: none;
}

/* Ponto de notificacao */
#rzz-chat-trigger .rzz-chat-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--grn, #00d98b);
  border-radius: 50%;
  border: 2px solid var(--bg, #07090e);
  transition: opacity 0.2s ease;
  z-index: 1;
}

#rzz-chat-trigger.rzz-chat-open .rzz-chat-dot {
  opacity: 0;
}

@keyframes rzz-chat-glow {
  0%, 100% { filter: drop-shadow(0 6px 14px rgba(245, 166, 35, 0.22)); }
  50%      { filter: drop-shadow(0 8px 20px rgba(245, 166, 35, 0.45)); }
}

@keyframes rzz-chat-ping {
  0%   { box-shadow: 0 0 0 0    rgba(245, 166, 35, 0.55); opacity: 1; }
  70%  { box-shadow: 0 0 0 14px rgba(245, 166, 35, 0);    opacity: 0; }
  100% { box-shadow: 0 0 0 0    rgba(245, 166, 35, 0);    opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #rzz-chat-trigger,
  #rzz-chat-trigger::after { animation: none; }
}

/* ========================================================
   BACKDROP (overlay dimmer atras do painel)
======================================================== */

#rzz-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 8801;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}

#rzz-chat-backdrop.rzz-chat-visible {
  opacity: 1;
  pointer-events: all;
}

/* ========================================================
   PAINEL FULL-SCREEN (mobile-first edge-to-edge)
======================================================== */

#rzz-chat-panel {
  position: fixed;
  inset: 0;
  /* Viewport dinamico iOS aware (Safari mobile address bar shrink) */
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  background: var(--bg, #07090e);
  z-index: 8802;
  display: flex;
  flex-direction: column;
  /* Animacao: slide de baixo pra cima */
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  overflow: hidden;
}

#rzz-chat-panel.rzz-chat-visible {
  transform: translateY(0);
  pointer-events: all;
}

/* Desktop e tablet: modal centralizado SaaS */
@media (min-width: 768px) {
  #rzz-chat-panel {
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, calc(-50% + 24px));
    width: min(720px, calc(100vw - 64px));
    height: min(760px, calc(100dvh - 64px));
    border-radius: 22px;
    box-shadow:
      0 40px 100px rgba(0,0,0,0.7),
      0 0 0 1px rgba(245,166,35,0.12);
    border: 1px solid var(--bdr, rgba(255,255,255,0.07));
    opacity: 0;
  }
  #rzz-chat-panel.rzz-chat-visible {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

@media (min-width: 768px) {
  #rzz-chat-trigger {
    right: 24px;
    bottom: 24px;
    width: 64px;
    height: 64px;
  }
}

/* ========================================================
   WELCOME BUBBLE , balaozinho de saudacao do Zapito
   Posicionado a esquerda do trigger. Aparece 2s pos-load
   (so na 1a sessao por device), some em 8s ou ao 1o toque.
   Padrao Intercom/Drift moderno: chama atencao sem ser intrusivo.
======================================================== */

#rzz-chat-welcome {
  position: fixed;
  /* v3.304: +36 (era +24) pra acompanhar o trigger que subiu 12px */
  bottom: calc(var(--nav-h, 48px) + env(safe-area-inset-bottom, 0px) + 36px);
  /* a direita do bubble fica encostada onde o trigger comeca */
  right: calc(18px + 56px + 8px); /* trigger.right + trigger.width + gap */
  max-width: 240px;
  background: var(--s2, #1a1f2e);
  color: var(--txt, #f5f7fa);
  border: 1px solid var(--bdr, rgba(255,255,255,0.08));
  border-radius: 16px;
  padding: 10px 12px 10px 14px;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 600;
  box-shadow: 0 6px 22px rgba(0,0,0,0.42), 0 2px 6px rgba(245,166,35,0.18);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 8799; /* abaixo do trigger pra setinha nao cobrir */
  opacity: 0;
  transform: translateX(8px) scale(0.92);
  pointer-events: none;
  transition: opacity 0.32s ease, transform 0.36s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#rzz-chat-welcome.rzz-chat-welcome--visible {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}

/* Setinha apontando pro trigger (lado direito do bubble) */
#rzz-chat-welcome::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--s2, #1a1f2e);
  border-right: 1px solid var(--bdr, rgba(255,255,255,0.08));
  border-top: 1px solid var(--bdr, rgba(255,255,255,0.08));
  border-radius: 2px;
}

.rzz-chat-welcome-text {
  flex: 1;
  min-width: 0;
}

.rzz-chat-welcome-close {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: none;
  color: var(--txt2, #c8d0da);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.18s ease;
}

.rzz-chat-welcome-close:hover,
.rzz-chat-welcome-close:active {
  background: rgba(255,255,255,0.16);
}

@media (min-width: 768px) {
  #rzz-chat-welcome {
    bottom: calc(24px + (64px - 50px) / 2); /* alinha vertical com trigger 64px */
    right: calc(24px + 64px + 10px);
    font-size: 14px;
    max-width: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #rzz-chat-welcome {
    transition: opacity 0.2s ease;
    transform: none;
  }
}

/* ========================================================
   HEADER , padrao SaaS (avatar + titulo central + X)
======================================================== */

/* v3.238: header padrao banco. Avatar fixo a esquerda + titulo
   "ATENDIMENTO" centralizado HORIZONTAL absoluto (independente do avatar)
   + botao fechar absoluto a direita. Avatar e close usam position:absolute
   pra nao deslocar o titulo centralizado. */
#rzz-chat-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 12px;
  background: linear-gradient(180deg,
    rgba(245,166,35,0.06) 0%,
    var(--s1, #0e1117) 60%);
  border-bottom: 1px solid var(--bdr, rgba(255,255,255,0.07));
  flex-shrink: 0;
  min-height: calc(env(safe-area-inset-top, 0px) + 56px);
}

@media (min-width: 768px) {
  #rzz-chat-header {
    padding: 14px 16px;
    min-height: 60px;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
  }
}

.rzz-chat-header-avatar {
  position: absolute;
  left: 14px;
  top: calc(env(safe-area-inset-top, 0px) + 9px); /* (56 - 38) / 2 = 9 */
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: visible;
  background: transparent;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.rzz-chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.rzz-chat-header-avatar::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  background: var(--grn, #00d98b);
  border-radius: 50%;
  border: 2px solid var(--s1, #0e1117);
  animation: rzz-blink 2.5s ease-in-out infinite;
}

@media (min-width: 768px) {
  .rzz-chat-header-avatar { top: 11px; } /* (60 - 38) / 2 */
}

.rzz-chat-title-center {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--txt, #f0f0f0);
  line-height: 1.2;
  text-align: center;
}

@keyframes rzz-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.rzz-chat-close-btn {
  /* v3.237: absolute pra nao deslocar o titulo centralizado. Ancorado
     pelo padding-top equivalente do header pra ficar alinhado com o titulo,
     respeitando safe-area no iOS standalone. */
  position: absolute;
  right: 14px;
  top: calc(env(safe-area-inset-top, 0px) + 11px); /* (56 - 34) / 2 = 11 */
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--s2, #13161f);
  border: 1px solid var(--bdr, rgba(255,255,255,0.1));
  color: var(--txt2, #8a8f9d);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) {
  .rzz-chat-close-btn { top: 13px; } /* (60 - 34) / 2 */
}

.rzz-chat-close-btn:hover {
  background: rgba(255,77,106,0.12);
  border-color: rgba(255,77,106,0.3);
  color: var(--red, #ff4d6a);
}

.rzz-chat-close-btn:active {
  transform: scale(0.92);
}

/* ========================================================
   AREA DE MENSAGENS
======================================================== */

#rzz-chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 20px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Subtle pattern */
  background:
    radial-gradient(ellipse at top, rgba(245,166,35,0.04) 0%, transparent 50%),
    var(--bg, #07090e);
}

#rzz-chat-messages::-webkit-scrollbar { display: none; width: 0; }
#rzz-chat-messages::-webkit-scrollbar-track { display: none; }
#rzz-chat-messages::-webkit-scrollbar-thumb { display: none; }

/* -- Empty state (boas-vindas com branding) -- */
.rzz-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 16px 14px;
  text-align: center;
  animation: rzz-msg-in 0.32s ease;
}

.rzz-empty-state-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: transparent;
  overflow: visible;
  margin-bottom: 14px;
  filter: drop-shadow(0 8px 20px rgba(245, 166, 35, 0.22));
  position: relative;
  animation: rzz-empty-pulse 4s ease-in-out infinite;
}

.rzz-empty-state-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

@keyframes rzz-empty-pulse {
  0%, 100% { filter: drop-shadow(0 8px 20px rgba(245, 166, 35, 0.22)); }
  50%      { filter: drop-shadow(0 12px 30px rgba(245, 166, 35, 0.40)); }
}

.rzz-empty-state-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--txt, #f0f0f0);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.rzz-empty-state-subtitle {
  font-size: 13.5px;
  color: var(--txt2, #8a8f9d);
  line-height: 1.45;
  max-width: 280px;
}

/* -- Separador de data -- */
.rzz-date-separator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 16px;
}

.rzz-date-chip {
  background: var(--s2, #13161f);
  border: 1px solid var(--bdr, rgba(255,255,255,0.08));
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 11.5px;
  color: var(--txt3, #5a5f70);
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* -- Grupo de mensagens (agrupa por remetente) -- */
.rzz-msg-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.rzz-msg-group-bot  { align-items: flex-start; }
.rzz-msg-group-user { align-items: flex-end; }

/* -- Bolhas -- */
.rzz-msg-bubble {
  max-width: 82%;
  padding: 11px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
  overflow-wrap: break-word;
  margin-bottom: 2px;
  animation: rzz-msg-in 0.22s ease;
}

@keyframes rzz-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rzz-msg-group-bot .rzz-msg-bubble {
  background: var(--s2, #13161f);
  color: var(--txt, #f0f0f0);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--bdr, rgba(255,255,255,0.07));
}

.rzz-msg-group-user .rzz-msg-bubble {
  background: linear-gradient(135deg, var(--acc, #f5a623) 0%, #ff9117 100%);
  color: #0a0a0a;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 10px rgba(245,166,35,0.18);
}

/* -- Timestamp -- */
.rzz-msg-time {
  font-size: 10.5px;
  color: var(--txt3, #5a5f70);
  padding: 0 4px;
  margin-top: 1px;
}

.rzz-msg-group-user .rzz-msg-time {
  text-align: right;
}

/* -- Erro -- */
.rzz-msg-group-bot.rzz-msg-error .rzz-msg-bubble {
  background: rgba(255,77,106,0.1);
  border-color: rgba(255,77,106,0.25);
  color: var(--red, #ff4d6a);
}

/* v3.143: links autolinkificados pelas mensagens do Zapito (linkifyBotText
   em chat-widget.js). Verde brand pra contraste com bubble cinza/branco. */
.rzz-msg-bubble .rzz-link {
  color: var(--grn, #00d98b);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
  font-weight: 600;
  word-break: break-all;
}
.rzz-msg-bubble .rzz-link:hover {
  color: var(--acc, #f5a623);
  text-decoration-color: var(--acc, #f5a623);
}
.rzz-msg-bubble .rzz-link:focus-visible {
  outline: 2px solid var(--acc, #f5a623);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ========================================================
   CHIPS DE RESPOSTA RAPIDA
======================================================== */

/* v3.239: chips em fluxo row+wrap alinhados a direita. Sugestoes curtas
   se acomodam lado a lado na mesma linha; longas quebram pra proxima.
   Antes (v3.238) era flex-direction column forcando 1 por linha. */
#rzz-quick-replies {
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg, #07090e);
  overflow-x: hidden;
}

@media (max-width: 480px) {
  #rzz-quick-replies {
    gap: 6px;
    padding: 4px 12px 10px;
  }
}

.rzz-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--acc, #f5a623);
  color: var(--acc, #f5a623);
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(245,166,35,0.04);
  cursor: pointer;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
  max-width: 90%;
  width: auto;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  font-family: inherit;
}

.rzz-chip:hover {
  background: rgba(245,166,35,0.12);
}

.rzz-chip:active {
  background: var(--acc, #f5a623);
  color: #0a0a0a;
  transform: scale(0.97);
}

@media (max-width: 480px) {
  .rzz-chip {
    padding: 7px 14px;
    font-size: 12px;
  }
}

/* v3.364 LIGHT-MODE FIX: chips de sugestao usavam --acc (#f5a623) como texto
   sobre fundo quase branco -> contraste 1.86 (WCAG AA exige 4.5). Em light
   trocamos pelo ambar escuro --acc-text (#9c5300). :active mantem #0a0a0a
   sobre fundo solido laranja, que ja passa. */
:root[data-theme="light"] .rzz-chip {
  color: var(--acc-text, #9c5300);
  border-color: rgba(156, 83, 0, 0.45);
}

/* ========================================================
   INDICADOR DE DIGITACAO
======================================================== */

.rzz-typing-wrap {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  animation: rzz-msg-in 0.22s ease;
}

.rzz-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 13px 16px;
  background: var(--s2, #13161f);
  border: 1px solid var(--bdr, rgba(255,255,255,0.07));
  border-radius: 18px;
  border-bottom-left-radius: 4px;
}

.rzz-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--txt3, #5a5f70);
  animation: rzz-typing 1.2s ease-in-out infinite;
}

.rzz-typing-dot:nth-child(1) { animation-delay: 0s; }
.rzz-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.rzz-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes rzz-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* ========================================================
   INPUT (rodapé) — v3.134
   Mic + send inline dentro do campo. Mic visivel por padrao;
   send aparece ao digitar (toggle via rzz-hidden no JS).
======================================================== */

#rzz-chat-input-area {
  padding: 12px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bdr, rgba(255,255,255,0.07));
  background: var(--s1, #0e1117);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  #rzz-chat-input-area {
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 22px;
  }
}

/* v3.237: wrap vira flex horizontal, send ao lado do textarea (padrao
   Santander). Centralizado verticalmente com o campo via align-items:center.
   Antes (v3.134) era position:relative + send absoluto dentro do campo. */
#rzz-chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

#rzz-chat-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: var(--s2, #13161f);
  border: 1.5px solid var(--bdr, rgba(255,255,255,0.1));
  border-radius: 22px;
  /* v3.237: padding-right igual ao padding-left (sem espaco reservado pro
     botao inline, que foi pra fora) */
  padding: 11px 16px;
  font-size: 14px;
  color: var(--txt, #f0f0f0);
  outline: none;
  resize: none;
  max-height: 88px;
  line-height: 1.45;
  font-family: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#rzz-chat-input::placeholder { color: var(--txt3, #5a5f70); }

#rzz-chat-input:focus {
  border-color: rgba(245, 166, 35, 0.45);
  box-shadow: 0 0 0 3px rgba(245,166,35,0.08);
}

/* v3.174: TODAS as regras de #rzz-chat-mic / .rzz-mic-idle / .rzz-mic-stop /
   .is-recording / @keyframes rzzMicPulse foram REMOVIDAS junto com a feature
   de microfone. Reintroduzir requer reconsiderar engine (Web Speech API tinha
   bug de duplicacao em pt-BR Android). */

/* v3.237: SEND a direita do campo, centralizado verticalmente pelo wrap.
   Levemente maior (40px) pra ter peso visual proporcional ao textarea. */
#rzz-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--acc, #f5a623) 0%, #ff9117 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 3px 10px rgba(245,166,35,0.35);
}

#rzz-chat-send:hover  {
  transform: scale(1.08);
  box-shadow: 0 5px 14px rgba(245,166,35,0.45);
}
#rzz-chat-send:active { transform: scale(0.92); }

#rzz-chat-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#rzz-chat-send svg {
  width: 17px;
  height: 17px;
  color: #0a0a0a;
}

/* v3.174: utilitario para ocultar send via JS (mic removido) */
#rzz-chat-send.rzz-hidden {
  display: none !important;
}

/* ========================================================
   OCULTAR EM TELAS ESPECIFICAS
======================================================== */

/* v3.292: regra body.rzz-chat-hidden #rzz-chat-* REMOVIDA daqui (e tambem
   do inline em index.html). Motivo: classe podia ficar stuck em alguns
   paths de navegacao (popstate history.back nao removia em todos cases),
   escondendo Zapito na Home tambem (regressao reportada apos v3.291).
   Substituto: regras por body[data-screen="X"] em index.html (eager) +
   body[data-screen="X"] em chat-widget.css (lazy fallback abaixo).
   data-screen attribute eh atualizado SEMPRE no showScreen() linha 8369,
   nunca fica stuck (overwrite a cada navegacao). */

/* Zapito nao aparece em telas de autenticacao / biometria (login e biolock).
   Contexto e foco do user nesses momentos sao sensiveis (digitar email, OTP,
   Face ID) e o assistente seria ruido visual + risco de tap acidental. v3.62 */
body[data-screen="login"]   #rzz-chat-trigger,
body[data-screen="login"]   #rzz-chat-panel,
body[data-screen="login"]   #rzz-chat-backdrop,
body[data-screen="login"]   #rzz-chat-welcome,
body[data-screen="biolock"] #rzz-chat-trigger,
body[data-screen="biolock"] #rzz-chat-panel,
body[data-screen="biolock"] #rzz-chat-backdrop,
body[data-screen="biolock"] #rzz-chat-welcome {
  display: none !important;
}

/* v3.289 BUG FIX: defesa em profundidade pra HIDDEN_SCREENS do chat-widget.js.
   Antes dependia EXCLUSIVAMENTE do JS hook em window.showScreen (linha 825 do
   chat-widget.js). Bug reportado: ao SELECIONAR plano no /paywall, Zapito
   icon APARECE na parte inferior. Root cause provavel:
     - O JS hook so atualiza body.classList.toggle('rzz-chat-hidden') em
       FUTURAS chamadas de showScreen. Se chat-widget init rodar DEPOIS do
       user ja estar na tela atual (race comum em mobile / SW activation),
       a classe nunca eh setada inicialmente. JS hook so funciona se
       showScreen for re-chamada apos init.
     - Adicionar regras CSS por [data-screen="X"] cobre TODOS os cenarios,
       independente de quando JS roda. data-screen e setado em showScreen
       linha 8306 (document.body.dataset.screen=name), confiavel.
   Telas listadas: mesmas do CFG.HIDDEN_SCREENS em chat-widget.js. */
body[data-screen="paywall"]      #rzz-chat-trigger,
body[data-screen="paywall"]      #rzz-chat-panel,
body[data-screen="paywall"]      #rzz-chat-backdrop,
body[data-screen="paywall"]      #rzz-chat-welcome,
body[data-screen="piloto"]       #rzz-chat-trigger,
body[data-screen="piloto"]       #rzz-chat-panel,
body[data-screen="piloto"]       #rzz-chat-backdrop,
body[data-screen="piloto"]       #rzz-chat-welcome,
body[data-screen="onboarding"]   #rzz-chat-trigger,
body[data-screen="onboarding"]   #rzz-chat-panel,
body[data-screen="onboarding"]   #rzz-chat-backdrop,
body[data-screen="onboarding"]   #rzz-chat-welcome,
body[data-screen="valor"]        #rzz-chat-trigger,
body[data-screen="valor"]        #rzz-chat-panel,
body[data-screen="valor"]        #rzz-chat-backdrop,
body[data-screen="valor"]        #rzz-chat-welcome,
body[data-screen="public-track"] #rzz-chat-trigger,
body[data-screen="public-track"] #rzz-chat-panel,
body[data-screen="public-track"] #rzz-chat-backdrop,
body[data-screen="public-track"] #rzz-chat-welcome,
body[data-screen="pacotes"]      #rzz-chat-trigger,
body[data-screen="pacotes"]      #rzz-chat-panel,
body[data-screen="pacotes"]      #rzz-chat-backdrop,
body[data-screen="pacotes"]      #rzz-chat-welcome,
body[data-screen="bau"]          #rzz-chat-trigger,
body[data-screen="bau"]          #rzz-chat-panel,
body[data-screen="bau"]          #rzz-chat-backdrop,
body[data-screen="bau"]          #rzz-chat-welcome,
body[data-screen="rota"]         #rzz-chat-trigger,
body[data-screen="rota"]         #rzz-chat-panel,
body[data-screen="rota"]         #rzz-chat-backdrop,
body[data-screen="rota"]         #rzz-chat-welcome,
body[data-screen="financeiro"]   #rzz-chat-trigger,
body[data-screen="financeiro"]   #rzz-chat-panel,
body[data-screen="financeiro"]   #rzz-chat-backdrop,
body[data-screen="financeiro"]   #rzz-chat-welcome,
body[data-screen="plataformas"]  #rzz-chat-trigger,
body[data-screen="plataformas"]  #rzz-chat-panel,
body[data-screen="plataformas"]  #rzz-chat-backdrop,
body[data-screen="plataformas"]  #rzz-chat-welcome {
  display: none !important;
}

/* v3.292: regra body.rzz-chat-hidden #rzz-chat-welcome REMOVIDA pelo
   mesmo motivo da regra acima (classe stuck). Welcome bubble agora hidden
   via body[data-screen="X"] inline em index.html (eager). */

/* Quando o chat esta aberto, trava scroll do body em mobile */
body.rzz-chat-open-mobile {
  overflow: hidden;
}

/* ========================================================
   COEXISTÊNCIA COM SOS, removido 2026-05-24
   O SOS migrou pra header global (#sos-header) em commit 50c8b54
   e nao compete mais com o launcher. O Zapito volta pro lado direito
   (right:18px do bloco principal), padrao SaaS premium consagrado
   (Intercom, Drift, Crisp, HubSpot).
======================================================== */

/* ========================================================
   REDUCED MOTION
======================================================== */

@media (prefers-reduced-motion: reduce) {
  #rzz-chat-trigger,
  #rzz-chat-panel,
  #rzz-chat-backdrop,
  .rzz-msg-bubble,
  .rzz-typing-dot,
  .rzz-empty-state-avatar,
  .rzz-chat-header-avatar::after {
    animation: none !important;
    transition: opacity 0.15s ease !important;
  }
  /* Hint: skip animacao MAS forca estado final visivel (senao opacity:0 stuck). */
  #rzz-chat-hint {
    animation: none !important;
    opacity: 1 !important;
    transform: translateX(50%) !important;
  }
  #rzz-chat-hint.rzz-chat-hint--hidden {
    opacity: 0 !important;
  }
}

/* ========================================================
   HELP HINT (v3.302), chip discreto "Posso ajudar?" sob o trigger
   Pista visual pra usuarios que nao conhecem o Zapito. Some no 1o
   toque do trigger (persistido em localStorage). Padrao SaaS:
   Intercom usa um teaser similar pra reduzir friction de descoberta.
======================================================== */
#rzz-chat-hint {
  position: fixed;
  /* v3.304: +4px sobre o bottom-nav → hint fica entre trigger (bottom +28) e nav,
     com gap real de ~4px do trigger e ~4px do nav. Sem sobrepor o icone. */
  bottom: calc(var(--nav-h, 48px) + env(safe-area-inset-bottom, 0px) + 4px);
  /* Centraliza horizontalmente sob o trigger (right:18px, width:56px → centro em 46px do right) */
  right: 46px;
  transform: translateX(50%);
  padding: 3px 9px;
  background: rgba(13, 16, 24, 0.85);
  backdrop-filter: blur(10px) saturate(1.3);
  -webkit-backdrop-filter: blur(10px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 100px;
  font-family: var(--body, -apple-system, system-ui, sans-serif);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.78);
  letter-spacing: 0.2px;
  line-height: 1.2;
  white-space: nowrap;
  z-index: 8799; /* abaixo do trigger 8800 */
  pointer-events: none;
  user-select: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  opacity: 0;
  animation: rzz-hint-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 1.8s forwards;
}
@keyframes rzz-hint-in {
  from { opacity: 0; transform: translateX(50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(50%) translateY(0); }
}
#rzz-chat-hint.rzz-chat-hint--hidden {
  opacity: 0 !important;
  transform: translateX(50%) translateY(-4px) !important;
  transition: opacity 0.25s ease, transform 0.25s ease;
  animation: none;
}
/* Hint segue mesma regra de visibilidade do trigger (HIDDEN_SCREENS).
   Se trigger esta hidden, hint tambem esconde. */
body[data-screen="login"]        #rzz-chat-hint,
body[data-screen="biolock"]      #rzz-chat-hint,
body[data-screen="paywall"]      #rzz-chat-hint,
body[data-screen="piloto"]       #rzz-chat-hint,
body[data-screen="onboarding"]   #rzz-chat-hint,
body[data-screen="valor"]        #rzz-chat-hint,
body[data-screen="public-track"] #rzz-chat-hint,
body[data-screen="pacotes"]      #rzz-chat-hint,
body[data-screen="bau"]          #rzz-chat-hint,
body[data-screen="rota"]         #rzz-chat-hint,
body[data-screen="financeiro"]   #rzz-chat-hint,
body[data-screen="plataformas"]  #rzz-chat-hint {
  display: none !important;
}
