/* NeerVerse Chatbot Styles */
.neerverse-chatbot {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Chatbot Toggle Button */
.chatbot-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(66, 133, 244, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 25px rgba(66, 133, 244, 0.4);
}

.chatbot-toggle:active {
  transform: scale(0.95);
}

/* Toggle button icons */
.chatbot-toggle .chat-icon,
.chatbot-toggle .close-icon {
  width: 24px;
  height: 24px;
  fill: white;
  transition: all 0.3s ease;
  position: absolute;
}

.chatbot-toggle .close-icon {
  opacity: 0;
  transform: rotate(90deg);
}

.chatbot-toggle.active .chat-icon {
  opacity: 0;
  transform: rotate(-90deg);
}

.chatbot-toggle.active .close-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Notification badge */
.chatbot-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background: #ea4335;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Chatbot Window */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  height: 500px;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot-window.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
  padding: 16px 20px;
  background: rgba(66, 133, 244, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4285f4, #34a853);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 14px;
}

.chatbot-info h3 {
  color: #ffffff;
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chatbot-info p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin: 2px 0 0 0;
}

.chatbot-status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #34a853;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #34a853;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Chat Messages Area */
.chatbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.chatbot-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

/* Message Bubbles */
.message {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.message.bot .message-avatar {
  background: linear-gradient(135deg, #4285f4, #34a853);
  color: white;
}

.message.user .message-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
}

.message-content {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}

.message.bot .message-content {
  background: rgba(66, 133, 244, 0.1);
  border: 1px solid rgba(66, 133, 244, 0.2);
  color: #ffffff;
  border-bottom-left-radius: 4px;
}

.message.user .message-content {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  border-bottom-right-radius: 4px;
}

.message-time {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
  text-align: right;
}

.message.user .message-time {
  text-align: left;
}

/* Message content formatting */
.message-content h4 {
  color: #4285f4;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.message-content ul {
  margin: 8px 0;
  padding-left: 16px;
}

.message-content li {
  margin-bottom: 4px;
}

.message-content strong {
  color: #ffffff;
  font-weight: 600;
}

/* Quick Response Buttons */
.quick-responses {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-response-btn {
  background: rgba(66, 133, 244, 0.1);
  border: 1px solid rgba(66, 133, 244, 0.3);
  color: #4285f4;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-response-btn:hover {
  background: rgba(66, 133, 244, 0.2);
  border-color: rgba(66, 133, 244, 0.5);
  transform: translateY(-1px);
}

/* Chat Input Area */
.chatbot-input {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  color: #ffffff;
  font-size: 14px;
  resize: none;
  min-height: 20px;
  max-height: 80px;
  transition: all 0.2s ease;
}

.chat-input:focus {
  outline: none;
  border-color: #4285f4;
  background: rgba(255, 255, 255, 0.08);
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.send-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #4285f4;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.send-button:hover {
  background: #3367d6;
  transform: scale(1.05);
}

.send-button:disabled {
  background: rgba(255, 255, 255, 0.1);
  cursor: not-allowed;
  transform: none;
}

.send-button svg {
  width: 16px;
  height: 16px;
  fill: white;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-style: italic;
}

.typing-dots {
  display: flex;
  gap: 3px;
}

.typing-dot {
  width: 4px;
  height: 4px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  animation: typingDot 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingDot {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Welcome Message */
.welcome-message {
  text-align: center;
  padding: 20px;
  color: rgba(255, 255, 255, 0.7);
}

.welcome-message h4 {
  color: #4285f4;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.welcome-message p {
  font-size: 13px;
  line-height: 1.4;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .neerverse-chatbot {
    bottom: 15px;
    right: 15px;
  }

  .chatbot-window {
    width: calc(100vw - 30px);
    height: 70vh;
    bottom: 85px;
    right: -10px;
  }

  .chatbot-toggle {
    width: 55px;
    height: 55px;
  }

  .chatbot-toggle .chat-icon,
  .chatbot-toggle .close-icon {
    width: 22px;
    height: 22px;
  }

  .message-content {
    max-width: 85%;
    font-size: 13px;
  }

  .quick-responses {
    padding: 10px 12px;
  }

  .quick-response-btn {
    font-size: 11px;
    padding: 5px 10px;
  }
}

@media (max-width: 360px) {
  .chatbot-window {
    width: calc(100vw - 20px);
    right: -5px;
  }
}

/* Tablet adjustments */
@media (min-width: 481px) and (max-width: 768px) {
  .chatbot-window {
    width: 350px;
  }
}

/* Large screen adjustments */
@media (min-width: 1200px) {
  .neerverse-chatbot {
    bottom: 30px;
    right: 30px;
  }

  .chatbot-window {
    width: 400px;
    height: 550px;
  }
}

/* Accessibility improvements */
.chatbot-toggle:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: 2px;
}

.chat-input:focus-visible {
  outline: 2px solid #4285f4;
  outline-offset: -2px;
}

.send-button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .chatbot-toggle,
  .chatbot-window,
  .message,
  .quick-response-btn {
    transition: none;
  }

  .chatbot-badge,
  .typing-dot,
  .status-dot {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .chatbot-window {
    border: 2px solid #ffffff;
    background: #000000;
  }

  .message.bot .message-content {
    border: 2px solid #4285f4;
    background: rgba(66, 133, 244, 0.2);
  }

  .message.user .message-content {
    border: 2px solid #ffffff;
    background: rgba(255, 255, 255, 0.1);
  }
}

/* Dark theme optimization (already optimized but for completeness) */
@media (prefers-color-scheme: dark) {
  /* Styles are already optimized for dark theme */
}

/* Print styles - hide chatbot when printing */
@media print {
  .neerverse-chatbot {
    display: none !important;
  }
}

/* Loading state for messages */
.message-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Error state styling */
.message-error .message-content {
  background: rgba(234, 67, 53, 0.1);
  border-color: rgba(234, 67, 53, 0.3);
  color: #ff6b6b;
}

/* Success state styling */
.message-success .message-content {
  background: rgba(52, 168, 83, 0.1);
  border-color: rgba(52, 168, 83, 0.3);
  color: #4caf50;
}

/* Chatbot minimized state indicator */
.chatbot-toggle.has-unread::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 12px;
  height: 12px;
  background: #ea4335;
  border-radius: 50%;
  border: 2px solid rgba(10, 10, 10, 0.95);
}

/* Smooth scrolling for messages */
.chatbot-messages {
  scroll-behavior: smooth;
}

/* Message content styling for better readability */
.message-content pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 8px;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  margin: 4px 0;
}

.message-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 12px;
}

/* Emergency message styling */
.message-emergency .message-content {
  background: rgba(234, 67, 53, 0.15);
  border-color: rgba(234, 67, 53, 0.4);
  border-left: 4px solid #ea4335;
}

.message-emergency .message-content::before {
  content: "🚨 ";
  font-size: 16px;
}
