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

/* Chat Container */
.chat-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 400px;
  height: 500px;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: all 0.3s ease;
}

.chat-container.minimized {
  height: 60px;
  width: 60px;
  border-radius: 50%;
  overflow: hidden;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #4c1d95 100%);
  color: #ffffff;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.chat-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.chat-toggle {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.chat-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: fadeInUp 0.3s ease-out;
}

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

.message-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  flex-shrink: 0;
}

.message-avatar.user {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
}

.message-avatar.bot {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
}

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

.message-bubble.user {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  border-bottom-right-radius: 0.25rem;
}

.message-bubble.bot {
  background: #f8fafc;
  color: #374151;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 0.25rem;
}

/* Chat Input */
.chat-input-container {
  padding: 1rem;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

.chat-input-form {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  resize: none;
  min-height: 2.5rem;
  max-height: 100px;
  transition: all 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-send-btn {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
}

.chat-send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

/* Chat Toggle Button */
.chat-toggle-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.chat-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 15px 35px rgba(59, 130, 246, 0.4);
}

.chat-toggle-btn.hidden {
  display: none;
}

/* Loading States */
.chat-loading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  color: #6b7280;
  font-size: 0.875rem;
}

.chat-loading-dots {
  display: flex;
  gap: 0.25rem;
}

.chat-loading-dot {
  width: 0.5rem;
  height: 0.5rem;
  background: #3b82f6;
  border-radius: 50%;
  animation: chatLoading 1.4s infinite ease-in-out;
}

.chat-loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}
.chat-loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes chatLoading {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-radius: 1rem;
  border-bottom-left-radius: 0.25rem;
  max-width: 80%;
  animation: fadeInUp 0.3s ease-out;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dot {
  width: 0.375rem;
  height: 0.375rem;
  background: #6b7280;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

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

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

/* Error States */
.chat-error {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  border-radius: 0.5rem;
  padding: 0.75rem;
  margin: 0.5rem 0;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-error-icon {
  color: #dc2626;
  font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chat-container {
    width: calc(100vw - 2rem);
    height: calc(100vh - 4rem);
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .chat-toggle-btn {
    bottom: 1rem;
    right: 1rem;
  }

  .message-bubble {
    max-width: 90%;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  .chat-container {
    background: #1f2937;
    border-color: #374151;
  }

  .chat-header {
    background: linear-gradient(135deg, #1e40af, #7c3aed);
  }

  .message-bubble.bot {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }

  .chat-input {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
  }

  .chat-input:focus {
    border-color: #3b82f6;
  }

  .chat-input-container {
    background: #1f2937;
    border-color: #374151;
  }

  .typing-indicator {
    background: #374151;
  }
}
