/* ===== COMPONENT STYLES ===== */

/* Floating Action Button */
.floating-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  border: none;
  cursor: pointer;
}

.floating-btn:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.6);
}

/* Button Styles */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 8px 15px -3px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: transparent;
  color: #3b82f6;
  border: 2px solid #3b82f6;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background: #3b82f6;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Enhanced Chatbot Styles */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6, #10b981);
  border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2563eb, #059669);
}

/* Chat Modal Animations */
#chatbotModal.show #chatModalContent {
  transform: scale(1);
  opacity: 1;
}

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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out;
}

.message-user {
  animation: slideInRight 0.4s ease-out;
}

.message-bot {
  animation: slideInLeft 0.4s ease-out;
}

/* Enhanced Button Hover Effects */
.quick-question:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Typing Animation */
.typing-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: scale(1);
    opacity: 0.5;
  }
  30% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Message Bubbles */
.message-bubble {
  position: relative;
  word-wrap: break-word;
  max-width: 80%;
}

.message-bubble.user {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: white;
  border-radius: 18px 18px 4px 18px;
  margin-left: auto;
  min-width: 120px;
  max-width: 280px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  margin-right: 8px;
}

.message-bubble.bot {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 4px 18px 18px 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  line-height: 1.6;
}

.message-bubble.bot p {
  margin: 0 0 8px 0;
}

.message-bubble.bot p:last-child {
  margin-bottom: 0;
}

.message-bubble.bot a {
  word-break: break-word;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #6b7280;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-online {
  background-color: #10b981;
}
.status-busy {
  background-color: #f59e0b;
}
.status-offline {
  background-color: #ef4444;
}

/* Enhanced Glassmorphism */
.glass-effect {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* Code Syntax Highlighting */
.code-block {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
  position: relative;
}

.code-block pre {
  margin: 0;
  white-space: pre-wrap;
}

/* Enhanced link styling in messages */
.message-content a {
  color: #2563eb;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: all 0.2s ease;
}

.message-content a:hover {
  color: #1d4ed8;
  border-bottom-color: #2563eb;
}

/* List styling in messages */
.message-list {
  margin: 8px 0;
  padding-left: 0;
}

.message-list-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 4px;
  padding-left: 0;
}

.message-list-bullet {
  color: #3b82f6;
  margin-right: 8px;
  font-weight: 500;
  line-height: 1.6;
}

/* Mobile Responsiveness Improvements */
@media (max-width: 768px) {
  /* Full-screen mobile modal */
  #chatbotModal {
    align-items: flex-end;
    padding: 0;
  }

  #chatModalContent {
    max-width: 100vw !important;
    width: 100vw !important;
    height: 95vh !important;
    max-height: 95vh !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  /* Larger close button for mobile */
  #closeChatbot {
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 12px !important;
  }

  /* Better message bubbles */
  .message-bubble {
    max-width: 75%;
    font-size: 15px;
    line-height: 1.5;
    padding: 12px 16px;
  }

  .message-bubble.user {
    max-width: 70% !important;
    margin-right: 0 !important;
  }

  /* Mobile-friendly input area */
  #chatInput {
    font-size: 16px !important; /* Prevent iOS zoom */
    min-height: 48px !important;
    padding: 12px 16px !important;
    border-radius: 24px !important;
  }

  #sendMessage {
    min-width: 48px !important;
    min-height: 48px !important;
    padding: 12px !important;
  }

  /* Better quick question buttons */
  .quick-question {
    font-size: 14px !important;
    padding: 12px 16px !important;
    min-height: 48px !important;
    border-radius: 16px !important;
    margin-bottom: 8px !important;
  }

  /* Chat messages container */
  #chatMessages {
    padding: 16px 12px !important;
    padding-bottom: 20px !important;
  }

  /* Chat input container */
  .chat-input-container {
    padding: 16px !important;
    padding-bottom: 20px !important;
  }

  /* Floating buttons repositioning */
  .floating-btn {
    width: 56px !important;
    height: 56px !important;
    bottom: 20px !important;
    right: 20px !important;
  }

  #chatbotBtn {
    bottom: 90px !important;
  }

  /* Increase touch target sizes */
  nav a,
  button,
  .mobile-friendly {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Add proper spacing for touch targets */
  .mobile-touch-spacing > * {
    margin-bottom: 0.75rem;
  }

  /* Ensure inputs have enough height */
  input,
  textarea,
  select,
  button[type="submit"] {
    min-height: 44px;
    font-size: 16px; /* Prevent iOS zoom on focus */
  }

  /* Improve scrolling experience */
  html,
  body {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Better mobile menu */
  #mobile-menu {
    max-height: 80vh;
    overflow-y: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  /* Active state for touch feedback */
  .touch-active:active {
    background-color: rgba(59, 130, 246, 0.1);
    transform: scale(0.98);
  }

  /* Mobile-specific animations */
  .fade-in-up,
  .fade-in-left,
  .fade-in-right {
    animation-duration: 0.5s;
  }

  /* Reduce motion for better performance */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* Safe area handling for modern phones */
  #chatModalContent {
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Hide banner on very small screens when modal is open */
  body.modal-open #chatbot-banner {
    display: none;
  }

  /* Hide floating buttons when modal is open on mobile */
  body.modal-open .floating-btn {
    display: none;
  }

  /* Ensure proper message spacing on mobile */
  .message-user {
    padding-right: 8px !important;
  }

  .message-bot {
    padding-left: 8px !important;
  }
}
