/* ============================================================
   CHATBOT — widget flottant Souhel Immo
   ============================================================ */

/* ---------- Bouton flottant ---------- */
.chat-trigger {
  position: fixed;
  bottom: 32px; right: 32px;
  z-index: 500;
  width: 60px; height: 60px;
  background: var(--or);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 32px rgba(201,168,76,0.35), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.4s cubic-bezier(0.22,0.7,0.16,1),
              box-shadow 0.4s cubic-bezier(0.22,0.7,0.16,1);
}
.chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(201,168,76,0.45), 0 4px 12px rgba(0,0,0,0.35);
}
.chat-trigger svg { width: 26px; height: 26px; color: var(--noir); transition: opacity 0.3s; }
.chat-trigger .icon-close { display: none; }
.chat-trigger.open .icon-chat  { display: none; }
.chat-trigger.open .icon-close { display: block; }

/* Pastille notification */
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  width: 18px; height: 18px;
  background: #e05252; border-radius: 50%;
  font-size: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 400;
  animation: badge-pop 0.5s cubic-bezier(0.22,0.7,0.16,1) both;
}
@keyframes badge-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ---------- Fenêtre de chat ---------- */
.chat-window {
  position: fixed;
  bottom: 108px; right: 32px;
  z-index: 499;
  width: 360px;
  max-height: 540px;
  display: flex; flex-direction: column;
  background: var(--noir);
  border: 1px solid var(--line-dark);
  box-shadow: 0 24px 64px rgba(0,0,0,0.55);
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.22,0.7,0.16,1),
              opacity   0.4s cubic-bezier(0.22,0.7,0.16,1);
  transform-origin: bottom right;
}
.chat-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chat-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line-dark);
  display: flex; align-items: center; gap: 12px;
  flex: none;
}
.chat-header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--anthracite);
  border: 1px solid var(--line-gold);
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.chat-header-avatar img {
  width: 24px; height: 24px; object-fit: contain;
}
.chat-header-info { flex: 1; min-width: 0; }
.chat-header-name {
  font-family: var(--serif);
  font-size: 1rem; letter-spacing: 0.08em;
  color: var(--creme); margin: 0; line-height: 1.2;
}
.chat-header-status {
  font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--or); margin-top: 3px;
  display: flex; align-items: center; gap: 6px;
}
.chat-header-status::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: #5cd97d;
  display: inline-block;
}

/* Corps messages */
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-dark) transparent;
}
.chat-body::-webkit-scrollbar { width: 4px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--line-dark); }

/* Bulles */
.chat-msg {
  display: flex; flex-direction: column; gap: 2px;
  animation: msg-in 0.35s cubic-bezier(0.22,0.7,0.16,1) both;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
.chat-msg.bot  { align-items: flex-start; }
.chat-msg.user { align-items: flex-end; }

.chat-bubble {
  max-width: 82%;
  padding: 11px 14px;
  font-size: 0.88rem; line-height: 1.65;
  font-family: var(--sans); font-weight: 300;
}
.chat-msg.bot  .chat-bubble {
  background: var(--anthracite);
  border: 1px solid var(--line-dark);
  color: var(--on-dark);
  border-radius: 0 12px 12px 12px;
}
.chat-msg.user .chat-bubble {
  background: var(--or);
  color: var(--noir);
  font-weight: 400;
  border-radius: 12px 12px 0 12px;
}
.chat-bubble a { color: var(--or-soft); text-decoration: underline; text-underline-offset: 3px; }
.chat-msg.user .chat-bubble a { color: var(--noir); }

.chat-time {
  font-size: 0.58rem; letter-spacing: 0.1em;
  color: var(--on-dark-faint); padding-inline: 4px;
}

/* Indicateur de frappe */
.chat-typing .chat-bubble {
  display: flex; gap: 5px; align-items: center;
  padding: 14px 16px;
}
.chat-typing .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--on-dark-soft);
  animation: typing 1.2s infinite ease-in-out;
}
.chat-typing .dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%            { transform: translateY(-5px); opacity: 1; }
}

/* Réponses rapides */
.chat-quick {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 16px 12px;
  flex: none;
}
.chat-quick-btn {
  background: transparent;
  border: 1px solid var(--line-gold);
  color: var(--or-soft);
  font-family: var(--sans); font-size: 0.72rem;
  letter-spacing: 0.12em;
  padding: 0.55em 1em;
  cursor: pointer;
  transition: background 0.3s, color 0.3s;
  white-space: nowrap;
}
.chat-quick-btn:hover {
  background: var(--or);
  color: var(--noir);
  border-color: var(--or);
}

/* Saisie */
.chat-input-row {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 14px;
  border-top: 1px solid var(--line-dark);
  flex: none;
}
.chat-input {
  flex: 1;
  background: var(--anthracite);
  border: 1px solid var(--line-dark);
  color: var(--creme);
  font-family: var(--sans); font-size: 0.86rem; font-weight: 300;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.3s;
  min-width: 0;
}
.chat-input::placeholder { color: var(--on-dark-faint); }
.chat-input:focus { border-color: var(--or); }
.chat-send {
  width: 40px; height: 40px; flex: none;
  background: var(--or); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--noir);
  transition: background 0.3s, transform 0.2s;
}
.chat-send:hover { background: var(--or-soft); transform: scale(1.05); }
.chat-send svg { width: 18px; height: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .chat-window { right: 12px; left: 12px; width: auto; bottom: 100px; }
  .chat-trigger { right: 20px; bottom: 24px; }
}
