/* ============================================================
   FASSOLI — Assistente virtual (chat.js) · estilos
   ============================================================ */

/* Esconde o flutuante do WhatsApp — o botão do chat ocupa o lugar (e também leva ao WhatsApp) */
.floatwa { display: none !important; }

/* botão flutuante do chat (lado direito, no lugar do antigo WhatsApp) */
.chatw__fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 75;
  display: inline-flex; align-items: center; gap: 0;
  height: 58px; padding: 0; border: none; cursor: pointer;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent, #2563EB), var(--primary, #1E3A5F));
  color: #fff;
  box-shadow: 0 16px 36px -12px rgba(37,99,235,.6), 0 4px 12px -4px rgba(16,28,50,.4);
  transition: transform .22s ease, box-shadow .22s ease, opacity .2s, visibility .2s;
  overflow: hidden;
}
.chatw__fab:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -12px rgba(37,99,235,.7), 0 6px 16px -4px rgba(16,28,50,.45); }
.chatw__fab-ic {
  position: relative; flex: none;
  width: 58px; height: 58px; display: grid; place-items: center;
}
.chatw__fab-ic svg { width: 27px; height: 27px; }
.chatw__fab-ic::before {
  content: ""; position: absolute; inset: 9px; border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255,255,255,.4);
  animation: chatwPulse 2.6s ease-out infinite;
}
@keyframes chatwPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); }
  70% { box-shadow: 0 0 0 16px rgba(255,255,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.chatw__fab-dot {
  position: absolute; top: 12px; right: 12px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #34D399; border: 2px solid #fff;
}
.chatw__fab-label {
  max-width: 0; opacity: 0;
  font-family: var(--font-body, sans-serif); font-weight: 600; font-size: .96rem;
  white-space: nowrap; overflow: hidden;
  transition: max-width .35s cubic-bezier(.4,0,.2,1), opacity .25s ease, padding .35s ease;
}
.chatw__fab:hover .chatw__fab-label,
.chatw__fab.chatw__fab--peek .chatw__fab-label {
  max-width: 180px; opacity: 1; padding-right: 22px;
}
@media (prefers-reduced-motion: reduce) {
  .chatw__fab-ic::before { animation: none; }
}
.chatw__fab svg { width: 28px; height: 28px; }
.chatw__fab.is-hidden { opacity: 0; visibility: hidden; transform: scale(.7); }

/* painel do chat */
.chatw__panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 76;
  width: min(380px, calc(100vw - 44px));
  height: min(560px, calc(100vh - 96px));
  background: #fff; border: 1px solid var(--border, #E3E9F1);
  border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 70px -28px rgba(16,28,50,.55), 0 10px 30px -12px rgba(16,28,50,.2);
  opacity: 0; visibility: hidden; transform: translateY(16px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.chatw__panel.is-open { opacity: 1; visibility: visible; transform: none; }

/* cabeçalho */
.chatw__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--primary, #1E3A5F); color: #fff;
}
.chatw__id { display: flex; align-items: center; gap: 11px; }
.chatw__avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.14); display: grid; place-items: center; flex: none;
}
.chatw__avatar svg { width: 22px; height: 22px; color: #fff; }
.chatw__id strong { display: block; font-family: var(--font-display, sans-serif); font-size: 1.02rem; line-height: 1.2; }
.chatw__status { font-size: .76rem; color: rgba(255,255,255,.75); display: inline-flex; align-items: center; gap: 5px; }
.chatw__status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #5BD675; }
.chatw__close {
  background: rgba(255,255,255,.14); border: none; color: #fff;
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
  transition: background .2s;
}
.chatw__close:hover { background: rgba(255,255,255,.28); }

/* corpo / mensagens */
.chatw__body {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg-soft, #F6F8FB);
  -webkit-overflow-scrolling: touch;
}
.chatw__msg { display: flex; }
.chatw__msg--user { justify-content: flex-end; }
.chatw__bubble {
  max-width: 84%; padding: 11px 14px; font-size: .92rem; line-height: 1.5;
  border-radius: 16px; word-wrap: break-word;
}
.chatw__msg--bot .chatw__bubble {
  background: #fff; color: var(--text, #16243B);
  border: 1px solid var(--border, #E3E9F1); border-bottom-left-radius: 5px;
}
.chatw__msg--user .chatw__bubble {
  background: var(--accent, #2563EB); color: #fff; border-bottom-right-radius: 5px;
}
.chatw__bubble a { color: inherit; text-decoration: underline; }
.chatw__msg--bot .chatw__bubble a { color: var(--accent, #2563EB); font-weight: 600; }

/* sugestões iniciais */
.chatw__sugs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.chatw__sug {
  font-family: inherit; font-size: .84rem; font-weight: 500;
  color: var(--primary, #1E3A5F); background: #fff;
  border: 1px solid #D4E0F2; border-radius: 999px; padding: 8px 13px; cursor: pointer;
  transition: background .18s, border-color .18s;
}
.chatw__sug:hover { background: var(--accent-soft, #EFF4FF); border-color: var(--accent, #2563EB); }

/* indicador "digitando" */
.chatw__dots { display: inline-flex; gap: 4px; padding: 2px 0; }
.chatw__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint, #8A98AC); animation: chatwDot 1.2s infinite ease-in-out; }
.chatw__dots i:nth-child(2) { animation-delay: .18s; }
.chatw__dots i:nth-child(3) { animation-delay: .36s; }
@keyframes chatwDot { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* formulário */
.chatw__form { display: flex; align-items: center; gap: 8px; padding: 12px; border-top: 1px solid var(--border, #E3E9F1); background: #fff; }
.chatw__form input {
  flex: 1; font-family: inherit; font-size: .94rem; color: var(--text, #16243B);
  border: 1px solid var(--border-strong, #CDD7E5); border-radius: 999px; padding: 11px 16px;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.chatw__form input:focus { border-color: var(--accent, #2563EB); box-shadow: 0 0 0 3px var(--accent-soft, #EFF4FF); }
.chatw__send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent, #2563EB); color: #fff; display: grid; place-items: center;
  transition: background .2s, transform .15s;
}
.chatw__send:hover { background: var(--accent-hover, #1D4ED8); transform: scale(1.05); }
.chatw__send svg { width: 19px; height: 19px; }

.chatw__foot { font-size: .72rem; color: var(--text-faint, #8A98AC); text-align: center; padding: 0 14px 12px; line-height: 1.4; background: #fff; }
.chatw__foot a { color: var(--accent, #2563EB); font-weight: 600; }

/* estado "limite atingido" — botão para o WhatsApp */
.chatw__locked { padding: 12px; border-top: 1px solid var(--border, #E3E9F1); background: #fff; }
.chatw__wabtn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; padding: 13px; border-radius: 12px;
  background: var(--accent, #2563EB); color: #fff; font-weight: 600; font-size: .96rem;
  text-decoration: none; transition: background .2s, transform .15s;
}
.chatw__wabtn:hover { background: var(--accent-hover, #1D4ED8); transform: translateY(-1px); }
.chatw__wabtn svg { width: 19px; height: 19px; }

/* botão de WhatsApp inline (quando o visitante pede atendente) — não trava o chat */
.chatw__cta { padding: 4px 14px 8px; }
.chatw__cta .chatw__wabtn { width: 100%; }

/* mobile: o FAB sobe para não cobrir a barra inferior; painel ocupa quase tudo */
@media (max-width: 620px) {
  .chatw__fab { right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); height: 52px; }
  .chatw__fab-ic { width: 52px; height: 52px; }
  .chatw__fab-ic svg { width: 24px; height: 24px; }
  /* no mobile fica só o círculo (sem rótulo) para não cobrir conteúdo */
  .chatw__fab .chatw__fab-label { display: none; }
  .chatw__panel {
    left: 8px; right: 8px; bottom: 8px; width: auto;
    height: min(78vh, calc(100vh - 90px));
  }
}
