/* ============================================
   AMPLITUDEJS AUDIO PLAYER - DARK THEME
   Створити: assets/css/audio-player.css
   ============================================ */

/* Container */
.audio-portfolio {
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  padding: 4rem 0;
}

/* Playlist Selector Tabs */
.playlist-selector {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.1);
}

.btn-outline-gold {
  color: var(--accent-gold);
  border: 2px solid var(--accent-gold);
  background: transparent;
  padding: 0.5rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all var(--duration-normal) var(--transition-smooth);
}

.btn-outline-gold:hover,
.btn-outline-gold.active {
  background: var(--accent-gold);
  color: var(--bg-primary);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Main Player Card */
.audio-player-card {
  background: linear-gradient(135deg, rgba(30, 30, 30, 0.9), rgba(18, 18, 18, 0.9));
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
}

/* Player Header (Artwork + Info) */
.player-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.player-artwork {
  width: 140px;
  height: 140px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  transition: transform var(--duration-slow) var(--transition-smooth);
}

.audio-player-card:hover .player-artwork {
  transform: scale(1.05) rotate(2deg);
}

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

.track-name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 1rem;
  color: var(--accent-gold);
  margin: 0;
}

/* Progress Bar - Input Range Slider */
.amplitude-song-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  transition: height 0.2s;
}

.amplitude-song-slider:hover {
  height: 8px;
}

/* Track (progress filled part) */
.amplitude-song-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: #D4AF37;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
  transition: transform 0.2s;
}

.amplitude-song-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.amplitude-song-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: #D4AF37;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
  transition: transform 0.2s;
}

.amplitude-song-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
}

/* Track styling for filled portion */
.amplitude-song-slider::-webkit-slider-runnable-track {
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #D4AF37 0%, #D4AF37 var(--amplitude-song-played-progress, 0%), rgba(255, 255, 255, 0.1) var(--amplitude-song-played-progress, 0%), rgba(255, 255, 255, 0.1) 100%);
  border-radius: 3px;
}

.amplitude-song-slider::-moz-range-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.amplitude-song-slider::-moz-range-progress {
  height: 6px;
  background: #D4AF37;
  border-radius: 3px;
}

/* Time Display */
.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-family: 'Courier New', monospace;
  margin-top: 0.5rem;
}

/* Playback Controls */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.control-btn {
  background: transparent;
  border: 2px solid rgba(212, 175, 55, 0.3);
  color: var(--text-primary);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--transition-smooth);
  font-size: 1.25rem;
}

/* Bootstrap Icons inside control buttons */
.control-btn i {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
}

.control-btn:hover {
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: scale(1.1);
  background: rgba(212, 175, 55, 0.1);
}

/* Main Play/Pause Button */
.control-btn-main {
  width: 64px;
  height: 64px;
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: var(--bg-primary);
  font-size: 1.75rem;
}

.control-btn-main i {
  font-size: 1.75rem;
}

.control-btn-main:hover {
  background: #c49d2f;
  border-color: #c49d2f;
  color: var(--bg-primary);
  box-shadow: var(--shadow-lg);
}

/* Icon visibility toggles */
.amplitude-playing .amplitude-paused {
  display: none;
}

.amplitude-paused .amplitude-playing {
  display: none;
}

.amplitude-muted .amplitude-not-muted {
  display: none;
}

.amplitude-not-muted .amplitude-muted {
  display: none;
}

/* Ensure icon spans are visible */
.amplitude-playing,
.amplitude-paused,
.amplitude-muted,
.amplitude-not-muted {
  display: inline-block;
  line-height: 1;
}

/* Volume Control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.amplitude-volume-slider-container {
  flex: 1;
  max-width: 200px;
}

.amplitude-volume-slider {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.amplitude-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
  transition: all var(--duration-fast);
}

.amplitude-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.8);
}

.amplitude-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--accent-gold);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.5);
}

/* Playlist Card */
.audio-playlist-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(212, 175, 55, 0.1);
  border-radius: 16px;
  padding: 2rem;
  max-height: 600px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}

/* Custom Scrollbar */
.audio-playlist-card::-webkit-scrollbar {
  width: 8px;
}

.audio-playlist-card::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

.audio-playlist-card::-webkit-scrollbar-thumb {
  background: var(--accent-gold);
  border-radius: 4px;
}

.audio-playlist-card::-webkit-scrollbar-thumb:hover {
  background: #c49d2f;
}

.playlist-title {
  font-family: var(--font-display);
  color: var(--accent-gold);
  font-size: 1.5rem;
  font-weight: 700;
  border-bottom: 2px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

/* Playlist Track Items */
.amplitude-song-container {
  cursor: pointer;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  transition: all var(--duration-fast) var(--transition-smooth);
}

.amplitude-song-container:hover {
  background: rgba(212, 175, 55, 0.1);
}

.amplitude-active-song-container {
  background: rgba(212, 175, 55, 0.15);
  border-left: 3px solid var(--accent-gold);
}

.track-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}

