/* =========================================
   LYRA - Bot Premium AI & Beyond
   Design Glassmorphism + Néon
   ========================================= */

/* Variables Lyra */
:root {
  --lyra-primary: #6366f1;
  --lyra-secondary: #8b5cf6;
  --lyra-accent: #06b6d4;
  --lyra-neon-cyan: #00f5ff;
  --lyra-neon-purple: #bf5af2;
  --lyra-dark: #0a0a1a;
  --lyra-glass-bg: rgba(15, 23, 42, 0.85);
  --lyra-glass-border: rgba(99, 102, 241, 0.3);
}

/* =========================================
   BOUTON FLOTTANT
   ========================================= */
#lyra-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

#lyra-trigger {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--lyra-primary), var(--lyra-secondary));
  box-shadow: 
    0 4px 20px rgba(99, 102, 241, 0.5),
    0 0 40px rgba(99, 102, 241, 0.3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

#lyra-trigger::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lyra-neon-cyan), var(--lyra-neon-purple));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#lyra-trigger:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 
    0 8px 30px rgba(99, 102, 241, 0.6),
    0 0 60px rgba(99, 102, 241, 0.4);
}

#lyra-trigger:hover::before {
  opacity: 1;
  animation: rotate-glow 2s linear infinite;
}

/* Icône du bouton */
#lyra-trigger svg {
  width: 28px;
  height: 28px;
  color: white;
  transition: transform 0.3s ease;
}

#lyra-trigger:hover svg {
  transform: scale(1.1);
}

/* Badge notification */
.lyra-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5);
  animation: pulse-badge 2s ease-in-out infinite;
}

/* Animation pulsation badge */
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Animation rotation glow */
@keyframes rotate-glow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Animation pulsation bouton */
@keyframes pulse-button {
  0%, 100% { 
    box-shadow: 
      0 4px 20px rgba(99, 102, 241, 0.5),
      0 0 40px rgba(99, 102, 241, 0.3);
  }
  50% { 
    box-shadow: 
      0 4px 30px rgba(99, 102, 241, 0.7),
      0 0 60px rgba(99, 102, 241, 0.5);
  }
}

#lyra-trigger.pulse {
  animation: pulse-button 2s ease-in-out infinite;
}

/* =========================================
   CONTENEUR CHAT
   ========================================= */
#lyra-container {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 48px);
  height: 550px;
  max-height: calc(100vh - 140px);
  background: var(--lyra-glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid var(--lyra-glass-border);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(99, 102, 241, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#lyra-container.active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

#lyra-container.closing {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
}

/* =========================================
   HEADER CHAT
   ========================================= */
#lyra-header {
  position: relative;
  background: linear-gradient(135deg, 
    rgba(99, 102, 241, 0.9), 
    rgba(139, 92, 246, 0.9));
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
}

/* Particules header */
#lyra-header::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.2) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: float-particles 8s ease-in-out infinite;
}

@keyframes float-particles {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.2); }
}

.lyra-avatar-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 1;
}

.lyra-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--lyra-neon-cyan), var(--lyra-neon-purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
  animation: breathe 3s ease-in-out infinite;
}

/* Animation "respiration" avatar */
@keyframes breathe {
  0%, 100% { 
    transform: scale(1);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.7);
  }
}

.lyra-avatar svg {
  width: 24px;
  height: 24px;
  color: white;
}

/* Status online */
.lyra-status {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 12px;
  height: 12px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.9);
  animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.lyra-info {
  color: white;
}

.lyra-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.5px;
}

.lyra-role {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 2px;
}

#lyra-close {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#lyra-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

/* =========================================
   ZONE DE MESSAGES
   ========================================= */
#lyra-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, 
    rgba(15, 23, 42, 0.3) 0%, 
    rgba(15, 23, 42, 0.5) 100%);
}

/* Scrollbar custom */
#lyra-messages::-webkit-scrollbar {
  width: 6px;
}

#lyra-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

