/* Sammeldatei / Programm-Picker. */

.collection-matrix-shell {
  border: var(--app-panel-border);
  border-radius: var(--app-panel-radius);
  background: var(--app-surface);
}

.collection-matrix-shell > .table-responsive {
  border-radius: 0 0 var(--app-panel-radius) var(--app-panel-radius);
}

.collection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0.75rem;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  border-radius: var(--app-panel-radius) var(--app-panel-radius) 0 0;
}

.collection-meta-line {
  flex: 1 1 auto;
  min-width: 0;
}

.collection-toolbar #collectionPickerRow {
  flex: 0 0 auto;
}

.collection-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  min-width: 0;
}

.collection-favorites-only {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  min-width: max-content;
  white-space: nowrap;
}

.collection-favorites-only .form-check-input {
  position: static;
  float: none;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.collection-favorites-only .form-check-label {
  cursor: pointer;
  font-size: 0.8125rem;
  color: var(--app-text);
}

.collection-favorites-only:has(:checked) .form-check-label {
  color: var(--app-primary);
  font-weight: 600;
}

.collection-types-filter {
  flex: 0 0 auto;
  max-width: 10rem;
}

@media (max-width: 768px) {
  .collection-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .collection-meta-line,
  .collection-toolbar #collectionPickerRow {
    flex: 1 1 100%;
  }

  .collection-controls {
    justify-content: stretch;
  }

  .collection-types-filter,
  .collection-programme-search.search-group,
  .collection-display-settings-dropdown,
  .collection-favorites-only {
    flex: 1 1 100%;
    width: 100%;
  }
}

/* Matrix: Programmzeilen × Typ-Spalten. */
.collection-matrix {
  /* Keep default compare-table sticky behavior intact. */
  overflow: visible;
}

.collection-clear-link:hover,
.collection-clear-link:focus-visible {
  color: var(--status-diff) !important;
}

.collection-matrix td,
.collection-matrix th {
  padding: 0.6rem 0.65rem;
  vertical-align: middle;
}

.collection-matrix .collection-matrix-programme {
  font-weight: 650;
  color: var(--app-text);
  white-space: nowrap;
  min-width: 28ch;
  max-width: none;
}

.collection-matrix-programme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.collection-cell-filtered-empty {
  color: var(--app-muted);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
  vertical-align: middle;
  background: rgba(26, 35, 50, 0.025);
  white-space: normal;
}

.collection-matrix-row--types-hidden:hover .collection-cell-filtered-empty {
  background: rgba(26, 35, 50, 0.04);
}

.collection-programme-favorite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin-left: auto;
  padding: 0;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--app-muted);
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.collection-programme-favorite:hover,
.collection-programme-favorite:focus-visible {
  color: var(--app-primary);
  background: var(--app-primary-light);
}

.collection-programme-favorite.is-favorite {
  color: var(--app-primary);
}

.collection-programme-label {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}

.collection-matrix-programme--favorite .collection-programme-label {
  font-weight: 650;
}

.collection-matrix thead th.collection-matrix-programme-head,
.collection-matrix thead th.sticky-col-uid {
  min-width: 28ch;
  max-width: none;
  font-family: inherit;
  text-align: left;
  vertical-align: middle;
}

.collection-matrix .collection-cell {
  cursor: pointer;
  text-align: center;
}

.collection-matrix .collection-cell.is-selected {
  background: var(--app-primary-light);
  box-shadow: inset 0 0 0 1px rgba(30, 90, 138, 0.25);
}

.collection-matrix .collection-cell .badge {
  font-variant-numeric: tabular-nums;
}

.collection-matrix .collection-cell-empty {
  color: var(--app-muted);
  text-align: center;
}

/* Sticky header + first column (programme) */
.collection-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  background-color: var(--app-table-head-fill);
  color: var(--app-table-head-text);
}

.collection-matrix thead th:first-child,
.collection-matrix thead th.sticky-col-uid {
  left: 0;
  z-index: 7;
}

.collection-matrix tbody th {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--app-surface);
  box-shadow:
    inset 0 0 0 9999px var(--bs-table-bg-state, transparent),
    2px 0 4px -2px rgba(26, 35, 50, 0.1);
}

/* Wie compare-table: Zeile + ganze Spalte. */
.collection-matrix.table-hover > tbody > tr:hover > * {
  --bs-table-bg-state: var(--compare-row-hover-bg);
}
