.site-chatbot-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.5rem;
  z-index: 1045; /* below Bootstrap modals (1055) and toasts (1090) */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.site-chatbot-modal .modal-content {
  border: 0;
  border-radius: 14px;
  overflow: hidden;
}

.site-chatbot-modal .modal-dialog {
  position: fixed;
  right: 1rem;
  bottom: 5.5rem;
  margin: 0;
  width: 100%;
  max-width: 420px;
  /* Override Bootstrap's modal-dialog-scrollable height:calc(100% - margin),
     which (with the fixed bottom anchor) made the dialog ~full-viewport tall and
     pushed the header off-screen. Cap height so it grows within the viewport and
     the body scrolls instead. */
  height: auto;
  max-height: calc(100vh - 7rem);
  max-height: calc(100dvh - 7rem);
}

.site-chatbot-modal .modal-header {
  background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 70%, #3b82f6 100%);
  color: #fff;
  border: 0;
}

.site-chatbot-modal .btn-close {
  filter: invert(1);
}

.site-chatbot-messages {
  max-height: 48vh;
  overflow-y: auto;
  padding: 0.75rem;
  background: #f8fafc;
}

.site-chatbot-msg {
  margin-bottom: 0.5rem;
  display: flex;
}

.site-chatbot-msg.user {
  justify-content: flex-end;
}

.site-chatbot-bubble {
  max-width: 82%;
  padding: 0.55rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.35rem;
}

.site-chatbot-msg.user .site-chatbot-bubble {
  background: #1d4ed8;
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.site-chatbot-msg.assistant .site-chatbot-bubble {
  background: #e2e8f0;
  color: #0f172a;
  border-bottom-left-radius: 0.2rem;
}

/* Error/failed reply — visually distinct from a normal assistant message */
.site-chatbot-msg.assistant .site-chatbot-bubble.site-chatbot-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.site-chatbot-actions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.site-chatbot-quick {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.site-chatbot-quick .btn {
  margin: 0.15rem 0.2rem 0.15rem 0;
}

/* Suggestion chips */
.site-chatbot-suggestions {
  margin-top: 0.4rem;
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.site-chatbot-suggestions .btn {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
}

/* Typing indicator */
.typing-dots span {
  animation: typingBlink 1.4s infinite both;
  font-weight: bold;
  font-size: 1.2rem;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBlink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

@media (max-width: 576px) {
  .auth-body .site-chatbot-fab {
    display: none;
  }

  .site-chatbot-fab {
    right: 0.75rem;
    bottom: 5.25rem;
  }
  .site-chatbot-modal .modal-dialog {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 9.25rem;
    max-width: none;
    width: auto;
    max-height: calc(100vh - 10.75rem);
    max-height: calc(100dvh - 10.75rem);
  }
}
