/* =========================================================
   ✅ CONFIG (tokens) — agora com variáveis reutilizáveis
   -> Você só troca aqui (ou injeta via JS no :root)
========================================================= */

:root{
  --wb-lang: "pt-BR";
  --wb-avatar: none;

  --wb-header-bg: #ffffff;
  --wb-header-text: #111827;

  --wb-footer-bg: rgba(255,255,255,0.92);

  --wb-chat-bg-color: #f5f7fb;
  --wb-chat-bg-image: none;
  --wb-chat-bg-size: cover;
  --wb-chat-bg-position: center;
  --wb-chat-bg-repeat: no-repeat;

  --wb-bubble-bot-bg: #ffffff;
  --wb-bubble-bot-text: #111827;

  --wb-bubble-user-bg: #4f46e5;
  --wb-bubble-user-text: #ffffff;

  --wb-radius: 18px;
  --wb-shadow: 0 18px 50px rgba(0,0,0,0.35);
  --wb-soft-shadow: 0 10px 24px rgba(0,0,0,0.18);

  --wb-avatar-delay: 2s;
  --wb-teaser-typing-delay: 3s;
  --wb-teaser-msg-delay: 8.4s;
  --wb-teaser-badge-delay: 8.4s;
}

/* =========================================================
   Wrapper flutuante
========================================================= */
.floating-cta{
  position: fixed;
  right: 16px;
  bottom: 60px;
  z-index: 2147483647;
  pointer-events: none;

  --cta-bottom: 60px;
  transition: bottom .22s cubic-bezier(.2,.8,.2,1);
}
/* ✅ quando abrir, desce MAIS o avatar */
.floating-cta.is-open{
  bottom: 6px;
  --cta-bottom: 6px;
}



/* Avatar */
.floating-avatar{
  width: 64px;
  height: 64px;
  position: relative;
  pointer-events: auto;
  z-index: 3;
  cursor: pointer;

  opacity: 0;
  transform: scale(0.6) translateY(10px);
  transform-origin: bottom right;
  animation: avatarPop .45s cubic-bezier(.2,.9,.2,1) var(--wb-avatar-delay, 2s) forwards;
}
@keyframes avatarPop{ to{ opacity: 1; transform: scale(1) translateY(0);} }

.floating-avatar::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:50%;
  background: var(--wb-avatar) center/cover no-repeat;
  box-shadow: 0 4px 10px rgba(0,0,0,0.22), 0 1px 3px rgba(0,0,0,0.14);
}
.floating-avatar img{ display:none; }

/* Badge */
.floating-badge{
  position:absolute;
  top:-6px; right:-6px;
  width:22px; height:22px;
  background:#22c55e;
  box-shadow:
    0 2px 6px rgba(0,0,0,0.28),
    0 0 0 4px rgba(34,197,94,0.18);
  color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700;
  border-radius:50%;
  border:2px solid #fff;
  opacity:0;
  transform:scale(.7);
  pointer-events:none;
  animation: badgeIn .25s cubic-bezier(.2,.8,.2,1) var(--wb-teaser-badge-delay, 8.4s) forwards;
}
@keyframes badgeIn{ to{ opacity:1; transform:scale(1);} }

/* ✅ vidro mais aparente (Apple-like) */
.floating-bubble-base{
 position: absolute;
  right: calc(64px + 10px); /* só depende do avatar */
   bottom: 32px;             /* alinhado no “meio” do avatar */
  z-index: 2;
  pointer-events: none;

  background: rgba(255,255,255,0.58);
  color: #111827;

  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);

  border: 1px solid rgba(255,255,255,0.55);
  box-shadow:
    0 18px 40px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.85),
    inset 0 -1px 0 rgba(0,0,0,0.06);

  border-radius: 16px;
}

/* ✅ seta com o mesmo material + “brilho” */
.floating-bubble-base::after{
  content:"";
  position:absolute;
  top:50%;
  transform:translateY(-50%) rotate(45deg);
  right:-6px;
  width:12px; height:12px;

  background: rgba(255,255,255,0.58);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);

  border-right: 1px solid rgba(255,255,255,0.55);
  border-bottom: 1px solid rgba(255,255,255,0.55);

  box-shadow: 8px 8px 18px rgba(0,0,0,0.10);
}

