/* ==========================================================================
   ELNE REEL — ALTER EGO IA CHAT WIDGET
   Design Haute Couture : Obsidian, Or Chaud & Verre Fumé (Glassmorphism)
   ========================================================================== */

/* 1. Bouton Flottant Déclencheur */
.elne-ai-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 12px;
  background: rgba(11, 15, 25, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 9999px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(251, 191, 36, 0.25);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
}

.elne-ai-trigger:hover {
  transform: translateY(-3px) scale(1.03);
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7), 0 0 32px rgba(251, 191, 36, 0.45);
}

.elne-ai-trigger:active {
  transform: translateY(0) scale(0.98);
}

/* Badge Icone dans le bouton */
.elne-ai-trigger-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #090d16);
  border: 1px solid rgba(251, 191, 36, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.elne-ai-trigger-icon svg {
  width: 20px;
  height: 20px;
  fill: #fbbf24;
}

/* Point vert/doré En Ligne */
.elne-ai-status-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  background: #10b981;
  border: 2px solid #090d16;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.elne-ai-trigger-label {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.elne-ai-trigger-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.elne-ai-trigger-sub {
  font-size: 11px;
  color: #fbbf24;
  opacity: 0.9;
  letter-spacing: 0.02em;
}

/* 2. Fenêtre de Chat Flottante */
.elne-ai-modal {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 110px);
  z-index: 10000;
  background: rgba(9, 13, 22, 0.94);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(251, 191, 36, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  pointer-events: none;
  transition: all 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.elne-ai-modal.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* En-tête du Chat */
.elne-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.7);
  border-bottom: 1px solid rgba(251, 191, 36, 0.2);
}

.elne-ai-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.elne-ai-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #020617;
  border: 1px solid #fbbf24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
  color: #fbbf24;
  letter-spacing: 0.05em;
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.3);
}

.elne-ai-header-meta h3 {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 0.03em;
}

.elne-ai-header-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #94a3b8;
}

.elne-ai-header-meta span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.elne-ai-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.elne-ai-close-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* Corps des Messages */
.elne-ai-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.elne-ai-body::-webkit-scrollbar {
  width: 4px;
}

.elne-ai-body::-webkit-scrollbar-thumb {
  background: rgba(251, 191, 36, 0.2);
  border-radius: 4px;
}

/* Bulles de conversation */
.elne-ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: elneMsgFade 0.3s ease-out;
}

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

.elne-ai-msg.is-ai {
  align-self: flex-start;
}

.elne-ai-msg.is-user {
  align-self: flex-end;
}

.elne-ai-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.elne-ai-msg.is-ai .elne-ai-bubble {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #f1f5f9;
  border-bottom-left-radius: 4px;
}

.elne-ai-msg.is-user .elne-ai-bubble {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
  border: 1px solid rgba(251, 191, 36, 0.5);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}

.elne-ai-time {
  font-size: 10px;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

.elne-ai-msg.is-user .elne-ai-time {
  text-align: right;
}

/* Suggestions rapides */
.elne-ai-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}

.elne-ai-chip {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.elne-ai-chip:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: #fbbf24;
  color: #fbbf24;
  transform: translateX(3px);
}

/* Indicateur de saisie IA */
.elne-ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
}

.elne-ai-typing span {
  width: 6px;
  height: 6px;
  background: #fbbf24;
  border-radius: 50%;
  animation: elneBounce 1.4s infinite ease-in-out both;
}

.elne-ai-typing span:nth-child(1) { animation-delay: -0.32s; }
.elne-ai-typing span:nth-child(2) { animation-delay: -0.16s; }

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

/* Pied de page & Saisie */
.elne-ai-footer {
  padding: 12px;
  background: rgba(11, 15, 25, 0.9);
  border-top: 1px solid rgba(251, 191, 36, 0.2);
}

.elne-ai-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.elne-ai-input {
  flex: 1;
  background: rgba(2, 6, 23, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
}

.elne-ai-input:focus {
  border-color: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.elne-ai-send-btn {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  border: none;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.elne-ai-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.5);
}

.elne-ai-send-btn:active {
  transform: scale(0.95);
}

.elne-ai-send-btn svg {
  width: 18px;
  height: 18px;
  fill: #090d16;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  .elne-ai-trigger {
    bottom: 18px;
    right: 18px;
    padding: 8px 14px 8px 10px;
  }
  .elne-ai-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }
}