#lyra-messages::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.5);
  border-radius: 3px;
}

#lyra-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.7);
}

/* =========================================
   MESSAGES
   ========================================= */
.lyra-message {
  max-width: 85%;
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Message Bot */
.lyra-message.bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  border-bottom-left-radius: 6px;
}

/* Message User */
.lyra-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--lyra-primary), var(--lyra-secondary));
  color: white;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Lien dans message */
.lyra-message a {
  color: var(--lyra-neon-cyan);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lyra-message a:hover {
  color: white;
}

/* =========================================
   QUICK REPLIES
   ========================================= */
.lyra-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  animation: message-appear 0.3s ease-out 0.1s both;
}

.lyra-quick-reply {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.lyra-quick-reply:hover {
  background: linear-gradient(135deg, var(--lyra-primary), var(--lyra-secondary));
  border-color: transparent;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* =========================================
   TYPING INDICATOR
   ========================================= */
.lyra-typing {
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  align-self: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.lyra-typing span {
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, var(--lyra-neon-cyan), var(--lyra-neon-purple));
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
}

.lyra-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.lyra-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% { 
    transform: translateY(0);
    opacity: 0.5;
  }
  30% { 
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* =========================================
   INPUT ZONE
   ========================================= */
#lyra-input-area {
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.6);
  border-top: 1px solid rgba(99, 102, 241, 0.2);
  display: flex;
  gap: 12px;
  align-items: center;
}

#lyra-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 24px;
  padding: 14px 20px;
  color: white;
  font-size: 14px;
  outline: none;
  transition: all 0.3s ease;
}

#lyra-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

#lyra-input:focus {
  border-color: var(--lyra-neon-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

#lyra-send {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lyra-primary), var(--lyra-secondary));
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

#lyra-send:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
}

#lyra-send:active {
  transform: scale(0.95);
}

#lyra-send svg {
  width: 20px;
  height: 20px;
}

/* =========================================
   POWERED BY
   ========================================= */
.lyra-powered {
  text-align: center;
  padding: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.2);
}

.lyra-powered a {
  color: rgba(99, 102, 241, 0.7);
  text-decoration: none;
}

.lyra-powered a:hover {
  color: var(--lyra-neon-cyan);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 640px) {
  #lyra-widget {
    bottom: 16px;
    right: 16px;
  }
  
  #lyra-trigger {
    width: 56px;
    height: 56px;
  }
  
  #lyra-container {
    bottom: 84px;
    right: 16px;
    left: 16px;
    width: auto;
    height: calc(100vh - 100px);
    max-height: none;
    border-radius: 20px;
  }
  
  #lyra-header {
    padding: 16px;
  }
  
  .lyra-avatar {
    width: 40px;
    height: 40px;
  }
  
  #lyra-messages {
    padding: 16px;
  }
  
  .lyra-message {
    max-width: 90%;
    padding: 12px 16px;
    font-size: 14px;
  }
  
  .lyra-quick-reply {
    padding: 8px 14px;
    font-size: 12px;
  }
  
  #lyra-input-area {
    padding: 12px 16px;
  }
  
  #lyra-input {
    padding: 12px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  #lyra-send {
    width: 44px;
    height: 44px;
  }
}

/* =========================================
   ANIMATIONS REDUCED MOTION
   ========================================= */
@media (prefers-reduced-motion: reduce) {
  #lyra-trigger,
  #lyra-container,
  .lyra-avatar,
  .lyra-message,
  .lyra-quick-reply,
  .lyra-typing span {
    animation: none !important;
    transition: none !important;
  }
  
  #lyra-container.active {
    opacity: 1;
    transform: none;
  }
}

/* =========================================
   DARK MODE (par défaut - le site est dark)
   ========================================= */
/* Les styles sont déjà optimisés pour dark mode */

/* =========================================
   PRINT (cacher le widget)
   ========================================= */
@media print {
  #lyra-widget {
    display: none !important;
  }
}