/* typing */
.floating-typing{
  padding:10px 14px;
  border-radius:14px 18px 18px 14px;
  opacity:0;
  transform: translateX(8px) translateY(50%) scale(.98);
  transform-origin:right center;
  animation: typingLifecycle 5.5s linear var(--wb-teaser-typing-delay, 3s) forwards;

  /* ✅ GLASS mais forte APENAS no typing do preview */
  background: rgba(255,255,255,0.42) !important;
  backdrop-filter: blur(22px) saturate(190%) !important;
  -webkit-backdrop-filter: blur(22px) saturate(190%) !important;
  border: 1px solid rgba(255,255,255,0.65) !important;
  box-shadow:
    0 18px 40px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.9),
    inset 0 -1px 0 rgba(255,255,255,0.25) !important;
}
@keyframes typingLifecycle{
  0%{opacity:0; transform: translateX(8px) translateY(50%) scale(.98);}
  8%{opacity:1; transform: translateX(0) translateY(50%) scale(1);}
  95%{opacity:1; transform: translateX(0) translateY(50%) scale(1);}
  100%{opacity:0;}
}

.typing-dots{ display:inline-flex; gap:6px; }
.typing-dots i{
  width:6px; height:6px; border-radius:50%;
  background: rgba(31,41,55,0.75);
  animation: dotBounce 1s infinite ease-in-out;
}
.typing-dots i:nth-child(2){animation-delay:.15s;}
.typing-dots i:nth-child(3){animation-delay:.3s;}
@keyframes dotBounce{
  0%,80%,100%{transform:translateY(0); opacity:.5;}
  40%{transform:translateY(-4px); opacity:1;}
}

/* preview message */
.floating-message{
  width:max-content;
  max-width: calc(100vw - 120px);
  font-size:17px;
  font-weight:600;
  line-height:1.35;
  padding:12px 14px;
  border-radius:16px 22px 22px 16px;
  opacity:0;
  transform: translateX(3px) translateY(50%) scale(.99);
  transform-origin:right center;
  animation: messageLifecycle 6s cubic-bezier(.2,.8,.2,1) var(--wb-teaser-msg-delay, 8.4s) forwards;
}
@keyframes messageLifecycle{
  0%{opacity:0; transform: translateX(3px) translateY(50%) scale(.99);}
  6%{opacity:1; transform: translateX(0) translateY(50%) scale(1);}
  80%{opacity:1;}
  100%{opacity:0;}
}

/* mostrar preview/badge quando o JS pedir */
.floating-message.is-show{
  opacity: 1 !important;
  transform: translateX(0) translateY(50%) scale(1) !important;
  animation: none !important;
}
.floating-badge.is-show{
  opacity: 1 !important;
  transform: scale(1) !important;
  animation: none !important;
}
#teaserMsg[data-mode="notify"]{
  animation: none !important;
}

/* =========================================================
   ✅ Bubble de imagem
========================================================= */
.msg.image{
  padding: 6px;
  overflow: hidden;
}

.msg.image img{
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  cursor: pointer;
}


/* =========================================================
   CHAT MODAL (SEM iframe)
========================================================= */
.chat-modal{
  position: fixed;
  inset: 0;
  z-index: 2147483647;

  display:block;
  opacity:0;
  visibility:hidden;
  pointer-events:none;

  transition: opacity .18s ease, visibility 0s linear .18s;
}
.chat-modal.is-open{
  opacity:1;
  visibility:visible;
  pointer-events:auto;
  transition: opacity .18s ease;
}

.chat-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.45);

  opacity:0;
  transition: opacity .18s ease;
}
.chat-modal.is-open .chat-backdrop{ opacity:1; }

/* painel animado via transform inline (FLIP) */
.chat-panel{
  position:absolute;
  left:10px;
  right:10px;
  top:10px;
  bottom:10px;
  background:#fff;
  border-radius:18px;
  overflow:hidden;
  box-shadow: var(--wb-shadow);
  display:flex;
  flex-direction:column;

  opacity:0;
  transform: translate3d(0,0,0) scale(1);
  transform-origin:center center;
  will-change: transform, opacity, border-radius;
  transition:
    transform .38s cubic-bezier(.2,.9,.2,1),
    opacity .22s ease,
    border-radius .38s cubic-bezier(.2,.9,.2,1);
}

/* ✅ header e footer fixos dentro do painel */
.chat-header{ flex: 0 0 auto; position: sticky; top: 0; z-index: 3; }
.chat-footer{ flex: 0 0 auto; position: sticky; bottom: 0; z-index: 3; }

