/* ═══════════════════════════════════════════════
   Chat da Tatá — assistente virtual do CBR
   Widget flutuante em todas as páginas
   ═══════════════════════════════════════════════ */

.tchat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2000;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: #E8F4FA;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 2.5px var(--blue, #0086BC), 0 0 22px rgba(0, 134, 188, 0.45), 0 14px 30px -12px rgba(1, 42, 58, 0.5);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s;
}
.tchat-fab:hover { transform: translateY(-4px) scale(1.06); box-shadow: 0 0 0 2.5px var(--gold, #FDB603), 0 0 28px rgba(253, 182, 3, 0.5), 0 18px 34px -12px rgba(1, 42, 58, 0.5); }
.tchat-fab img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.tchat-fab::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #4ADE80;
  border: 2.5px solid #fff;
}

/* balãozinho de convite */
.tchat-hello {
  position: fixed;
  right: 96px;
  bottom: 34px;
  z-index: 2000;
  background: #fff;
  border: 2px solid var(--blue, #0086BC);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 16px;
  font: 600 0.85rem/1.35 'Poppins', sans-serif;
  letter-spacing: -0.05em;
  color: var(--blue-ink, #012A3A);
  box-shadow: 0 12px 28px -14px rgba(1, 42, 58, 0.45);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  max-width: 220px;
}
.tchat-hello.is-in { opacity: 1; transform: none; pointer-events: auto; }

/* ── Painel ────────────────────────────────── */
.tchat {
  position: fixed;
  right: 22px;
  bottom: 98px;
  z-index: 2001;
  width: min(352px, calc(100vw - 32px));
  height: min(520px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 2.5px solid var(--blue, #0086BC);
  border-radius: 22px;
  box-shadow: 0 0 30px rgba(0, 134, 188, 0.25), 0 30px 60px -24px rgba(1, 42, 58, 0.55);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1), transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: 'Poppins', sans-serif;
  letter-spacing: -0.05em;
}
.tchat.is-open { opacity: 1; transform: none; pointer-events: auto; }

/* cabeçalho */
.tchat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(120deg, #0091ca, #0086BC 55%, #006b96);
  color: #fff;
  flex: 0 0 auto;
}
.tchat__live {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #E8F4FA;
  border: 2.5px solid #fff;
  box-shadow: 0 4px 12px -4px rgba(1, 42, 58, 0.4);
}
.tchat__live canvas { width: 100%; height: 100%; display: block; }
.tchat__id { display: flex; flex-direction: column; line-height: 1.2; }
.tchat__id strong { font-size: 1rem; font-weight: 800; }
.tchat__id span { font-size: 0.72rem; opacity: 0.9; display: flex; align-items: center; gap: 5px; }
.tchat__id span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; }
.tchat__close {
  margin-left: auto;
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.25s;
}
.tchat__close:hover { background: rgba(255, 255, 255, 0.3); }

/* mensagens */
.tchat__msgs {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.tchat__msg {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.86rem;
  line-height: 1.5;
  animation: tchatIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes tchatIn { from { opacity: 0; transform: translateY(10px); } }
.tchat__msg--bot {
  align-self: flex-start;
  background: #EFF7FB;
  border: 1.5px solid rgba(0, 134, 188, 0.22);
  border-bottom-left-radius: 5px;
  color: #123;
}
.tchat__msg--bot a { color: var(--blue, #0086BC); font-weight: 700; text-decoration: underline; }
.tchat__msg--bot strong { color: var(--blue, #0086BC); }
.tchat__msg--user {
  align-self: flex-end;
  background: var(--blue, #0086BC);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.tchat__typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 13px 16px;
  background: #EFF7FB;
  border: 1.5px solid rgba(0, 134, 188, 0.22);
  border-radius: 16px 16px 16px 5px;
}
.tchat__typing i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--blue, #0086BC);
  opacity: 0.5;
  animation: tchatDot 1.1s infinite;
}
.tchat__typing i:nth-child(2) { animation-delay: 0.18s; }
.tchat__typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes tchatDot { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* sugestões */
.tchat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 4px 14px 10px;
  flex: 0 0 auto;
}
.tchat__chip {
  border: 1.5px solid var(--blue, #0086BC);
  color: var(--blue, #0086BC);
  background: #fff;
  font: 600 0.72rem 'Poppins', sans-serif;
  letter-spacing: -0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.22s, color 0.22s, transform 0.22s;
}
.tchat__chip:hover { background: var(--blue, #0086BC); color: #fff; transform: translateY(-2px); }
.tchat__chip--go {
  background: var(--gold, #FDB603);
  border-color: var(--gold, #FDB603);
  color: #012A3A;
  font-weight: 800;
  box-shadow: 0 6px 16px -8px rgba(253, 182, 3, 0.8);
}
.tchat__chip--go:hover { background: #012A3A; border-color: #012A3A; color: #FDB603; }

/* entrada */
.tchat__bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1.5px solid rgba(0, 134, 188, 0.15);
  flex: 0 0 auto;
  background: #fff;
}
.tchat__input {
  flex: 1;
  border: 1.8px solid rgba(0, 134, 188, 0.35);
  border-radius: 999px;
  padding: 10px 16px;
  font: 500 0.86rem 'Poppins', sans-serif;
  letter-spacing: -0.04em;
  color: #123;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.tchat__input:focus { border-color: var(--blue, #0086BC); box-shadow: 0 0 0 3px rgba(0, 134, 188, 0.15); }
.tchat__send {
  width: 42px; height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--blue, #0086BC);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.25s, transform 0.25s;
}
.tchat__send:hover { background: var(--gold, #FDB603); transform: scale(1.08); }
.tchat__send svg { width: 18px; height: 18px; }

@media (max-width: 520px) {
  .tchat { right: 12px; left: 12px; width: auto; bottom: 92px; height: min(560px, calc(100vh - 110px)); }
  .tchat-hello { display: none; }
}
