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

.chatbot-widget {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 1000;
}

.chatbot-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-sage), #6FA871);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(136, 199, 138, 0.4);
  transition: all 0.3s;
  position: relative;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px rgba(136, 199, 138, 0.5);
}

.chatbot-toggle svg {
  color: white;
  transition: all 0.3s;
}

.chatbot-toggle .close-icon {
  display: none;
}

.chatbot-widget.open .chatbot-toggle .chat-icon {
  display: none;
}

.chatbot-widget.open .chatbot-toggle .close-icon {
  display: block;
}

.chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 24px;
  height: 24px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.chatbot-window {
  position: absolute;
  bottom: 80px;
  left: 0;
  width: 380px;
  height: 550px;
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.chatbot-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--color-sage), #6FA871);
  border-radius: 1.5rem 1.5rem 0 0;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.chatbot-avatar {
  width: 48px;
  height: 48px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-avatar svg {
  color: var(--color-sage);
}

.chatbot-info h4 {
  color: white;
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.chatbot-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.chatbot-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chatbot-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.chatbot-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 32px;
  height: 32px;
  background: rgba(136, 199, 138, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message-avatar svg {
  color: var(--color-sage);
}

.message-bubble {
  max-width: 70%;
  padding: 0.75rem 1rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}

.chatbot-message.bot .message-bubble {
  background: rgba(136, 199, 138, 0.1);
  color: var(--color-graphite);
  border-bottom-left-radius: 0.25rem;
}

.chatbot-message.user .message-bubble {
  background: var(--color-sage);
  color: white;
  border-bottom-right-radius: 0.25rem;
}

.message-bubble .chat-link {
  color: var(--color-sage);
  text-decoration: underline;
  font-weight: 600;
  transition: all 0.2s;
}

.message-bubble .chat-link:hover {
  color: #6FA871;
  text-decoration: none;
}

.chatbot-message.bot .message-bubble .chat-link {
  color: var(--color-sage);
}

.chatbot-message.user .message-bubble .chat-link {
  color: white;
  text-decoration: underline;
}

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

.chatbot-quick-replies {
  padding: 0 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.quick-reply-btn {
  padding: 0.5rem 1rem;
  background: white;
  border: 1px solid rgba(136, 199, 138, 0.3);
  border-radius: 9999px;
  font-size: 0.8125rem;
  color: var(--color-sage);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.quick-reply-btn:hover {
  background: rgba(136, 199, 138, 0.1);
  border-color: var(--color-sage);
  transform: translateY(-2px);
}

.chatbot-input {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(136, 199, 138, 0.1);
  display: flex;
  gap: 0.75rem;
}

.chatbot-input input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(136, 199, 138, 0.2);
  border-radius: 9999px;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
}

.chatbot-input input:focus {
  border-color: var(--color-sage);
  box-shadow: 0 0 0 3px rgba(136, 199, 138, 0.1);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  background: var(--color-sage);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.chatbot-send:hover {
  background: #7ab87c;
  transform: scale(1.1);
}

.chatbot-send svg {
  color: white;
}

[data-theme="dark"] .chatbot-window {
  background: #242424;
}

[data-theme="dark"] .chatbot-message.bot .message-bubble {
  background: rgba(136, 199, 138, 0.15);
  color: #f5f5f5;
}

[data-theme="dark"] .chatbot-input input {
  background: #2a2a2a;
  border-color: rgba(136, 199, 138, 0.2);
  color: #f5f5f5;
}

[data-theme="dark"] .quick-reply-btn {
  background: #2a2a2a;
  border-color: rgba(136, 199, 138, 0.3);
}

/* Typing Indicator */
.typing-dots {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0;
}

.typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--color-sage);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .chatbot-widget {
    bottom: 1rem;
    left: 1rem;
  }
  
  .chatbot-toggle {
    width: 56px;
    height: 56px;
  }
  
  .chatbot-window {
    width: calc(100vw - 2rem);
    height: calc(100vh - 12rem);
    max-width: 380px;
  }
}
