/* ===================================================
   AQARX – AI Property Expert Chatbot CSS
=================================================== */

/* FAB BUTTON */
.chatbot-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  background: var(--red, #CC0000);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(204,0,0,0.5);
  z-index: 9999;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chatbot-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(204,0,0,0.6);
}

.chatbot-fab-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #22cc66;
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Montserrat', sans-serif;
  border: 2px solid #0a0a0a;
}

/* CHAT WINDOW */
.chatbot-window {
  position: fixed;
  bottom: 98px;
  right: 28px;
  width: 380px;
  max-height: 580px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 9998;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  overflow: hidden;
}

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

/* HEADER */
.chatbot-header {
  background: #0a0a0a;
  border-bottom: 1px solid #1a1a1a;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

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

.chatbot-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  background: rgba(204,0,0,0.15);
  border: 1px solid rgba(204,0,0,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #CC0000;
  flex-shrink: 0;
}

.chatbot-online {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #22cc66;
  border-radius: 50%;
  border: 2px solid #0a0a0a;
}

.chatbot-header-info h4 {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 1px;
}

.chatbot-header-info p {
  font-size: 11px;
  color: #22cc66;
}

.chatbot-header-actions {
  display: flex;
  gap: 6px;
}

.chatbot-header-actions button {
  width: 28px;
  height: 28px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  color: #666;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.chatbot-header-actions button:hover {
  background: #CC0000;
  border-color: #CC0000;
  color: #fff;
}

/* MESSAGES */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #2a2a2a transparent;
}

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

/* MESSAGES */
.chat-msg {
  display: flex;
  flex-direction: column;
}

.chat-msg.user { align-items: flex-end; }
.chat-msg.bot  { align-items: flex-start; }

.chat-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}

.chat-msg.user .chat-bubble {
  background: #CC0000;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.bot .chat-bubble {
  background: #1a1a1a;
  border: 1px solid #222;
  color: #ccc;
  border-bottom-left-radius: 4px;
}

.chat-bubble p { margin: 0; }
.chat-bubble p + p { margin-top: 6px; }
.chat-bubble strong { color: #fff; }

/* QUICK TOPICS */
.quick-topics {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.quick-topics button {
  background: #111;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px 10px;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  font-family: 'Open Sans', sans-serif;
  transition: all 0.2s;
}

.quick-topics button:hover {
  border-color: #CC0000;
  color: #fff;
  background: rgba(204,0,0,0.08);
}

/* MSG ACTIONS */
.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-msg.bot:hover .msg-actions { opacity: 1; }

.msg-actions button {
  background: none;
  border: none;
  color: #444;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.msg-actions button:hover { color: #CC0000; }

/* TYPING INDICATOR */
.chatbot-typing {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.typing-bubble {
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.typing-bubble span {
  width: 6px;
  height: 6px;
  background: #444;
  border-radius: 50%;
  animation: typingDot 1.2s infinite;
}

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

@keyframes typingDot {
  0%, 60%, 100% { transform: translateY(0); background: #444; }
  30% { transform: translateY(-6px); background: #CC0000; }
}

.chatbot-typing p {
  font-size: 11px;
  color: #444;
  font-style: italic;
}

/* INPUT AREA */
.chatbot-input-area {
  border-top: 1px solid #1a1a1a;
  padding: 12px;
  flex-shrink: 0;
  background: #0d0d0d;
}

.chatbot-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chatbot-input-wrap textarea {
  flex: 1;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  font-family: 'Open Sans', sans-serif;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  transition: border-color 0.2s;
  overflow-y: auto;
}

.chatbot-input-wrap textarea:focus {
  outline: none;
  border-color: #CC0000;
}

.chatbot-input-wrap textarea::placeholder { color: #444; }

.chatbot-send-btn {
  width: 40px;
  height: 40px;
  background: #CC0000;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}

.chatbot-send-btn:hover   { background: #990000; }
.chatbot-send-btn:active  { transform: scale(0.95); }
.chatbot-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.chatbot-footer-note {
  font-size: 10px;
  color: #333;
  text-align: center;
  margin-top: 8px;
  font-family: 'Montserrat', sans-serif;
}

/* MOBILE */
@media (max-width: 480px) {
  .chatbot-window {
    width: calc(100vw - 24px);
    right: 12px;
    bottom: 88px;
    max-height: 70vh;
  }

  .chatbot-fab {
    right: 16px;
    bottom: 16px;
  }
}