/* Set-Detailseite (#/sets/:id). Alle Farben und Abstände aus tokens.css. */

.set-view {
  display: flex;
  flex-direction: column;
  gap: var(--s-7);
  min-width: 0;
}

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

.set-view .btn--small {
  min-height: var(--tap);
  padding: 0 var(--s-4);
  font-size: 13.5px;
}

/* Farbfelder: Datenfarben des Farbvertrags */
.swatch {
  display: inline-block;
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 3px;
}
.swatch--auto { background: var(--ok); }
.swatch--manual { background: var(--manual); }
.swatch--ai { background: var(--ai); }
.swatch--gap { background: var(--gap-hatch); }

/* ---------------------------------------------------------------------- Kopf */

.set-head {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) auto;
  gap: var(--s-6) var(--s-7);
  align-items: start;
}

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

.set-info { min-width: 0; }

.set-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  margin-bottom: var(--s-3);
}
.set-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
}
.set-meta__text { color: var(--text-muted); font-size: 14px; }

.set-title {
  font-size: 36px;
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.set-title:focus { outline: none; }

.set-dates {
  margin: var(--s-3) 0 var(--s-5);
  color: var(--text-muted);
  font-size: 14px;
}

.set-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.set-reprocess { display: flex; }

.set-feedback { margin-top: var(--s-3); }
.set-feedback:empty { display: none; }
.set-feedback__text { margin: 0; font-size: 14px; color: var(--text-muted); }
.set-feedback__text--error { color: var(--text); }
.set-feedback__text--error::before {
  content: "Error: ";
  font-weight: 600;
}

/* Fortschrittsanzeige anstelle des Reprocess-Knopfs */
.progress {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  font-weight: 500;
}
.progress__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--brand);
  transition: width 0.4s ease;
}
.progress__text { position: relative; }

/* Kennzahlen */
.set-stats { display: flex; gap: var(--s-3); }
.stat {
  min-width: 160px;
  padding: var(--s-4) 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.stat__label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat__value {
  margin-top: var(--s-1);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.15;
}
.stat__sub { color: var(--text-muted); font-size: 13px; }

/* -------------------------------------------------------------------- Timeline */

.timeline {
  padding: var(--s-6) 26px;
  background: var(--surface-timeline);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}

.timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-6);
}

.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: 13px;
}
.tl-legend__item { display: inline-flex; align-items: center; gap: var(--s-2); }

/* Bereich für den Tooltip */
.tl-tipzone {
  position: relative;
  height: 40px;
}
.tl-tip {
  position: absolute;
  bottom: var(--s-1);
  max-width: 100%;
  padding: 3px var(--s-3);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.25;
}
.tl-tip__name {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: 600;
}
.tl-tip__meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.tl-tip__meta .swatch { width: 9px; height: 9px; flex-basis: 9px; border-radius: 2px; }

/* Balken: der Grund ist die Schraffur, Blöcke liegen darauf */
.tl-bar {
  position: relative;
  height: 62px;
  background: var(--gap-hatch);
  border-radius: 8px;
}
.tl-block {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 3px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.12s ease;
}
.tl-block--auto { background: var(--ok); }
.tl-block--manual { background: var(--manual); }
.tl-block--ai { background: var(--ai); }

.tl-bar.is-hovering .tl-block:not(.is-active) { opacity: 0.55; }
.tl-block.is-active {
  z-index: 1;
  box-shadow: 0 0 0 2px var(--text);
}
.tl-block:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

/* Zeitlineal: sieben Marken, an ihrer Zeit ausgerichtet */
.tl-ruler {
  position: relative;
  height: 32px;
  margin-top: var(--s-2);
}
.tl-tick {
  position: absolute;
  top: 0;
  padding-top: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  transform: translateX(-50%);
}
.tl-tick::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 5px;
  background: var(--border-strong);
}
.tl-tick[data-pos="first"] { transform: none; }
.tl-tick[data-pos="first"]::before { left: 0; }
.tl-tick[data-pos="last"] { transform: translateX(-100%); }
.tl-tick[data-pos="last"]::before { left: auto; right: 0; }

.timeline__note {
  margin: var(--s-3) 0 0;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* -------------------------------------------------------------------- Tracklist */

.tracklist__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3) var(--s-6);
  margin-bottom: var(--s-4);
}

