/* =====================================================================
   Sorbflix-Steuerelemente fuer Steuerzentrale (Admin), Studio und Live-Konsole.
   Vorlage: apps/web/styles.css (Redesign 0.15.0): eine Schrift (Schibsted Grotesk),
   dunkle Flaechen, Weiss als Akzent, Rot nur fuer Marke und Live.

   Eingebunden NACH dem jeweiligen App-Stylesheet und VOR live-console.css
   (apps/admin/index.html, apps/studio/index.html; ?v= in beiden gemeinsam erhoehen).
   Gestaltet bestehende Klassen (btn-primary, btn-ghost, btn-danger, filter-pill,
   checkbox-row ...), damit kein Markup-Umbau noetig ist. Ein/Aus-Einstellungen
   bekommen input[type=checkbox][role=switch].
   ===================================================================== */

/* Schibsted Grotesk (OFL, /fonts/OFL.txt); latin-ext traegt die sorbischen Buchstaben. */
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/schibsted-grotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Schibsted Grotesk';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/schibsted-grotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  /* Flaechen wie apps/web/styles.css */
  --bg: #0b0b0d;
  --bg-2: #111114;
  --surface: #18181b;
  --surface-2: #27272a;
  --panel: #18181b;
  --line: rgba(244,244,245,0.08);
  --line-strong: rgba(244,244,245,0.18);
  /* Feldrahmen mit mindestens 3:1 gegen Flaeche und Grund (WCAG 1.4.11) */
  --field-bg: #111114;
  --field-line: #6b6b74;
  --field-line-hover: #8a8a93;

  --text: #f4f4f5;
  --muted: #a1a1aa;
  --muted-2: #8a8a93;

  /* Rot nur fuer Marke und Live; --live ist dunkler, damit weisse Schrift 6:1 erreicht. */
  --red: #e5483b;
  --live: #b3372b;
  --live-deep: #9a2e24;
  --accent: #f4f4f5;
  --accent-deep: #d4d4d8;
  --accent-ink: #0b0b0d;
  --accent-soft: rgba(244,244,245,0.12);
  --danger: #ff6a78;
  --danger-soft: rgba(255,106,120,0.14);
  --danger-line: rgba(255,106,120,0.45);
  --ok: #4ade80;
  --success: #4ade80;
  --warn: #f0b95a;

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-ctl: 6px;
  --shadow-pop: 0 30px 60px -20px rgba(0,0,0,0.7);
  --ring: #fff;

  --display: 'Schibsted Grotesk', system-ui, sans-serif;
  --sans: 'Schibsted Grotesk', system-ui, sans-serif;
  --mono: 'SF Mono', 'JetBrains Mono', Menlo, Monaco, 'Courier New', monospace;
}

html, body { background: var(--bg); color: var(--text); font-family: var(--sans); }
button, input, select, textarea { font-family: var(--sans); }

/* Sichtbarer Fokus fuer alles Bedienbare (wie die oeffentliche Seite). */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Knoepfe: eine Familie, 6px Radius, 40px hoch (klein 32px), 14px/600
   --------------------------------------------------------------------- */
