:root {
  --chat-bg: #1e1e1e;
  --chat-foreground: #ffffff;
  --chat-card: #262626;
  --chat-secondary: #2d2d2d;
  --chat-border: #333333;
  --chat-primary: #ffb400;
  --chat-primary-foreground: #000000;
  --transition: all 0.3s ease;
  --chat-font: 'Roboto', sans-serif;
  --chat-heading-font: 'Poppins', sans-serif;
}

/* --- Body & fonts --- */
body {
  font-family: var(--chat-font);
}

/* --- Toggle Button --- */
#chatbot-toggle {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--chat-card);
  border: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10000;
  transition: var(--transition);
}

#chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

#chatbot-toggle img {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); /* shadow adapts automatically */
}

/* --- Chatbot --- */
.chatbot {
  position: fixed;
  bottom: 160px;
  right: 20px;
  width: 360px;
  height: 520px;
  background: var(--chat-card);
  border: 1px solid var(--chat-border);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6);
  transition: var(--transition);
  z-index: 9999;
}

/* Hidden */
.hidden {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  pointer-events: none;
}

/* --- Header --- */
.chatbot-header {
  padding: 1rem;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bot-info {
  display: flex;
  gap: 0.75rem;
}

.bot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--chat-primary);
  color: var(--chat-primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.bot-name {
  font-family: var(--chat-heading-font);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--chat-foreground);
}

.bot-status {
  font-size: 0.7rem;
  color: var(--chat-primary);
}

/* Modern close button */
#chatbot-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--chat-foreground);
  transition: var(--transition);
}

#chatbot-close:hover {
  color: var(--chat-primary);
  transform: rotate(90deg);
}

/* --- Body --- */
.chatbot-body {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: var(--chat-bg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* --- Messages --- */
.bot-message,
.user-message {
  max-width: 80%;
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 14px;
  position: relative;
  animation: fadeIn 0.3s ease forwards;
  word-wrap: break-word;
}

/* Smooth fade-in */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px);}
  to { opacity: 1; transform: translateY(0);}
}

.bot-message {
  background: var(--chat-secondary);
  color: var(--chat-foreground);
  align-self: flex-start;
}

.user-message {
  background: var(--chat-primary);
  color: var(--chat-primary-foreground);
  align-self: flex-end;
}

/* --- Typing dots --- */
.typing-dots {
  display: inline-block;
  margin-left: 5px;
  width: 18px;
  text-align: left;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 20% { color: transparent; }
  40% { color: var(--chat-foreground); }
  60% { color: transparent; }
  80% { color: var(--chat-foreground); }
  100% { color: transparent; }
}

/* --- Footer / Pill-style Buttons --- */
.chatbot-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--chat-border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-start;
}

#chatbot-buttons button {
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 1px solid var(--chat-border);
  background: var(--chat-secondary);
  color: var(--chat-foreground);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.3s ease;
}

#chatbot-buttons button:hover {
  background: var(--chat-primary);
  color: var(--chat-primary-foreground);
  transform: scale(1.05);
}

/* --- Scrollbar --- */
.chatbot-body::-webkit-scrollbar {
  width: 6px;
}
.chatbot-body::-webkit-scrollbar-thumb {
  background-color: var(--chat-border);
  border-radius: 3px;
}
.chatbot-body::-webkit-scrollbar-track {
  background: var(--chat-bg);
}

/* --- Responsive --- */
@media(max-width: 400px) {
  .chatbot {
    width: 90%;
    right: 5%;
    bottom: 140px;
  }
}

#chatbot-buttons button {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
