/* AI Chatbot Styles */

/* Chatbot Container */
#ai-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Chat Button */
.chat-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.chat-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.chat-button:active {
  transform: scale(0.95);
}

.chat-button iconify-icon {
  font-size: 28px;
  color: white;
}

/* Notification Badge */
.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
  border: 2px solid white;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Chat Header */
.chat-header {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.chat-header-text h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-status {
  font-size: 12px;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

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

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

.chat-close iconify-icon {
  font-size: 20px;
  color: white;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Message */
.message {
  display: flex;
  gap: 10px;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: #64748b;
}

.message-content {
  max-width: 70%;
  background: white;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.message-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

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

.typing-dot {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  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);
  }

  30% {
    transform: translateY(-10px);
  }
}

/* Quick Replies */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 12px;
  background: #f8fafc;
}

.quick-reply {
  background: white;
  border: 1px solid #e2e8f0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s;
}

.quick-reply:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Chat Input */
.chat-input-container {
  padding: 16px 20px;
  background: white;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  max-height: 100px;
  transition: border-color 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: #6366f1;
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.chat-send:hover {
  transform: scale(1.05);
}

.chat-send:active {
  transform: scale(0.95);
}

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

.chat-send iconify-icon {
  font-size: 20px;
  color: white;
}

/* Powered By */
.chat-powered {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: #94a3b8;
  background: #f8fafc;
}

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

  .chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 76px;
  }

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

/* Chat Bubble (Proactive) */
.chat-bubble {
  position: absolute;
  bottom: 25px;
  /* Aligned with button */
  right: 90px;
  /* Left of button (60px + 24px + gap) */
  background: white;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  color: #334155;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  pointer-events: none;
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 250px;
  white-space: normal;
  line-height: 1.4;
  z-index: 9998;
}

.chat-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
  cursor: pointer;
}

/* Arrow pointing right */
.chat-bubble::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 6px solid white;
}

.chat-bubble-close {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 4px;
}

.chat-bubble-close:hover {
  background: #e2e8f0;
  color: #64748b;
}

@media (max-width: 640px) {
  .chat-bubble {
    right: 16px;
    bottom: 80px;
    /* Above the button */
    max-width: 250px;
    font-size: 12px;
  }

  /* Move arrow to bottom */
  .chat-bubble::after {
    right: 20px;
    top: auto;
    bottom: -6px;
    transform: none;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid white;
    border-bottom: none;
  }
}

/* Language Selector in Header */
.chat-lang-select {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 8px;
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  margin-right: 8px;
  transition: background 0.2s;
}

.chat-lang-select:hover {
  background: rgba(255, 255, 255, 0.3);
}

.chat-lang-select option {
  background: white;
  color: #334155;
  padding: 8px;
}

/* Dark Mode Overrides */
body.night-mode .chat-window {
  background-color: #0f172a;
  border-color: #1e293b;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

body.night-mode .chat-header {
  background: linear-gradient(to right, #1e1b4b, #312e81);
  border-bottom-color: #1e293b;
}

body.night-mode .chat-messages {
  background-color: #0f172a;
}

body.night-mode .message.bot .message-content {
  background-color: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

body.night-mode .message.user .message-content {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: white;
}

body.night-mode .chat-input-area {
  background-color: #0f172a;
  border-top-color: #1e293b;
}

body.night-mode .chat-input {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: #334155;
}

body.night-mode .chat-input::placeholder {
  color: #64748b;
}

body.night-mode .chat-send-btn {
  background-color: #3730a3;
  color: #e0e7ff;
}

body.night-mode .chat-send-btn:hover {
  background-color: #4338ca;
}