/* ═══════════════════════════════════════════════════════════════
   STREAMIFY - Spotify-Inspired Green & Black Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
  /* Brand Colors */
  --green:          #1DB954;
  --green-bright:   #1ed760;
  --green-dark:     #158a3e;
  --green-muted:    #1aa34a;

  /* Backgrounds */
  --bg-base:        #121212;
  --bg-elevated:    #1a1a1a;
  --bg-highlight:   #242424;
  --bg-press:       #2a2a2a;
  --bg-sidebar:     #000000;
  --bg-player:      #181818;
  --bg-card:        #282828;
  --bg-card-hover:  #2e2e2e;

  /* Text */
  --text-primary:   #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted:     #6a6a6a;
  --text-on-green:  #000000;

  /* Borders */
  --border:         rgba(255,255,255,0.1);
  --border-subtle:  rgba(255,255,255,0.05);

  /* Sizing */
  --sidebar-width:  240px;
  --queue-width:    300px;
  --player-height:  90px;
  --topbar-height:  64px;
  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-full:    9999px;

  /* Transitions */
  --transition:     0.2s ease;
  --transition-slow: 0.35s ease;
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }
img { display: block; }
svg { display: block; flex-shrink: 0; }

/* ── App Layout ────────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: 1fr;
  height: calc(100vh - var(--player-height));
  overflow: hidden;
  transition: grid-template-columns var(--transition-slow);
}

#app.queue-open {
  grid-template-columns: var(--sidebar-width) 1fr var(--queue-width);
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-highlight) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--bg-highlight); border-radius: 2px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 24px 16px;
}

.logo-icon { width: 40px; height: 40px; flex-shrink: 0; }

.logo-text {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  transition: color var(--transition), background var(--transition);
}

.nav-item svg { width: 24px; height: 24px; }

.nav-item:hover { color: var(--text-primary); background: var(--bg-highlight); }
.nav-item.active { color: var(--text-primary); }

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 16px 24px;
}

.sidebar-section { padding: 0 8px; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.playlist-list { display: flex; flex-direction: column; gap: 2px; }

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-item:hover { color: var(--text-primary); background: var(--bg-highlight); }
.playlist-item.active { color: var(--text-primary); }

.playlist-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.playlist-item-icon svg { width: 16px; height: 16px; color: var(--text-secondary); }
.playlist-item-icon.liked { background: linear-gradient(135deg, #450af5, #c4efd9); }
.playlist-item-icon.liked svg { color: white; }

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, #1a2a1a 0%, var(--bg-base) 300px);
}

/* ── Topbar ────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  height: var(--topbar-height);
  background: rgba(18,18,18,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.topbar-nav { display: flex; gap: 8px; }

.nav-arrow {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-arrow svg { width: 20px; height: 20px; }
.nav-arrow:hover { background: var(--bg-highlight); }

/* ── Search Bar ────────────────────────────────────────────────── */
.search-container { flex: 1; max-width: 480px; }

.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition);
}

.search-input {
  width: 100%;
  height: 40px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0 40px 0 44px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--text-primary);
  background: var(--bg-highlight);
}

.search-input:focus + .search-icon,
.search-input-wrap:focus-within .search-icon { color: var(--text-primary); }

.search-clear {
  position: absolute;
  right: 10px;
  width: 24px;
  height: 24px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity var(--transition);
}

.search-clear svg { width: 18px; height: 18px; }
.search-clear.visible { opacity: 1; }
.search-clear:hover { color: var(--text-primary); }

.topbar-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Views ─────────────────────────────────────────────────────── */
.view {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-highlight) transparent;
}

.view::-webkit-scrollbar { width: 6px; }
.view::-webkit-scrollbar-track { background: transparent; }
.view::-webkit-scrollbar-thumb { background: var(--bg-highlight); border-radius: 3px; }

.view.hidden { display: none; }

.view-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 24px;
}

.view-header h1, .view-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.results-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* ── Home View ─────────────────────────────────────────────────── */
.greeting { font-size: 2rem; font-weight: 800; }

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.home-cta { display: flex; justify-content: center; padding: 40px 0; }

