/* ── FILE: css/chatbot.css ─────────────────────────── */
.chatbot-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* Let clicks pass through empty areas */
}

.chatbot-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--biolum), var(--biolum-dim));
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: var(--void);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(57, 255, 110, 0.4);
  pointer-events: auto;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  z-index: 2;
}

.chatbot-toggle:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 8px 30px rgba(57, 255, 110, 0.6);
}

.chatbot-toggle svg {
  width: 28px;
  height: 28px;
  transition: transform 0.3s ease;
}

.chatbot-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 550px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  visibility: hidden;
}

.chatbot-container.open .chatbot-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.chatbot-container.open .chatbot-toggle svg {
  transform: rotate(90deg);
}

/* Header */
.chatbot-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(10, 26, 14, 0.9);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.chatbot-header img {
  width: 32px;
  height: 32px;
}

.chatbot-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.status-indicator {
  font-size: 0.75rem;
  color: var(--biolum);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.status-indicator::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: var(--biolum);
  border-radius: 50%;
  animation: dot-pulse 2s infinite;
}

/* Messages Area */
.chatbot-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.chatbot-messages::-webkit-scrollbar {
  width: 6px;
}
.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.chat-bubble {
  max-width: 85%;
  padding: 0.8rem 1.2rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.4;
  word-wrap: break-word;
  animation: message-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.chat-bubble.user {
  align-self: flex-end;
  background: rgba(57, 255, 110, 0.15);
  border: 1px solid rgba(57, 255, 110, 0.3);
  color: var(--text-primary);
  border-bottom-right-radius: 4px;
}

.chat-bubble.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-bottom-left-radius: 4px;
}

.chat-bubble.ai strong {
  color: var(--text-primary);
}

@keyframes message-pop {
  0% { opacity: 0; transform: translateY(10px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Input Area */
.chatbot-input {
  padding: 1rem;
  border-top: 1px solid var(--glass-border);
  display: flex;
  gap: 0.5rem;
  background: rgba(10, 26, 14, 0.9);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.chatbot-input input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  outline: none;
  transition: border-color var(--transition);
}

.chatbot-input input:focus {
  border-color: var(--biolum);
}

.chatbot-input button {
  width: 48px;
  height: 48px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.chatbot-input button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.typing-indicator {
  display: none;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.8rem 1.2rem;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  gap: 0.3rem;
}

.typing-indicator.active {
  display: flex;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

@media (max-width: 767px) {
  .chatbot-panel {
    width: calc(100vw - 2rem);
    right: -1rem; /* counteract the container right: 2rem on small screens */
  }
}
