/* ═══════════════════════════════════════════════════════════════════════
   SongTag — Design System
   Blue palette, light + dark modes, CSS custom properties
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Light mode tokens ─────────────────────────────────────────────────── */
:root {
  --bg-app: #F0F4FA;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F6F8FC;
  --bg-input: #F0F4FA;
  --bg-overlay: rgba(15, 23, 42, 0.45);

  --border: #D6E0F0;
  --border-hover: #B8C8E0;
  --border-focus: #3B82F6;

  --text: #0C1929;
  --text-secondary: #4A5E7A;
  --text-tertiary: #8896B3;
  --text-inverse: #FFFFFF;

  --accent: #2563EB;
  --accent-hover: #1D4ED8;
  --accent-soft: rgba(37, 99, 235, 0.08);
  --accent-muted: rgba(37, 99, 235, 0.15);
  --accent-glow: rgba(37, 99, 235, 0.25);

  --danger: #DC2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --danger-text: #B91C1C;
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.07);
  --success-text: #047857;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
  --shadow-xl: 0 20px 48px rgba(15, 23, 42, 0.12);

  --font-display: 'Outfit', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);

  --header-h: 60px;
  --player-h: 104px;
  --spectrum-h: 48px;
}

/* ── Dark mode tokens ──────────────────────────────────────────────────── */
.dark {
  --bg-app: #060A13;
  --bg-surface: #0D1321;
  --bg-card: #131B2E;
  --bg-card-hover: #182240;
  --bg-input: #0F1726;
  --bg-overlay: rgba(0, 0, 0, 0.6);

  --border: #1C2942;
  --border-hover: #263654;
  --border-focus: #3B82F6;

  --text: #E4EAF4;
  --text-secondary: #8494B2;
  --text-tertiary: #506280;
  --text-inverse: #0C1929;

  --accent: #3B82F6;
  --accent-hover: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.1);
  --accent-muted: rgba(59, 130, 246, 0.18);
  --accent-glow: rgba(59, 130, 246, 0.3);

  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --danger-text: #FCA5A5;
  --success: #34D399;
  --success-soft: rgba(52, 211, 153, 0.1);
  --success-text: #6EE7B7;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --shadow-xl: 0 20px 48px rgba(0, 0, 0, 0.5);
}

/* ── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
button { cursor: pointer; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.dark body {
  background: linear-gradient(160deg, #060A13 0%, #0A1020 50%, #060A13 100%);
  background-attachment: fixed;
}

/* ── Scrollbar ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Typography ────────────────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ── Focus visible ─────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  height: 36px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 1px 3px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  height: 36px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-muted);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-icon:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-muted);
}

.btn-danger-ghost {
  height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--danger);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn-danger-ghost:hover { background: var(--danger-soft); }

.btn-play {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
  border: none;
}
.btn-play:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.04);
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Inputs ────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 40px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}
.input::placeholder { color: var(--text-tertiary); }
.input:hover { border-color: var(--border-hover); }
.input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-surface);
}

textarea.input {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
  min-height: 72px;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.dark .card:hover {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-md);
}

.card-cover {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--bg-input);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.card:hover .card-cover img { transform: scale(1.05); }

.card-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background var(--transition);
  cursor: pointer;
}
.card:hover .card-cover-overlay { background: rgba(0, 0, 0, 0.35); }

.card-play-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.card:hover .card-play-btn { opacity: 1; transform: scale(1); }

.card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-body { padding: 14px; }
.card-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--transition);
}

.card-action-btn {
  flex: 1;
  height: 30px;
  font-size: 11px;
}
.card-action-del {
  flex-shrink: 0;
}

.card:hover .card-actions { opacity: 1; transform: translateY(0); }

.card-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Badge ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
}

/* ── Sort pill ─────────────────────────────────────────────────────────── */
.sort-pill {
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.sort-pill:hover { border-color: var(--border-hover); color: var(--text); }
.sort-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-muted);
  color: var(--accent);
}

/* ── Header ────────────────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  transition: background-color var(--transition-slow);
}
.dark .header { background: rgba(13, 19, 33, 0.82); }
.light .header { background: rgba(255, 255, 255, 0.88); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
}
.header-logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-btn {
  height: 32px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.lang-btn:hover { color: var(--text); border-color: var(--border-hover); }

/* ── Main content ──────────────────────────────────────────────────────── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
}
.main-content--with-player { padding-bottom: calc(var(--player-h) + var(--spectrum-h) + 32px); }

/* ── Toolbar ───────────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 12px;
  pointer-events: none;
}
.search-input {
  padding-left: 36px;
}

/* ── Bulk bar (no layout shift) ───────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 28px;
  font-size: 12px;
  color: var(--text-secondary);
}

.bulk-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.bulk-bar input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.bulk-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.bulk-bar-actions.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── File grid ─────────────────────────────────────────────────────────── */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

