/* AI Chatbot Styles */
#ai-chatbot-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Button */
.ai-chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

.ai-chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }
  50% {
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
  }
  100% {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  }
}

/* Chat Window */
.ai-chat-window {
  width: 380px;
  height: 600px;
  max-height: calc(100vh - 100px);
  background: white;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

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

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header-content h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.ai-chat-header-content p {
  margin: 4px 0 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.ai-chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-close-btn,
.ai-chat-clear-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.ai-chat-close-btn:hover,
.ai-chat-clear-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Custom scrollbar */
.ai-chat-messages::-webkit-scrollbar {
  width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e0;
  border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #a0aec0;
}

/* Message */
.ai-chat-message {
  display: flex;
  margin-bottom: 8px;
}

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

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

.ai-chat-message-bubble {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: fadeIn 0.3s ease;
}

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

.ai-chat-message-user .ai-chat-message-bubble {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

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

/* Links inside chat messages */
.ai-chat-link {
  color: #667eea;
  text-decoration: underline;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  word-break: break-all;
}

.ai-chat-link:hover {
  color: #764ba2;
  text-decoration: underline;
}

/* Links in user messages */
.ai-chat-message-user .ai-chat-link {
  color: rgba(255, 255, 255, 0.95);
  text-decoration: underline;
  font-weight: 600;
}

.ai-chat-message-user .ai-chat-link:hover {
  color: white;
}

/* Typing Indicator */
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 16px;
}

.ai-typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e0;
  animation: typing 1.4s infinite;
}

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

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

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

/* Input Container */
.ai-chat-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.2s;
}

.ai-chat-input:focus {
  outline: none;
  border-color: #667eea;
}

.ai-chat-input::placeholder {
  color: #a0aec0;
}

.ai-chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chat-send-btn:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.ai-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

  .ai-chat-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
  }

  .ai-chat-button {
    width: 56px;
    height: 56px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .ai-chat-window {
    background: #1a202c;
  }

  .ai-chat-messages {
    background: #2d3748;
  }

  .ai-chat-message-bot .ai-chat-message-bubble {
    background: #4a5568;
    color: #e2e8f0;
  }

  .ai-chat-input-container {
    background: #1a202c;
    border-top-color: #4a5568;
  }

  .ai-chat-input {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
  }

  .ai-chat-input::placeholder {
    color: #718096;
  }

  /* Link styles in dark mode */
  .ai-chat-link {
    color: #9f7aea;
  }

  .ai-chat-link:hover {
    color: #b794f4;
  }

  .ai-chat-message-user .ai-chat-link {
    color: #e2e8f0;
  }

  .ai-chat-message-user .ai-chat-link:hover {
    color: #f7fafc;
  }
}
