/* ═══════════════════════════════════════════════════════════════════════════════
   CrateGap Purge - DJ Track Manager
   CrateGap paper theme (matches crategap.com design system)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Custom Properties ──────────────────────────────────────────────────── */
:root {
  /* Core palette: CrateGap paper theme */
  --bg-primary: #f3f0e8;
  --bg-secondary: #fbfaf6;
  --bg-tertiary: #f6f3ea;
  --bg-card: #fbfaf6;
  --bg-card-hover: #f1ede2;
  --bg-elevated: #fbfaf6;
  --bg-input: #f6f3ea;

  /* Accent: ink (var names kept for compatibility) */
  --accent-purple: #16150f;
  --accent-purple-dim: #2b2a22;
  --accent-purple-glow: rgba(22, 21, 15, 0.10);
  --accent-neon: #1d6b45;
  --accent-neon-dim: #17573a;
  --accent-neon-glow: rgba(29, 107, 69, 0.15);

  /* Danger / Purge */
  --danger: #e5412d;
  --danger-dim: #c9341f;
  --danger-glow: rgba(229, 65, 45, 0.18);
  --danger-bg: rgba(229, 65, 45, 0.08);

  /* Keep / Success */
  --success: #1d6b45;
  --success-dim: #17573a;
  --success-glow: rgba(29, 107, 69, 0.18);

  /* Text */
  --text-primary: #16150f;
  --text-secondary: #4a473d;
  --text-tertiary: #7d796c;
  --text-accent: var(--accent-purple);

  /* Borders */
  --border: #dcd7c9;
  --border-hover: #bdb7a6;
  --border-active: var(--accent-purple);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(22, 21, 15, 0.08);
  --shadow-md: 0 6px 20px -8px rgba(22, 21, 15, 0.18);
  --shadow-lg: 0 24px 60px -24px rgba(22, 21, 15, 0.30);
  --shadow-glow: 0 0 0 transparent;

  /* Layout */
  --header-height: 64px;
  --panel-gap: 2px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Typography */
  --font-ui: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'Hanken Grotesk', -apple-system, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', sans-serif;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  background: #f3f0e8;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.active {
  display: flex !important;
}

/* ─── Modal Overlay ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 21, 15, 0.45);
  backdrop-filter: blur(20px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn var(--transition-base) ease;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 90%;
  max-width: 520px;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(22, 21, 15, 0.08);
  animation: slideUp var(--transition-slow) ease;
}

.modal-export {
  max-width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.close-btn:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

/* Logo */
.modal-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-mark {
  width: 72px;
  height: 48px;
  display: block;
  margin: 0 auto 16px;
  color: var(--text-primary);
  filter: drop-shadow(0 0 20px rgba(22, 21, 15, 0.35));
}

.logo-text {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--text-primary);
}

.logo-sub {
  color: var(--text-secondary);
  font-size: 14px;
  letter-spacing: 0;
  
  margin-top: 4px;
}

/* Setup steps */
.setup-step {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.setup-step.active {
  display: flex;
}

.setup-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ─── Drop Zone ──────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  background: var(--bg-input);
}

.drop-zone:hover {
  border-color: var(--accent-purple-dim);
  background: rgba(22, 21, 15, 0.04);
}

.drop-zone.drag-over {
  border-color: var(--accent-purple);
  background: rgba(22, 21, 15, 0.08);
  box-shadow: 0 0 24px var(--accent-purple-glow), inset 0 0 24px rgba(22, 21, 15, 0.05);
}

.drop-zone.has-file {
  border-color: var(--accent-neon-dim);
  border-style: solid;
  background: rgba(29, 107, 69, 0.04);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.drop-zone-icon {
  font-size: 28px;
  opacity: 0.6;
  transition: all var(--transition-base);
}

.drag-over .drop-zone-icon {
  opacity: 1;
  transform: scale(1.15);
}

.drop-zone-text {
  font-size: 14px;
  color: var(--text-secondary);
}

.drop-zone-text strong {
  color: var(--accent-purple);
}

.drop-zone-or {
  font-size: 12px;
  color: var(--text-tertiary);
  
  letter-spacing: 0;
}

.file-input-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: -1;
}

/* File info (shown after selecting a file) */
.drop-zone-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.drop-zone-file.hidden {
  display: none;
}

.file-icon {
  font-size: 20px;
}

.file-name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-neon);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.file-remove {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1;
}

.file-remove:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Input divider */
.input-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
}

.input-divider::before,
.input-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider-text {
  font-size: 11px;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Load button inside drop zone */
.drop-zone-load {
  margin-top: 8px;
  width: 100%;
}

.drop-zone-load.hidden {
  display: none;
}

/* ─── Inputs ─────────────────────────────────────────────────────────────────── */
.input-label {
  font-size: 13px;
  font-weight: 600;
  
  letter-spacing: 0;
  color: var(--text-secondary);
}

.optional {
  color: var(--text-tertiary);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.input-group {
  display: flex;
  gap: 8px;
}

.text-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: all var(--transition-fast);
}

.text-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

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

.input-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.select-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 5px 8px;
  outline: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  max-width: 140px;
}

