/* ============================================================
   Paulista Invest — assistente de IA (chatbot)
   Mesma linguagem visual: teal + dourado, geometria reta, mono nos rótulos.
   Lançador no canto inferior ESQUERDO (o FAB do WhatsApp fica na direita).
   ============================================================ */

.cbot__launch {
  position: fixed; left: 20px; bottom: 20px; z-index: 95;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 16px; border: 1.5px solid var(--gold); border-radius: 14px;
  background: var(--ink); color: #fff; cursor: pointer;
  font-family: var(--f-disp); font-weight: 600; font-size: .92rem; letter-spacing: -.01em;
  box-shadow: 0 14px 30px -14px rgba(11,59,59,.6);
  transition: transform .18s var(--ease), background .2s;
}
.cbot__launch:hover { transform: translateY(-2px); background: var(--ink-2); }
.cbot__launch svg { width: 20px; height: 20px; fill: none; stroke: var(--gold-soft); stroke-width: 2; }
body.cbot-open .cbot__launch { display: none; }
@media (max-width: 480px) { .cbot__launch span { display: none; } .cbot__launch { padding: 12px; } }

.cbot {
  position: fixed; left: 20px; bottom: 20px; z-index: 130;
  width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100vh - 40px));
  display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 20px;
  box-shadow: 0 30px 60px -30px rgba(11,59,59,.45), 0 8px 24px -16px rgba(11,59,59,.3);
  overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none;
  transition: opacity .22s var(--ease), transform .22s var(--ease);
}
body.cbot-open .cbot { opacity: 1; transform: none; pointer-events: auto; }

/* ---- CELULAR: o assistente vira tela cheia e acompanha o teclado ----
   height fica com 100dvh (viewport dinâmica) e o JS ajusta pela
   visualViewport quando o teclado sobe, pra o campo nunca ficar escondido. */
