/* =========================================================
   MAV UNITED REALTY — LUXURY CONCIERGE CHAT WIDGET
   Premium styling — inspired by One Sotheby's & Luxury Presence
   ========================================================= */

/* ── Keyframes ── */
@keyframes bubblePop {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)  scale(1); }
}
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(37, 211, 102, 0); }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 6px 28px rgba(167,122,82,0.5); }
  50%       { box-shadow: 0 8px 36px rgba(167,122,82,0.8); }
}

/* ═══════════════════════════════════════════════════════
   FLOATING TRIGGER BUTTON
   ═══════════════════════════════════════════════════════ */
.chatbot-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 500;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C49A6C 0%, #A77A52 55%, #8B5E38 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 28px rgba(167,122,82,0.5), 0 2px 8px rgba(0,0,0,0.18);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeSlideUp 0.6s ease both 1.2s, glowPulse 3s ease-in-out 2s infinite;
  opacity: 0;
}
.chatbot-trigger:hover {
  transform: scale(1.09) translateY(-2px);
  box-shadow: 0 10px 36px rgba(167,122,82,0.7);
}
.chatbot-trigger.open {
  animation: none;
  background: #1a2035;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Icon toggle */
.chatbot-trigger__icon {
  color: #fff;
  position: absolute;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.chatbot-trigger__icon--close {
  opacity: 0;
  transform: rotate(-90deg);
}
.chatbot-trigger.open .chatbot-trigger__icon--chat {
  opacity: 0;
  transform: rotate(90deg);
}
.chatbot-trigger.open .chatbot-trigger__icon--close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Notification badge */
.chatbot-trigger__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 20px;
  height: 20px;
  background: #25D166;
  border-radius: 50%;
  border: 2px solid #fff;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  animation: pulseDot 2.5s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════
   CHAT MODAL
   ═══════════════════════════════════════════════════════ */
.chatbot-modal {
  position: fixed;
  bottom: calc(28px + 72px);
  right: 28px;
  z-index: 499;
  width: 390px;
  max-width: calc(100vw - 32px);
  max-height: 620px;
  background: #0D1120;
  border: 1px solid rgba(167,122,82,0.22);
  border-radius: 20px;
  box-shadow:
    0 24px 60px rgba(0,0,0,0.55),
    0 0 0 1px rgba(167,122,82,0.08),
    inset 0 1px 0 rgba(255,255,255,0.04);
  display: flex;
  flex-direction: column;
  overflow: hidden;

  /* Hidden state */
  transform: scale(0.9) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
  transform-origin: bottom right;
}
.chatbot-modal.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════ */
.chatbot-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, #111827 0%, #0D1120 100%);
  border-bottom: 1px solid rgba(167,122,82,0.15);
  flex-shrink: 0;
}

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

/* Avatar wrapper */
.chatbot-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.chatbot-avatar-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C49A6C, #8B5E38);
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot-avatar-face {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #0D1120;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.chatbot-avatar-status {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: #25D166;
  border-radius: 50%;
  border: 2px solid #0D1120;
  animation: pulseDot 2.5s ease-in-out infinite;
}

.chatbot-header__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chatbot-header__name {
  font-family: var(--font-sans, 'Manrope', sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: #F2EFE7;
  letter-spacing: 0.03em;
}
.chatbot-header__status {
  font-family: var(--font-sans, 'Manrope', sans-serif);
  font-size: 11px;
  color: rgba(242,239,231,0.5);
  display: flex;
  align-items: center;
  gap: 5px;
}
.chatbot-online-dot {
  width: 7px;
  height: 7px;
  background: #25D166;
  border-radius: 50%;
  flex-shrink: 0;
}

.chatbot-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.chatbot-modal__close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(242,239,231,0.06);
  border: 1px solid rgba(242,239,231,0.08);
  color: rgba(242,239,231,0.55);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.chatbot-modal__close:hover {
  background: rgba(167,122,82,0.15);
  color: #A77A52;
  border-color: rgba(167,122,82,0.3);
}

/* ── Response time ribbon ── */
.chatbot-intro-ribbon {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(167,122,82,0.08);
  border-bottom: 1px solid rgba(167,122,82,0.12);
  font-size: 11px;
  font-family: var(--font-sans, 'Manrope', sans-serif);
  color: rgba(196,154,108,0.85);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   MESSAGES AREA
   ═══════════════════════════════════════════════════════ */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar { width: 3px; }
.chatbot-messages::-webkit-scrollbar-track { background: transparent; }
.chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(167,122,82,0.25);
  border-radius: 99px;
}

/* ── Message rows ── */
.chat-message {
  display: flex;
  gap: 10px;
  animation: bubblePop 0.3s ease both;
}
.chat-message--bot  { flex-direction: row; align-items: flex-end; }
.chat-message--user { flex-direction: row-reverse; }

/* ── Bubbles ── */
.chat-bubble {
  max-width: 82%;
  padding: 11px 15px;
  font-size: 13.5px;
  line-height: 1.65;
  font-family: var(--font-sans, 'Manrope', sans-serif);
}
.chat-message--bot .chat-bubble {
  background: #141D2E;
  border: 1px solid rgba(167,122,82,0.15);
  color: #E8E2D9;
  border-radius: 4px 16px 16px 16px;
}
.chat-message--user .chat-bubble {
  background: linear-gradient(135deg, #C49A6C 0%, #A77A52 100%);
  color: #0D1120;
  font-weight: 600;
  border-radius: 16px 4px 16px 16px;
}

/* ── Typing indicator ── */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: #141D2E;
  border: 1px solid rgba(167,122,82,0.15);
  border-radius: 4px 16px 16px 16px;
  width: fit-content;
}
.typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(167,122,82,0.6);
  animation: typingBounce 1.3s ease infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.18s; }
.typing-dot:nth-child(3) { animation-delay: 0.36s; }

/* ═══════════════════════════════════════════════════════
   QUICK REPLY PILLS
   ═══════════════════════════════════════════════════════ */
.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.quick-reply {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid rgba(167,122,82,0.35);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #C49A6C;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans, 'Manrope', sans-serif);
  white-space: nowrap;
}
.quick-reply:hover:not(:disabled) {
  background: rgba(167,122,82,0.15);
  border-color: #A77A52;
  color: #F2EFE7;
  transform: translateY(-1px);
}
.quick-reply:disabled {
  opacity: 0.35;
  cursor: default;
}
.quick-reply--active {
  background: linear-gradient(135deg, #C49A6C, #A77A52) !important;
  color: #0D1120 !important;
  border-color: transparent !important;
  opacity: 1 !important;
}

/* ═══════════════════════════════════════════════════════
   CONFIRMATION CARD
   ═══════════════════════════════════════════════════════ */
.chat-bubble--confirm {
  background: linear-gradient(135deg, #111827, #0D1120);
  border: 1px solid rgba(167,122,82,0.3);
  border-radius: 12px;
  padding: 16px 18px;
  max-width: 100%;
  animation: bubblePop 0.4s ease both;
}
.confirm-check {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(167,122,82,0.15);
  border: 1px solid rgba(167,122,82,0.4);
  color: #C49A6C;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.confirm-title {
  font-family: var(--font-serif, 'Cormorant Garamond', serif);
  font-size: 18px;
  font-weight: 600;
  color: #F2EFE7;
  margin-bottom: 6px;
}
.confirm-body {
  font-size: 12.5px;
  color: rgba(242,239,231,0.65);
  line-height: 1.65;
  margin-bottom: 12px;
}
.confirm-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(167,122,82,0.12);
  border-radius: 8px;
  font-size: 11.5px;
  color: #C49A6C;
  font-family: var(--font-sans, 'Manrope', sans-serif);
}

.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.confirm-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.04em;
  font-family: var(--font-sans, 'Manrope', sans-serif);
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}
.confirm-btn--wa {
  background: rgba(37,211,102,0.12);
  border: 1px solid rgba(37,211,102,0.3);
  color: #25D166;
}
.confirm-btn--wa:hover {
  background: rgba(37,211,102,0.2);
  transform: translateY(-1px);
}
.confirm-btn--call {
  background: rgba(167,122,82,0.12);
  border: 1px solid rgba(167,122,82,0.3);
  color: #C49A6C;
}
.confirm-btn--call:hover {
  background: rgba(167,122,82,0.2);
  transform: translateY(-1px);
}

/* ═══════════════════════════════════════════════════════
   INPUT AREA
   ═══════════════════════════════════════════════════════ */
.chatbot-input-area {
  padding: 14px 16px 12px;
  border-top: 1px solid rgba(167,122,82,0.12);
  background: #0D1120;
  flex-shrink: 0;
}
.chatbot-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.chatbot-input {
  flex: 1;
  background: #141D2E;
  border: 1px solid rgba(167,122,82,0.18);
  border-radius: 99px;
  padding: 10px 16px;
  font-size: 13px;
  font-family: var(--font-sans, 'Manrope', sans-serif);
  color: #F2EFE7;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.chatbot-input::placeholder { color: rgba(242,239,231,0.28); }
.chatbot-input:focus {
  border-color: rgba(167,122,82,0.5);
  box-shadow: 0 0 0 3px rgba(167,122,82,0.08);
}
.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #C49A6C, #A77A52);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #0D1120;
  transition: all 0.2s ease;
  box-shadow: 0 3px 10px rgba(167,122,82,0.35);
}
.chatbot-send:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 16px rgba(167,122,82,0.5);
}
.chatbot-send:active { transform: scale(0.96); }

.chatbot-powered {
  text-align: center;
  font-size: 10px;
  color: rgba(242,239,231,0.22);
  margin-top: 8px;
  letter-spacing: 0.04em;
  font-family: var(--font-sans, 'Manrope', sans-serif);
}

/* ═══════════════════════════════════════════════════════
   MOBILE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .chatbot-trigger { right: 16px; bottom: 16px; }
  .chatbot-modal {
    right: 16px;
    bottom: calc(16px + 70px);
    width: calc(100vw - 32px);
    max-height: 80vh;
  }
}