.select-input:focus {
  border-color: var(--accent-purple);
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dim));
  color: #f3f0e8;
  box-shadow: 0 2px 12px var(--accent-purple-glow);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--accent-purple-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(22, 21, 15, 0.04);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-icon {
  font-size: 14px;
}

/* Purge button */
.btn-purge {
  background: linear-gradient(135deg, var(--danger), #b91c1c);
  color: #f3f0e8;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px var(--danger-glow);
  
  position: relative;
  overflow: hidden;
  flex: 1;
}

.btn-purge::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(45deg, transparent, rgba(22, 21, 15, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-purge:hover::before {
  transform: translateX(100%);
}

.btn-purge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px var(--danger-glow), 0 0 60px rgba(229, 65, 45, 0.15);
}

.btn-purge:active {
  transform: translateY(0);
}

.purge-icon {
  font-size: 18px;
}

/* Keep button */
.btn-keep {
  background: linear-gradient(135deg, var(--success), var(--success-dim));
  color: #f3f0e8;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px var(--success-glow);
  flex: 0.6;
}

.btn-keep:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 36px var(--success-glow);
}

/* ─── Status Messages ────────────────────────────────────────────────────────── */
.status-message {
  font-size: 13px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: none;
}

.status-message.success {
  display: block;
  background: rgba(29, 107, 69, 0.1);
  color: var(--success);
  border: 1px solid rgba(29, 107, 69, 0.2);
}

.status-message.error {
  display: block;
  background: rgba(229, 65, 45, 0.1);
  color: var(--danger);
  border: 1px solid rgba(229, 65, 45, 0.2);
}

.status-message.loading {
  display: block;
  background: rgba(22, 21, 15, 0.1);
  color: var(--accent-purple);
  border: 1px solid rgba(22, 21, 15, 0.2);
}

/* ─── App Layout ─────────────────────────────────────────────────────────────── */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.app-header {
  height: var(--header-height);
  background: rgba(243, 240, 232, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(22, 21, 15, 0.06);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 24px;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark-small {
  width: 30px;
  height: 20px;
  color: var(--text-primary);
  flex-shrink: 0;
}

.header-brand {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--text-tertiary);
  
  align-self: flex-end;
  padding-bottom: 1px;
}

.header-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-stats {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-danger .stat-value {
  color: var(--danger);
}

.stat-label {
  font-size: 11px;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
}

.stat-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.progress-bar {
  width: 120px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-neon));
  border-radius: 3px;
  transition: width var(--transition-base);
  width: 0%;
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 32px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Main Grid ──────────────────────────────────────────────────────────────── */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 240px 1fr 380px;
  gap: 12px;
  overflow: hidden;
  background: transparent;
  padding: 12px;
}

.panel {
  background:
    linear-gradient(180deg, rgba(22, 21, 15, 0.045), rgba(22, 21, 15, 0.012)),
    linear-gradient(rgba(251, 250, 246, 0.92), rgba(251, 250, 246, 0.92));
  border: 1px solid rgba(22, 21, 15, 0.07);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.panel-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  
  letter-spacing: 0;
  color: var(--text-secondary);
}

.panel-controls {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ─── Search ─────────────────────────────────────────────────────────────────── */
.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 7px 10px 7px 30px;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent-purple);
  box-shadow: 0 0 0 3px var(--accent-purple-glow);
}

/* ─── Track List ─────────────────────────────────────────────────────────────── */
.track-list-header {
  display: grid;
  grid-template-columns: 28px 1.5fr 1fr 50px 50px 0.8fr;
  padding: 6px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.th {
  font-size: 11px;
  font-weight: 600;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.th:hover {
  color: var(--text-secondary);
}

.th.sort-active {
  color: var(--accent-purple);
}

.track-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.track-item {
  display: grid;
  grid-template-columns: 28px 1.5fr 1fr 50px 50px 0.8fr;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
  align-items: center;
}

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

.track-item.active {
  background: var(--bg-card);
  border-left: 3px solid var(--accent-purple);
  padding-left: 13px;
}

.track-item.purged {
  opacity: 0.4;
  background: var(--danger-bg);
}

.track-item.purged:hover {
  opacity: 0.7;
}

.track-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: all var(--transition-fast);
}

.track-status-dot.assigned {
  background: var(--accent-neon);
  box-shadow: 0 0 8px var(--accent-neon-glow);
}

.track-status-dot.purged {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
}

.track-status-dot.playing {
  background: var(--accent-purple);
  box-shadow: 0 0 8px var(--accent-purple-glow);
  animation: pulse 1.5s infinite;
}

.track-cell {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}

.track-cell-title {
  font-weight: 500;
  color: var(--text-primary);
}

.track-cell-artist {
  color: var(--text-secondary);
}

.track-cell-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}

