/* ═══════════════════════ CHATBOT ═══════════════════════ */

/* ── Toggle Button ── */
.chatbot-toggle {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--indigo-light), var(--indigo));
  color: var(--white);
  cursor: pointer;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.25), 0 2px 8px rgba(15, 23, 42, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(79, 70, 229, 0.35), 0 4px 12px rgba(15, 23, 42, 0.08);
}
.chatbot-toggle:active {
  transform: scale(0.97);
}

/* ── Chat Panel ── */
.chatbot-panel {
  position: fixed;
  bottom: 5rem;
  right: 1.5rem;
  width: 400px;
  height: 500px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 16px;
  z-index: 9000;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12), 0 4px 16px rgba(15, 23, 42, 0.06);
  animation: chatAppear 0.25s ease;
}
.chatbot-panel.open {
  display: flex;
}

/* ── Header ── */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chatbot-header-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.chatbot-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.chatbot-close:hover {
  background: var(--surface-alt);
}

/* ── Disclaimer ── */
.chatbot-disclaimer {
  padding: 0.55rem 1.25rem;
  font-size: 0.7rem;
  text-align: center;
  color: var(--red-soft);
  background: rgba(232, 93, 93, 0.06);
  border-bottom: 1px solid rgba(232, 93, 93, 0.1);
  letter-spacing: 0.2px;
  flex-shrink: 0;
}

/* ── Messages Area ── */
.chatbot-messages {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}
.chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ── Message Bubbles ── */
.chatbot-messages .chat-msg {
  display: flex;
  max-width: 80%;
}
.chat-msg-content {
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* User message: right-aligned, gold */
.chat-msg-user {
  align-self: flex-end;
}
.chat-msg-user .chat-msg-content {
  background: linear-gradient(135deg, var(--indigo-light), var(--indigo));
  color: var(--white);
  border-bottom-right-radius: 4px;
}

/* Bot message: left-aligned, navy */
.chat-msg-bot {
  align-self: flex-start;
}
.chat-msg-bot .chat-msg-content {
  background: var(--surface-alt);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

/* ── Input Area ── */
.chatbot-input-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chatbot-input {
  flex: 1 1 0;
  padding: 0.65rem 0.9rem;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.chatbot-input:focus {
  border-color: var(--indigo-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.06);
}
.chatbot-input::placeholder {
  color: rgba(154, 163, 180, 0.5);
}
.chatbot-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.chatbot-send {
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--indigo-light), var(--indigo));
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.25);
}
.chatbot-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}
.chatbot-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Typing Indicator ── */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.7rem 1rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}
.typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

/* ── Mobile Responsive ── */
@media (max-width: 640px) {
  .chatbot-panel {
    width: calc(100vw - 1.5rem);
    right: 0.75rem;
    left: 0.75rem;
    bottom: 4.5rem;
    height: calc(100vh - 7rem);
    max-height: 500px;
  }
  .chatbot-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
  }
}
