/* ============================================================
   🎧 Harmonix — Player.css (v2.0.0)
   Lecteur audio avec visualizer et mascotte dansante
   ============================================================ */

/* --- DÉFINITION DE L'ANIMATION DE DANSE (CSP Friendly) --- */
@keyframes dance-move {
  0% {
    transform: translateY(0) rotate(0deg);
  }

  25% {
    transform: translateY(-3px) rotate(-1deg);
  }

  75% {
    transform: translateY(3px) rotate(1deg);
  }

  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes mascot-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

/* --- STYLES MASCOTTE --- */
.mascot-container {
  position: absolute;
  inset: 0;
  display: none;
  /* CACHÉ par défaut sur desktop */
  align-items: center;
  justify-content: center;
}

.dancing-mascot {
  width: 80%;
  height: 80%;
  transition: transform var(--transition);
}

/* Appliquer la danse uniquement quand la musique joue (classe 'is-dancing' ajoutée par JS) */
.mascot-container.is-dancing .dancing-mascot {
  animation: dance-move 0.5s ease-in-out infinite alternate, mascot-pulse 2s infinite;
}

/* FIN STYLES MASCOTTE */


/* --- STRUCTURE GÉNÉRALE (Desktop Default) --- */
.player-container {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--player-height);
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 100;
}

.player {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
}

/* Track info avec visualizer */
.track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 250px;
  min-width: 0;
}

.album-art {
  width: 60px;
  height: 60px;
  position: relative;
  flex-shrink: 0;
}

.visualizer-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: var(--bg-elevated);
}

.visualizer-circle canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* Visible par défaut sur desktop */
}

.golden-border {
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold);
  border-radius: 50%;
  pointer-events: none;
}

.track-details {
  min-width: 0;
  flex: 1;
}

.track-details h4 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-details p {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Player center controls */
.player-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 600px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.control-btn {
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
  position: relative;
}

.control-btn:hover {
  color: var(--text);
}

.play-btn {
  width: 40px;
  height: 40px;
  background: var(--text);
  color: var(--bg-dark);
}

.play-btn:hover {
  transform: scale(1.05);
}

/* Repeat badge */
.repeat-badge {
  display: none;
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--gold);
  color: var(--bg-dark);
  font-size: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Progress */
.progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-display {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: center;
}

#progress-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  transition: transform var(--transition);
}

#progress-bar::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#progress-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}

/* Volume */
.player-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 140px;
}

#volume-bar {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
}

#volume-bar::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: none;
}

/* --- ADAPTATION MOBILE (<= 768px) --- */
@media (max-width: 768px) {

  /* GESTION MASCOTTE/VISUALISEUR */
  .visualizer-circle canvas {
    display: none !important;
    /* Cacher le visualiseur canvas */
  }

  .mascot-container {
    display: flex !important;
    /* Afficher la mascotte */
  }

  /* FIN GESTION MASCOTTE/VISUALISEUR */

  /* Vos règles responsives */
  .player-container {
    left: 0;
  }

  .player {
    padding: 0 16px;
    gap: 16px;
    justify-content: space-between;
  }

  .track-info {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .player-right {
    display: none;
  }

  .player-center {
    flex: 0 0 auto;
    max-width: none;
    align-items: center;
    /* Changé de flex-end à center pour centrer le bloc de contrôle */
  }

  .progress-container {
    display: none;
  }

  .player-controls {
    gap: 8px;
    justify-content: flex-end;
  }

  .control-btn {
    width: 32px;
    height: 32px;
  }

  .play-btn {
    width: 38px;
    height: 38px;
  }

  .album-art,
  .visualizer-circle {
    width: 50px;
    height: 50px;
  }

  /* Cacher Shuffle et Repeat (Précédent/Suivant/Play restent) */
  #shuffle,
  #repeat-btn {
    display: none;
  }

}

/* Écran extra-petit (pour les téléphones très serrés) */
@media (max-width: 480px) {

  /* Masquer shuffle et repeat pour une expérience encore plus épurée */
  #shuffle,
  #repeat-btn {
    display: none !important;
  }

  /* Réduire encore l'album art si nécessaire (optionnel) */
  .album-art,
  .visualizer-circle {
    width: 40px;
    height: 40px;
  }

  /* Réduire la taille de la police pour le titre/artiste */
  .track-details h4 {
    font-size: 13px;
  }

  .track-details p {
    font-size: 12px;
  }
}