.track-cell-genre {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.page-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.page-btn.active {
  background: var(--accent-purple);
  color: #f3f0e8;
  border-color: var(--accent-purple);
}

.page-info {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: 0 8px;
}

/* ─── Player Panel ───────────────────────────────────────────────────────────── */
.panel-detail {
  background: var(--bg-primary);
  overflow-y: auto;
}

.player-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--text-tertiary);
}

.empty-icon {
  font-size: 48px;
  opacity: 0.3;
}

.player-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
  overflow-y: auto;
}

.track-detail {
  text-align: center;
}

.track-info-large {
  margin-bottom: 20px;
}

.track-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
}

.track-artist {
  font-size: 15px;
  font-weight: 400;
  color: var(--accent-purple);
}

.track-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.meta-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
}

.meta-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ─── Visualizer ─────────────────────────────────────────────────────────────── */
.visualizer-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.visualizer-canvas {
  width: 100%;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.seek-bar-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.seek-bar,
.volume-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.seek-bar::-webkit-slider-thumb,
.volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-purple);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-purple-glow);
  transition: transform var(--transition-fast);
}

.seek-bar::-webkit-slider-thumb:hover,
.volume-bar::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ─── Player Controls ────────────────────────────────────────────────────────── */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.control-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

.control-btn-play {
  width: 52px;
  height: 52px;
  font-size: 18px;
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-purple-dim));
  color: #f3f0e8;
  border: none;
  box-shadow: 0 4px 16px var(--accent-purple-glow);
}

.control-btn-play:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px var(--accent-purple-glow);
}

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

.volume-icon {
  font-size: 14px;
}

.volume-bar {
  width: 80px;
}

/* ─── Action Buttons ─────────────────────────────────────────────────────────── */
.action-buttons {
  display: flex;
  gap: 12px;
  margin-top: auto;
}

/* ─── Sidebar Panel ──────────────────────────────────────────────────────────── */
.panel-sidebar {
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 600;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
  padding: 12px 16px 4px;
  border-top: 1px solid var(--border);
}

.sidebar-purge {
  padding: 4px 0 8px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-secondary);
  font-size: 14px;
  border-left: 3px solid transparent;
  user-select: none;
}

.sidebar-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(22, 21, 15, 0.08);
  border-left-color: var(--accent-purple);
  color: var(--text-primary);
}

.sidebar-item-purge:hover {
  background: var(--danger-bg);
}

.sidebar-item-purge.active {
  background: var(--danger-bg);
  border-left-color: var(--danger);
  color: var(--danger);
}

.sidebar-icon {
  font-size: 14px;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.sidebar-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
  min-width: 24px;
  text-align: right;
}

/* ─── Detail Panel - Playlist Assign Section ─────────────────────────────────── */
.detail-section {
  padding: 16px 24px 0;
}

.section-subtitle {
  font-size: 12px;
  font-weight: 600;
  
  letter-spacing: 0;
  color: var(--text-tertiary);
  margin-bottom: 8px;
}

.section-danger {
  color: var(--danger);
}

.empty-text {
  font-size: 13px;
  color: var(--text-tertiary);
  font-style: italic;
}

.current-playlists,
.all-playlists {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.playlist-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.playlist-tag:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.playlist-tag.active {
  background: rgba(22, 21, 15, 0.12);
  border-color: var(--accent-purple);
  color: var(--accent-purple);
}

.playlist-tag.dragging {
  opacity: 0.5;
  background: var(--surface-light);
  border: 1px dashed var(--accent-purple);
}

.playlist-tag.drag-over {
  border-top: 2px solid var(--accent-purple);
}

.playlist-tag .tag-shortcut {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--surface-light);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  margin-right: 2px;
}

.playlist-tag .tag-check {
  font-size: 11px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.playlist-tag.active .tag-check {
  opacity: 1;
}

.playlist-tag .tag-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-left: auto;
}

.playlist-tag .tag-hide-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: all var(--transition-fast);
  line-height: 1;
}

.playlist-tag:hover .tag-hide-btn {
  opacity: 1;
}

.playlist-tag .tag-hide-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ─── Export ──────────────────────────────────────────────────────────────────── */
.export-summary {
  margin-bottom: 20px;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}

.export-item-name {
  color: var(--text-primary);
  font-weight: 500;
}

.export-item-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.export-item.danger {
  border-color: rgba(229, 65, 45, 0.2);
  background: var(--danger-bg);
}

.export-item.danger .export-item-name {
  color: var(--danger);
}

.export-select-all {
  margin-bottom: 12px;
  padding: 0 4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple);
  cursor: pointer;
}

/* ─── Animations ─────────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

@keyframes purgeFlash {
  0% {
    background: var(--danger-bg);
  }

  50% {
    background: rgba(229, 65, 45, 0.2);
  }

  100% {
    background: var(--danger-bg);
  }
}

.purge-flash {
  animation: purgeFlash 0.4s ease;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .app-main {
    grid-template-columns: 200px 1fr 320px;
  }
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 180px 1fr;
  }

  .panel-detail {
    grid-column: 1 / -1;
  }
}

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

  .panel-sidebar {
    display: none;
  }

  .header-stats {
    display: none;
  }
}