/* ===== CHATBOT WIDGET ===== */
.chatbot-widget {
  position: fixed;
  z-index: 9999;
}

/* Toggle Button */
.chatbot-toggle {
  position: fixed;
  bottom: 80px;
  left: 20px;
  width: 55px;
  height: 55px;
  background: linear-gradient(135deg, #5B3CC4, #7B5CE6);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(91, 60, 196, 0.4);
  z-index: 9999;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: chatbotPulse 2s infinite;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(91, 60, 196, 0.6);
}

@keyframes chatbotPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(91, 60, 196, 0.4); }
  50% { box-shadow: 0 4px 40px rgba(91, 60, 196, 0.7); }
}

/* Chat Window */
.chatbot-window {
  position: fixed;
  bottom: 145px;
  left: 20px;
  width: 340px;
  height: 480px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 16px;
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.chatbot-window.open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

/* Chat Header */
.chatbot-header {
  background: linear-gradient(135deg, #5B3CC4, #7B5CE6);
  color: #fff;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

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

.chatbot-header-info h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.chatbot-header-info span {
  font-size: 11px;
  opacity: 0.85;
}

.chatbot-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: background 0.2s;
}

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

/* Chat Body */
.chatbot-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
  width: 5px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(91, 60, 196, 0.3);
  border-radius: 10px;
}

/* Message Bubbles */
.message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #5B3CC4, #7B5CE6);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.message.bot {
  align-self: flex-start;
  background: #f0f0f5;
  color: #333;
  border-bottom-left-radius: 4px;
}

/* Suggestion Chips */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 15px 10px;
}

.suggestion-chip {
  padding: 6px 14px;
  border: 1px solid #5B3CC4;
  border-radius: 20px;
  font-size: 12px;
  color: #5B3CC4;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-chip:hover {
  background: linear-gradient(135deg, #5B3CC4, #7B5CE6);
  color: #fff;
  border-color: transparent;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 15px;
}

.typing-indicator span {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typingDot 1.4s infinite ease-in-out;
}

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

@keyframes typingDot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Chat Footer */
.chatbot-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border-top: 1px solid #eee;
  background: #fff;
}

.chatbot-footer input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.chatbot-footer input:focus {
  border-color: #5B3CC4;
}

.chatbot-footer button {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #5B3CC4, #7B5CE6);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: transform 0.2s;
}

.chatbot-footer button:hover {
  transform: scale(1.05);
}

/* ─── Mobile Responsive ─── */
@media (max-width: 767px) {
  .chatbot-toggle {
    width: 50px;
    height: 50px;
    font-size: 20px;
    bottom: 80px;
    left: 15px;
  }
  .chatbot-window {
    width: calc(100% - 30px);
    max-width: 400px;
    height: 460px;
    bottom: 140px;
    left: 15px;
  }
}

@media (max-width: 575px) {
  .chatbot-toggle {
    width: 44px;
    height: 44px;
    font-size: 18px;
    bottom: 75px;
    left: 12px;
  }
  .chatbot-window {
    width: calc(100% - 20px);
    max-width: none;
    height: calc(100vh - 180px);
    min-height: 320px;
    bottom: 130px;
    left: 10px;
    border-radius: 12px;
  }
  .chatbot-header { padding: 12px 15px; }
  .chatbot-header-info h4 { font-size: 13px; }
  .chatbot-messages { padding: 10px; }
  .message { max-width: 88%; padding: 8px 12px; font-size: 12px; }
  .chatbot-footer { padding: 8px 10px; }
  .chatbot-footer input { font-size: 12px; padding: 8px 12px; }
  .chatbot-footer button { width: 34px; height: 34px; font-size: 12px; }
  .suggestion-chip { font-size: 11px; padding: 5px 11px; }
}

@media (max-width: 399px) {
  .chatbot-toggle {
    width: 40px;
    height: 40px;
    font-size: 16px;
    bottom: 70px;
    left: 10px;
  }
  .chatbot-window {
    width: calc(100% - 16px);
    left: 8px;
    bottom: 120px;
    height: calc(100vh - 160px);
  }
}
