/* ===========================
   CHATBOT WIDGET
=========================== */
#chatbot-widget {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  font-family: 'Inter', sans-serif;
}

/* Toggle Button */
.chat-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #c4897a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(196,137,122,0.45);
  transition: transform 0.3s, background 0.3s;
  position: relative;
}
.chat-toggle:hover { transform: scale(1.1); background: #d49a8a; }
.chat-toggle svg { width: 24px; height: 24px; color: #fff; }

.chat-badge {
  position: absolute;
  top: 0; right: 0;
  background: #e05c5c;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #faf7f4;
}

/* Chat Window */
.chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 340px;
  max-height: 520px;
  background: #faf7f4;
  border: 1px solid #ddd0c8;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
.chat-header {
  background: #c4897a;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-avatar {
  font-size: 1.5rem;
  width: 38px;
  height: 38px;
  background: rgba(255,255,255,0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
}
.chat-status {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.85);
  margin-top: 1px;
}
.chat-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}
.chat-close:hover { color: #fff; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #ddd0c8; border-radius: 2px; }

.chat-msg {
  display: flex;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg.bot { justify-content: flex-start; }

.chat-bubble {
  max-width: 82%;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.6;
}
.chat-msg.user .chat-bubble {
  background: #c4897a;
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.bot .chat-bubble {
  background: #fff;
  color: #2e1f1f;
  border: 1px solid #ddd0c8;
  border-bottom-left-radius: 3px;
}

/* Typing indicator */
.typing-indicator .chat-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 0.7rem 1rem;
}
.typing-indicator span {
  width: 7px; height: 7px;
  background: #c4897a;
  border-radius: 50%;
  display: block;
  animation: typingBounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Quick Replies */
.chat-quick {
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  border-top: 1px solid #f0e8e3;
  background: #faf7f4;
}
.quick-reply-btn {
  background: #fff;
  border: 1px solid #ddd0c8;
  color: #8c7370;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}
.quick-reply-btn:hover {
  background: #f0e8e3;
  border-color: #c4897a;
  color: #c4897a;
}

/* Input Area */
.chat-input-area {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid #ddd0c8;
  background: #fff;
}
#chatInput {
  flex: 1;
  border: 1px solid #ddd0c8;
  background: #faf7f4;
  color: #2e1f1f;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  padding: 0.55rem 0.85rem;
  border-radius: 20px;
  outline: none;
  transition: border-color 0.3s;
}
#chatInput:focus { border-color: #c4897a; }
#chatSend {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #c4897a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
  flex-shrink: 0;
}
#chatSend:hover { background: #d49a8a; }
#chatSend svg { color: #fff; }

/* Mobile */
@media (max-width: 400px) {
  .chat-window { width: calc(100vw - 2rem); right: -0.5rem; }
  #chatbot-widget { right: 1rem; bottom: 1rem; }
}
