/* ============================================================
   KATALIST — player.css
   Player bar, scrubber, waveform, artwork panel
   ============================================================ */

#player-bar {
  min-height: var(--player-height);
  background: var(--bg-surface); border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; align-content: center;
  padding: 8px 20px; column-gap: 16px; row-gap: 0;
  position: relative; z-index: 10; flex-shrink: 0;
}

/* Theme accent line */
#player-bar::before {
  content: '';
  position: absolute; top: -1px; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--waveform), transparent);
  opacity: 0.5;
}

/* Artwork */
.player-artwork-wrap { position: relative; cursor: pointer; flex-shrink: 0; }

.player-artwork {
  width: 48px; height: 48px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); overflow: hidden;
  border: 1px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease;
}
.player-artwork:hover { transform: scale(1.05); }
.player-artwork svg { width: 20px; height: 20px; fill: var(--text-muted); }
.player-artwork img { width: 100%; height: 100%; object-fit: cover; }

/* Artwork expand panel */
#artwork-panel {
  position: absolute; bottom: calc(var(--player-height) + 8px); left: 0;
  width: 280px; height: 280px;
  background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); overflow: hidden;
  display: none; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  z-index: 100; animation: panelIn 0.2s ease;
}
#artwork-panel.open { display: block; }

.artwork-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-overlay));
}
.artwork-placeholder svg { width: 64px; height: 64px; fill: var(--text-muted); }

/* Track info */
.player-info { min-width: 0; flex: 1; cursor: pointer; }
.player-song-title {
  font-family: var(--font-display); font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary);
}
.player-version-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Controls */
.player-controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

.ctrl-btn {
  width: 32px; height: 32px; border: none; background: none;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: all 0.1s ease;
}
.ctrl-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.ctrl-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  filter: drop-shadow(0 0 4px var(--accent));
}
.ctrl-btn svg { width: 16px; height: 16px; fill: currentColor; }

.ctrl-btn.play-pause {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--waveform));
  color: white; border-radius: 50%;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.ctrl-btn.play-pause:hover { filter: brightness(1.15); box-shadow: 0 4px 20px var(--accent-glow); }
.ctrl-btn.play-pause svg { width: 14px; height: 14px; }

/* Scrubber — full width, sits above controls */
.player-scrubber {
  order: -1; flex: 0 0 100%;
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  margin-bottom: 4px;
}

.scrubber-track {
  position: relative; height: 32px; cursor: pointer;
  border-radius: var(--radius-sm); background: var(--bg-elevated);
  overflow: hidden; border: 1px solid var(--border);
}
#waveform-canvas,
#np-waveform-canvas { width: 100%; height: 100%; display: block; }

.scrubber-progress {
  position: absolute; top: 0; left: 0; height: 100%;
  background: var(--accent-dim);
  pointer-events: none; width: 0%; transition: width 0.1s linear;
}

.scrubber-playhead {
  position: absolute; top: 0; width: 2px; height: 100%;
  background: var(--accent);
  pointer-events: none; left: 0%;
  box-shadow: 0 0 8px var(--accent-glow);
}

.scrubber-times {
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--text-muted); letter-spacing: 0.05em;
}

/* Volume */
.player-volume { display: flex; align-items: center; gap: 6px; flex: 1; justify-content: flex-end; }

.volume-slider {
  -webkit-appearance: none; width: 72px; height: 3px;
  background: var(--bg-elevated); border-radius: 2px; outline: none; cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 3px; height: 14px;
  border-radius: 2px; background: var(--accent); cursor: pointer;
}
.volume-slider::-moz-range-thumb {
  width: 3px; height: 14px; border: none;
  border-radius: 2px; background: var(--accent); cursor: pointer;
}

/* ── MOBILE PLAYER ─────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Single-row compact layout — override desktop flex-wrap and height */
  #player-bar {
    flex-wrap: nowrap;
    align-content: center;
    height: 64px;
    min-height: 64px;
    padding: 0 12px;
    gap: 10px;
    overflow: hidden;
  }

  /* Theme progress strip along the bottom edge of the player */
  #player-bar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    height: 2px; width: 100%;
    background: linear-gradient(
      90deg,
      var(--waveform) 0%,
      var(--accent) var(--mobile-progress, 0%),
      var(--bg-elevated) var(--mobile-progress, 0%)
    );
    pointer-events: none;
  }

  /* Hide desktop-only elements */
  .player-scrubber { display: none; }
  .player-volume   { display: none; }
  #btn-toggle-artwork { display: none; }

  /* Compact artwork */
  .player-artwork  { width: 40px; height: 40px; }

  /* Info fills remaining space */
  .player-info { flex: 1; }

  /* Tighter control buttons */
  .player-controls { gap: 4px; }
}