.cta-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.cta-icon { font-size: 3rem; margin-bottom: 16px; }
.cta-card h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 8px; }
.cta-card p { color: var(--text-secondary); font-size: 0.875rem; margin-bottom: 24px; }

/* ── Track List ────────────────────────────────────────────────── */
.track-list { display: flex; flex-direction: column; gap: 2px; }

.track-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  cursor: pointer;
  position: relative;
}

.track-item:hover { background: var(--bg-card-hover); }
.track-item.playing { background: var(--bg-card); }
.track-item.playing .track-title { color: var(--green); }

.track-num {
  width: 40px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  position: relative;
}

.track-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}

.track-play-overlay svg { width: 18px; height: 18px; color: var(--text-primary); }
.track-item:hover .track-num .track-num-text { opacity: 0; }
.track-item:hover .track-play-overlay { opacity: 1; }
.track-item.playing .track-num-text { opacity: 0; }
.track-item.playing .track-play-overlay { opacity: 1; color: var(--green); }

.track-info { display: flex; align-items: center; gap: 12px; min-width: 0; }

.track-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-highlight);
}

.track-thumb-placeholder {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.track-thumb-placeholder svg { width: 20px; height: 20px; color: var(--text-muted); }

.track-text { min-width: 0; }
.track-title {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.track-artist {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
}

.track-item:hover .track-actions { opacity: 1; }

.track-duration {
  color: var(--text-secondary);
  font-size: 0.8rem;
  min-width: 40px;
  text-align: right;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition), transform var(--transition);
}

.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { color: var(--text-primary); background: var(--bg-highlight); }
.btn-icon:active { transform: scale(0.92); }

.btn-icon.active { color: var(--green); }

.btn-primary {
  background: var(--green);
  color: var(--text-on-green);
  font-size: 0.875rem;
  font-weight: 700;
  padding: 12px 32px;
  border-radius: var(--radius-full);
  transition: background var(--transition), transform var(--transition);
  letter-spacing: 0.5px;
}

.btn-primary:hover { background: var(--green-bright); transform: scale(1.02); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}

.btn-secondary:hover { border-color: var(--text-primary); background: var(--bg-highlight); }

.btn-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
}

.btn-pill svg { width: 16px; height: 16px; }
.btn-pill:hover { color: var(--text-primary); border-color: var(--text-secondary); }

/* Track action buttons */
.btn-track-action {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  font-size: 0.7rem;
  font-weight: 700;
}

.btn-track-action svg { width: 16px; height: 16px; }
.btn-track-action:hover { color: var(--text-primary); background: var(--bg-press); }
.btn-track-action.liked { color: var(--green); }

/* ── Loading / Error / Empty States ───────────────────────────── */
.loading-state, .error-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 60px 24px;
  color: var(--text-secondary);
  text-align: center;
}

.loading-state.hidden, .error-state.hidden, .empty-state.hidden { display: none; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-highlight);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.error-icon, .empty-icon { font-size: 2.5rem; }

/* ── Queue Panel ───────────────────────────────────────────────── */
.queue-panel {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.queue-panel.hidden { display: none; }

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px;
  flex-shrink: 0;
}

.queue-header h3 { font-size: 1rem; font-weight: 700; }

.queue-section-label {
  padding: 8px 16px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.queue-now-playing {
  padding: 4px 8px 8px;
  flex-shrink: 0;
}

.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-highlight) transparent;
}

.queue-list::-webkit-scrollbar { width: 4px; }
.queue-list::-webkit-scrollbar-thumb { background: var(--bg-highlight); border-radius: 2px; }

.queue-empty-msg {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 8px 8px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.queue-item:hover { background: var(--bg-card-hover); }

.queue-item-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-highlight);
  flex-shrink: 0;
}

