/* ═══════════════════════════════════════════════
   PLAYLIST — Floating panel, terminal style
   ═══════════════════════════════════════════════ */

/* ── Toggle Button (top-right, below nav) ── */
.playlist-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  height: 44px;
  padding: 0 20px;
  border-radius: 100px;
  background: var(--color-surface);
  border: 1px solid var(--color-border-accent);
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(0, 255, 65, 0.1);
  transition:
    box-shadow var(--duration-normal),
    transform var(--duration-normal),
    background var(--duration-fast);
}

.playlist-toggle:hover {
  box-shadow: 0 0 36px rgba(0, 255, 65, 0.2);
  transform: scale(1.03);
}

.playlist-toggle.active {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.playlist-toggle__icon {
  font-size: 16px;
}

.playlist-toggle__label {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Pulse animation when playing */
.playlist-toggle.playing {
  animation: toggle-pulse 2s ease-in-out infinite;
}

@keyframes toggle-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(0, 255, 65, 0.1); }
  50% { box-shadow: 0 0 36px rgba(0, 255, 65, 0.3); }
}

/* ── Panel — slides in from right as sidebar ── */
.playlist-panel {
  position: fixed;
  top: var(--nav-height);
  right: 0;
  bottom: 0;
  z-index: 899;
  width: 340px;
  max-height: none;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-accent);
  border-radius: 0;
  border-left: 1px solid var(--color-border-accent);
  border-right: none;
  border-top: none;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
  transition:
    transform var(--duration-normal) var(--ease-out),
    opacity var(--duration-normal) var(--ease-out);
}

.playlist-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* ── Panel Header ── */
.playlist-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playlist-header__title {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--color-accent);
  text-transform: uppercase;
}

.playlist-header__title::before {
  content: '> ';
  opacity: 0.5;
}

.playlist-header__close {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--color-text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  transition: color var(--duration-fast);
}

.playlist-header__close:hover {
  color: var(--color-accent);
}

/* ── VPN Notice ── */
.playlist-notice {
  padding: var(--space-3) var(--space-4);
  background: rgba(255, 170, 0, 0.06);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-highlight);
  letter-spacing: 1px;
  line-height: 1.6;
}

/* ── Now Playing ── */
.playlist-now-playing {
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: none;
}

.playlist-now-playing.active {
  display: block;
}

.playlist-now-playing__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--color-text-muted);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

.playlist-now-playing__song {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--color-accent);
  letter-spacing: 1px;
}

.playlist-now-playing__artist {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Controls ── */
.playlist-controls {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
}

.playlist-controls.active {
  display: flex;
}

.playlist-btn {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  border-radius: 6px;
  transition: color var(--duration-fast), background var(--duration-fast);
  letter-spacing: 1px;
  min-width: 36px;
  text-align: center;
}

.playlist-btn:hover {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.playlist-btn.active {
  color: var(--color-accent);
}

.playlist-btn--play {
  font-size: 18px;
  color: var(--color-accent);
  border: 1px solid var(--color-border-accent);
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  min-width: 48px;
}

.playlist-btn--play:hover {
  background: var(--color-accent);
  color: var(--color-bg);
}

/* Loop button states */
.playlist-btn--loop {
  position: relative;
  font-size: 18px;
}

.playlist-btn--loop .loop-badge {
  position: absolute;
  top: 0;
  right: 0;
  font-size: 9px;
  font-weight: 600;
  color: var(--color-accent);
  line-height: 1;
}

/* ── Song List ── */
.playlist-songs {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.playlist-song {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.playlist-song:hover {
  background: var(--color-accent-subtle);
}

.playlist-song.active {
  background: var(--color-accent-subtle);
}

.playlist-song__num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text-muted);
  min-width: 24px;
}

.playlist-song.active .playlist-song__num {
  color: var(--color-accent);
}

.playlist-song__info {
  flex: 1;
  min-width: 0;
}

.playlist-song__title {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-text);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-song.active .playlist-song__title {
  color: var(--color-accent);
}

.playlist-song__artist {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  margin-top: 2px;
}

/* ── YouTube Player (hidden) ── */
#yt-player-wrap {
  position: fixed;
  bottom: -200px;
  left: -200px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .playlist-panel {
    right: 0;
    left: 0;
    width: 100%;
    max-width: none;
    bottom: 0;
    top: var(--nav-height);
    max-height: none;
  }

  .playlist-toggle {
    bottom: 16px;
    right: 16px;
    height: 40px;
    padding: 0 16px;
    font-size: 12px;
  }

  .playlist-toggle__icon {
    font-size: 14px;
  }

  .playlist-toggle__label {
    font-size: 10px;
  }

  .playlist-song__title {
    font-size: 13px;
  }

  .playlist-now-playing__song {
    font-size: 14px;
  }
}
