/* ============================================================
    🎧 Harmonix — Player.css (v2.0.0) - NETTOYÉ
    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;
  /* Règle par défaut : CACHÉ sur desktop */
  display: none;
  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 CONSOLIDÉE */
  /* Cacher le visualiseur canvas sur mobile */
  .visualizer-circle canvas {
      display: none !important;
  }

  /* Afficher la mascotte sur mobile (sauf en mode fullscreen, géré plus bas) */
  .mascot-container {
      display: flex;
  }

  /* 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,
  .progress-container {
      display: none;
  }

  .player-center {
      flex: 0 0 auto;
      max-width: none;
      align-items: center;
  }

  .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 */
  #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 n'est plus nécessaire ici car ils sont déjà masqués dans la règle > 768px */
  /* Ces règles ont été fusionnées ci-dessus */

  /* 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;
  }
}

/* ============================================================
  🎧 MODE LECTEUR FULLSCREEN (MOBILE ONLY)
  ============================================================ */

@media (max-width: 768px) {

  .player-container.fullscreen {
      position: fixed;
      inset: 0;
      height: 100vh;
      background: var(--bg-surface);
      display: flex;
      flex-direction: column;
      padding: 20px;
      z-index: 9999;
      left: 0 !important;
  }

  /* Masquer tout le reste */
  .player-container.fullscreen~* {
      display: none !important;
  }

  .player-container.fullscreen .player {
      flex-direction: column;
      justify-content: center;
      align-items: center;
      height: 100%;
      gap: 28px;
      padding: 0;
  }

  .player-container.fullscreen .album-art,
  .player-container.fullscreen .visualizer-circle {
      width: 65vw;
      height: 65vw;
      max-width: 420px;
      max-height: 420px;
      margin-bottom: 12px;
  }

  /* Suppression du doublon : 'player-container.fullscreen .track-info' */
  .player-container.fullscreen .track-info {
      flex-direction: column;
  }

  /* Suppression du doublon : 'player-container.fullscreen .visualizer-circle canvas' */
  /* Il n'est pas nécessaire de cacher à nouveau le canvas ici,
     mais on le laisse pour être sûr qu'il n'y ait pas de conflit */
  .player-container.fullscreen .visualizer-circle canvas {
      display: none !important;
  }

  /* Suppression du doublon : 'player-container.fullscreen .mascot-container'
     La mascotte est déjà 'display: flex' sur mobile grâce à la règle mobile générale ci-dessus.
     Laisser cette règle si on veut s'assurer qu'elle soit affichée même si la règle mobile générale change. */
  .player-container.fullscreen .mascot-container {
      display: flex !important;
  }

  .player-container.fullscreen .track-details {
      text-align: center;
  }

  .player-container.fullscreen #track-title {
      font-size: 24px;
      font-weight: 600;
      margin-bottom: 4px;
  }

  .player-container.fullscreen #track-artist {
      font-size: 18px;
      color: var(--text-muted);
  }

  .player-container.fullscreen .progress-container {
      display: flex !important;
      width: 90%;
  }

  .player-container.fullscreen .player-controls {
      gap: 22px;
  }

    /* Cacher Shuffle et Repeat */
    .player-container.fullscreen #shuffle,
    .player-container.fullscreen #repeat-btn {
        display: flex;
    }

  .player-container.fullscreen .control-btn {
      width: 48px;
      height: 48px;
      font-size: 18px;
  }

  .player-container.fullscreen .play-btn {
      width: 60px;
      height: 60px;
      font-size: 22px;
  }

  .player-container.fullscreen .player-right {
      display: flex !important;
      justify-content: center;
      width: 100%;
  }
}