/* ─ Settings ─ */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 16px;
  border-radius: calc(var(--radius-lg) - 4px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  white-space: nowrap;
}

.settings-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.settings-tab.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.settings-section {
  margin-bottom: var(--space-5);
}

.settings-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--accent);
  margin-bottom: var(--space-2);
}

.settings-section-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Settings Sub-Section (Accordion) ──────────────────────────────────────
   Gruppiert verwandte Einstellungen innerhalb eines Tabs. Nutzt <details>
   fuer gratis Keyboard + ARIA. */
.settings-sub-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  overflow: hidden;
}

@keyframes settings-sub-section-flash {
  0%   { border-color: var(--border-subtle); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
  20%  { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
  100% { border-color: var(--border-subtle); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); }
}
.settings-sub-section--flash {
  animation: settings-sub-section-flash 1.4s ease-out;
}

.settings-sub-section-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 120ms ease;
}

.settings-sub-section-summary::-webkit-details-marker {
  display: none;
}

.settings-sub-section-summary:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.settings-sub-section-icon {
  display: inline-flex;
  color: var(--accent);
  flex-shrink: 0;
}

.settings-sub-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
}

.settings-sub-section-action {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.settings-sub-section-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.settings-sub-section[open] > .settings-sub-section-summary .settings-sub-section-chevron {
  transform: rotate(180deg);
}

.settings-sub-section-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  padding: 0 var(--space-3) var(--space-2);
}

.settings-sub-section-content {
  padding: var(--space-2) var(--space-3) var(--space-3);
}

/* Wenn das Accordion eine <section class="settings-section"> wrappt (Legacy-
   Content, der noch seine eigenen Header traegt), blenden wir den internen
   Section-Header aus — der Accordion-Summary uebernimmt dessen Rolle. */
.settings-sub-section-content > .settings-section {
  margin-bottom: 0;
}
.settings-sub-section-content > .settings-section > .settings-section-header {
  display: none;
}

/* ── Advanced Mode: Header-Toggle + Sub-Section Badge ──────────────────────
   Globaler Schalter im Settings-Header schaltet das Sichtbar-Werden aller
   <SettingsSubSection advanced> Bloecke um. Der Badge markiert die jeweilige
   Section nochmal optisch sobald sie eingeblendet ist. */
.settings-advanced-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: background 120ms ease;
  /* Lupe sitzt neben dem Titel; der Toggle wird durch auto-margin ans rechte
     Ende der Header-Zeile geschoben. */
  margin-left: auto;
}

.settings-advanced-toggle:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.settings-advanced-toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.settings-sub-section-advanced-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  flex-shrink: 0;
  margin-right: var(--space-2);
}

.settings-server-inline-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--text-on-accent);
  flex-shrink: 0;
}

.settings-server-inline-badge--positive {
  background: var(--positive);
  color: var(--text-on-accent, #111);
}

.settings-server-version-info-btn {
  padding: 2px;
  min-width: 20px;
  min-height: 20px;
  height: auto;
  line-height: 1;
  color: var(--text-muted);
  flex-shrink: 0;
  cursor: help;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.settings-server-use-active-slot {
  font-size: 12px;
  padding: 4px 10px;
  min-height: 28px;
  box-sizing: border-box;
}

button.settings-server-use-active-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

span.settings-server-use-active-slot {
  display: inline-flex;
  align-items: center;
}

/* ── In-Page-Suche fuer Settings ─────────────────────────────────────────── */
.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: 1.5rem;
  /* Fixiert die Zeilenhöhe so dass Lupen-Button vs. offenes Suchfeld
     die Zeile nicht 1–2 px nach unten verschieben können. */
  min-height: 40px;
}

.settings-header .page-title {
  margin-bottom: 0;
  line-height: 1;
}

.settings-search {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  /* h1.page-title hat im Display-Font einen visuellen Glyph-Mittelpunkt
     unterhalb der Box-Mitte. align-items: center wirkt deshalb so, als hänge
     die Lupe zu hoch. Wir verschieben sie auf die Glyph-Baseline runter. */
  align-self: end;
  padding-bottom: 6px;
}

.settings-search > .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: color 120ms ease, background 120ms ease;
}

.settings-search > .icon-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.settings-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 240px;
  height: 32px;
}

.settings-search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.settings-search-input {
  width: 100%;
  padding: 6px 32px;
  font-size: 13px;
}

