/* Chatbot Widget Styles */
#chatbot-widget {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #24d3ff, #7c5cff);
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(36, 211, 255, 0.4);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(36, 211, 255, 0.5);
}

#chatbot-toggle:focus {
  outline: 3px solid rgba(36, 211, 255, 0.5);
  outline-offset: 2px;
}

#chatbot-toggle .notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #ff4444;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: bold;
  color: white;
  border: 2px solid white;
}

#chatbot-toggle.has-notification .notification-badge {
  display: flex;
}

#chatbot-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 400px;
  height: 600px;
  max-height: 85vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
  transition: background 0.3s ease, color 0.3s ease;
}

#chatbot-panel.active {
  display: flex;
}

#chatbot-panel.dark-mode {
  background: #1a1a2e;
  color: #e0e0e0;
}

.chatbot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid #f0f0f0;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, rgba(36, 211, 255, 0.1), rgba(124, 92, 255, 0.1));
}

#chatbot-panel.dark-mode .chatbot-header {
  border-bottom-color: #333;
  background: linear-gradient(135deg, rgba(36, 211, 255, 0.2), rgba(124, 92, 255, 0.2));
}

.chatbot-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #2d3748;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#chatbot-panel.dark-mode .chatbot-header h3 {
  color: #e0e0e0;
}

.chatbot-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #718096;
  padding: 0.25rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #2d3748;
}

#chatbot-panel.dark-mode .chatbot-close {
  color: #a0a0a0;
}

#chatbot-panel.dark-mode .chatbot-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

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

.chatbot-messages::-webkit-scrollbar {
  width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: #7c5cff;
  border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: #6a4bff;
}

.message {
  display: flex;
  gap: 0.75rem;
  animation: fadeIn 0.3s ease-out;
}

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

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.message.bot .message-avatar {
  background: linear-gradient(135deg, #24d3ff, #7c5cff);
  color: white;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #7c5cff, #24d3ff);
  color: white;
}

.message-content {
  max-width: 75%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  line-height: 1.5;
  font-size: 0.95rem;
}

.message.bot .message-content {
  background: #f7fafc;
  color: #2d3748;
  border-bottom-left-radius: 4px;
}

#chatbot-panel.dark-mode .message.bot .message-content {
  background: #2d2d44;
  color: #e0e0e0;
}

.message.user .message-content {
  background: linear-gradient(135deg, #7c5cff, #24d3ff);
  color: white;
  border-bottom-right-radius: 4px;
}

.message-content a {
  color: #7c5cff;
  text-decoration: underline;
  font-weight: 600;
}

.message.user .message-content a {
  color: white;
  text-decoration: underline;
}

.message-content ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.message-content li {
  margin: 0.25rem 0;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.quick-reply-btn {
  padding: 0.5rem 1rem;
  background: rgba(124, 92, 255, 0.1);
  border: 1px solid rgba(124, 92, 255, 0.3);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #7c5cff;
  font-weight: 500;
}

.quick-reply-btn:hover {
  background: rgba(124, 92, 255, 0.2);
  transform: translateY(-2px);
}

#chatbot-panel.dark-mode .quick-reply-btn {
  background: rgba(124, 92, 255, 0.2);
  border-color: rgba(124, 92, 255, 0.4);
  color: #b8a0ff;
}

.chatbot-input-container {
  padding: 1rem 1.5rem;
  border-top: 2px solid #f0f0f0;
  background: white;
  border-radius: 0 0 16px 16px;
}

#chatbot-panel.dark-mode .chatbot-input-container {
  border-top-color: #333;
  background: #1a1a2e;
}

.chatbot-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

#chatbot-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  outline: none;
  transition: all 0.2s ease;
}

#chatbot-input:focus {
  border-color: #7c5cff;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.1);
}

#chatbot-panel.dark-mode #chatbot-input {
  background: #2d2d44;
  border-color: #444;
  color: #e0e0e0;
}

#chatbot-panel.dark-mode #chatbot-input:focus {
  border-color: #7c5cff;
}

.chatbot-send-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c5cff, #24d3ff);
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chatbot-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.4);
}

.chatbot-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.typing-indicator {
  display: flex;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  background: #f7fafc;
  border-radius: 12px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

#chatbot-panel.dark-mode .typing-indicator {
  background: #2d2d44;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7c5cff;
  animation: typing 1.4s infinite;
}

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

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

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

@media (max-width: 768px) {
  #chatbot-widget {
    bottom: 80px;
    right: 10px;
  }

  #chatbot-panel {
    width: calc(100vw - 20px);
    max-width: 400px;
    right: 0;
    bottom: 150px;
    height: calc(100vh - 170px);
    max-height: 600px;
  }
}