.song-number {
  font-family: 'Courier New', monospace;
  color: var(--accent-gold);
  font-size: 1.25rem;
  font-weight: 700;
  min-width: 40px;
  text-align: center;
}

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

.song-title {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.song-artist {
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
}

.song-duration {
  font-family: 'Courier New', monospace;
}

.song-play-icon {
  color: var(--accent-gold);
  font-size: 1.25rem;
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.song-play-icon i {
  display: inline-block;
  font-size: 1.25rem;
  line-height: 1;
}

.amplitude-song-container:hover .song-play-icon,
.amplitude-active-song-container .song-play-icon {
  opacity: 1;
}

.amplitude-active-song-container .song-play-icon {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 991px) {
  .audio-player-card {
    margin-bottom: 2rem;
  }
}

@media (max-width: 768px) {
  .audio-player-card {
    padding: 2rem 1.5rem;
  }
  
  .player-header {
    flex-direction: column;
    text-align: center;
  }
  
  .player-artwork {
    width: 180px;
    height: 180px;
  }
  
  .track-name {
    font-size: 1.25rem;
    white-space: normal;
  }
  
  .player-controls {
    gap: 0.75rem;
  }
  
  .control-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }
  
  .control-btn-main {
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }
  
  .volume-control {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .amplitude-volume-slider-container {
    max-width: 100%;
    width: 100%;
  }
}

@media (max-width: 576px) {
  .player-artwork {
    width: 150px;
    height: 150px;
  }

  .track-name {
    font-size: 1.1rem;
  }

  .playlist-selector {
    gap: 0.35rem;
  }

  .btn-outline-gold {
    padding: 0.4rem 1rem;
    font-size: 0.75rem;
  }

  .audio-playlist-card {
    padding: 1.5rem;
    max-height: 400px;
  }
}

/* ============================================
 WAVEFORM VISUALIZER (CSS Animation) - FIXED
 File: assets/css/audio-player.css
 ============================================ */

.amplitude-wave-form {
 height: 60px;
 display: flex !important;
 align-items: center !important;
 justify-content: center !important;
 gap: 3px;
 padding: 0 10px;
 background: rgba(30, 30, 30, 0.5);
 border-radius: 8px;
 margin-bottom: 1.5rem;
 border: 1px solid rgba(255, 255, 255, 0.05);
 overflow-x: auto; /* Allow horizontal scrolling if needed */
 min-width: 100%; /* Ensure container takes full width available */
 max-width: 100%; /* But don't exceed parent */
 box-sizing: border-box; /* Include padding in width calculation */
}

.wave-bar {
 display: block;
 width: 10px;
 height: 15px;
 background: #D4AF37;
 border-radius: 2px;
 opacity: 0.5;
 transition: all 0.2s ease;

 /* CRITICAL FIXES for flexbox collapse */
 flex-shrink: 0 !important;
 flex-grow: 0 !important;
 flex-basis: 10px !important; /* Explicit width that won't collapse */
 min-width: 10px !important; /* Fallback for older browsers */

 /* Performance optimization */
 transform: translateZ(0);
 will-change: transform, height, opacity;
}

/* Animation when playing - FIXED SELECTOR */
.amplitude-playing .wave-bar {
 animation: wave-animation 1.2s infinite ease-in-out;
 opacity: 1;
}

/* Staggered animation speeds */
.amplitude-playing .wave-bar:nth-child(odd) {
 animation-duration: 0.8s;
}
.amplitude-playing .wave-bar:nth-child(2n) {
 animation-duration: 1.1s;
}
.amplitude-playing .wave-bar:nth-child(3n) {
 animation-duration: 1.3s;
}
.amplitude-playing .wave-bar:nth-child(4n) {
 animation-duration: 0.9s;
}
.amplitude-playing .wave-bar:nth-child(5n) {
 animation-duration: 1.0s;
}

/* FIXED: Keyframes with explicit pixel values */
@keyframes wave-animation {
 0%, 100% {
   height: 15px;
   transform: scaleY(1);
   opacity: 0.7;
 }
 50% {
   height: 45px;
   transform: scaleY(1.1);
   opacity: 1;
   box-shadow: 0 0 12px rgba(212, 175, 55, 0.9);
 }
}

/* Ensure bars are visible even if animation doesn't load */
.amplitude-wave-form:not(.amplitude-playing) .wave-bar {
 height: 15px !important;
 opacity: 0.5 !important;
}

/* Fallback for very small screens */
@media (max-width: 320px) {
 .wave-bar {
   width: 2px !important;
   min-width: 2px !important;
   flex-basis: 2px !important;
 }
 .amplitude-wave-form {
   gap: 1px !important;
   height: 40px !important;
 }
}
