/* SHARED "ASK A QUESTION" CHAT WINDOW STYLING
   Scoped to `.ask-chatbot` and used by the homepage and the public FAQ page.
   Nothing here leaks onto /faq/chat or the price calculator chatbot.
   The homepage does not load Bootstrap, so every value is defined here. */

.ask-chatbot {
  --ask-chat-primary: var(--primary-color, #2563eb);
  --ask-chat-primary-dark: var(--primary-dark, #1e40af);
  --ask-chat-accent: #6f42c1;
  --ask-chat-surface: var(--bg-white, #ffffff);
  --ask-chat-surface-muted: var(--bg-light, #f9fafb);
  --ask-chat-border: var(--border-color, #e5e7eb);
  --ask-chat-text: var(--text-dark, #1f2937);
  --ask-chat-text-muted: var(--text-gray, #6b7280);
  --ask-chat-min-height: 300px;

  /* Keeps the #askChatbot anchor clear of the fixed site header. */
  scroll-margin-top: 80px;
  padding: 4rem 0;
  background-color: var(--ask-chat-surface-muted);
}

.ask-chatbot-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.ask-chatbot-heading {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--ask-chat-text);
  text-align: center;
}

.ask-chatbot-intro {
  margin: 0 0 1.75rem;
  color: var(--ask-chat-text-muted);
  text-align: center;
}

.ask-chatbot-window {
  display: flex;
  flex-direction: column;
  min-height: var(--ask-chat-min-height);
  border: 1px solid var(--ask-chat-border);
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: var(--ask-chat-surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.ask-chatbot-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  scroll-behavior: smooth;
}

/* Message rows and bubbles are built by the shared chatbot-ui.js engine. */
.ask-chatbot .chat-row {
  display: flex;
  max-width: 100%;
}

.ask-chatbot .chat-row.bot {
  justify-content: flex-start;
}

.ask-chatbot .chat-row.user {
  justify-content: flex-end;
}

.ask-chatbot .chat-bubble {
  max-width: 82%;
  padding: 0.7rem 0.95rem;
  border-radius: 1.1rem;
  font-size: 0.98rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: askChatFadeIn 0.25s ease;
}

.ask-chatbot .chat-row.bot .chat-bubble {
  background-color: var(--ask-chat-surface-muted);
  color: var(--ask-chat-text);
  border-bottom-left-radius: 0.3rem;
}

.ask-chatbot .chat-row.user .chat-bubble {
  background: linear-gradient(135deg, var(--ask-chat-primary), var(--ask-chat-accent));
  color: #fff;
  border-bottom-right-radius: 0.3rem;
}

.ask-chatbot .chat-bubble a {
  color: inherit;
}

.ask-chatbot .chat-bubble p {
  margin: 0;
}

.ask-chatbot .chat-bubble p.mb-2 {
  margin-bottom: 0.5rem;
}

.ask-chatbot-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.4rem 1.1rem 0.75rem;
  background-color: var(--ask-chat-surface);
}

.ask-chatbot-quick-replies .btn {
  border: 1px solid var(--ask-chat-primary);
  border-radius: 14px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.3;
  color: var(--ask-chat-primary);
  background-color: transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ask-chatbot-quick-replies .btn:hover,
.ask-chatbot-quick-replies .btn:focus-visible {
  background-color: var(--ask-chat-primary);
  color: #fff;
}

.ask-chatbot-input {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding: 0.75rem 0.9rem;
  background-color: var(--ask-chat-surface);
}

.ask-chatbot-input textarea {
  flex: 1 1 auto;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid var(--ask-chat-border);
  border-radius: 1rem;
  height: 96px;
  resize: none;
  overflow-y: auto;
  font: inherit;
  font-size: 0.98rem;
  color: var(--ask-chat-text);
  background-color: var(--ask-chat-surface);
}

.ask-chatbot-input textarea:focus {
  outline: none;
  border-color: var(--ask-chat-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.ask-chatbot-input .send-btn {
  border: 0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--ask-chat-primary), var(--ask-chat-accent));
  cursor: pointer;
}

.ask-chatbot-input .send-btn:disabled,
.ask-chatbot-input textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ask-chatbot .typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ask-chatbot .typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--ask-chat-text-muted);
  opacity: 0.5;
  animation: askChatTypingBounce 1.2s infinite ease-in-out;
}

.ask-chatbot .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.ask-chatbot .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes askChatTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

@keyframes askChatFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 575.98px) {
  .ask-chatbot {
    padding: 2.5rem 0;
  }

  .ask-chatbot-inner {
    padding: 0 1rem;
  }

  .ask-chatbot-heading {
    font-size: 1.6rem;
  }

  .ask-chatbot-window {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    border-right: 0;
    border-left: 0;
    border-radius: 0;
    min-height: 260px;
  }
}
