/* ==========================================================================
   Chatbot UI - Glassmorphism
   ========================================================================== */
.chatbot-toggler {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-main);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  transition: transform var(--transition-bounce);
}

.chatbot-toggler:hover {
  transform: scale(1.1);
}

.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 30px;
  width: 350px;
  max-width: calc(100vw - 60px);
  
  /* 🛠️ ADD THIS FIX: Forces the window to never grow taller than the screen */
  max-height: calc(100vh - 130px); 
  
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
  z-index: 1002;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all var(--transition-smooth);
}

.chatbot-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.chat-header {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  font-size: 1.2rem;
  margin: 0;
}

.close-chat {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.5rem;
  transition: color var(--transition-smooth);
}

.close-chat:hover {
  color: var(--accent-primary);
}

.chat-body {
  padding: 20px;
  height: 350px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Custom Scrollbar for Chat */
.chat-body::-webkit-scrollbar {
  width: 6px;
}
.chat-body::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease-out;
}

.chat-msg.bot {
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text-primary);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  background: var(--glass-hover);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-options {
  padding: 15px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-chip {
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-chip:hover {
  background: var(--accent-primary);
  color: var(--bg-main);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}