/* ── Root ── */
#nepiChatRoot {
  position: fixed;
  bottom: 88px; /* acima do botão WhatsApp */
  right: 20px;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  pointer-events: none;
}

/* ── Botão abrir ── */
.chat-open-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1f86ff;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(31,134,255,0.40);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.chat-open-btn:hover {
  background: #1675e1;
  transform: scale(1.04);
}

/* ── Painel ── */
.chat-panel {
  pointer-events: auto;
  width: min(92vw, 360px);
  background: #0b1730;
  border: 1px solid rgba(100,120,170,0.25);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  overflow: hidden;
  display: none; /* toggled via JS */
  flex-direction: column;
}
.chat-panel.is-open {
  display: flex;
  animation: chat-in 0.22s cubic-bezier(0.4,0,0.2,1) both;
}
@keyframes chat-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Header ── */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #10284a;
  border-bottom: 1px solid rgba(100,120,170,0.2);
  padding: 12px 14px;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-bot-avatar {
  width: 32px;
  height: 32px;
  background: rgba(31,134,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7bb8ff;
  flex-shrink: 0;
}
.chat-bot-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.chat-bot-status {
  font-size: 0.72rem;
  color: #8fa8c8;
  line-height: 1.2;
}
.chat-close-btn {
  background: none;
  border: none;
  color: #8fa8c8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  display: flex;
}
.chat-close-btn:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

/* ── Messages area ── */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 380px;
  overflow-y: auto;
  padding: 14px 12px;
  scroll-behavior: smooth;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

/* Bubble row */
.chat-row {
  display: flex;
}
.chat-row.bot  { justify-content: flex-start; }
.chat-row.user { justify-content: flex-end; }

/* Bubble */
.chat-bubble {
  max-width: 82%;
  border-radius: 16px;
  padding: 9px 12px;
  font-size: 0.8125rem;
  line-height: 1.6;
  white-space: pre-line;
}
.chat-bubble.bot {
  background: #0f223f;
  border: 1px solid rgba(100,120,170,0.25);
  color: #d9e3f2;
}
.chat-bubble.user {
  background: #1f86ff;
  color: #fff;
}

/* Sender label inside bubble */
.chat-bubble-sender {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.69rem;
  opacity: 0.8;
  margin-bottom: 4px;
}

/* Typing indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0f223f;
  border: 1px solid rgba(100,120,170,0.25);
  border-radius: 16px;
  padding: 10px 14px;
  max-width: 70px;
}
.chat-typing span {
  width: 6px;
  height: 6px;
  background: #5a7a9a;
  border-radius: 50%;
  animation: typing-dot 1.2s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Internal links inside messages */
.chat-internal-link {
  color: #8fd3ff;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.chat-internal-link:hover { color: #b9e7ff; }

/* ── Footer ── */
.chat-footer {
  border-top: 1px solid rgba(100,120,170,0.2);
  padding: 12px;
}
.chat-quick-opts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.chat-quick-btn {
  background: #10284a;
  border: 1px solid rgba(100,120,170,0.3);
  border-radius: 999px;
  color: #c8d9ee;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 5px 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.chat-quick-btn:hover {
  border-color: #5a8fc8;
  color: #fff;
}
.chat-input-row {
  display: flex;
  gap: 8px;
}
.chat-input {
  flex: 1;
  background: #0f223f;
  border: 1px solid rgba(100,120,170,0.3);
  border-radius: 8px;
  color: #fff;
  font-size: 0.8125rem;
  font-family: 'DM Sans', sans-serif;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: #5a7a9a; }
.chat-input:focus { border-color: #1f86ff; }
.chat-send-btn {
  background: #1f86ff;
  border: none;
  border-radius: 8px;
  color: #fff;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-send-btn:hover { background: #1675e1; }

.chat-disclaimer {
  margin-top: 8px;
  font-size: 0.69rem;
  color: #5a7a9a;
}
.chat-quick-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.chat-quick-links a {
  font-size: 0.69rem;
  color: #7bb8ff;
  text-decoration: none;
}
.chat-quick-links a:hover { color: #9bcfff; }

/* ── Responsive ── */
@media (max-width: 480px) {
  #nepiChatRoot { right: 12px; bottom: 80px; }
  .chat-open-btn { padding: 10px 16px; font-size: 0.8125rem; }
}