/* Katalog-Ansichten: Set-Liste, Track mit Rückwärtssuche, Suche, Artist-Profil,
   Submit und Login. Alle Farben und Abstände aus tokens.css — keine Festfarben.
   Gemeinsame Bausteine (.btn, .badge, .chip, .stat, .progress) kommen aus
   app.css und set.css und werden hier nur ergänzt. */

.page {
  display: flex;
  flex-direction: column;
  gap: var(--s-6);
  min-width: 0;
}
.page--narrow { max-width: 440px; }

.page .btn:disabled {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.page__more { display: flex; justify-content: center; }

/* ------------------------------------------------- Abschnitte und Zustände */

.section {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  min-width: 0;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s-2) var(--s-3);
}
.section__count { color: var(--text-muted); font-size: 13px; }

.state-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-6) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.state-card--error { border-color: var(--border-strong); }
.state-card__title { font-size: 19px; }
.state-card__text { margin: 0; max-width: 60ch; color: var(--text-muted); }
.state-card__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.load-state { display: flex; flex-direction: column; gap: var(--s-3); }
.load-state .sk--row {
  height: 76px;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  animation: sk-pulse 1.4s ease-in-out infinite;
}

/* Neutrale und gescheiterte Zustände: Punkt ohne Datenfarbe, der Text trägt
   die Bedeutung (Farbvertrag gilt nur für erkannt / manuell / KI / Lücke). */
.badge--neutral .badge__dot { background: var(--text-muted); }
.badge--failed { border-color: var(--border-strong); }
.badge--failed .badge__dot {
  background: transparent;
  border: 2px solid var(--text-muted);
}

/* ------------------------------------------------------------------ Artwork */

.art {
  flex: 0 0 auto;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
}
.art__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.art__ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--brand-weak), var(--surface-3) 60%, var(--surface));
}

/* ------------------------------------------------------- Fortschrittsring */

.ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
}
.ring__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* 0 % beginnt oben, nicht rechts */
  transform: rotate(-90deg);
}
.ring__track { fill: none; stroke: var(--border-strong); stroke-width: 5; }
.ring__fill {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.4s ease;
}
.ring__svg--ok .ring__fill { stroke: var(--ok); }
.ring__svg--ai .ring__fill { stroke: var(--ai); }
.ring__value {
  position: relative;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- Set-Zeilen */

.set-rows { display: flex; flex-direction: column; gap: var(--s-3); }

.set-row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
}
.set-row:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  text-decoration: none;
}
.set-row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.set-row__title {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.set-row__meta { color: var(--text-muted); font-size: 13.5px; overflow-wrap: anywhere; }
.set-row__side {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex: 0 0 auto;
}

/* ------------------------------------------------------------ Track-Ansicht */

.track-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-5) var(--s-6);
  align-items: start;
  padding: var(--s-6) 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.track-card__main { min-width: 0; }
