/* ============================================
   CHATBOT WIDGET STYLES
   ============================================ */

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 2rem;
  right: 6rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  box-shadow: 0 4px 24px rgba(102, 126, 234, 0.45);
  z-index: 1001;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}
.chatbot-toggle .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #f5576c;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  animation: badgePulse 2s ease infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 6rem;
  right: 2rem;
  width: 380px;
  max-height: 520px;
  background: #0f1629;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  z-index: 1002;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.3s ease;
}
.chatbot-window.open {
  display: flex;
}
@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.chat-header-info div h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
}
.chat-header-info div span {
  font-size: 0.7rem;
  opacity: 0.85;
}
.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #43e97b;
  display: inline-block;
}
.chat-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.chat-close:hover { opacity: 1; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 340px;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 126, 234, 0.3) transparent;
}
.chat-messages::-webkit-scrollbar {
  width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 3px;
}

.chat-msg {
  display: flex;
  gap: 0.5rem;
  max-width: 85%;
  animation: msgFade 0.3s ease;
}
@keyframes msgFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}
.chat-msg.bot .chat-msg-avatar {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
}
.chat-msg.user .chat-msg-avatar {
  background: rgba(102, 126, 234, 0.15);
  color: #7c94f4;
}

.chat-bubble {
  padding: 0.65rem 1rem;
  border-radius: 1rem;
  font-size: 0.82rem;
  line-height: 1.5;
}
.chat-msg.bot .chat-bubble {
  background: #1a2235;
  color: #e2e8f0;
  border-bottom-left-radius: 0.25rem;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 0.65rem 1rem;
  align-items: center;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.2s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* Quick replies */
.chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.quick-reply-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 500;
  color: #7c94f4;
  background: rgba(102, 126, 234, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.25);
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}
.quick-reply-btn:hover {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border-color: #667eea;
}

/* Input */
.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: #111827;
}
.chat-input {
  flex: 1;
  padding: 0.55rem 0.85rem;
  background: #1a2235;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input::placeholder { color: #64748b; }
.chat-input:focus { border-color: rgba(102, 126, 234, 0.5); }
.chat-send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.chat-send:hover { transform: scale(1.1); }

/* Responsive */
@media (max-width: 480px) {
  .chatbot-window {
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
    bottom: 5.5rem;
    max-height: 70vh;
  }
  .chatbot-toggle {
    right: 1rem;
    bottom: 1rem;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
}