@media (max-width: 560px) {
  .cbot {
    left: 0; right: 0; top: 0; bottom: auto;
    width: 100%; height: 100dvh; max-height: none;
    border: 0; border-radius: 0;
  }
  body.cbot-open { overflow: hidden; }            /* trava a rolagem da página atrás */
  .cbot__head { padding-top: max(16px, env(safe-area-inset-top)); }
  .cbot__disc { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .cbot__form input { font-size: 16px; }          /* >=16px evita o zoom do iOS ao focar */
}

.cbot__head {
  background: var(--ink); color: #fff; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.cbot__head b { font-family: var(--f-disp); font-weight: 600; font-size: 1rem; display: block; }
.cbot__head span { font-family: var(--f-mono); font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-soft); }
.cbot__acts { display: flex; align-items: center; gap: 2px; }
.cbot__x, .cbot__reset { background: none; border: 0; color: var(--tx-on-ink-mut); line-height: 1; cursor: pointer; padding: 6px; border-radius: 999px; transition: color .15s, background .15s; }
.cbot__x { font-size: 1.2rem; }
.cbot__reset { font-size: 1.05rem; }
.cbot__x:hover, .cbot__reset:hover { color: #fff; background: rgba(255,255,255,.08); }

.cbot__log { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--paper); }
.cbot__msg { max-width: 82%; padding: 11px 15px; border-radius: 18px; font-size: .93rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; animation: cbotPop .26s var(--ease) both; }
.cbot__msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--line); color: var(--tx); border-bottom-left-radius: 6px; }
.cbot__msg--me  { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 6px; }
/* mensagens seguidas do mesmo lado: encostam, como numa conversa */
.cbot__msg--bot + .cbot__msg--bot, .cbot__msg--me + .cbot__msg--me { margin-top: -6px; }
/* links dentro da resposta da IA (o "WhatsApp" vira atalho tocável) */
.cbot__msg--bot a { color: var(--gold); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.cbot__msg--bot a.cbot__wa { color: #128c7e; }
.cbot__msg--bot a:hover { text-decoration-thickness: 2px; }
@keyframes cbotPop { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cbot__msg { animation: none; } }

/* botões de sugestão inicial */
.cbot__chips { display: flex; flex-wrap: wrap; gap: 8px; align-self: flex-start; max-width: 100%; }
.cbot__chip {
  background: none; border: 1px solid var(--line-strong); border-radius: var(--r-btn);
  padding: 8px 12px; font-family: var(--f-body); font-size: .82rem; color: var(--ink); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.cbot__chip:hover { border-color: var(--ink); background: #fff; }
/* chip de ação "Falar com especialista" (verde WhatsApp) */
.cbot__chip--wa { border-color: #128c7e; color: #0c6b60; font-weight: 600; }
.cbot__chip--wa:hover { border-color: #0c6b60; background: #eefaf6; }

/* botão de WhatsApp no cabeçalho do chat */
.cbot__wa-top { background: none; border: 0; color: var(--gold-soft); cursor: pointer; padding: 6px; border-radius: 999px; line-height: 0; transition: color .15s, background .15s; }
.cbot__wa-top svg { width: 20px; height: 20px; }
.cbot__wa-top:hover { color: #fff; background: rgba(255,255,255,.08); }

/* cartão de contato (captação com consentimento LGPD) */
.cbot__handoff {
  align-self: stretch; background: #fff; border: 1px solid var(--line-strong);
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 10px;
  animation: cbotPop .26s var(--ease) both;
}
.cbot__handoff b { font-family: var(--f-disp); font-size: 1rem; color: var(--ink); }
.cbot__handoff-sub { margin: 0; font-size: .86rem; color: var(--tx-mut); line-height: 1.45; }
.cbot__field { display: flex; flex-direction: column; gap: 4px; }
.cbot__field span { font-size: .74rem; color: var(--tx-mut); font-family: var(--f-mono); letter-spacing: .04em; }
.cbot__field input {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px;
  font-family: var(--f-body); font-size: 16px; color: var(--tx); background: var(--paper);
}
.cbot__field input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cbot__consent { display: flex; align-items: flex-start; gap: 8px; font-size: .8rem; color: var(--tx-mut); line-height: 1.4; cursor: pointer; }
.cbot__consent input { margin-top: 2px; flex-shrink: 0; accent-color: var(--ink); width: 16px; height: 16px; }
.cbot__consent a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }
.cbot__handoff-go {
  border: 0; border-radius: 12px; background: #128c7e; color: #fff; padding: 12px;
  font-family: var(--f-disp); font-weight: 600; font-size: .95rem; cursor: pointer; transition: background .2s, opacity .2s;
}
.cbot__handoff-go:hover:not(:disabled) { background: #0e7568; }
.cbot__handoff-go:disabled { opacity: .45; cursor: not-allowed; }
.cbot__handoff-skip { border: 0; background: none; color: var(--tx-mut); font-size: .8rem; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; padding: 0; }
.cbot__handoff-skip:hover { color: var(--ink); }

/* indicador "digitando" */
.cbot__typing { align-self: flex-start; display: inline-flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 18px; border-bottom-left-radius: 6px; animation: cbotPop .26s var(--ease) both; }
.cbot__typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--tx-mut); opacity: .4; animation: cbotBlink 1.1s infinite; }
.cbot__typing i:nth-child(2) { animation-delay: .18s; }
.cbot__typing i:nth-child(3) { animation-delay: .36s; }
@keyframes cbotBlink { 0%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .cbot__typing i { animation: none; } }

.cbot__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: #fff; }
.cbot__form input {
  flex: 1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; font-family: var(--f-body); font-size: .93rem; color: var(--tx); background: var(--paper);
}
.cbot__form input:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cbot__form button {
  flex-shrink: 0; width: 46px; border: 0; border-radius: 12px; background: var(--ink); color: #fff;
  font-size: 1.2rem; cursor: pointer; transition: background .2s;
}
.cbot__form button:hover:not(:disabled) { background: var(--ink-2); }
.cbot__form button:disabled { opacity: .5; cursor: default; }

.cbot__disc { margin: 0; padding: 8px 14px 12px; background: #fff; font-size: .66rem; line-height: 1.4; color: var(--tx-mut); text-align: center; }