.queue-item-info { flex: 1; min-width: 0; }
.queue-item-title {
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-artist {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-clear-queue {
  margin: 8px 16px 16px;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}

.btn-clear-queue:hover { color: var(--text-primary); background: var(--bg-card-hover); }

/* ── Player Bar ────────────────────────────────────────────────── */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--player-height);
  background: var(--bg-player);
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

/* Track Info */
.player-track-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.player-thumb-wrap { position: relative; flex-shrink: 0; }

.player-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.player-thumb.hidden { display: none; }

.player-thumb-placeholder {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--bg-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
}

.player-thumb-placeholder svg { width: 24px; height: 24px; color: var(--text-muted); }

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

.player-title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.player-artist {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.player-like { flex-shrink: 0; }
.player-like svg { width: 20px; height: 20px; }
.player-like.liked { color: var(--green); }

/* Player Controls */
.player-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-btn { color: var(--text-secondary); }
.ctrl-btn:hover { color: var(--text-primary); background: none; }
.ctrl-btn.active { color: var(--green); }

.ctrl-btn svg { width: 20px; height: 20px; }

.play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--text-primary);
  color: var(--bg-base);
  transition: transform var(--transition), background var(--transition);
}

.play-btn svg { width: 22px; height: 22px; }
.play-btn:hover { background: var(--text-primary); transform: scale(1.06); color: var(--bg-base); }

/* Progress Bar */
.player-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
}

.time-current, .time-total {
  font-size: 0.7rem;
  color: var(--text-secondary);
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}

.time-total { text-align: right; }

.progress-bar-wrap {
  flex: 1;
  cursor: pointer;
  padding: 8px 0;
  position: relative;
}

.progress-bar-bg {
  height: 4px;
  background: var(--bg-highlight);
  border-radius: 2px;
  position: relative;
  overflow: visible;
}

.progress-bar-fill {
  height: 100%;
  background: var(--text-secondary);
  border-radius: 2px;
  width: 0%;
  transition: background var(--transition);
  pointer-events: none;
}

.progress-bar-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: transform var(--transition);
  pointer-events: none;
  left: 0%;
}

.progress-bar-wrap:hover .progress-bar-fill { background: var(--green); }
.progress-bar-wrap:hover .progress-bar-thumb { transform: translate(-50%, -50%) scale(1); }

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

.volume-control { display: flex; align-items: center; gap: 8px; }

#btn-mute svg { width: 20px; height: 20px; }

.volume-bar-wrap {
  width: 80px;
  cursor: pointer;
  padding: 8px 0;
}

.volume-bar-bg {
  height: 4px;
  background: var(--bg-highlight);
  border-radius: 2px;
  position: relative;
}

.volume-bar-fill {
  height: 100%;
  background: var(--text-secondary);
  border-radius: 2px;
  width: 80%;
  transition: background var(--transition);
}

.volume-bar-wrap:hover .volume-bar-fill { background: var(--green); }

/* ── Playlist Hero ──────────────────────────────────────────────── */
.playlist-hero {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  padding: 24px 0 32px;
  background: linear-gradient(180deg, rgba(29,185,84,0.3) 0%, transparent 100%);
  margin: -24px -24px 24px;
  padding: 40px 24px 24px;
}

.playlist-hero-art {
  width: 200px;
  height: 200px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #450af5, #c4efd9);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.playlist-hero-art svg { width: 80px; height: 80px; color: white; opacity: 0.8; }

.playlist-hero-info { flex: 1; }
.playlist-type { font-size: 0.7rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.playlist-hero-info h1 { font-size: 3rem; font-weight: 900; margin: 8px 0; letter-spacing: -1px; }
.playlist-hero-info p { color: var(--text-secondary); font-size: 0.875rem; }

.playlist-hero-actions { margin-top: 24px; }

.btn-play-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green);
  color: var(--text-on-green);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background var(--transition);
  box-shadow: 0 4px 16px rgba(29,185,84,0.4);
}

.btn-play-large svg { width: 28px; height: 28px; }
.btn-play-large:hover { background: var(--green-bright); transform: scale(1.06); }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  animation: modal-in 0.2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 12px;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; }

.modal-body { padding: 8px 20px; max-height: 300px; overflow-y: auto; }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px 20px;
}

.modal-input {
  width: 100%;
  background: var(--bg-highlight);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 10px 14px;
  outline: none;
  margin-bottom: 10px;
  transition: border-color var(--transition);
}

.modal-input:focus { border-color: var(--text-primary); }
.modal-input::placeholder { color: var(--text-muted); }

