/* ═══════════════════════════════════════════════════════
   CHATBOT — Dagé Realty Assistant
   ═══════════════════════════════════════════════════════ */

/* ── Bouton flottant ──────────────────────────────────── */
.dage-chat-btn {
  position: fixed;
  bottom: 102px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1c1c1e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.22);
  z-index: 150;
  transition: background .2s, transform .2s, box-shadow .2s;
  border: 2px solid rgba(201,168,76,.35);
  outline: none;
  position: fixed;
}
.dage-chat-btn:hover,
.dage-chat-btn.active {
  background: #c9a84c;
  box-shadow: 0 6px 28px rgba(201,168,76,.38);
  transform: scale(1.05);
}
.dage-chat-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  font-family: 'Inter', sans-serif;
}

/* ── Panneau ──────────────────────────────────────────── */
.dage-chat-panel {
  position: fixed;
  bottom: 174px;
  right: 28px;
  width: 360px;
  max-height: 530px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 72px rgba(0,0,0,.16), 0 4px 20px rgba(0,0,0,.09);
  display: flex;
  flex-direction: column;
  z-index: 149;
  overflow: hidden;
  border: 1px solid rgba(229,224,214,.7);
  transform: translateY(16px) scale(.96);
  opacity: 0;
  pointer-events: none;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .22s ease;
}
.dage-chat-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* ── En-tête ──────────────────────────────────────────── */
.dage-chat-header {
  background: #1c1c1e;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.dage-chat-header-info {
  display: flex;
  align-items: center;
  gap: 11px;
}
.dage-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #2d2d2f;
  border: 1.5px solid rgba(201,168,76,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dage-chat-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  font-family: 'Inter', sans-serif;
  line-height: 1.2;
}
.dage-chat-status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}
.dage-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #27ae60;
  flex-shrink: 0;
  animation: chatPulseGreen 2s ease-in-out infinite;
}
@keyframes chatPulseGreen {
  0%,100%{ opacity:1 }
  50%{ opacity:.5 }
}
.dage-chat-status-lbl {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  font-family: 'Inter', sans-serif;
}
.dage-chat-close {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
  cursor: pointer;
  padding: 7px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s, border-color .15s;
}
.dage-chat-close:hover {
  color: #fff;
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.35);
}