.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-live {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 18px;
  border: 1px solid transparent; border-radius: var(--radius-ctl);
  font-family: var(--sans); font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: 0.01em;
  text-align: center; text-decoration: none; cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn { background: rgba(244,244,245,0.08); border-color: var(--line); color: var(--text); }
.btn:hover:not(:disabled) { background: rgba(244,244,245,0.14); border-color: var(--line-strong); }
.btn-primary { background: #fff; border-color: #fff; color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: #e4e4e7; border-color: #e4e4e7; }
.btn-ghost { background: rgba(244,244,245,0.08); border-color: var(--line); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: rgba(244,244,245,0.14); border-color: var(--line-strong); }
.btn-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(255,106,120,0.24); }
.btn-live { background: var(--live); border-color: var(--live); color: #fff; }
.btn-live:hover:not(:disabled) { background: var(--live-deep); border-color: var(--live-deep); }
.btn-sm, .btn-small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
a.btn, a.btn-primary, a.btn-ghost, a.btn-danger, a.filter-pill { text-decoration: none; }

/* Chips wie .chip der oeffentlichen Seite; aktiv invertiert. */
.filter-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 6px 16px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 500; letter-spacing: 0.02em; line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
/* Aktive Chips behalten beim Ueberfahren Flaeche und Schrift (sonst weiss auf weiss). */
.filter-pill:hover:not(:disabled, .active, [aria-pressed="true"]) { color: var(--text); border-color: rgba(244,244,245,0.34); }
.filter-pill.active, .filter-pill[aria-pressed="true"] {
  background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600;
}
.filter-pill.active .count, .filter-pill[aria-pressed="true"] .count { color: inherit; opacity: 0.7; }

/* Kleine Entfernen-/Loeschen-/Sperren-Knoepfe in Listen und Tabellen: wie .btn-danger.btn-sm */
.asset-unlink {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 4px 12px;
  border: 1px solid var(--danger-line); border-radius: var(--radius-ctl);
  background: var(--danger-soft); color: var(--danger);
  font-family: var(--sans); font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.asset-unlink:hover:not(:disabled) { background: rgba(255,106,120,0.24); }

/* Gesperrt: einheitlich, ohne Hover und Bewegung. */
:is(.btn, .btn-primary, .btn-ghost, .btn-danger, .btn-live, .filter-pill, .asset-unlink):is(:disabled, [aria-disabled="true"]) {
  opacity: 0.45; cursor: not-allowed; box-shadow: none; transform: none;
}

/* ---------------------------------------------------------------------
   Text-, Such-, Datums- und Zahlenfelder, Auswahlfelder, Textbereiche.
   :where() haelt die Spezifitaet bei 0, damit gezielte Regeln gewinnen.
   --------------------------------------------------------------------- */
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="color"], [type="range"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"]), select, textarea) {
  box-sizing: border-box;
  min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--field-line); border-radius: var(--radius-ctl);
  background-color: var(--field-bg); color: var(--text);
  font-family: var(--sans); font-size: 14px; line-height: 1.4;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
/* Wert in Fliesstextgroesse und -farbe: Elementspezifitaet (0,0,1), spaeter geladen als der Reset
   `font: inherit; color: inherit` der App-Stylesheets; sonst erbt das Feld Grau und Groesse des Labels
   und sieht aus wie ein Platzhalter. Regeln mit Klasse (z. B. .i18n-cell textarea) gewinnen weiter. */
input:where(:not([type="checkbox"], [type="radio"], [type="file"], [type="color"], [type="range"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"])), select, textarea {
  color: var(--text); font-size: 14px; font-weight: 400; line-height: 1.4;
}
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="color"], [type="range"]), select, textarea):where(:hover:not(:disabled, [readonly])) {
  border-color: var(--field-line-hover);
}
:where(input:not([type="checkbox"], [type="radio"], [type="file"], [type="color"], [type="range"]), select, textarea):where(:focus) {
  border-color: var(--text);
}
:where(input, select, textarea):where(:disabled) { opacity: 0.55; cursor: not-allowed; }
:where(input, textarea)::placeholder { color: var(--muted-2); opacity: 1; }
:where(textarea) { resize: vertical; }
/* Auswahlfeld mit eigenem Pfeil */
:where(select:not([multiple], [size])) {
  appearance: none; -webkit-appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23a1a1aa' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px;
  text-overflow: ellipsis;
  cursor: pointer;
}
:where(select) :where(option, optgroup) { background: var(--surface); color: var(--text); }
:where(input)::-webkit-calendar-picker-indicator { opacity: 0.8; cursor: pointer; }

/* ---------------------------------------------------------------------
   Checkbox, Radio, Schalter: eigene Gestaltung statt nativ grau/blau.
   Angekreuzt weiss gefuellt wie aktive Chips; Radio mit klarem Punkt.
   --------------------------------------------------------------------- */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none;
  box-sizing: border-box; flex: 0 0 auto;
  width: 20px; height: 20px; margin: 0; padding: 0;
  border: 2px solid var(--field-line); border-radius: 5px;
  background: var(--field-bg) no-repeat center;
  vertical-align: middle; cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]:hover:not(:disabled), input[type="radio"]:hover:not(:disabled) { border-color: var(--field-line-hover); }
