/**
 * Chatbot Widget Styles
 * Modern bubble chat design matching the site theme
 */

#chatbot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
}

/* Bubble Button */
#chatbot-bubble {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  border: none;
  box-shadow: 0 4px 16px rgba(96, 165, 250, 0.4), 0 8px 32px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: chatbot-pulse 2s infinite;
}

#chatbot-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(96, 165, 250, 0.5), 0 12px 40px rgba(0, 0, 0, 0.25);
}

#chatbot-bubble:active {
  transform: scale(0.95);
}

@keyframes chatbot-pulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.4), 0 8px 32px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 0 4px 20px rgba(96, 165, 250, 0.6), 0 8px 32px rgba(0, 0, 0, 0.2);
  }
}

/* Chat Window */
#chatbot-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 100px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

#chatbot-window.chatbot-hidden {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  #chatbot-window {
    background: #1f2937;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
  }
}

/* Header */
#chatbot-header {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chatbot-header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  backdrop-filter: blur(10px);
}

.chatbot-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
}

.chatbot-subtitle {
  font-size: 13px;
  opacity: 0.9;
  line-height: 1.2;
}

#chatbot-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

#chatbot-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Messages Area */
#chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9fafb;
  scroll-behavior: smooth;
}

@media (prefers-color-scheme: dark) {
  #chatbot-messages {
    background: #111827;
  }
}

.chatbot-message {
  display: flex;
  gap: 8px;
  animation: chatbot-message-appear 0.3s ease-out;
}

@keyframes chatbot-message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chatbot-message-user {
  justify-content: flex-end;
}

.chatbot-message-bot {
  justify-content: flex-start;
}

.chatbot-message-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 14px;
  word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-bubble {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.chatbot-message-bot .chatbot-message-bubble {
  background: white;
  color: #1f2937;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  .chatbot-message-bot .chatbot-message-bubble {
    background: #374151;
    color: #f9fafb;
  }
}

.chatbot-message-bubble a {
  color: inherit;
  text-decoration: underline;
  font-weight: 500;
}

/* Input Area */
#chatbot-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: white;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

@media (prefers-color-scheme: dark) {
  #chatbot-input-area {
    background: #1f2937;
    border-top-color: #374151;
  }
}

#chatbot-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  background: #f9fafb;
  color: #1f2937;
}

#chatbot-input:focus {
  border-color: #60a5fa;
  background: white;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

@media (prefers-color-scheme: dark) {
  #chatbot-input {
    background: #111827;
    border-color: #374151;
    color: #f9fafb;
  }

  #chatbot-input:focus {
    background: #1f2937;
    border-color: #60a5fa;
  }
}

#chatbot-send {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  border: none;
  color: white;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 44px;
}

#chatbot-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

#chatbot-send:active {
  transform: translateY(0);
}

/* Suggestions */
#chatbot-suggestions {
  padding: 0 12px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: white;
  border-top: 1px solid #e5e7eb;
  max-height: 120px;
  overflow-y: auto;
}

@media (prefers-color-scheme: dark) {
  #chatbot-suggestions {
    background: #1f2937;
    border-top-color: #374151;
  }
}

.chatbot-quick-reply {
  padding: 8px 12px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
  white-space: nowrap;
}

.chatbot-quick-reply:hover {
  background: #e5e7eb;
  border-color: #60a5fa;
  color: #1f2937;
}

@media (prefers-color-scheme: dark) {
  .chatbot-quick-reply {
    background: #374151;
    border-color: #4b5563;
    color: #d1d5db;
  }

  .chatbot-quick-reply:hover {
    background: #4b5563;
    border-color: #60a5fa;
    color: #f9fafb;
  }
}

/* Scrollbar styling */
#chatbot-messages::-webkit-scrollbar,
#chatbot-suggestions::-webkit-scrollbar {
  width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track,
#chatbot-suggestions::-webkit-scrollbar-track {
  background: transparent;
}

#chatbot-messages::-webkit-scrollbar-thumb,
#chatbot-suggestions::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover,
#chatbot-suggestions::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

@media (prefers-color-scheme: dark) {
  #chatbot-messages::-webkit-scrollbar-thumb,
  #chatbot-suggestions::-webkit-scrollbar-thumb {
    background: #4b5563;
  }

  #chatbot-messages::-webkit-scrollbar-thumb:hover,
  #chatbot-suggestions::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
  }
}

/* Typing Indicator */
.chatbot-typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 14px !important;
}

.chatbot-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ca3af;
  animation: chatbot-typing-bounce 1.4s infinite ease-in-out;
}

.chatbot-typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.chatbot-typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes chatbot-typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mobile Responsive */
@media (max-width: 600px) {
  #chatbot-container {
    bottom: 16px;
    right: 16px;
  }

  #chatbot-bubble {
    width: 56px;
    height: 56px;
  }

  #chatbot-window {
    bottom: 16px;
    right: 16px;
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
  }
}
