/**
 * Widget Audio Compact - Styles
 * Extrait de aide-jeux.php pour utilisation sur toutes les pages
 */

/* === WIDGET AUDIO D&D === */
.music-player-container {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  right: calc(env(safe-area-inset-right, 0px) + 20px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  padding: 0;
  margin: 0;
}

/* Mode mobile - centré en bas */
@media (max-width: 768px) {
  .music-player-container {
    left: env(safe-area-inset-left, 10px);
    right: env(safe-area-inset-right, 10px);
    justify-content: center;
  }
}

.music-player {
  background: linear-gradient(135deg,
    rgba(15, 23, 42, 0.98) 0%,
    rgba(30, 41, 59, 0.98) 50%,
    rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 25px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 0 20px rgba(139, 92, 246, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: min(180px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 20px));
  max-width: 100%;
  margin: 0 auto;
}

.music-player:hover {
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(139, 92, 246, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transform: scale(1.02);
}

/* Indicateur de statut (note de musique verte) */
.music-status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e; /* Vert par défaut (en lecture) */
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

/* Animation de pulsation quand la musique joue */
.music-status-indicator::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: music-pulse 2s ease-in-out infinite;
}

@keyframes music-pulse {
  0%, 100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2);
  }
}

/* État en pause */
.music-status-indicator.paused {
  background: #6b7280; /* Gris */
  box-shadow: 0 0 6px rgba(107, 114, 128, 0.5);
}

.music-status-indicator.paused::before {
  animation: none; /* Pas d'animation en pause */
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.music-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(139, 92, 246, 0.8));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 12px rgba(139, 92, 246, 0.2);
  backdrop-filter: blur(10px);
}

.music-btn:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.music-btn:active {
  transform: scale(0.9);
}

.play-pause-btn {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(217, 119, 6, 0.9));
  box-shadow: 0 3px 15px rgba(245, 158, 11, 0.3);
}

.play-pause-btn:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 5px 25px rgba(245, 158, 11, 0.5);
}

.music-btn svg {
  width: 16px;
  height: 16px;
}

.play-pause-btn svg {
  width: 18px;
  height: 18px;
}

/* Règle .hidden spécifique pour les outils uniquement (ne pas affecter le header) */
.tool-card .hidden,
.music-player-container .hidden {
  display: none !important;
}

.music-volume-container {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-shrink: 0;
  padding: 6px 0 2px;
}

.volume-slider {
  flex: 1;
  width: 100%;
  height: 6px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.15);
  appearance: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.volume-slider:hover {
  background: rgba(255, 255, 255, 0.25);
}

.volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 3px 15px rgba(245, 158, 11, 0.5);
}

.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Status indicator - petit point lumineux */
.music-status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
  animation: musicPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

.music-status-indicator.paused {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  box-shadow: 0 0 4px rgba(107, 114, 128, 0.3);
  animation: none;
}

@keyframes musicPulse {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.2);
  }
}

/* === RESPONSIVE MOBILE === */
@media (max-width: 768px) {
  .music-player-container {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    left: env(safe-area-inset-left, 10px);
    right: env(safe-area-inset-right, 10px);
    top: auto;
    transform: none;
    z-index: 1000;
    justify-content: center;
  }

  .music-player {
    width: min(180px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
    padding: 14px;
    gap: 10px;
    border-radius: 20px;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
  }

  .music-controls {
    gap: 4px;
  }

  .music-volume-container {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0;
  }

  .music-btn {
    width: 28px;
    height: 28px;
  }

  .play-pause-btn {
    width: 34px;
    height: 34px;
  }

  .music-btn svg {
    width: 14px;
    height: 14px;
  }

  .play-pause-btn svg {
    width: 16px;
    height: 16px;
  }

  .volume-slider {
    flex: 1;
    width: auto;
  }
}

@media (max-width: 480px) {
  .music-player-container {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    left: env(safe-area-inset-left, 10px);
    right: env(safe-area-inset-right, 10px);
  }

  .music-player {
    width: min(160px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 20px));
    padding: 12px;
    gap: 8px;
  }

  .music-controls {
    gap: 3px;
  }

  .music-btn {
    width: 26px;
    height: 26px;
  }

  .play-pause-btn {
    width: 32px;
    height: 32px;
  }

  .volume-slider {
    flex: 1;
    width: auto;
  }

  .music-volume-container {
    gap: 4px;
    flex: 1 1 60%;
    min-width: 0;
    max-width: 60%;
  }

  .music-volume-container .volume-label,
  .music-volume-container .volume-text,
  .music-volume-container .volume-btn span {
    display: none !important;
  }
}

/* Animations fluides */
@keyframes musicPlayerFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.music-player-container {
  animation: musicPlayerFadeIn 0.6s ease-out;
}

/* === WIDGET AUDIO COMPACT UNIVERSEL === */
/* Widget audio compact pour toutes les plateformes */
.music-widget-compact {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  right: calc(env(safe-area-inset-right, 0px) + 16px);
  z-index: 1001;
  display: block;
}

/* État compact - juste bouton play/pause */
.music-compact-button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(15px);
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(139, 92, 246, 0.2);
  position: relative;
  overflow: hidden;
}

.music-compact-button:active {
  transform: scale(0.95);
}

.music-compact-button:hover {
  border-color: rgba(139, 92, 246, 0.6);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 0 25px rgba(139, 92, 246, 0.3);
}

/* Indicateur LED intégré */
.music-compact-button::before {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: musicPulse 2s ease-in-out infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.music-compact-button.playing::before {
  opacity: 1;
}

.music-compact-button.paused::before {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  box-shadow: 0 0 4px rgba(107, 114, 128, 0.4);
  animation: none;
  opacity: 0.7;
}

/* Emoji note de musique dans le bouton compact */
.music-note-emoji {
  font-size: 28px;
  line-height: 1;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
  user-select: none;
  display: block;
}

/* État étendu - contrôles complets */
.music-expanded-controls {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 240px;
  height: 130px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
  backdrop-filter: blur(15px);
  border: 1.5px solid rgba(139, 92, 246, 0.4);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 16px 20px 16px;
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(139, 92, 246, 0.2);
  transform: scale(0) translateX(25px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: bottom right;
}

.music-expanded-controls.visible {
  transform: scale(1) translateX(0);
  opacity: 1;
}

/* Masquer le bouton compact quand étendu */
.music-widget-compact.expanded .music-compact-button {
  opacity: 0;
  transform: scale(0);
}

/* Contrôles dans l'état étendu */
.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.music-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.8), rgba(139, 92, 246, 0.8));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.music-btn:active {
  transform: scale(0.9);
}

.music-btn:hover {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.music-btn svg {
  width: 28px;
  height: 28px;
  color: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* Toutes les icônes à la même taille que play/pause */
.music-btn.control-btn svg,
.music-btn.volume-btn svg {
  width: 28px;
  height: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* Bouton play/pause plus grand */
.music-btn.play-pause {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.music-btn.play-pause:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.5);
}

.music-btn.play-pause svg {
  width: 28px;
  height: 28px;
  color: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* Slider de volume */
.music-volume {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.music-volume-slider {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
  appearance: none;
  outline: none;
  cursor: pointer;
}

.music-volume-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

.music-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* Animation pour l'indicateur */
@keyframes musicPulse {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.6; 
    transform: scale(1.2);
  }
}

/* Masquer l'ancien widget desktop sur toutes les plateformes */
.music-player-container {
  display: none !important;
}
