/* =================================================================
   MUSIC PLAYER WIDGET
================================================================= */

/* --- CONTAINER (fixed bottom-right) --------------------------- */
#music-player {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* --- COLLAPSED BAR -------------------------------------------- */
#player-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #F2F0EB;
  border: 1px solid rgba(189,151,78,0.25);
  border-radius: 22px;
  padding: 0 10px 0 16px;
  height: 44px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.2s ease;
}

#player-bar:hover {
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

/* --- EQUALIZER BARS ------------------------------------------- */
.eq-wrap {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 18px;
}

.eq-bar {
  display: block;
  width: 3px;
  background: #BD974E;
  border-radius: 2px;
  height: 4px;
}

@keyframes eq-pulse {
  0%, 100% { height: 4px; }
  50%       { height: 16px; }
}

#music-player.player--playing .eq-bar:nth-child(1) { animation: eq-pulse 0.80s ease-in-out infinite; }
#music-player.player--playing .eq-bar:nth-child(2) { animation: eq-pulse 0.65s ease-in-out infinite 0.12s; }
#music-player.player--playing .eq-bar:nth-child(3) { animation: eq-pulse 0.90s ease-in-out infinite 0.25s; }
#music-player.player--playing .eq-bar:nth-child(4) { animation: eq-pulse 0.72s ease-in-out infinite 0.05s; }

/* Bars freeze at rest height when not playing */
#music-player:not(.player--playing) .eq-bar {
  animation: none;
  height: 4px;
}

/* --- PLAY / PAUSE BUTTON -------------------------------------- */
#pp-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #BD974E;
  padding: 0;
  transition: opacity 0.2s ease;
}

#pp-btn:hover  { opacity: 0.7; }
#pp-btn:focus  { outline: none; }
#pp-btn:focus-visible { outline: none; }

.pp-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  transition: opacity 0.15s ease;
}

/* Default: show play, hide pause */
.pp-icon--play  { opacity: 1; }
.pp-icon--pause { opacity: 0; }

/* Playing: show pause, hide play */
#music-player.player--playing .pp-icon--play  { opacity: 0; }
#music-player.player--playing .pp-icon--pause { opacity: 1; }

/* --- EXPANDED PANEL ------------------------------------------- */
#player-panel {
  width: 240px;
  background: #F2F0EB;
  border: 1px solid rgba(189,151,78,0.22);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.13);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, margin-bottom 0.35s ease;
  pointer-events: none;
}

#music-player.player--open #player-panel {
  max-height: 420px;
  opacity: 1;
  margin-bottom: 8px;
  pointer-events: auto;
}

.player-panel-inner {
  padding: 16px 18px 14px;
}

/* Now Playing label */
.np-label {
  font-family: var(--serif);
  font-style: italic;
  font-size: 11px;
  color: #bbb;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

/* Current track title */
#np-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: #BD974E;
  margin-bottom: 14px;
  line-height: 1.3;
}

/* --- VOLUME ROW ----------------------------------------------- */
.vol-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.vol-label {
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #bbb;
  flex-shrink: 0;
}

/* Volume slider — cross-browser gold */
#vol-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 14px;
  background: transparent;
  cursor: pointer;
  outline: none;
  border: none;
  padding: 0;
  margin: 0;
}

#vol-slider::-webkit-slider-runnable-track {
  height: 3px;
  background: rgba(189,151,78,0.25);
  border-radius: 2px;
  cursor: pointer;
}

#vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #BD974E;
  margin-top: -5px;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

#vol-slider::-moz-range-track {
  height: 3px;
  background: rgba(189,151,78,0.25);
  border-radius: 2px;
  cursor: pointer;
  border: none;
}

#vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #BD974E;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

/* --- TRACK LIST ----------------------------------------------- */
.player-tracklist {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid rgba(189,151,78,0.15);
  padding-top: 10px;
}

.player-tracklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  cursor: pointer;
  font-family: var(--serif);
  font-size: 14px;
  color: #bbb;
  transition: color 0.2s ease;
  user-select: none;
}

.player-tracklist li:hover { color: #BD974E; }

.player-tracklist li.track--active {
  color: #BD974E;
  font-weight: 600;
}

.track-sparkle {
  font-size: 10px;
  color: #BD974E;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}

/* --- MOBILE --------------------------------------------------- */
@media (max-width: 480px) {
  #music-player {
    bottom: 14px;
    right: 14px;
  }

  #player-bar {
    height: 40px;
    padding: 0 8px 0 14px;
    gap: 12px;
  }

  #player-panel { width: 210px; }

  .player-panel-inner { padding: 14px 16px 12px; }
}