.track-artist { margin: 0; color: var(--text-muted); font-size: 14px; }
.track-title {
  margin: var(--s-1) 0 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.track-title:focus { outline: none; }
.track-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.track-stats { display: flex; gap: var(--s-3); }

/* Fundstellen */
.occ-rows { display: flex; flex-direction: column; gap: var(--s-3); }

.occ {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 220px;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
}
.occ:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  text-decoration: none;
}
.occ__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.occ__title {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.occ__meta { color: var(--text-muted); font-size: 13.5px; overflow-wrap: anywhere; }
.occ__mini { min-width: 0; }

/* Mini-Timeline: Schraffur als Grund, Marker an start_sec / duration_sec */
.mini { display: flex; flex-direction: column; gap: var(--s-1); min-width: 0; }
.mini__bar {
  position: relative;
  height: 8px;
  background: var(--gap-hatch);
  border-radius: 4px;
}
.mini__marker {
  position: absolute;
  top: -1px;
  width: 10px;
  height: 10px;
  background: var(--ok);
  border-radius: 3px;
}
.mini__labels {
  display: flex;
  justify-content: space-between;
  gap: var(--s-2);
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.mini__found { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------- Suche */

.search-form { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.search-form input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
}

.hit-list { display: flex; flex-direction: column; gap: var(--s-2); margin: 0; padding: 0; list-style: none; }
.hit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2) var(--s-4);
  min-height: var(--tap);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
}
.hit:hover { background: var(--surface-2); border-color: var(--border-strong); text-decoration: none; }
.hit__label { font-weight: 500; overflow-wrap: anywhere; }
.hit__meta { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

/* ------------------------------------------------------------ Artist-Profil */

.artist-head { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: end; }
.artist-kicker {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.artist-name {
  margin: var(--s-1) 0 0;
  font-size: 34px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.artist-name:focus { outline: none; }
.artist-meta { margin: var(--s-2) 0 0; color: var(--text-muted); }

.top-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.top-item {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-2) var(--s-4);
  border-top: 1px solid var(--border);
}
.top-item:first-child { border-top: 0; }
.top-item__rank {
  flex: 0 0 24px;
  color: var(--text-muted);
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.top-item__link {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-height: var(--tap);
  min-width: 0;
  overflow-wrap: anywhere;
}
.top-item__count { flex: 0 0 auto; color: var(--text-muted); font-size: 13px; white-space: nowrap; }

/* ------------------------------------------------------------------ Submit */

.submit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s-7);
  align-items: start;
}
.submit-col { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.submit-col--queue {
  padding: var(--s-5) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.submit-intro { margin: 0; max-width: 60ch; color: var(--text-muted); }

.submit-form, .field { display: flex; flex-direction: column; gap: var(--s-2); }
.field__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field__row { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.field__row input, .login-form input {
  flex: 1 1 240px;
  min-width: 0;
  min-height: var(--tap);
  padding: 0 var(--s-3);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
}

.preview {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
}
.preview__head { display: flex; gap: var(--s-4); align-items: flex-start; }
.preview__main { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-2); min-width: 0; }
.preview__title {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 17px;
  overflow-wrap: anywhere;
}
.preview__meta { margin: 0; color: var(--text-muted); font-size: 13.5px; overflow-wrap: anywhere; }

.check { display: flex; align-items: center; gap: var(--s-3); min-height: var(--tap); }
.check input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: var(--brand);
}
.check label { font-size: 14px; }

.submit-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); }

.note {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
}
.note__text { margin: 0; }
.note__text--error::before, .note--error .note__text::before {
  content: "Error: ";
  font-weight: 600;
}

.platforms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
}
.platforms__label { font-weight: 600; }

.queue-list { display: flex; flex-direction: column; gap: var(--s-4); margin: 0; padding: 0; list-style: none; }
.queue-item { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.queue-item__title {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.queue-item__meta { color: var(--text-muted); font-size: 13px; overflow-wrap: anywhere; }
.queue-item .progress { min-width: 0; width: 100%; font-size: 13px; }
.queue-note { margin: 0; color: var(--text-dim); font-size: 12.5px; }

/* ------------------------------------------------------------------- Login */

.login-card {
  padding: var(--s-6) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.login-form { display: flex; flex-direction: column; gap: var(--s-4); }
.login-actions { display: flex; }
.login-actions .btn { flex: 1 1 auto; }
.login-feedback:empty { display: none; }
.login-hint { margin: var(--s-4) 0 0; color: var(--text-muted); font-size: 13px; }

/* ------------------------------------------------------------------- Schmal */

@media (max-width: 960px) {
  .submit-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .occ { grid-template-columns: auto minmax(0, 1fr); }
  .occ__mini { grid-column: 1 / -1; }
  .track-card { grid-template-columns: minmax(0, 1fr); padding: var(--s-5) var(--s-4); }
  .track-stats > .stat { flex: 1 1 0; min-width: 0; }
}

@media (max-width: 640px) {
  .set-row {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .set-row__main { flex: 1 1 100%; order: 2; }
  .set-row__side { order: 1; margin-left: auto; }
  .artist-name { font-size: 26px; }
  .track-title { font-size: 23px; }
  .track-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
  .track-stats .stat { padding: var(--s-3) var(--s-4); }
  .track-stats .stat__value { font-size: 24px; }
  .submit-actions .btn, .search-form .btn { flex: 1 1 auto; }
}
