/* ===== Chatbot Container ===== */
.chatbot-container {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px) saturate(180%);
  border-radius: 24px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12);
  width: 441px;
  height: 632px;
  display: none; /* Hidden initially */
  flex-direction: column;
  overflow: hidden;
  position: absolute;
  bottom: 78px;
  right: -12px;
  z-index: 1001;
  border: 1.5px solid rgba(99, 102, 241, 0.15);
  opacity: 0;
  transform: translateY(30px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.4, 1.4, 0.4, 1),
              transform 0.4s cubic-bezier(0.4, 1.4, 0.4, 1);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chatbot-container.active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ===== Chat Header ===== */
.chat-header {
  background-color: #f9fafb;
  border-bottom: 1px solid #e1e8ed;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: inset 0 -1px 0 #e1e8ed;
}

.bot-avatar-header {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bot-avatar-header .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.chat-header-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.chat-header-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.chat-header-text p {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 400;
  color: #7f8c8d;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

/* ===== Chat Messages Area ===== */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  background: linear-gradient(180deg, #fcfcfc 0%, #f0f2f5 100%);
  scrollbar-width: thin;
  scrollbar-color: #a5b1c2 transparent;
}

/* Custom scrollbar for WebKit */
.chat-messages::-webkit-scrollbar {
  width: 8px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #a5b1c2;
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: content-box;
}

/* ===== Individual Messages ===== */
.message {
  margin-bottom: 18px;
  animation: slideInUp 0.35s ease forwards;
  opacity: 0;
  transform: translateY(12px);
}

.message.bot {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

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

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

.bot-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  border-radius: 50%;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.message-content {
  max-width: 75%;
  background: #ffffff;
  padding: 14px 20px;
  border-radius: 22px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.07);
  line-height: 1.5;
  word-wrap: break-word;
  font-size: 1rem;
  color: #34495e;
  user-select: text;
  transition: background-color 0.3s ease;
}

.message.user .message-content {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  box-shadow: 0 3px 14px rgba(99, 102, 241, 0.5);
}

/* ===== Quick Replies ===== */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.quick-reply {
  background: linear-gradient(135deg, #e0e7ff, #f3e8ff);
  border: 1.5px solid #c7d2fe;
  padding: 10px 16px;
  border-radius: 24px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4f46e5;
  user-select: none;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  
}

.quick-reply:hover,
.quick-reply:focus {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  outline: none;
}

/* ===== Chat Input Area ===== */
.chat-input {
  padding: 20px 24px;
  background: #fff;
  border-top: 1px solid #e6e9ef;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: inset 0 1px 0 #e6e9ef;
}

.input-field {
  flex: 1;
  padding: 14px 18px;
  border: 2.5px solid #e6e9ef;
  border-radius: 28px;
  font-size: 1rem;
  outline: none;
  background: #fefefe;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  color: #34495e;
  font-weight: 500;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.input-field::placeholder {
  color: #a0aec0;
  font-weight: 400;
}

.input-field:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

/* ===== Send Button ===== */
.send-button {
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: white;
  border: none;
  padding: 14px;
  border-radius: 50%;
  cursor: pointer;
  width: 46px;
  height: 46px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  user-select: none;
}

.send-button:hover:not(:disabled),
.send-button:focus:not(:disabled) {
  transform: scale(1.1);
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.6);
  outline: none;
}

.send-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== Typing Indicator ===== */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 20px;
  background: #fff;
  border-radius: 22px;
  margin-top: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  user-select: none;
}

.typing-dot {
  width: 10px;
  height: 10px;
  background: #a0aec0;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

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

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

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* ===== Chat Widget Container ===== */
.chat-widget {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 10000;
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  pointer-events: none;
  color: #000;
}

.chat-widget * {
  box-sizing: border-box;
  color: #000;
}

/* ===== Chat Toggle Button ===== */
.chat-toggle {
  pointer-events: auto;
  position: absolute;
  bottom: 0;
  right: 0;
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #6366f1, #38bdf8);
  color: #fff;
  border-radius: 50%;
  border: none;
  box-shadow:
    0 8px 32px rgba(54, 94, 254, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
  z-index: 10002;
  outline: none;
  filter: drop-shadow(0 0 8px #60a5fa44);
}

.chat-toggle:hover,
.chat-toggle:focus {
  transform: scale(1.1) rotate(-8deg);
  box-shadow:
    0 12px 48px rgba(54, 94, 254, 0.32),
    0 4px 16px rgba(0, 0, 0, 0.13);
  outline: none;
}

/* ===== Responsive ===== */
@media (max-width: 576px) {
  .chat-widget {
    bottom: 8px; /* Further reduce distance from bottom */
    right: 8px;  /* Further reduce distance from right */
  }

  /* Chatbot Container: Make it even smaller */
  .chatbot-container {
    width: 260px; /* Reduced width */
    height: 516px; /* Reduced height */
    bottom: 55px;
    right: 8px;
    border-radius: 18px; /* Slightly smaller border-radius */
  }

  /* Chat Header: Adjust padding and text size */
  .chat-header {
    padding: 12px 16px; /* Reduced padding */
    gap: 10px;
  }

  .bot-avatar-header {
    width: 40px; /* Smaller avatar */
    height: 40px;
  }

  .chat-header-text h1 {
    font-size: 1.1rem; /* Smaller header title */
  }

  .chat-header-text p {
    font-size: 0.75rem; /* Smaller header subtitle */
  }

  /* Chat Messages Area: Reduced padding and smaller messages */
  .chat-messages {
    padding: 12px 16px; /* Reduced padding */
  }

  .message {
    margin-bottom: 12px; /* Smaller margin between messages */
  }

  .message-content {
    padding: 10px 14px; /* Reduced padding within message bubbles */
    font-size: 0.85rem; /* Smaller message text */
    border-radius: 18px; /* Slightly smaller border-radius for bubbles */
  }

  /* Quick Replies: Smaller buttons */
  .quick-replies {
    gap: 8px;
    margin-top: 10px;
  }

  .quick-reply {
    padding: 6px 10px; /* Reduced padding for quick replies */
    font-size: 0.75rem; /* Smaller text for quick replies */
    border-radius: 20px; /* Slightly smaller border-radius */
  }

  /* Chat Input Area: Smaller input and send button */
  .chat-input {
    padding: 10px 12px; /* Reduced padding */
    gap: 10px;
  }

  .input-field {
    padding: 8px 12px; /* Reduced input field padding */
    font-size: 0.85rem; /* Smaller input text */
    border-radius: 24px; /* Slightly smaller border-radius */
  }

  .send-button {
    width: 34px; /* Smaller send button */
    height: 34px;
    font-size: 18px; /* Smaller icon */
    padding: 8px;
  }

  /* Typing Indicator: Smaller dots */
  .typing-indicator {
    padding: 10px 14px;
    gap: 4px;
  }

  .typing-dot {
    width: 8px; /* Smaller dots */
    height: 8px;
  }

  /* Chat Toggle Button: Make it smaller and adjust position */
  .chat-toggle {
    width: 44px; /* Smaller toggle button */
    height: 44px;
    font-size: 18px; /* Smaller icon */
    right: 12px; /* Adjusted position */
    bottom: 12px;
  }
}

/* ===== Chat Status ===== */
#chatStatus {
  color: #00796b;
  font-style: italic;
  padding: 8px 16px;
  min-height: 26px;
  transition: opacity 0.5s ease;
  opacity: 0;
  margin-top: -4px;
  height: 6%;
  font-weight: 500;
  user-select: none;
  font-size: 14px;
}

