/* Catalog, Song Grade, song stats dialog and the artist area. Tokens come from app.css. */

/* ---------- Grade badge ---------- */

.grade-score { font-size: 14px; }
.grade[title] { cursor: help; }
.grade-early { border: 1px dashed var(--line-strong); color: var(--ink-2); }
.grade-note { display: block; font-size: 13px; line-height: 1.35; color: var(--ink-2); max-width: 46ch; }

/* The grade chip as a control that opens the song stats (Song Grade rows). */
.grade-open { display: inline-flex; align-items: center; min-height: 32px; padding: 0; border: 0; border-radius: var(--r1); background: none; font: inherit; color: inherit; cursor: pointer; }
.grade-open .grade { cursor: pointer; }
.grade-open:hover .grade { box-shadow: 0 0 0 1px var(--ink); }

/* ---------- Catalog table ---------- */

.catalog-table .icon-btn.is-on .icon { fill: currentColor; }
.catalog-table .icon-btn.is-on { color: var(--ink); }
.catalog-table .track { max-width: 340px; }
.catalog-listen { display: inline-block; margin: 2px 0 0 56px; color: var(--ink-2); }
.catalog-group { font-size: 18px; }
.catalog-count { font-family: var(--body); font-weight: 400; }

.status-cell { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.status { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r1); flex: none; }
.status-wait { color: var(--note); }
.status-ok { color: var(--good); }
.status-bad, .icon-btn.status-bad { color: var(--bad); }
.icon-btn.status-bad:hover:not(:disabled) { background: var(--bad-soft); color: var(--bad); }

/* ---------- Reader access (Spotify for Artists) ---------- */

.access-line { margin: 0; max-width: none; }
.access-title { font-size: 15px; }
.access-steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: var(--s2); }
.access-address { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-top: 6px; }
.access-email { padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: var(--r1); background: var(--sunken); font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.access-how { margin-top: 4px; }

/* ---------- Song picker ---------- */

.picker-empty { padding: var(--s3); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); margin: 0; }
.picker-star { display: inline-flex; color: var(--ink-2); }
.picker-star .icon { fill: currentColor; }
.picker-problem:empty, .form-error:empty { display: none; }
.picker-working { display: inline-flex; align-items: center; gap: var(--s2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.picker-working .spinner { width: 14px; height: 14px; }
button.list-item.is-working:disabled { opacity: 1; cursor: progress; background: var(--sunken); }

/* ---------- Genre picker ---------- */

.genre-list { max-height: 44vh; }
.genre-none { padding: var(--s3); margin: 0; }

/* ---------- Song stats dialog ---------- */

.songstats-head { display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.songstats-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.songstats-title { font: 600 20px/1.2 var(--display); font-stretch: 87%; text-decoration: none; overflow-wrap: anywhere; }
a.songstats-title:hover { text-decoration: underline; }
.songstats-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s2); flex: 0 1 300px; min-width: 0; }
.songstats-side .grade-note { text-align: right; }
.songstats-chart { display: flex; flex-direction: column; gap: var(--s3); min-height: 120px; }
.songstats-import { display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; padding-top: var(--s3); border-top: 1px solid var(--line); }
.songstats-import .grow { flex: 1 1 260px; }
.songstats-tabs { flex: none; }
.songstats-tabs button { flex: none; }
.songstats-desc { margin: 0; }
.songstats-sub { font-size: 15px; }
.songstats-sourcebox { padding-top: var(--s3); border-top: 1px solid var(--line); }
.songstats-sources td:first-child { overflow-wrap: anywhere; }
.budget .row { flex-wrap: nowrap; }
.budget-input { width: 120px; height: 30px; }
.modal-foot .grow { align-self: center; }

/* ---------- Song Grade genre groups ---------- */

.pool-title { font-size: 18px; min-width: 0; }
.pool-toggle { display: flex; align-items: center; gap: var(--s2); background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; text-align: left; min-width: 0; }
.pool-name { overflow-wrap: anywhere; }
.pool-count { font-family: var(--body); font-weight: 400; white-space: nowrap; }
.pool-empty { padding: var(--s3) var(--s4); margin: 0; }
.pool-hint { margin: 0; }
.pool-none { border-left: 3px solid var(--line-strong); }
.pool-note { display: flex; align-items: center; gap: var(--s2); margin: 0; padding: 10px var(--s4); background: var(--sunken); border-bottom: 1px solid var(--line); font-size: 14px; max-width: none; }

/* Every genre group uses the same column grid, so the tables line up under each other. */
.pool-table { table-layout: fixed; min-width: 900px; }
.pool-col-check { width: 44px; }
.pool-col-num { width: 44px; }
.pool-col-release { width: 140px; }
.pool-col-genre { width: 190px; }
.pool-col-pop { width: 96px; }
.pool-col-grade { width: 136px; }
.pool-col-stats { width: 56px; }
.pool-table th:first-child, .pool-table td:first-child { padding-left: 8px; padding-right: 4px; }
.pool-check { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; cursor: pointer; }
.pool-table input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ink); display: block; }
:root[data-theme="dark"] .pool-table input[type="checkbox"] { accent-color: var(--signal); }
.pool-basis { display: block; margin: 2px 0 0 56px; }
.pool-basis .grade-note { max-width: none; }
.pool-genre { max-width: 100%; }
.pool-genre-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.selection-bar { position: sticky; top: calc(var(--bar-h) + var(--s2)); z-index: 5; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: 10px var(--s3); background: var(--surface); border: 1px solid var(--ink); border-radius: var(--r2); }
.selection-bar strong { margin-right: var(--s2); }