.seg {
  display: inline-flex;
  gap: var(--s-1);
  padding: var(--s-1);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg__btn {
  min-height: var(--tap);
  padding: 0 var(--s-4);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-pressed="true"] {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
  font-weight: 600;
}

.tl-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.tl-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 190px 92px;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  border-top: 1px solid var(--border);
  min-width: 0;
}
.tl-row--head {
  padding-top: var(--s-3);
  padding-bottom: var(--s-3);
  border-top: 0;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tl-rows > .tl-row:first-child { border-top: 1px solid var(--border); }
.tl-row.tl-row--head > * { font-size: 12px; color: inherit; }
.tl-row:focus { outline: none; }
.tl-row.is-flash { animation: row-flash 1.6s ease-out; }
@keyframes row-flash {
  0%, 55% { box-shadow: inset 0 0 0 2px var(--link); }
  100% { box-shadow: inset 0 0 0 2px transparent; }
}

.tl-row > * { min-width: 0; }
.c-time {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.time {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  white-space: nowrap;
}
.c-title { overflow-wrap: anywhere; }
.tl-name { font-weight: 500; }
.c-label { color: var(--text-muted); font-size: 14px; overflow-wrap: anywhere; }
.c-sets { text-align: right; font-variant-numeric: tabular-nums; }
.sets-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: var(--tap);
  min-height: var(--tap);
}
.sets-link__word { display: none; margin-left: 0.3em; }

/* Plakette für manuelle und KI-Einträge: Text, nicht nur Farbe */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: var(--s-2);
  padding: 2px 8px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: 1px;
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.tag--manual::before { background: var(--manual); }
.tag--ai::before { background: var(--ai); }

/* Lückenzeile */
.tl-row--gap { background: var(--surface-2); }
.c-gap { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-1) var(--s-3); }
.tl-gapdur { color: var(--text-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.c-actions {
  grid-column: 3 / 5;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
}

.tl-empty {
  margin: 0;
  padding: var(--s-6) var(--s-5);
  color: var(--text-muted);
  text-align: center;
}

/* ------------------------------------------------------------ Hinweise, Laden */

.set-notice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-6) 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}
.set-notice--error { border-color: var(--border-strong); }
.set-notice__title { font-size: 22px; }
.set-notice__title:focus { outline: none; }
.set-notice__text { margin: 0; max-width: 60ch; color: var(--text-muted); }

.sk {
  background: var(--surface-2);
  border-radius: var(--r-md);
  animation: sk-pulse 1.4s ease-in-out infinite;
}
@keyframes sk-pulse { 50% { opacity: 0.55; } }
.set-loading { display: flex; flex-direction: column; gap: var(--s-7); }
.set-head--sk { grid-template-columns: 168px minmax(0, 1fr); }
.sk--art { width: 168px; height: 168px; border-radius: var(--r-lg); }
.sk-col { display: flex; flex-direction: column; gap: var(--s-4); }
.sk--line { height: 16px; }
.sk--title { height: 40px; width: 80%; }
.sk--w40 { width: 40%; }
.sk--w60 { width: 60%; }
.sk--timeline { height: 200px; border-radius: var(--r-xl); }

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

@media (max-width: 1060px) {
  .set-head { grid-template-columns: 168px minmax(0, 1fr); }
  .set-stats { grid-column: 1 / -1; }
  .stat { flex: 1 1 0; }
}

@media (max-width: 640px) {
  .set-view { gap: var(--s-6); }
  .set-head { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  .set-head--sk { grid-template-columns: minmax(0, 1fr); }
  .set-title { font-size: 28px; }
  .set-stats { display: grid; grid-template-columns: 1fr 1fr; }
  .stat { min-width: 0; padding: var(--s-3) var(--s-4); }
  .stat__value { font-size: 26px; }
  .set-actions > .btn, .set-reprocess { flex: 1 1 auto; }
  .set-reprocess .btn, .progress { width: 100%; min-width: 0; }

  .timeline { padding: var(--s-4); }
  .tl-tick { font-size: 11px; }
}

/* Unter 480px passen sieben Zeitangaben nicht nebeneinander: jede zweite Marke
   behält ihren Strich, aber keine Zahl (das Lineal ist für Screenreader ohnehin
   ausgeblendet, die Blöcke tragen ihre Zeit im aria-label). */
@media (max-width: 480px) {
  .tl-tick:nth-child(even) { font-size: 0; }
}

@media (max-width: 640px) {

  .tracklist__head { align-items: stretch; }
  .seg { display: flex; width: 100%; }
  .seg__btn { flex: 1 1 0; padding: 0 var(--s-2); }

  /* Tabelle wird zu gestapelten Karten: Zeit, Titel, darunter Label und Zählung */
  .tl-table { background: transparent; border: 0; border-radius: 0; overflow: visible; }
  .tl-row--head { display: none; }
  .tl-rows { display: flex; flex-direction: column; gap: var(--s-3); }
  .tl-row, .tl-rows > .tl-row:first-child {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "time time"
      "title title"
      "label sets";
    gap: var(--s-2) var(--s-3);
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
  }
  .tl-row--gap, .tl-rows > .tl-row--gap:first-child {
    background: var(--surface-2);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "time" "gap" "actions";
  }
  .c-time { grid-area: time; }
  .c-title { grid-area: title; }
  .c-label { grid-area: label; }
  .c-sets { grid-area: sets; }
  .no-label .c-label { visibility: hidden; }
  .c-gap { grid-area: gap; }
  .c-actions { grid-area: actions; grid-column: auto; justify-content: flex-start; }
  .c-actions .btn { flex: 1 1 140px; }
  .sets-link { min-width: 0; }
  .sets-link__word { display: inline; }
}