.settings-search-clear {
  position: absolute;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.settings-search-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.settings-search-empty {
  padding: var(--space-3) var(--space-4);
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  text-align: center;
}

.settings-search-results {
  list-style: none;
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-search-result-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s, border-color 0.12s;
}
.settings-search-result-item:hover,
.settings-search-result-item[data-selected="true"] {
  background: var(--bg-hover);
  border-color: var(--border);
}
.settings-search-result-item[data-selected="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-hover));
}
.settings-search-result-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.settings-search-result-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Mitwirkende: Card-Grid mit klappbaren Beitragslisten ────────────────── */
.contributors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-2);
}

.contributor-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 120ms ease, background 120ms ease;
}

.contributor-card[open] {
  grid-column: 1 / -1;
  background: color-mix(in srgb, var(--accent) 4%, var(--bg-elevated));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border-subtle));
}

.contributor-card-summary {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.contributor-card-summary::-webkit-details-marker {
  display: none;
}

.contributor-card-summary:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.contributor-card-avatar {
  border-radius: 50%;
  flex-shrink: 0;
}

.contributor-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contributor-card-name {
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  width: fit-content;
}

.contributor-card-name:hover {
  text-decoration: underline;
}

.contributor-card-sub {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.contributor-card-since {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 99px;
  font-weight: 600;
}

.contributor-card-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 180ms ease;
}

.contributor-card[open] .contributor-card-chevron {
  transform: rotate(180deg);
}

.contributor-card-list {
  margin: 0;
  padding: 0 var(--space-3) var(--space-3) calc(var(--space-3) + 40px);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  list-style: none;
}
.contributor-card-list li {
  position: relative;
  padding-left: 14px;
}
.contributor-card-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
  line-height: 1.7;
}

/* Sub-headings inside the Contributors section (App / Themes). */
.contributors-subsection-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: var(--space-4) 0 var(--space-2);
}
.contributors-subsection-label:first-child {
  margin-top: 0;
}

/* ── Datenschutz-Hinweis-Banner (z.B. oben im Integrations-Tab) ──────────── */
.settings-privacy-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  color: var(--text-primary);
}

.settings-privacy-notice-icon {
  color: var(--warning);
  flex-shrink: 0;
  margin-top: 2px;
}

.settings-privacy-notice-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: var(--space-1);
}

.settings-privacy-notice-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.settings-privacy-notice-body strong {
  color: var(--text-primary);
  font-weight: 600;
}

.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
}

/* A card whose only content is one boxed group double-frames it (card border +
   group border). Collapse the card so single-group sections render just the
   group — matching the card-less subsections (e.g. Lyrics). Multi-group cards
   keep their frame as the grouping container. The flat Themes sections are
   excluded: not being inside an accordion, their card is the contrast surface. */
.settings-card:has(> .settings-group:only-child):not(.themes-section *) {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* Boxed sub-section panel inside a settings card — sets related controls
   apart as a distinct block (e.g. Normalization / Track transitions /
   Queue behaviour in the Playback card). */
.settings-group {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

.settings-group + .settings-group {
  margin-top: var(--space-3);
}

.settings-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.settings-group-title-icon {
  display: inline-flex;
  color: var(--accent);
}

/* Right-aligned slot in the group title row holding the optional Advanced
   badge and/or action (e.g. a reset button), in that order. */
.settings-group-title-end {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
}

.settings-group-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

/* Small consistent left inset for box content (the title/header stays flush
   at the box edge; the controls sit slightly indented for breathing room). */
.settings-group-body {
  padding-left: 10px;
}

.settings-card.user-row {
  transition: background 120ms ease, border-color 120ms ease;
}
.settings-card.user-row:hover {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-card));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-subtle));
}
.settings-card.user-row:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent);
}

.settings-hint {
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  line-height: 1.45;
}
.settings-hint-info {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--text-secondary);
}

/* Dim the non-toggle content of a settings row when its toggle is off.
 * `:not(:disabled)` excludes mutex-disabled toggles (e.g. Crossfade/Gapless)
 * whose row already carries an inline opacity — avoids dim-stacking. */
.settings-toggle-row:has(.toggle-switch input:not(:checked):not(:disabled)) > *:not(.toggle-switch),
.sidebar-customizer-row:has(.toggle-switch input:not(:checked):not(:disabled)) > *:not(.toggle-switch) {
  opacity: 0.6;
  transition: opacity 150ms ease;
}