/* ---------- Artist area ---------- */

.panel-title { font-size: 18px; margin-bottom: var(--s3); }
.panel-title-inline { font-size: 18px; }
.artist-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s4); align-items: start; }
.list-plain .list-item { padding-left: 0; padding-right: 0; }
.artist-table .track { max-width: 420px; }

.hero { display: flex; flex-direction: column; gap: var(--s4); }
.hero-head { display: flex; align-items: flex-start; gap: var(--s3); flex-wrap: wrap; }
.hero-text { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1 1 240px; min-width: 0; }
.hero-text h2 { overflow-wrap: anywhere; }
.hero-grade { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); flex: 0 1 320px; min-width: 0; }
.hero-grade .grade { height: 32px; padding: 0 12px; font-size: 15px; }
.hero-grade .grade-score { font-size: 18px; }
.hero-stats .stat-value { font-size: 24px; }
.hero-chart { min-height: 60px; }

.bench-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); }
.bench-row:last-child { border-bottom: 0; padding-bottom: 0; }

.artist-card { display: flex; align-items: flex-start; gap: var(--s3); }
.artist-card h2 { font-size: 18px; overflow-wrap: anywhere; }
.artist-card-text { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); }
.artist-results .list-item { padding-left: 12px; padding-right: 12px; }
.artist-results p { margin: 0; }

@media (max-width: 860px) {
  .artist-grid { grid-template-columns: minmax(0, 1fr); }
  .songstats-side { align-items: flex-start; flex-basis: 100%; }
  .songstats-side .grade-note { text-align: left; }
  .catalog-listen { margin-left: 0; }
  .artist-card { flex-wrap: wrap; }
  .selection-bar { top: calc(var(--bar-h) + 4px); }

  /* Phones: the key number stays on screen. Song plus popularity (catalog) or grade (Song Grade, artist catalog). */
  .catalog-table th, .catalog-table td, .artist-table th, .artist-table td { padding-left: 6px; padding-right: 6px; }
  .catalog-table .track { max-width: 132px; gap: 8px; }
  .artist-table .track { max-width: 168px; gap: 8px; }
  .pool-table { min-width: 0; }
  .pool-table th, .pool-table td { padding-left: 6px; padding-right: 6px; }
  .pool-table .track { gap: 8px; }
  .pool-col-grade { width: 118px; }
}
