/* ==========================================================================
   🎙️ LeMicro.live — Widget IA "Dark Neon Studio"
   Styles pour le bouton flottant, la fenêtre de dialogue et les animations
   ========================================================================== */

:root {
  --lm-ia-cyan: #00F2FE;
  --lm-ia-cyan-glow: rgba(0, 242, 254, 0.35);
  --lm-ia-violet: #A855F7;
  --lm-ia-bg: #0B0F19;
  --lm-ia-card: #111827;
  --lm-ia-border: rgba(0, 242, 254, 0.22);
  --lm-ia-text: #F1F5F9;
  --lm-ia-text-muted: #94A3B8;
}

/* Bouton Déclencheur Flottant */
.lemicro-ia-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
  border: 1px solid var(--lm-ia-cyan);
  border-radius: 50px;
  padding: 8px 16px 8px 10px;
  color: var(--lm-ia-text);
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5), 0 0 15px var(--lm-ia-cyan-glow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  font-family: inherit;
}

.lemicro-ia-launcher:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 242, 254, 0.5);
  border-color: #38BDF8;
}

.lemicro-ia-launcher .launcher-icon-wrap {
  position: relative;
  width: 38px;
  height: 38px;
  background: radial-gradient(circle, rgba(0, 242, 254, 0.25) 0%, rgba(15, 23, 42, 0.8) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 242, 254, 0.4);
}

.lemicro-ia-launcher .launcher-pulse {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background: #10B981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10B981;
  animation: lmIaPulse 2s infinite;
}

@keyframes lmIaPulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.lemicro-ia-launcher .launcher-label {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.lemicro-ia-launcher .launcher-sub {
  font-size: 0.68rem;
  color: var(--lm-ia-cyan);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Modal / Fenêtre de Conversation */
.lemicro-ia-modal {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 110px);
  background: rgba(11, 15, 25, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--lm-ia-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 242, 254, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

.lemicro-ia-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

/* En-tête de la fenêtre */
.lm-ia-header {
  padding: 14px 18px;
  background: rgba(15, 23, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lm-ia-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lm-ia-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.2) 0%, rgba(168, 85, 247, 0.3) 100%);
  border: 1px solid var(--lm-ia-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.lm-ia-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.2;
}

.lm-ia-status {
  font-size: 0.72rem;
  color: var(--lm-ia-cyan);
  display: flex;
  align-items: center;
  gap: 5px;
}

.lm-ia-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lm-ia-btn-icon {
  background: transparent;
  border: none;
  color: var(--lm-ia-text-muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.lm-ia-btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

/* Zone des Messages */
.lm-ia-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.lm-ia-messages::-webkit-scrollbar {
  width: 5px;
}
.lm-ia-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

/* Bulles */
.lm-ia-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 86%;
}

.lm-ia-bubble-wrap.user {
  align-self: flex-end;
}

.lm-ia-bubble-wrap.assistant {
  align-self: flex-start;
}

.lm-ia-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.87rem;
  line-height: 1.5;
  word-break: break-word;
}

.lm-ia-bubble-wrap.user .lm-ia-bubble {
  background: linear-gradient(135deg, #0284C7 0%, #00B4D8 100%);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}

.lm-ia-bubble-wrap.assistant .lm-ia-bubble {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(0, 242, 254, 0.2);
  color: #F8FAFC;
  border-bottom-left-radius: 4px;
}

.lm-ia-bubble p {
  margin: 0 0 8px 0;
}
.lm-ia-bubble p:last-child {
  margin-bottom: 0;
}
.lm-ia-bubble a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: #00F2FE;
  padding: 5px 12px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.83rem;
  margin: 4px 4px 4px 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.lm-ia-bubble a:hover {
  background: rgba(0, 242, 254, 0.22);
  border-color: #00F2FE;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 242, 254, 0.35);
  color: #FFFFFF;
}
.lm-ia-bubble a[href*="wa.me"] {
  background: rgba(37, 211, 102, 0.15);
  border-color: rgba(37, 211, 102, 0.5);
  color: #25D366;
}
.lm-ia-bubble a[href*="wa.me"]:hover {
  background: rgba(37, 211, 102, 0.28);
  border-color: #25D366;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  color: #FFFFFF;
}

/* Barre d'outils réponse (Vocalise / Copier) */
.lm-ia-bubble-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-left: 4px;
}

.lm-ia-bubble-action {
  font-size: 0.72rem;
  color: var(--lm-ia-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

.lm-ia-bubble-action:hover {
  color: var(--lm-ia-cyan);
}

/* Chips / Suggestions rapides */
.lm-ia-suggestions {
  padding: 6px 14px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lm-ia-chip {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(0, 242, 254, 0.25);
  color: var(--lm-ia-cyan);
  padding: 5px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.lm-ia-chip:hover {
  background: rgba(0, 242, 254, 0.15);
  border-color: var(--lm-ia-cyan);
  transform: translateY(-1px);
}

/* Zone de Saisie */
.lm-ia-footer {
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lm-ia-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #090D16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 4px 6px 4px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.lm-ia-input-row:focus-within {
  border-color: var(--lm-ia-cyan);
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.25);
}

.lm-ia-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
  padding: 6px 0;
}

.lm-ia-input::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

/* Boutons vocal & envoi */
.lm-ia-btn-mic, .lm-ia-btn-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.lm-ia-btn-mic {
  background: rgba(255, 255, 255, 0.08);
  color: var(--lm-ia-text-muted);
}

.lm-ia-btn-mic:hover {
  background: rgba(0, 242, 254, 0.2);
  color: var(--lm-ia-cyan);
}

.lm-ia-btn-mic.listening {
  background: #EF4444;
  color: #FFFFFF;
  animation: lmIaPulse 1.2s infinite;
}

.lm-ia-btn-send {
  background: linear-gradient(135deg, #00F2FE 0%, #0284C7 100%);
  color: #0B0F19;
  font-weight: 800;
}

.lm-ia-btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.lm-ia-btn-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Animation Réflexion / Chargement */
.lm-ia-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.lm-ia-typing span {
  width: 6px;
  height: 6px;
  background: var(--lm-ia-cyan);
  border-radius: 50%;
  animation: lmIaTyping 1.4s infinite ease-in-out;
}

.lm-ia-typing span:nth-child(2) { animation-delay: 0.2s; }
.lm-ia-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Responsive Mobile */
@media (max-width: 640px) {
  .lemicro-ia-launcher {
    bottom: 16px;
    right: 16px;
    padding: 7px 12px 7px 8px;
  }
  .lemicro-ia-launcher .launcher-label {
    display: none; /* Icone seule sur petit mobile pour ne pas cacher le contenu */
  }
  .lemicro-ia-modal {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
  }
}