input[type="checkbox"]:checked {
  background-color: var(--accent); border-color: var(--accent);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%230b0b0d' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 14px 14px;
}
input[type="checkbox"]:indeterminate {
  background-color: var(--accent); border-color: var(--accent);
  background-image: linear-gradient(var(--accent-ink), var(--accent-ink));
  background-size: 10px 2px;
}
input[type="radio"]:checked {
  border-color: var(--accent);
  background-image: radial-gradient(circle, var(--accent) 0 4.5px, transparent 5px);
}
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: 0.45; cursor: not-allowed; }

/* Schalter fuer Ein/Aus-Einstellungen: Knopf links grau = aus, rechts auf Weiss = an. */
input[type="checkbox"][role="switch"] {
  width: 40px; height: 24px; border-radius: 999px;
  background: var(--field-bg) radial-gradient(circle at 10px 50%, var(--muted) 0 6.5px, transparent 7px) no-repeat;
}
input[type="checkbox"][role="switch"]:checked {
  border-color: var(--accent);
  background: var(--accent) radial-gradient(circle at calc(100% - 10px) 50%, var(--accent-ink) 0 6.5px, transparent 7px) no-repeat;
}

/* Zeile mit Checkbox oder Schalter: ganze Zeile klickbar, Fokusring auf der Zeile. */
.checkbox-row {
  display: flex; flex-direction: row; align-items: center; gap: 12px;
  min-height: 44px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: transparent; color: var(--text);
  font-size: 14px; letter-spacing: 0; cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.checkbox-row:hover { border-color: var(--line-strong); }
.checkbox-row > span { color: var(--text); font-size: 14px; font-weight: 500; }
.checkbox-row:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.checkbox-row:has(input:focus-visible) input { outline: none; }
.checkbox-row:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }

/* Auswahlkarten fuer Radio-Gruppen (z. B. Sichtbarkeit in der Live-Konsole) */
.choice-group { border: 0; margin: 0; padding: 0; min-width: 0; }
.choice-group > legend { padding: 0; margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: 0.02em; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.choice-card {
  display: flex; align-items: flex-start; gap: 12px;
  min-height: 44px; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-md);
  background: transparent; color: var(--text); cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.choice-card:hover { border-color: rgba(244,244,245,0.34); }
.choice-card:has(input:checked) { border-color: var(--accent); background: rgba(244,244,245,0.07); }
.choice-card:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.choice-card:has(input:focus-visible) input { outline: none; }
.choice-card input { margin-top: 1px; }
.choice-card > span { display: grid; gap: 3px; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.3; color: var(--text); }
.choice-card > span small { font-size: 12.5px; font-weight: 400; color: var(--muted); }
@media (max-width: 520px) { .choice-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------------
   Akkordeons (details/summary): 44px hoch, Pfeil statt Browser-Dreieck
   --------------------------------------------------------------------- */
.live-sec > summary, .live-guide > summary, .bug-detail-section > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; list-style: none; cursor: pointer; font-weight: 600;
}
.live-sec > summary::-webkit-details-marker, .live-guide > summary::-webkit-details-marker, .bug-detail-section > summary::-webkit-details-marker { display: none; }
.live-sec > summary::after, .live-guide > summary::after, .bug-detail-section > summary::after {
  content: ''; flex: none; width: 8px; height: 8px; margin-right: 4px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg); transition: transform 0.15s ease;
}
.live-sec[open] > summary::after, .live-guide[open] > summary::after, .bug-detail-section[open] > summary::after {
  transform: translateY(2px) rotate(-135deg);
}
.live-sec > summary:focus-visible, .live-guide > summary:focus-visible, .bug-detail-section > summary:focus-visible {
  outline: 2px solid var(--ring); outline-offset: -2px; border-radius: var(--radius-md);
}

/* Hinweiszeilen ohne Text nehmen keinen Platz weg (Live-Regionen bleiben im Baum). */
.field-hint:empty:not([role]) { display: none; }

/* Weniger Bewegung, wenn im System eingestellt. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .item-card:hover { transform: none !important; }
}
