/* ============================================
   DALAXI — Chatbot Widget (Kinsta-style)
   ============================================ */

/* --- Floating Chat Button --- */
.chatbot-toggle {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border: none;
  cursor: pointer;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.45);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.chatbot-toggle:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 28px rgba(124, 58, 237, 0.55);
}

.chatbot-toggle .icon-chat,
.chatbot-toggle .icon-close {
  position: absolute;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.chatbot-toggle .icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chatbot-toggle.active .icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.chatbot-toggle.active .icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Preview tooltip */
.chatbot-preview {
  position: fixed;
  bottom: 96px;
  right: 28px;
  background: white;
  border-radius: 14px;
  padding: 14px 18px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9997;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
  max-width: 280px;
  cursor: pointer;
}

.chatbot-preview.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chatbot-preview-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chatbot-preview p {
  color: #1a1a2e;
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
}

.chatbot-preview-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e5e5f0;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #6b6b8a;
  transition: background 0.2s ease;
}

.chatbot-preview-close:hover {
  background: #d4d4e0;
}

/* --- Chat Window (Light/White like Kinsta) --- */
.chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 390px;
  max-height: 580px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #e8e8f0;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
}

.chatbot-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

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

.chatbot-avatar::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #6d28d9;
}

.chatbot-header-info h4 {
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  font-family: 'Inter', sans-serif;
}

.chatbot-header-info p {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.73rem;
  margin: 2px 0 0;
  font-family: 'Inter', sans-serif;
}

.chatbot-header-close {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chatbot-header-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.15);
}

/* Messages area — WHITE background */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  max-height: 380px;
  scroll-behavior: smooth;
  background: #fafafa;
}

.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb { background: #d4d4e0; border-radius: 4px; }

/* Message bubbles */
.chat-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot { align-self: flex-start; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }

.chat-msg .msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg.bot .msg-avatar { background: #f0ecff; }
.chat-msg.user .msg-avatar { background: #ecfdf5; }

.chat-msg .msg-bubble {
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 0.87rem;
  line-height: 1.55;
  font-family: 'Inter', sans-serif;
}

.chat-msg.bot .msg-bubble {
  background: #ffffff;
  color: #2d2d3f;
  border: 1px solid #ececf4;
  border-bottom-left-radius: 4px;
}

.chat-msg.user .msg-bubble {
  background: #7c3aed;
  color: white;
  border-bottom-right-radius: 4px;
}

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

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a78bfa;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Quick reply buttons */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.quick-reply-btn {
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid #e0daf0;
  background: #ffffff;
  color: #5b21b6;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.quick-reply-btn:hover {
  background: #7c3aed;
  color: white;
  border-color: #7c3aed;
}

/* Input area */
.chatbot-input {
  padding: 12px 14px;
  border-top: 1px solid #ececf4;
  display: flex;
  gap: 8px;
  align-items: center;
  background: #ffffff;
  flex-shrink: 0;
}

.chatbot-input input,
.chatbot-input textarea {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #e0daf0;
  background: #f8f7ff;
  color: #1a1a2e;
  font-size: 0.87rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s ease;
  resize: none;
}

.chatbot-input input:focus,
.chatbot-input textarea:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.1);
}

.chatbot-input input::placeholder,
.chatbot-input textarea::placeholder {
  color: #9a9ab0;
}

.chatbot-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #7c3aed;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
}

.chatbot-send:hover {
  background: #6d28d9;
  transform: scale(1.05);
}

.chatbot-send:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

.chatbot-skip {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e0daf0;
  background: transparent;
  color: #9a9ab0;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s ease;
}

.chatbot-skip:hover {
  color: #7c3aed;
  border-color: #7c3aed;
}

/* Hidden state */
.chatbot-input.hidden { display: none; }

/* Success checkmark */
.chat-success { text-align: center; padding: 6px 0; }
.chat-success .checkmark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ecfdf5;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

/* Powered by */
.chatbot-footer {
  padding: 8px 16px;
  text-align: center;
  border-top: 1px solid #f0f0f5;
  background: #ffffff;
  flex-shrink: 0;
}

.chatbot-footer p {
  font-size: 0.68rem;
  color: #b0b0c0;
  font-family: 'Inter', sans-serif;
  margin: 0;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .chatbot-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 100vh;
    border-radius: 16px 16px 0 0;
  }

  .chatbot-toggle {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
  }

  .chatbot-preview {
    right: 18px;
    bottom: 80px;
  }

  .chatbot-messages {
    max-height: calc(100vh - 200px);
  }
}