/* ── Zone de messages ─────────────────────────────────── */
.dage-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}
.dage-chat-messages::-webkit-scrollbar { width: 3px; }
.dage-chat-messages::-webkit-scrollbar-track { background: transparent; }
.dage-chat-messages::-webkit-scrollbar-thumb { background: #e5e0d6; border-radius: 3px; }

/* ── Bulles ───────────────────────────────────────────── */
.dage-chat-msg {
  max-width: 90%;
  font-size: 13.5px;
  line-height: 1.55;
  font-family: 'Inter', sans-serif;
  animation: chatMsgIn .2s ease;
}
@keyframes chatMsgIn {
  from { opacity:0; transform:translateY(4px) }
  to   { opacity:1; transform:translateY(0) }
}
.dage-chat-msg-bot {
  align-self: flex-start;
  background: #f2ede4;
  color: #1c1c1e;
  border-radius: 4px 14px 14px 14px;
  padding: 9px 13px;
}
.dage-chat-msg-bot.no-bubble {
  background: none;
  padding: 0;
  max-width: 100%;
}
.dage-chat-msg-user {
  align-self: flex-end;
  background: #1c1c1e;
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  padding: 9px 13px;
}

/* ── Carte bien ───────────────────────────────────────── */
.dage-chat-card {
  display: flex;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e0d6;
  text-decoration: none;
  color: #1c1c1e;
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
  align-self: stretch;
  max-width: 100%;
  animation: chatMsgIn .2s ease;
}
.dage-chat-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  transform: translateY(-1px);
}
.dage-chat-card-img {
  width: 82px;
  height: 82px;
  object-fit: cover;
  flex-shrink: 0;
}
.dage-chat-card-body {
  padding: 9px 10px 9px 0;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dage-chat-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #1c1c1e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dage-chat-card-loc {
  font-size: 10.5px;
  color: #6b7280;
}
.dage-chat-card-meta {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.dage-chat-card-price {
  font-size: 12px;
  font-weight: 700;
  color: #a8872c;
}
.dage-chat-card-chip {
  font-size: 10.5px;
  color: #6b7280;
}
.dage-chat-card-cta {
  font-size: 10.5px;
  font-weight: 700;
  color: #c9a84c;
  margin-top: auto;
}

/* ── Cartes contact ───────────────────────────────────── */
.dage-chat-contact-cards {
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: 100%;
}
.dage-chat-contact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: #f2ede4;
  border-radius: 10px;
  text-decoration: none;
  color: #1c1c1e;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s;
  border: 1px solid #e5e0d6;
  font-family: 'Inter', sans-serif;
}
.dage-chat-contact-card:hover { background: #e8e2d8; }
.dage-chat-contact-wa {
  background: rgba(37,211,102,.07);
  border-color: rgba(37,211,102,.22);
  color: #1a9b44;
}
.dage-chat-contact-wa:hover { background: rgba(37,211,102,.14); }

/* ── Indicateur de frappe ─────────────────────────────── */
.dage-chat-typing {
  padding: 6px 14px 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.dage-chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: chatDot 1.2s infinite ease-in-out;
}
.dage-chat-typing-dot:nth-child(2) { animation-delay: .2s; }
.dage-chat-typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes chatDot {
  0%,80%,100% { transform:scale(.55);opacity:.35 }
  40%          { transform:scale(1);opacity:1 }
}

/* ── Réponses rapides ─────────────────────────────────── */
.dage-chat-replies {
  padding: 6px 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid #f2ede4;
  max-height: 130px;
  overflow-y: auto;
}
.dage-chat-replies:empty {
  display: none;
  padding: 0;
  border-top: none;
}
.dage-chat-reply {
  background: #fff;
  border: 1.5px solid #e5e0d6;
  color: #1c1c1e;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: 'Inter', sans-serif;
  white-space: nowrap;
  line-height: 1;
}
.dage-chat-reply:hover {
  background: #1c1c1e;
  color: #fff;
  border-color: #1c1c1e;
}
.dage-chat-reply-back {
  background: #faf9f7;
  border-color: #d4cfc7;
  color: #6b7280;
  font-weight: 500;
}
.dage-chat-reply-back:hover {
  background: #f0ebe3;
  color: #374151;
  border-color: #9ca3af;
}

/* ── RTL ──────────────────────────────────────────────── */
[dir="rtl"] .dage-chat-btn  { right:auto; left:28px; }
[dir="rtl"] .dage-chat-panel { right:auto; left:28px; }
[dir="rtl"] .dage-chat-msg-bot  { border-radius:14px 4px 14px 14px; }
[dir="rtl"] .dage-chat-msg-user { border-radius:4px 14px 14px 14px; }
[dir="rtl"] .dage-chat-header-info { flex-direction:row-reverse; }
[dir="rtl"] .dage-chat-status     { flex-direction:row-reverse; }
[dir="rtl"] .dage-chat-msg-bot    { align-self:flex-end; }
[dir="rtl"] .dage-chat-msg-user   { align-self:flex-start; }
[dir="rtl"] .dage-chat-card-body  { padding:9px 0 9px 10px; }

/* ── Mobile ───────────────────────────────────────────── */
@media(max-width:480px) {
  .dage-chat-panel {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 78vh;
  }
  .dage-chat-btn { bottom: 102px; }
  [dir="rtl"] .dage-chat-panel { right:0; left:0; }
  [dir="rtl"] .dage-chat-btn { right:auto; left:28px; }
}
