﻿/* ===== Rise Estate — Aria AI Chatbot ===== */

#re-chatbot-btn {
  position: fixed;
  bottom: 76px;
  right: 28px;
  width: 52px;
  height: 52px;
  background: linear-gradient(145deg, #4D2327 0%, #2E1215 100%);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 18px;
  cursor: pointer;
  z-index: 9997;
  border: none;
  box-shadow: 0 4px 16px rgba(77, 35, 39, 0.55), 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  opacity: 0;
  visibility: hidden;
}
#re-chatbot-btn.visible {
  opacity: 1;
  visibility: visible;
}
#re-chatbot-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(77, 35, 39, 0.65), 0 2px 6px rgba(0,0,0,0.3);
}
#re-chatbot-btn .chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #0A0A0A;
  animation: pulse-badge 2.5s infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* ── Chat Window ── */
#re-chatbot-window {
  position: fixed;
  bottom: 144px;
  right: 28px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: clamp(452px, 68vh, 540px);
  background: #111111;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0,0,0,0.4);
  transform: translateY(14px);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
#re-chatbot-window.open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* ── Header ── */
.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  background: linear-gradient(90deg, #1A0D0F 0%, #150B0C 100%);
  border-bottom: 1px solid rgba(196, 120, 126, 0.12);
  flex-shrink: 0;
}
.chatbot-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chatbot-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(145deg, #4D2327, #2E1215);
  border: 1px solid rgba(196, 120, 126, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.chatbot-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chatbot-header-info h4 {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chatbot-ai-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #C4787E;
  background: rgba(196, 120, 126, 0.12);
  border: 1px solid rgba(196, 120, 126, 0.3);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.5;
  vertical-align: middle;
}
.chatbot-header-info span {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.38);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
}
.chatbot-header-info span::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

/* Header action buttons */
.chatbot-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chatbot-close,
.chatbot-clear {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot-close:hover,
.chatbot-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.chatbot-clear:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

/* ── Messages area ── */
.chatbot-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #111111;
}
.chatbot-messages::-webkit-scrollbar { width: 3px; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}

.chat-msg {
  max-width: 90%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.58;
  font-family: 'Inter', sans-serif;
}
.chat-msg.bot {
  align-self: flex-start;
  background: #1C1C1C;
  color: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom-left-radius: 3px;
}
.chat-msg.bot p {
  margin: 0;
}
.chat-msg.bot p + p,
.chat-msg.bot p + ul,
.chat-msg.bot p + ol,
.chat-msg.bot ul + p,
.chat-msg.bot ol + p,
.chat-msg.bot .chat-heading + p,
.chat-msg.bot .chat-heading + ul,
.chat-msg.bot .chat-heading + ol,
.chat-msg.bot p + .chat-heading,
.chat-msg.bot ul + .chat-heading,
.chat-msg.bot ol + .chat-heading {
  margin-top: 10px;
}
.chat-msg.bot ul,
.chat-msg.bot ol {
  margin: 10px 0 0;
  padding-left: 18px;
}
.chat-msg.bot li + li {
  margin-top: 6px;
}
.chat-msg.bot .chat-heading {
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.chat-msg.bot strong {
  color: #FFFFFF;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(145deg, #4D2327, #3a1a1d);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg a {
  color: #C4787E;
  font-weight: 500;
  text-decoration: none;
}
.chat-msg a:hover { text-decoration: underline; }

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: #1C1C1C;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  border-bottom-left-radius: 3px;
  align-self: flex-start;
}
.typing-indicator span {
  width: 6px;
  height: 6px;
  background: rgba(196, 120, 126, 0.5);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* ── Input bar ── */
.chatbot-input-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #161616;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
#chatbot-input {
  flex: 1;
  background: #1E1E1E;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  min-width: 0;
}
#chatbot-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}
#chatbot-input:focus {
  border-color: rgba(196, 120, 126, 0.45);
}
#chatbot-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#chatbot-send {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: linear-gradient(145deg, #4D2327, #3a1a1d);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s, opacity 0.15s;
}
#chatbot-send:hover:not(:disabled) {
  background: linear-gradient(145deg, #5e2b30, #4D2327);
  transform: scale(1.05);
}
#chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  #re-chatbot-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: min(76vh, 600px);
    border-radius: 14px 14px 0 0;
  }
  #re-chatbot-btn {
    bottom: 70px;
    right: 16px;
    width: 48px;
    height: 48px;
    font-size: 16px;
  }
  .chatbot-messages {
    min-height: 0;
  }
}