/* ── Metadata grid (inside cards) ──────────────────────────────────────── */
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 12px;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ── Empty state ───────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}
.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.empty-icon i { font-size: 28px; color: var(--accent); opacity: 0.5; }
.empty-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-sub { font-size: 13px; color: var(--text-secondary); }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  font-size: 12px;
  color: var(--text-tertiary);
}
.pagination strong { color: var(--text); font-weight: 600; }

/* ── Player bar ────────────────────────────────────────────────────────── */
.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: var(--bg-surface);
  transition: background-color var(--transition-slow);
}
.dark .player { background: rgba(13, 19, 33, 0.88); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); }
.light .player { background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%); }

/* ── Retro spectrum overrides ──────────────────────────────────────────── */
.player-spectrum {
  height: var(--spectrum-h);
  width: 100%;
  overflow: hidden;
  background: #000000;
  border-bottom: 1px solid rgba(255, 60, 20, 0.15);
  margin-bottom: 20px;
  position: relative;
}
.player-spectrum canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.player-progress-wrap {
  padding: 0 20px;
  cursor: pointer;
}
.player-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  position: relative;
  transition: height var(--transition-fast);
}
.player-progress-wrap:hover .player-progress { height: 6px; }
.player-progress-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  position: relative;
  transition: width 80ms linear;
}
.player-progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.player-progress-wrap:hover .player-progress-thumb { opacity: 1; }

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--player-h);
  padding: 0 20px;
  max-width: 1280px;
  margin: 0 auto;
}
.player-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.player-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-input);
  flex-shrink: 0;
}
.player-cover img { width: 100%; height: 100%; object-fit: cover; }
.player-cover-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.player-cover-placeholder i { color: var(--text-tertiary); opacity: 0.3; font-size: 14px; }
.player-meta { min-width: 0; }
.player-title { font-size: 13px; font-weight: 600; color: var(--text); }
.player-artist { font-size: 12px; color: var(--text-secondary); }

.player-center {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.player-time { font-size: 11px; color: var(--text-tertiary); min-width: 36px; text-align: center; }

.player-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.player-volume { display: flex; align-items: center; gap: 6px; }
.player-volume i { font-size: 12px; color: var(--text-tertiary); }

/* ── Range input (volume) ──────────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--transition-fast);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* ── Modal / Overlay ───────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.overlay-panel {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.overlay-panel--sm { max-width: 420px; }
.overlay-panel--md { max-width: 560px; }
.overlay-panel--lg { max-width: 680px; }
.overlay-panel--top { align-self: flex-start; margin-top: 40px; margin-bottom: 40px; }

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.overlay-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.overlay-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
}
.overlay-close:hover { background: var(--accent-soft); color: var(--text); }

.overlay-body { padding: 20px 24px 24px; }
.overlay-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0 24px 20px;
}

/* ── Dropzone ──────────────────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.dropzone:hover { border-color: var(--border-hover); }
.dropzone.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  animation: pulse-border 1.5s ease infinite;
}
.dropzone-icon { font-size: 36px; color: var(--text-tertiary); margin-bottom: 12px; transition: color var(--transition); }
.dropzone.active .dropzone-icon { color: var(--accent); }
.dropzone-text { font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.dropzone-sub { font-size: 12px; color: var(--text-tertiary); }
.dropzone-link { color: var(--accent); font-weight: 600; }
.dropzone-hint { font-size: 11px; color: var(--text-tertiary); margin-top: 12px; opacity: 0.7; }

/* ── Upload item ───────────────────────────────────────────────────────── */
.upload-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; margin-bottom: 16px; }
.upload-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 13px;
}
.upload-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item-error { font-size: 11px; color: var(--danger); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Edit form ─────────────────────────────────────────────────────────── */
.edit-cover-section {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}
.edit-cover-preview {
  width: 112px;
  height: 112px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-input);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.edit-cover-preview img { width: 100%; height: 100%; object-fit: cover; }
.edit-cover-actions { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.edit-cover-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.edit-cover-btn:hover { color: var(--text); border-color: var(--border-hover); }
.edit-cover-remove { color: var(--danger); }
.edit-cover-remove:hover { background: var(--danger-soft); border-color: transparent; }

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
.edit-grid .full { grid-column: 1 / -1; }
.edit-label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }

/* ── Toast ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--player-h) + var(--spectrum-h) + 20px);
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid;
  box-shadow: var(--shadow-md);
}
.toast--success { background: var(--success-soft); border-color: var(--success); color: var(--success-text); }
.toast--error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-text); }
.toast--info { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ── Confirm dialog ────────────────────────────────────────────────────── */
.confirm-body { margin-bottom: 24px; }
.confirm-body p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.btn-danger {
  height: 36px;
  padding: 0 16px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-danger:hover { opacity: 0.9; }

/* ── Loading ───────────────────────────────────────────────────────────── */
.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
}
.loading-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.login-logo-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--accent); display: flex; align-items: center; justify-content: center; color: #fff; font-size: 18px; }
.login-logo-text { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.login-subtitle { font-size: 13px; color: var(--text-secondary); }
.login-error { font-size: 13px; color: var(--danger); margin-top: 8px; }
.login-btn { width: 100%; height: 44px; margin-top: 16px; font-size: 14px; }

/* ── Active card state ─────────────────────────────────────────────────── */
.card--active { border-color: var(--accent-muted); box-shadow: 0 0 0 1px var(--accent-soft), var(--shadow-md); }

/* ── No-cover placeholder ──────────────────────────────────────────────── */
.no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--bg-input));
}
.no-cover i { font-size: 28px; color: var(--accent); opacity: 0.2; }