/* ✅ só o miolo rola */
.chat-body{
  flex: 1 1 auto;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Header */
.chat-header{
  background: var(--wb-header-bg);
  color: var(--wb-header-text);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  padding: 12px 12px;

  display:flex;
  align-items:center;
  gap: 10px;

  position: sticky;
  top: 0;
  z-index: 2;
}
.chat-header .avatar{
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--wb-avatar) center/cover no-repeat;
  flex: 0 0 auto;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.chat-header .meta{
  min-width: 0;
  display:flex;
  flex-direction:column;
  gap: 2px;
}
.chat-header .name{
  font-size: 16px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header .status{
  font-size: 13px;
  font-weight: 600;
  opacity: .75;
  display:flex;
  align-items:center;
  gap: 6px;
}
.chat-header .dot{
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.18);
}

/* Minimizar */
.chat-minimize{
  margin-left: auto;
  width: 42px; height: 42px;
  border-radius: 14px;
  border: 0;
  background: rgba(17,24,39,0.08);
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: background .15s ease, transform .05s ease;
}
.chat-minimize:hover{ background: rgba(17,24,39,0.12); }
.chat-minimize:active{ transform: translateY(1px); }
.chat-minimize svg{
  width: 20px; height: 20px;
  stroke: #111827;
  stroke-width: 2.2;
  fill: none;
  opacity: .85;
}

/* Body */
.chat-body{
  flex: 1 1 auto;
  padding: 6px 12px 10px;
  overflow:auto;
  overscroll-behavior: contain;

  background-color: var(--wb-chat-bg-color);
  background-image: var(--wb-chat-bg-image);
  background-size: var(--wb-chat-bg-size);
  background-position: var(--wb-chat-bg-position);
  background-repeat: var(--wb-chat-bg-repeat);
}

/* =========================================================
   Badge "Agora" — versão mais clean e discreta
========================================================= */
.chat-now{
  position: sticky;
  top: 2px;
  z-index: 9;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin: 0 0 8px;
}
.chat-now span{
  padding: 5px 10px;
  border-radius: 10px;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15px;

  color: rgba(17,24,39,.65);
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(0,0,0,.06);

  backdrop-filter: blur(6px);
  box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

/* =========================================================
   ✅ Mensagens com horário DENTRO do bubble
========================================================= */
.msg-row{ display:flex; margin: 10px 0; }
.msg-row.bot{ justify-content: flex-start; }
.msg-row.user{ justify-content: flex-end; }

.msg{
  max-width: 88%;
  padding: 12px 14px 18px;
  border-radius: var(--wb-radius);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 600;
  word-wrap: break-word;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  position: relative;
}

.msg.bot{
  background: var(--wb-bubble-bot-bg);
  color: var(--wb-bubble-bot-text);
  border: 1px solid rgba(0,0,0,0.06);
  border-top-left-radius: 12px;
}
.msg.user{
  background: var(--wb-bubble-user-bg);
  color: var(--wb-bubble-user-text);
  border-top-right-radius: 12px;
}

.msg-time{
  position: absolute;
  bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  opacity: .55;
  letter-spacing: .2px;
  user-select: none;
  white-space: nowrap;
}
.msg.bot .msg-time{ right: 10px; }
.msg.user .msg-time{ right: 10px; }

/* Footer */
.chat-footer{
  background: var(--wb-footer-bg);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0,0,0,0.06);
  padding: 10px;
  display:flex;
  gap: 10px;
  align-items:center;
}

.chat-input{
  flex: 1 1 auto;
  min-width: 0;

  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 14px;
  padding: 13px 12px;

  font-size: 17px;
  line-height: 1.25;

  outline: none;
  background: #fff;

  resize: none;
  overflow-y: hidden;
  max-height: calc(1.25em * 3 + 20px);
}

.chat-input:focus{
  border-color: rgba(79,70,229,.35);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
}

.chat-send{
  flex: 0 0 auto;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 16px;
  font-weight: 800;
  cursor:pointer;
  background: var(--wb-bubble-user-bg);
  color: var(--wb-bubble-user-text);
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}
.chat-send:active{ transform: translateY(1px); }

@media (max-width: 480px){
  .chat-panel{
    top:10px; left:8px; right:8px;
    bottom: calc(var(--cta-bottom, 60px) + 64px + 12px);
    border-radius: 16px;
  }
  .msg{ max-width: 92%; }
}

/* ✅ bubble de "digitando" dentro do chat */
.msg.is-typing{
  padding: 10px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
}
.msg.is-typing .typing-dots{
  display:inline-flex;
  gap:6px;
}
.msg.is-typing .typing-dots i{
  width:6px; height:6px; border-radius:50%;
  background: rgba(31,41,55,0.55);
  animation: dotBounce 1s infinite ease-in-out;
}
.msg.is-typing .typing-dots i:nth-child(2){animation-delay:.15s;}
.msg.is-typing .typing-dots i:nth-child(3){animation-delay:.3s;}

/* preview/badge helpers */
.floating-typing.is-hidden{ display:none !important; }

.floating-message.is-hide{
  opacity: 0 !important;
  transform: translateX(8px) translateY(50%) scale(.98) !important;
  animation: none !important;
}
.floating-message.is-reset{
  opacity: 0 !important;
  transform: translateX(3px) translateY(50%) scale(.99) !important;
  animation: none !important;
}
.floating-badge{
  display:flex;
  opacity:0;
  transform:scale(.7);
  pointer-events:none;
}
.floating-badge.is-show{
  opacity:1 !important;
  transform:scale(1) !important;
}

/* =========================================================
   ✅ Link CTA dentro do bubble (preview) - MAIOR
========================================================= */
.link-cta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-top:10px;

  width:100%;
  padding:14px 14px;
  min-height:56px;

  border-radius:16px;
  border:1px solid rgba(0,0,0,0.10);
  background: rgba(255,255,255,0.80);

  color:#111827;
  font-weight:800;
  font-size:15px;
  text-decoration:none;

  cursor:pointer;
  box-shadow: 0 10px 22px rgba(0,0,0,0.12);
  position:relative;
  overflow:hidden;
}

