/**
 * Music Fanatix — player.css
 * Fire-gradient WaveSurfer player, animated EQ bars, download buttons
 * Loaded conditionally on album single + mixes pages only.
 */

/* ============================================================
   TRACK ROW ENHANCEMENTS
   ============================================================ */

/* Updated grid: num | play | title | duration | download */
.track-row {
  grid-template-columns: 2rem 2.2rem 1fr auto auto;
}

/* Track play button — fire glow when active */
.track-row.active .track-play-btn {
  background: linear-gradient(135deg, #c8a84b, #e63946);
  color: #0a0a0f;
  border-color: transparent;
  box-shadow: 0 0 14px rgba(230,57,70,0.5);
  animation: btnPulse 1.8s ease-in-out infinite;
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 10px rgba(230,57,70,0.4); }
  50%      { box-shadow: 0 0 22px rgba(230,57,70,0.7), 0 0 6px rgba(200,168,75,0.4); }
}

.track-play-btn--disabled {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  color: var(--clr-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Tracklist header row */
.tracklist-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.tracklist-hint {
  font-size: 0.72rem;
  color: var(--clr-muted);
  letter-spacing: 0.06em;
}

/* ---- Share button — per track row ---- */
.track-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(230,57,70,0.2);
  background: rgba(230,57,70,0.05);
  color: var(--clr-muted);
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
  cursor: pointer;
}
.track-share-btn:hover {
  color: var(--clr-accent2);
  border-color: var(--clr-accent2);
  background: rgba(230,57,70,0.14);
  transform: translateY(-2px);
}
.track-share-btn svg { pointer-events: none; }

/* ---- Download button — per track row ---- */
.track-download-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(200,168,75,0.2);
  background: rgba(200,168,75,0.06);
  color: var(--clr-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s, background 0.2s, transform 0.15s;
  cursor: pointer;
}
.track-download-btn:hover {
  color: var(--clr-accent);
  border-color: var(--clr-accent);
  background: rgba(200,168,75,0.14);
  transform: translateY(-2px);
}
.track-download-btn svg { pointer-events: none; }

/* ---- Share button — WaveSurfer player bar ---- */
.ws-share-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(230,57,70,0.3);
  background: rgba(230,57,70,0.07);
  color: var(--clr-accent2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.ws-share-btn:hover {
  background: rgba(230,57,70,0.18);
  border-color: var(--clr-accent2);
  transform: translateY(-2px);
}
.ws-share-btn svg { flex-shrink: 0; }

/* ============================================================
   WAVESURFER PLAYER BAR — fixed bottom
   ============================================================ */
.ws-player-bar {
  padding: 0.7rem 0;
  transition: box-shadow 0.4s;
}

/* Glowing border when playing */
.ws-player-bar.is-playing {
  box-shadow:
    0 -1px 0 rgba(200,168,75,0.35),
    0 -4px 30px rgba(230,57,70,0.15);
  animation: barGlow 2.5s ease-in-out infinite alternate;
}
@keyframes barGlow {
  from { box-shadow: 0 -1px 0 rgba(200,168,75,0.25), 0 -4px 20px rgba(230,57,70,0.10); }
  to   { box-shadow: 0 -1px 0 rgba(200,168,75,0.50), 0 -4px 40px rgba(230,57,70,0.25); }
}

/* Layout */
.ws-player-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.25rem;
  align-items: center;
}

.ws-waveform-col { min-width: 0; }

/* WaveSurfer canvas */
#waveform wave       { border-radius: 3px; overflow: hidden; }
#waveform canvas     { display: block; }

/* Controls cluster */
.ws-controls {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-shrink: 0;
}

/* Play/Pause button */
#wsPlayPause {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #c8a84b 0%, #e8b94f 45%, #e63946 100%);
  color: #0a0a0f;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(230,57,70,0.35);
  transition: transform 0.15s, box-shadow 0.2s;
}
#wsPlayPause:hover {
  transform: scale(1.1);
  box-shadow: 0 0 30px rgba(230,57,70,0.55);
}
#wsPlayPause.playing {
  animation: playBtnPulse 1.8s ease-in-out infinite;
}
@keyframes playBtnPulse {
  0%,100% { box-shadow: 0 0 14px rgba(230,57,70,0.35); }
  50%      { box-shadow: 0 0 32px rgba(230,57,70,0.65), 0 0 8px rgba(200,168,75,0.4); }
}

/* Loading indicator */
.ws-loading {
  font-size: 0.55rem;
  letter-spacing: 2px;
  animation: loadingDots 0.9s ease-in-out infinite;
}
@keyframes loadingDots {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

/* ============================================================
   ANIMATED EQ BARS — inside player bar + mix cards
   ============================================================ */
.ws-eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 26px;
  flex-shrink: 0;
}