/* ── Animations ────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-border { 0%, 100% { border-color: var(--accent); } 50% { border-color: var(--accent-muted); } }

.anim-fade { animation: fadeIn 0.25s ease both; }
.anim-slide { animation: slideUp 0.3s ease both; }
.anim-scale { animation: scaleIn 0.2s ease both; }

/* ── Staggered grid items ──────────────────────────────────────────────── */
.file-grid > * { animation: fadeIn 0.3s ease both; }
.file-grid > *:nth-child(1) { animation-delay: 0ms; }
.file-grid > *:nth-child(2) { animation-delay: 40ms; }
.file-grid > *:nth-child(3) { animation-delay: 80ms; }
.file-grid > *:nth-child(4) { animation-delay: 120ms; }
.file-grid > *:nth-child(5) { animation-delay: 160ms; }
.file-grid > *:nth-child(6) { animation-delay: 200ms; }
.file-grid > *:nth-child(7) { animation-delay: 240ms; }
.file-grid > *:nth-child(8) { animation-delay: 280ms; }
.file-grid > *:nth-child(n+9) { animation-delay: 300ms; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .file-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { overflow: hidden; }
  .card-body { padding: 10px; overflow: hidden; }
  .card-actions { opacity: 1; transform: none; }
  .card-play-btn { opacity: 0; transform: scale(0.8); }
  .card:hover .card-play-btn { opacity: 1; transform: scale(1); }
  .meta-grid { font-size: 10px; gap: 1px 8px; }
  .header { padding: 0 12px; }
  .header-actions { gap: 6px; }
  .header-actions .pill-label { display: none; }
  .header-actions .btn-primary { padding: 0 10px; }
  .main-content { padding: 16px 12px; }
  .player-controls { padding: 0 12px; gap: 10px; }
  .player-progress-wrap { padding: 0 12px; }
  .player-right { display: none; }
  .player-info .player-meta { display: none; }
  .toolbar { gap: 8px; }
  .toolbar-row:last-child {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -12px;
    padding: 0 12px 2px;
  }
  .toolbar-row:last-child::-webkit-scrollbar { display: none; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-grid .full { grid-column: 1; }
  .overlay-panel { border-radius: var(--radius-lg); }
  .sort-pill span.pill-label { display: none; }
  .toast-container { right: 12px; left: 12px; max-width: none; bottom: calc(var(--player-h) + var(--spectrum-h) + 12px); }
  .pagination { gap: 10px; }
  .card-action-text { display: none; }
  .card-action-btn { padding: 0; justify-content: center; }
  .player-spectrum canvas {
    height: 36px !important;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .file-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1440px) {
  .file-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Modern checkbox ────────────────────────────────────────────────────── */
.cb-wrap {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.cb-wrap input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
  z-index: 2;
}

.cb-box {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cb-box svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  stroke-dasharray: 18;
  stroke-dashoffset: 18;
  transition: stroke-dashoffset 180ms cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
}

.cb-wrap input:checked + .cb-box {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow), 0 2px 6px rgba(0,0,0,0.2);
}

.cb-wrap input:checked + .cb-box svg {
  stroke-dashoffset: 0;
  opacity: 1;
}

.cb-wrap input:focus-visible + .cb-box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cb-wrap:hover .cb-box {
  border-color: rgba(255, 255, 255, 0.6);
  transform: scale(1.08);
}

.cb-wrap input:checked:hover + .cb-box {
  transform: scale(1.08);
  border-color: var(--accent);
}

.light .cb-box {
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.12);
}

.light .cb-wrap:hover .cb-box {
  border-color: rgba(0, 0, 0, 0.25);
}

.light .cb-box svg {
  stroke: #fff;
}

.card-checkbox {
  display: none !important;
}

.theme-icon {
  transition: transform 0.3s ease;
}

.theme-btn:hover .theme-icon {
  transform: rotate(25deg) scale(1.2);
}