.msg.user .link-cta{
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}

.link-cta .link-domain{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 75%;
  font-size:15px;
  font-weight:800;
}

.link-cta .link-icon{
  flex:0 0 auto;
  width:34px;height:34px;
  border-radius:12px;
  display:grid;
  place-items:center;
  background: rgba(79,70,229,0.12);
  font-size:18px;
}

@keyframes softPulse{
  0%{ transform: translateZ(0) scale(1); box-shadow:0 8px 18px rgba(0,0,0,0.10); }
  50%{ transform: translateZ(0) scale(1.02); box-shadow:0 10px 22px rgba(0,0,0,0.14); }
  100%{ transform: translateZ(0) scale(1); box-shadow:0 8px 18px rgba(0,0,0,0.10); }
}

/* ✅ “Levemente pulsando” até clicar */
.link-cta.is-pulsing{
  animation: softPulse 1.35s ease-in-out infinite;
}

/* =========================================================
   ✅ Clique do teaser (controle de pointer-events)
========================================================= */
#teaserMsg{
  pointer-events: none;
  cursor: default;
}
#teaserMsg.is-show{
  pointer-events: auto;
  cursor: pointer;
}
#teaserMsg.is-hide,
#teaserMsg.is-reset{
  pointer-events: none !important;
}
#teaserMsg[data-mode="default"]{
  pointer-events: auto;
  cursor: pointer;
}
#teaserMsg.is-hide,
#teaserMsg.is-reset{
  pointer-events: none !important;
  cursor: default;
}

/* =========================================================
   ✅ Modal de imagem fullscreen
========================================================= */
.image-modal{
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.image-modal.is-open{
  opacity: 1;
  pointer-events: auto;
}

.image-modal img{
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.msg.image-group .img-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:8px;
  width:min(320px, 72vw);
}

.msg.image-group .img-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:8px;
  width: min(320px, 72vw);
}

.msg.image-group .img-cell{
  position:relative;
  overflow:hidden;
  border-radius:14px;
  aspect-ratio: 1 / 1;
  cursor:pointer;
  background: rgba(0,0,0,0.03);
}

.msg.image-group .img-cell img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.msg.image-group .img-cell::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.00), rgba(0,0,0,0.12));
  pointer-events:none;
}


.msg.image-group .img-more{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:26px;
  color:#fff;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(2px);
}

.image-modal .im-wrap{
  position:relative;
  width: min(980px, 96vw);
  height: min(720px, 92vh);
  display:flex;
  align-items:center;
  justify-content:center;
}

.image-modal .im-wrap img{
  max-width: 100%;
  max-height: 100%;
  border-radius: 16px;
}

.image-modal .im-nav,
.image-modal .im-close{
  position:absolute;
  border:0;
  cursor:pointer;
  color:#fff;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
}

.image-modal .im-close{
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 900;
}

.image-modal .im-nav{
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 56px;
  border-radius: 16px;
  font-size: 34px;
  font-weight: 900;
  display:flex;
  align-items:center;
  justify-content:center;
}

.image-modal .im-prev{ left: 12px; }
.image-modal .im-next{ right: 12px; }

.image-modal .im-counter{
  position:absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .2px;
}

/* ✅ só no grupo: bubble um pouco menos arredondado */
.msg.image-group{
  border-radius: 14px !important;   /* antes seguia --wb-radius (18px) */
  padding: 8px !important;         /* deixa o grid mais “justo” */
  gap:6px !important;
}

/* ✅ só no grupo: tiles menos arredondados */
.msg.image-group .img-cell{
  border-radius: 10px !important;  /* antes 14px */
}

/* ✅ garante que a imagem acompanha o tile */
.msg.image-group .img-cell img{
  border-radius: 10px !important;
}