.ws-eq-bars span {
  display: block;
  width: 4px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(to top, #e63946 0%, #ff8800 50%, #c8a84b 100%);
  /* Idle state — short bars */
  height: 4px;
  opacity: 0.35;
  transition: height 0.1s, opacity 0.3s;
}

/* When audio is playing — bars dance */
.ws-eq-bars.eq-active span {
  opacity: 1;
  animation: eqDance ease-in-out infinite alternate;
}

.ws-eq-bars.eq-active span:nth-child(1) { animation-name: eqDance; animation-duration: 0.55s; animation-delay: 0.00s; }
.ws-eq-bars.eq-active span:nth-child(2) { animation-name: eqDance; animation-duration: 0.40s; animation-delay: 0.08s; }
.ws-eq-bars.eq-active span:nth-child(3) { animation-name: eqDance; animation-duration: 0.65s; animation-delay: 0.04s; }
.ws-eq-bars.eq-active span:nth-child(4) { animation-name: eqDance; animation-duration: 0.45s; animation-delay: 0.12s; }
.ws-eq-bars.eq-active span:nth-child(5) { animation-name: eqDance; animation-duration: 0.58s; animation-delay: 0.06s; }

@keyframes eqDance {
  0%   { height: 4px;  }
  30%  { height: 20px; }
  60%  { height: 10px; }
  100% { height: 24px; }
}

/* Smaller variant for mix cards */
.ws-eq-bars--small {
  height: 20px;
}
.ws-eq-bars--small span { width: 3px; }
.ws-eq-bars--small.eq-active span:nth-child(1) { animation-duration: 0.52s; }
.ws-eq-bars--small.eq-active span:nth-child(2) { animation-duration: 0.38s; }
.ws-eq-bars--small.eq-active span:nth-child(3) { animation-duration: 0.62s; }
.ws-eq-bars--small.eq-active span:nth-child(4) { animation-duration: 0.43s; }
.ws-eq-bars--small.eq-active span:nth-child(5) { animation-duration: 0.55s; }
@keyframes eqDanceSmall {
  0%   { height: 3px;  }
  30%  { height: 15px; }
  60%  { height: 8px;  }
  100% { height: 18px; }
}
.ws-eq-bars--small.eq-active span { animation-name: eqDanceSmall !important; }

/* ============================================================
   TRACK INFO
   ============================================================ */
.ws-track-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

#wsCurrentTrack {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f0eee8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

#wsTime {
  font-size: 0.7rem;
  color: #888;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* ============================================================
   DOWNLOAD BUTTON — in player bar
   ============================================================ */
.ws-download-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(200,168,75,0.3);
  background: rgba(200,168,75,0.08);
  color: var(--clr-accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.ws-download-btn:hover {
  background: rgba(200,168,75,0.18);
  border-color: var(--clr-accent);
  transform: translateY(-2px);
}
.ws-download-btn svg { flex-shrink: 0; }

/* ---- Mix download button ---- */
.mix-download-btn {
  display: inline-flex;
  align-items: center;
  align-self: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 0.4rem;
  border: 1px solid rgba(200,168,75,0.25);
  background: rgba(200,168,75,0.07);
  color: var(--clr-accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.mix-download-btn:hover {
  background: rgba(200,168,75,0.16);
  border-color: var(--clr-accent);
  transform: translateY(-2px);
}

/* ============================================================
   MIX CARD — artwork / featured image
   ============================================================ */
.mix-card-artwork {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
  margin-bottom: 0;
  border: none;
  background: var(--clr-card);
}
.mix-artwork-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}
.mix-card:hover .mix-artwork-img {
  transform: scale(1.04);
}

/* ============================================================
   MIX CARD — waveform
   ============================================================ */
.mix-waveform-container wave { border-radius: 4px; overflow: hidden; }

/* Shimmer while loading */
.mix-waveform-container:empty {
  height: 52px;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mix controls row update — add download to flex */
.mix-controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
  .ws-player-inner { grid-template-columns: 1fr; gap: 0.75rem; }
  .ws-controls     { justify-content: center; flex-wrap: wrap; }
  #wsCurrentTrack  { max-width: 160px; }
  .ws-download-btn span { display: none; }  /* icon only on mobile */
  .ws-download-btn { padding: 0.5rem; }
  .ws-share-btn span { display: none; }
  .ws-share-btn { padding: 0.5rem; }
  .track-row       { grid-template-columns: 1.5rem 2rem 1fr auto; }
  .track-duration  { display: none; }
}