.modal-playlist-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.875rem;
}

.modal-playlist-option:hover { background: var(--bg-card-hover); }

.modal-playlist-option-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-playlist-option-icon.liked { background: linear-gradient(135deg, #450af5, #c4efd9); }
.modal-playlist-option-icon svg { width: 16px; height: 16px; }

/* ── Toast ─────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--player-height) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden { display: none; }

/* ── Playlist Grid ─────────────────────────────────────────────── */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.playlist-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: background var(--transition);
}

.playlist-card:hover { background: var(--bg-card-hover); }

.playlist-card-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #450af5, #c4efd9);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.playlist-card-art.liked { background: linear-gradient(135deg, #450af5, #c4efd9); }
.playlist-card-art svg { width: 40px; height: 40px; color: white; opacity: 0.8; }

.playlist-card-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-card-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Buffering Indicator ───────────────────────────────────────── */
.buffering-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.buffering-indicator.visible { display: block; }

/* ── Scrollbar Global ──────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-highlight) transparent;
}

*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--bg-highlight); border-radius: 3px; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 200px;
    --queue-width: 260px;
  }

  .logo-text { font-size: 1.1rem; }
  .playlist-hero-info h1 { font-size: 2rem; }
}

@media (max-width: 768px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .sidebar {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    bottom: var(--player-height);
    width: 260px;
    z-index: 50;
  }

  .sidebar.mobile-open { display: flex; }

  .main-content { grid-column: 1; }

  .topbar { padding: 8px 16px; gap: 8px; }
  .topbar-nav { display: none; }
  .topbar-actions { display: none; }

  .search-container { max-width: 100%; }

  .player-bar {
    grid-template-columns: 1fr auto;
    padding: 0 12px;
  }

  .player-extras { display: none; }

  .player-controls { gap: 4px; }
  .player-progress { max-width: 100%; }

  #btn-shuffle, #btn-repeat { display: none; }

  .view { padding: 16px 16px 24px; }

  .playlist-hero { flex-direction: column; align-items: flex-start; }
  .playlist-hero-art { width: 140px; height: 140px; }
  .playlist-hero-info h1 { font-size: 1.75rem; }

  #app.queue-open {
    grid-template-columns: 1fr;
  }

  .queue-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: var(--player-height);
    width: 280px;
    z-index: 50;
  }
}

@media (max-width: 480px) {
  .player-bar { grid-template-columns: 1fr auto; }
  .player-track-info { gap: 8px; }
  .player-thumb, .player-thumb-placeholder { width: 44px; height: 44px; }
  .player-title { font-size: 0.8rem; }
  .player-artist { font-size: 0.7rem; }
  .play-btn { width: 36px; height: 36px; }
  .play-btn svg { width: 18px; height: 18px; }
}

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.track-item { animation: fadeIn 0.2s ease both; }
.track-item:nth-child(1)  { animation-delay: 0.02s; }
.track-item:nth-child(2)  { animation-delay: 0.04s; }
.track-item:nth-child(3)  { animation-delay: 0.06s; }
.track-item:nth-child(4)  { animation-delay: 0.08s; }
.track-item:nth-child(5)  { animation-delay: 0.10s; }
.track-item:nth-child(6)  { animation-delay: 0.12s; }
.track-item:nth-child(7)  { animation-delay: 0.14s; }
.track-item:nth-child(8)  { animation-delay: 0.16s; }
.track-item:nth-child(9)  { animation-delay: 0.18s; }
.track-item:nth-child(10) { animation-delay: 0.20s; }

/* ── Equalizer Animation (playing indicator) ───────────────────── */
.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 14px;
}

.eq-bar {
  width: 3px;
  background: var(--green);
  border-radius: 1px;
  animation: eq-bounce 0.8s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { height: 60%; animation-delay: 0s; }
.eq-bar:nth-child(2) { height: 100%; animation-delay: 0.2s; }
.eq-bar:nth-child(3) { height: 40%; animation-delay: 0.4s; }

@keyframes eq-bounce {
  from { transform: scaleY(0.4); }
  to   { transform: scaleY(1); }
}