/* ==========================================================================
   LUXURY ELITE IMMOBILIER - ASSISTANT VIRTUEL INTERACTIF (CHATBOT)
   Style moderne, élégant, réactif & ergonomique
   Emplacement : /assistant/assistant.css
   ========================================================================== */

:root {
  --lei-gold: #ad8c32;
  --lei-gold-hover: #967828;
  --lei-gold-light: rgba(173, 140, 50, 0.12);
  --lei-gold-glow: rgba(173, 140, 50, 0.35);
  --lei-dark: #111827;
  --lei-dark-card: #1f2937;
  --lei-light-bg: #f8fafc;
  --lei-gray-text: #64748b;
  --lei-chat-width: 380px;
  --lei-chat-height: 580px;
  --lei-radius: 20px;
  --lei-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
  --lei-transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Container Global Flottant */
.lei-assistant-wrapper {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.lei-assistant-wrapper * {
  box-sizing: border-box;
  pointer-events: auto;
}

/* Teaser / Bulle Proactive */
.lei-assistant-teaser {
  background: #ffffff;
  color: var(--lei-dark);
  padding: 12px 18px;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 280px;
  border: 1px solid rgba(173, 140, 50, 0.25);
  animation: leiTeaserBounce 0.5s ease forwards;
  position: relative;
  cursor: pointer;
  transition: var(--lei-transition);
}

.lei-assistant-teaser:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(173, 140, 50, 0.25);
  border-color: var(--lei-gold);
}

.lei-assistant-teaser-close {
  position: absolute;
  top: -8px;
  left: -8px;
  background: var(--lei-dark);
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.2s;
}

.lei-assistant-teaser-close:hover {
  background: var(--lei-gold);
}

/* Bouton Déclencheur (Floating Launcher) */
.lei-assistant-toggle {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a1a1a 0%, #ad8c32 100%);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  position: relative;
  transition: var(--lei-transition);
}

.lei-assistant-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 14px 30px var(--lei-gold-glow);
}

.lei-assistant-toggle-pulse {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid var(--lei-gold);
  animation: leiPulseRing 2s infinite;
}

.lei-assistant-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  font-weight: bold;
  height: 20px;
  min-width: 20px;
  border-radius: 10px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Fenêtre Principale du Chatbot */
.lei-assistant-window {
  width: var(--lei-chat-width);
  height: var(--lei-chat-height);
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: var(--lei-radius);
  box-shadow: var(--lei-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(173, 140, 50, 0.2);
  margin-bottom: 16px;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.lei-assistant-window.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

/* En-tête du Chatbot */
.lei-assistant-header {
  background: linear-gradient(135deg, #111827 0%, #1f2937 60%, #ad8c32 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lei-assistant-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lei-assistant-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  padding: 3px;
  border: 2px solid var(--lei-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.lei-assistant-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.lei-assistant-info h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.3px;
}

.lei-assistant-status {
  font-size: 0.78rem;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.lei-status-dot {
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 8px #22c55e;
}

.lei-assistant-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lei-header-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background 0.2s ease;
}

.lei-header-btn:hover {
  background: var(--lei-gold);
}

/* Zone du Fil de Conversation */
.lei-assistant-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background-color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

/* Style des Messages */
.lei-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: leiFadeIn 0.3s ease forwards;
}

.lei-msg-bot {
  align-self: flex-start;
}

.lei-msg-user {
  align-self: flex-end;
}

.lei-msg-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
  word-break: break-word;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.lei-msg-bot .lei-msg-bubble {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-top-left-radius: 4px;
}

.lei-msg-user .lei-msg-bubble {
  background: linear-gradient(135deg, #ad8c32 0%, #8c6d21 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
}

.lei-msg-time {
  font-size: 0.68rem;
  color: #94a3b8;
  margin-top: 4px;
  padding: 0 4px;
}

.lei-msg-user .lei-msg-time {
  text-align: right;
}

/* Cartes & Options Interactives */
.lei-quick-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.lei-quick-btn {
  background: #ffffff;
  border: 1.5px solid var(--lei-gold);
  color: #1e293b;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--lei-transition);
  box-shadow: 0 2px 6px rgba(173, 140, 50, 0.08);
}

.lei-quick-btn i {
  color: var(--lei-gold);
  font-size: 1.1rem;
  transition: transform 0.2s ease;
}

.lei-quick-btn:hover {
  background: var(--lei-gold);
  color: #ffffff;
  transform: translateX(4px);
  box-shadow: 0 4px 12px var(--lei-gold-glow);
}

.lei-quick-btn:hover i {
  color: #ffffff;
  transform: translateX(3px);
}

/* Boutons Réseau / Actions Directes */
.lei-action-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #25D366;
  color: #ffffff !important;
  padding: 10px 16px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none !important;
  margin-top: 8px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}

.lei-action-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.lei-action-link.btn-estimate {
  background: var(--lei-dark);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.3);
}

.lei-action-link.btn-estimate:hover {
  background: var(--lei-gold);
}

/* Indicateur de saisie (Typing Indicator) */
.lei-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: #ffffff;
  border-radius: 16px;
  border-top-left-radius: 4px;
  width: fit-content;
  border: 1px solid #e2e8f0;
}

.lei-typing-dot {
  width: 7px;
  height: 7px;
  background-color: var(--lei-gold);
  border-radius: 50%;
  animation: leiTyping 1.4s infinite ease-in-out both;
}

.lei-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.lei-typing-dot:nth-child(2) { animation-delay: -0.16s; }

/* Zone de Saisie / Footer */
.lei-assistant-footer {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lei-chat-form {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.lei-chat-input {
  flex: 1;
  border: 1.5px solid #e2e8f0;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #f8fafc;
}

.lei-chat-input:focus {
  border-color: var(--lei-gold);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--lei-gold-light);
}

.lei-send-btn {
  background: var(--lei-gold);
  color: #ffffff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: transform 0.2s, background 0.2s;
  flex-shrink: 0;
}

.lei-send-btn:hover {
  background: var(--lei-gold-hover);
  transform: scale(1.05);
}

/* Quick Chips / Suggestions sous l'input */
.lei-chat-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.lei-chat-chips::-webkit-scrollbar {
  display: none;
}

.lei-chip {
  background: #f1f5f9;
  color: #475569;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  border: 1px solid #e2e8f0;
}

.lei-chip:hover {
  background: var(--lei-gold-light);
  color: var(--lei-gold);
  border-color: var(--lei-gold);
}

/* Modal Formulaire de Contact Express */
.lei-chat-mini-form {
  background: #ffffff;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--lei-gold-light);
  margin-top: 8px;
}

.lei-chat-mini-form input,
.lei-chat-mini-form textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  margin-bottom: 8px;
  outline: none;
}

.lei-chat-mini-form input:focus,
.lei-chat-mini-form textarea:focus {
  border-color: var(--lei-gold);
}

.lei-chat-mini-form button {
  width: 100%;
  background: var(--lei-dark);
  color: #ffffff;
  border: none;
  padding: 8px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.lei-chat-mini-form button:hover {
  background: var(--lei-gold);
}

/* Animations Keyframes */
@keyframes leiPulseRing {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

@keyframes leiTeaserBounce {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  60% { transform: translateY(-4px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes leiFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes leiTyping {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* Responsivité Mobile (< 576px) */
@media (max-width: 576px) {
  .lei-assistant-wrapper {
    bottom: 16px;
    right: 16px;
  }

  .lei-assistant-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    margin-bottom: 0;
    z-index: 10000;
  }

  .lei-assistant-toggle {
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
  }
}
