/* ========================================
   Music Player - Persistent across pages
   ======================================== */

.music-player {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  width: 320px;
  background: linear-gradient(135deg, rgba(40, 0, 70, 0.95), rgba(15, 0, 30, 0.95));
  border: 1px solid rgba(255, 138, 255, 0.3);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(231, 84, 255, 0.3);
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: all 0.3s ease, width 0.3s ease, height 0.3s ease;
  max-height: 220px;
  overflow: hidden;
}

/* Collapsed State */
.music-player.collapsed {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(231, 84, 255, 0.4);
}

.music-player.collapsed .player-track-info,
.music-player.collapsed .player-progress-container,
.music-player.collapsed .player-controls,
.music-player.collapsed .player-volume {
  display: none;
}

.music-player.collapsed::before {
  content: "♫";
  font-size: 24px;
  color: #ff8aff;
  text-shadow: 0 0 12px #ff8aff;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.player-track-info {
  margin-bottom: 12px;
  text-align: center;
  overflow: hidden;
}

.player-song-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #ff9cff;
  text-shadow: 0 0 6px #ff7aff60;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: truncate 8s linear infinite;
}

/* Progress Bar */
.player-progress-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.7rem;
  color: rgba(255, 138, 255, 0.6);
}

.player-progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 138, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  overflow: visible;
  position: relative;
}

.player-progress {
  height: 100%;
  background: linear-gradient(90deg, #ff8aff, #e754ff);
  width: 0%;
  border-radius: 3px;
  box-shadow: 0 0 8px #ff8aff;
  transition: width 0.05s linear;
  position: relative;
}

/* Progress Slider Handle */
.player-progress::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: #ff8aff;
  border-radius: 50%;
  box-shadow: 0 0 8px #ff8aff, 0 0 16px rgba(255, 138, 255, 0.6);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.player-progress-bar:hover .player-progress::after {
  opacity: 1;
}

/* Controls */
.player-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.player-btn {
  background: rgba(255, 138, 255, 0.1);
  border: 1px solid rgba(255, 138, 255, 0.3);
  border-radius: 8px;
  color: #ff8aff;
  cursor: pointer;
  padding: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.player-btn:hover {
  background: rgba(255, 138, 255, 0.2);
  box-shadow: 0 0 12px rgba(255, 138, 255, 0.4);
  transform: scale(1.05);
}

.player-btn.active {
  background: rgba(231, 84, 255, 0.3);
  border-color: #e754ff;
  box-shadow: 0 0 12px rgba(231, 84, 255, 0.5);
}

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

.player-play-btn {
  width: 40px;
  height: 40px;
  background: rgba(231, 84, 255, 0.2);
  border-color: #e754ff;
}

/* Loop button indicator dot for loop-one mode */
.player-loop-btn[data-mode="2"]::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  background: #ff8aff;
  border-radius: 50%;
  box-shadow: 0 0 4px #ff8aff;
}

.player-play-btn:hover {
  background: rgba(231, 84, 255, 0.3);
  box-shadow: 0 0 16px rgba(231, 84, 255, 0.6);
}

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

.player-pause-icon.hidden,
.player-play-icon.hidden {
  display: none;
}

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

.player-volume-icon {
  width: 16px;
  height: 16px;
  color: #ff8aff;
  flex-shrink: 0;
}

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

.player-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #ff8aff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px #ff8aff;
}

.player-volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #ff8aff;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px #ff8aff;
}

.player-volume-slider::-moz-range-track {
  background: transparent;
  border: none;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .music-player {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    border-radius: 16px 16px 0 0;
    padding: 12px;
    max-height: 140px;
    overflow: hidden;
    animation: slideUpMobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .music-player.collapsed {
    width: 56px;
    height: 56px;
    bottom: 16px;
    right: 16px;
    left: auto;
    border-radius: 50%;
    padding: 0;
  }

  @keyframes slideUpMobile {
    from {
      opacity: 0;
      transform: translateY(200px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .player-track-info {
    margin-bottom: 8px;
  }

  .player-song-title {
    font-size: 0.85rem;
  }

  .player-progress-container {
    margin-bottom: 8px;
    gap: 4px;
  }

  .player-controls {
    gap: 6px;
    margin-bottom: 8px;
  }

  .player-btn {
    width: 28px;
    height: 28px;
    padding: 4px;
  }

  .player-play-btn {
    width: 36px;
    height: 36px;
  }

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

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

  .player-volume {
    gap: 6px;
  }

  .player-volume-icon {
    width: 14px;
    height: 14px;
  }
}

@media (max-width: 480px) {
  .music-player {
    padding: 10px;
  }

  .player-controls {
    gap: 4px;
  }

  .player-btn {
    width: 24px;
    height: 24px;
    padding: 3px;
  }

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

  .player-btn svg {
    width: 12px;
    height: 12px;
  }

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

  .player-song-title {
    font-size: 0.75rem;
  }

  .player-progress-container {
    font-size: 0.65rem;
  }
}

/* Playing State Animation */
.music-player.playing {
  animation: playingPulse 1.5s ease-in-out infinite;
}

.music-player.playing::before {
  animation: float 3s ease-in-out infinite, playingPulseNote 1.5s ease-in-out infinite;
}

.music-player.playing::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(255, 138, 255, 0.1), transparent);
  animation: playingRing 1.5s ease-out infinite;
  pointer-events: none;
}

@keyframes playingPulse {
  0%, 100% {
    box-shadow: 0 8px 32px rgba(231, 84, 255, 0.3),
                inset 0 0 20px rgba(255, 138, 255, 0.05);
  }
  50% {
    box-shadow: 0 8px 32px rgba(231, 84, 255, 0.6),
                inset 0 0 20px rgba(255, 138, 255, 0.15);
  }
}

@keyframes playingPulseNote {
  0%, 100% {
    text-shadow: 0 0 12px #ff8aff;
    filter: drop-shadow(0 0 2px #ff8aff);
  }
  50% {
    text-shadow: 0 0 20px #ff8aff, 0 0 30px #e754ff;
    filter: drop-shadow(0 0 4px #e754ff);
  }
}

@keyframes playingRing {
  0% {
    border: 1px solid rgba(255, 138, 255, 0.6);
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    border: 1px solid rgba(255, 138, 255, 0);
    transform: translate(-50%, -50%) scale(1.4);
    opacity: 0;
  }
}

/* Collapsed player playing animation */
.music-player.collapsed.playing::after {
  display: none;
}

.music-player.collapsed.playing {
  animation: playingPulse 1.5s ease-in-out infinite, slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Hidden utility */
.hidden {
  display: none !important;
}
