/* Upload page (/upload) styles.
 *
 * Design tokens (--bg, --surface, --accent, --space-*, --radius, …) and the
 * shared header / nav styles live in app.css, which this page
 * also links. Everything below is upload-specific and references those tokens —
 * it never redefines the theme palettes.
 *
 * Mobile-first: single column, then a two-zone workers bar and a responsive
 * cover grid at wider viewports.
 */

/* Bottom breathing room under the upload content. Scoped to .upload-main (not
   body.upload-page) because the shell swaps <main> but keeps the body class of
   whichever page loaded first. */
.upload-main { padding-bottom: var(--space-6); }

.upload-main {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.upload-section { display: flex; flex-direction: column; gap: var(--space-3); }

.section-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.empty-note {
  color: var(--text-muted);
  font-size: 14px;
  padding: var(--space-3) 0;
}

/* Upload-page buttons. SCOPED to .upload-main so they never shadow the shared
   header .btn (BUG-15): the shell keep-injects this sheet, and the header is
   persistent, so an unscoped `.btn` here would restyle the header on every page. */
.upload-main .btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.upload-main .btn:hover { background: var(--surface-hover); }
.upload-main .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload-main .btn:disabled { opacity: 0.5; cursor: not-allowed; }

.upload-main .btn--accent {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
.upload-main .btn--accent:hover { background: var(--accent-dim); }
.upload-main .btn--accent:disabled:hover { background: var(--accent); }

.upload-main .btn--danger {
  border-color: var(--error);
  color: var(--error);
}
.upload-main .btn--danger:hover:not(:disabled) { background: var(--error); color: #fff; }

/* One-button "Add music" dropdown menu */
.add-menu { position: relative; display: inline-block; }
.add-menu__list {
  position: absolute;
  top: calc(100% + var(--space-1));
  left: 0;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  padding: var(--space-1);
  z-index: 20;
}
.add-menu__list[hidden] { display: none; }
.add-menu__item {
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  white-space: nowrap;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  cursor: pointer;
}
.add-menu__item:hover { background: var(--surface-hover); }
.add-menu__item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ── Drop zone ─────────────────────────────────────────────────────────── */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5);
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.drop-zone:hover { border-color: var(--accent-dim); }
.drop-zone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}
.drop-zone__icon { font-size: 40px; color: var(--accent); line-height: 1; }
.drop-zone__lead { font-size: 16px; font-weight: 500; color: var(--text); }
.drop-zone__hint { color: var(--text-muted); font-size: 13px; }
.drop-zone__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-2);
}

/* ── Workers bar ───────────────────────────────────────────────────────── */
.workers-bar {
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.workers-control { display: flex; align-items: center; gap: var(--space-4); }
.workers-label { font-weight: 500; white-space: nowrap; }
.workers-label span { color: var(--accent); font-variant-numeric: tabular-nums; }
.workers-range {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
  height: 6px;
}
.workers-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.workers-actions { display: flex; gap: var(--space-3); }

@media (min-width: 600px) {
  .workers-bar { flex-direction: row; align-items: center; justify-content: space-between; }
  .workers-control { flex: 1; }
  .workers-actions { flex-shrink: 0; }
}

/* ── Upload queue ──────────────────────────────────────────────────────── */
.queue-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); }

.queue-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    "name  size  close"
    "bar   bar   close"
    "msg   msg   close";
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.queue-item__name {
  grid-area: name;
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}
.queue-item__size {
  grid-area: size;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Progress bar — track + fill, mirrors the player's progress styling. */
.queue-item__bar {
  grid-area: bar;
  height: 6px;
  border-radius: 3px;
  background: var(--range-track);
  overflow: hidden;
}
.queue-item__fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width 150ms ease;
}

.queue-item__msg {
  grid-area: msg;
  font-size: 13px;
  display: none;
  align-items: center;
  gap: var(--space-3);
}

/* Per-row remove/cancel button — a quiet × that brightens on hover. */
.queue-item__close {
  grid-area: close;
  align-self: center;
  justify-self: end;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.queue-item__close:hover { color: var(--text); background: var(--surface-hover); border-color: var(--border); }
.queue-item__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.queue-item__msg .retry-btn {
  padding: var(--space-1) var(--space-3);
  font-size: 12px;
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.queue-item__msg .retry-btn:hover { background: var(--accent-glow); border-color: var(--accent); }
.queue-item__msg .retry-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* State variants — color is always paired with a text label / icon. */
.queue-item[data-state="done"]     .queue-item__fill { background: var(--success); }
.queue-item[data-state="error"]    .queue-item__fill,
.queue-item[data-state="rejected"] .queue-item__fill { background: var(--error); }
.queue-item[data-state="error"]    .queue-item__msg,
.queue-item[data-state="rejected"] .queue-item__msg { display: flex; color: var(--error); }
.queue-item[data-state="done"]     .queue-item__msg { display: flex; color: var(--success); }
.queue-item[data-state="waiting"]  .queue-item__msg { display: flex; color: var(--text-muted); }

/* Cover-image and skipped rows are not uploaded: show the note, drop the bar. */
.queue-item[data-state="cover"]    .queue-item__msg,
.queue-item[data-state="skipped"]  .queue-item__msg { display: flex; color: var(--text-muted); }
.queue-item[data-state="cover"]    .queue-item__bar,
.queue-item[data-state="skipped"]  .queue-item__bar { visibility: hidden; }

/* Toasts use the shared system (app.css .toast* + #toastStatus/#toastAlert).
   The page-local .toast/.toast-stack rules were removed: they redefined the
   global classes (opacity:0 by default) and, because shell stylesheets are
   inject-and-keep, leaked onto every page once /upload was visited. */

/* ── Utility ───────────────────────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Advanced: precheck toggle ─────────────────────────────────────────────── */
.upload-advanced { gap: var(--space-2); }
.section-title--sub { font-size: 15px; }
.precheck-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
}
.precheck-toggle input { cursor: pointer; }
.upload-advanced__hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  max-width: 64ch;
}
.queue-item[data-state="checking"] .queue-item__msg { display: flex; color: var(--text-muted); }

/* The Upload ⇄ My uploads subtab bar uses the shared .subtabs / .subtab
   component (app.css); see partials.html (#tabBtnUpload / #tabBtnMine). */

/* The "My uploads" tab is now rendered by the shared file-management component
   (file-list.js) styled via file-view.css; the old .mine-* list styles were
   removed with the migration (docs/architecture/file-management-view.md). */
