/* ==========================================================================
   AI Chatbot Drawer & FAB Styles
   ========================================================================== */

/* Floating Action Button */
.ai-chat-fab {
  position: fixed;
  bottom: 30px;
  left: 30px;
  z-index: 999;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chat-fab:hover {
  transform: scale(1.1);
}

.fab-icon-container {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.4);
  font-size: 1.8rem;
  border: 3px solid white;
}

.fab-tooltip {
  position: absolute;
  left: 75px;
  background: white;
  color: #1e293b;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s ease;
  pointer-events: none;
}

.ai-chat-fab:hover .fab-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Chat Drawer / Window */
.ai-chat-drawer {
  position: fixed;
  bottom: 100px;
  left: 30px;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: 550px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 24px;
  box-shadow: 0 15px 40px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1000;
  transform: scale(0.8) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  transform-origin: bottom left;
}

.ai-chat-drawer.active {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  padding: 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ai-avatar {
  background: rgba(255,255,255,0.2);
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.ai-title h4 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
}

.ai-title span {
  font-size: 0.8rem;
  color: #c7d2fe;
}

.chat-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 0;
}

.chat-close-btn:hover {
  opacity: 1;
}

/* Messages Area */
.chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

/* Scrollbar styles for messages */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

.message {
  display: flex;
  max-width: 85%;
}

.ai-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.msg-bubble {
  padding: 0.8rem 1.2rem;
  border-radius: 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.ai-message .msg-bubble {
  background: white;
  color: #334155;
  border: 1px solid #e2e8f0;
  border-top-right-radius: 4px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.user-message .msg-bubble {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: white;
  border-top-left-radius: 4px;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  border-top-right-radius: 4px;
  width: fit-content;
  align-self: flex-start;
  box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 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 {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.chat-input-area {
  padding: 1rem;
  background: white;
  border-top: 1px solid #e2e8f0;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: #f1f5f9;
  padding: 0.5rem;
  border-radius: 30px;
}

.chat-form input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  color: #334155;
}

.chat-send-btn {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  transition: transform 0.2s;
}

.chat-send-btn:hover {
  transform: scale(1.05);
}

.chat-send-btn:active {
  transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
  .ai-chat-drawer {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 90px;
  }
  
  .ai-chat-fab {
    left: 20px;
    bottom: 20px;
  }
}
