/* ================ LIVE (Phase 8) ================ */
/* Gemeinsam fuer Admin und Studio (.studio-live). Knoepfe, Felder, Checkboxen, Schalter,
   Auswahlkarten und Akkordeons kommen aus serboflix-controls.css; hier nur die Konsole. */
.live-disabled { padding: 18px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-md, 10px); color: var(--muted); }
.live-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.live-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.live-newform { max-width: 560px; padding: 16px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--radius-md, 10px); background: var(--surface); }
.live-inline-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.live-empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-md, 10px); }
.live-rows { display: grid; gap: 6px; }
.live-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto 130px 130px; align-items: center; gap: 14px;
  padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: var(--radius-md, 10px);
  background: var(--surface); color: var(--text); text-align: left; font-family: inherit; font-size: 14px; cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}
.live-row:hover { background: var(--surface-2); border-color: var(--line-strong); }
.live-thumb { display: block; width: 96px; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,0.05); }
.live-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.live-thumb-ph { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)); }
.live-thumb-ph.big { width: 160px; height: 90px; border-radius: 6px; flex-shrink: 0; }
.live-row-main { display: grid; gap: 2px; min-width: 0; }
.live-row-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-row-main small, .live-row-viewers, .live-row-provider { color: var(--muted); font-size: 0.82rem; }

/* Status-Chips; LIVE wie .live-badge der Zuschauerseite: weiss mit rotem Punkt */
.live-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap;
  background: rgba(244,244,245,0.1); color: var(--muted);
}
.live-chip.is-big { padding: 6px 14px; font-size: 0.86rem; }
.live-chip-scheduled { background: rgba(96,150,255,0.16); color: #9cc0ff; }
.live-chip-preview { background: rgba(255,200,40,0.16); color: #ffd25a; }
.live-chip-live { background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.live-chip-processing { background: rgba(255,150,40,0.18); color: #ffb062; }
.live-chip-archived { background: rgba(74,222,128,0.14); color: var(--ok, #4ade80); }
.live-chip-error { background: var(--danger-soft, rgba(255,106,120,0.16)); color: var(--danger); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red, #e5483b); animation: live-pulse 1.4s ease-in-out infinite; }
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.live-event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; }
.live-event-title { margin: 0; font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.02em; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.live-provider-tag { color: var(--muted); font-size: 0.82rem; }
.live-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1000px) { .live-cols { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.live-col-left { min-width: 0; }
.live-signal {
  display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; padding: 12px 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--radius-md, 10px); background: var(--surface);
}
.live-signal-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.live-signal-state.is-warn { color: var(--warn, #f0b95a); }
.live-sigdot { width: 10px; height: 10px; border-radius: 50%; background: #71717a; display: inline-block; }
.live-sigdot.is-on { background: var(--ok, #4ade80); box-shadow: 0 0 8px rgba(74,222,128,0.6); }
.live-stat { display: grid; gap: 1px; min-width: 0; }
.live-stat small { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; }
.live-stat b { font-variant-numeric: tabular-nums; font-weight: 600; }
.live-player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius-md, 10px); overflow: hidden; border: 1px solid var(--line); }
.live-player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.live-player-ph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--muted); }
.live-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 14px; }
/* "Event beenden" rechts abgesetzt, nicht an der Stelle von "Live schalten" */
.live-actions #liveEndBtn { margin-left: auto; }
.live-golive {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border: 1px solid transparent; border-radius: var(--radius-ctl, 6px);
  background: var(--live, #b3372b); color: #fff;
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer;
  transition: background-color 0.15s ease;
}
.live-golive:hover:not(:disabled) { background: var(--live-deep, #9a2e24); }
.live-golive:disabled { opacity: 0.45; cursor: not-allowed; }
.live-golive[hidden] { display: none; }

.live-col-right { display: grid; gap: 10px; min-width: 0; }
.live-sec { border: 1px solid var(--line); border-radius: var(--radius-md, 10px); background: var(--surface); min-width: 0; }
.live-sec > summary { padding: 0 16px; }
/* Abschnittsbreite statt Fensterbreite entscheidet ueber Umbrueche (Tonspuren, Auswahlkarten). */
.live-sec-body { padding: 2px 16px 16px; display: grid; gap: 12px; container-type: inline-size; min-width: 0; }
.live-form.editor-form { padding: 0; }
.live-kv { display: grid; gap: 6px; }
.live-kv > span { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.live-copyrow { display: flex; flex-wrap: wrap; gap: 8px; }
.live-copyrow input { flex: 1 1 180px; min-width: 0; font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 0.85rem; }
.live-key[data-shown="0"] { letter-spacing: 0.12em; }
.live-obs { border-collapse: collapse; font-size: 0.85rem; width: 100%; }
.live-obs caption { text-align: left; color: var(--muted); font-size: 0.8rem; padding-bottom: 6px; }
.live-obs th, .live-obs td { padding: 6px 8px; border-top: 1px solid var(--line); text-align: left; }
.live-obs th { color: var(--muted); font-size: 12px; font-weight: 600; width: 45%; }
.live-thumbbox { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.live-thumbbox img { width: 160px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.live-chat { display: grid; gap: 6px; max-height: 360px; overflow-y: auto; }
.live-chat-msg { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }
.live-chat-msg p { margin: 2px 0 0; overflow-wrap: anywhere; }
.live-chat-msg small { color: var(--muted); }
.live-rec-status { margin: 0; line-height: 1.3; }

/* Sichtbarkeit: Auswahlkarten (choice-group/choice-card aus serboflix-controls.css) */
.live-choice .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (max-width: 520px) { .live-choice .choice-grid { grid-template-columns: minmax(0, 1fr); } }

/* Meldungen unten mittig (rechts unten liegt der Feedback-Knopf); Fehler in eigener role=alert-Region */
.live-toasts {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: grid; gap: 8px; justify-items: center; z-index: 260; width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.live-toast-region { display: grid; gap: 8px; justify-items: center; }
.live-toast {
  padding: 12px 18px; border-radius: var(--radius-md, 10px); background: var(--surface-2); color: var(--text);
  border: 1px solid var(--line-strong); box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  max-width: min(440px, calc(100vw - 32px)); font-size: 14px; font-weight: 500; pointer-events: auto;
}
.live-toast.is-error { border-color: var(--danger-line, rgba(255,106,120,0.45)); color: var(--danger); }
.live-toast.is-success { border-color: rgba(74,222,128,0.4); }
.live-note-warn {
  margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-md, 10px);
  background: rgba(240,185,90,0.12); border: 1px solid rgba(240,185,90,0.35); color: var(--warn, #f0b95a); font-size: 14px;
}
@media (max-width: 760px) {
  .live-row { grid-template-columns: 72px minmax(0, 1fr) auto; }
  .live-row-viewers, .live-row-provider { display: none; }
  .live-thumb { width: 72px; }
}
@media (max-width: 640px) {
  .live-event-head > [data-live-action="back"] { order: 0; }
  .live-event-title { order: 2; flex-basis: 100%; font-size: 1.25rem; }
  #liveStatusChip { order: 1; }
  .live-provider-tag { order: 3; }
  .live-signal { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px 14px; }
  .live-signal-state { grid-column: 1 / -1; }
  .live-actions #liveEndBtn { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* ---- Tonspuren, SRT-Anleitung, Spur abhoeren (Live-Studio) ---- */
.live-tracks { display: grid; gap: 8px; }
/* Zwei Zeilen: Sprache ueber die volle Breite (Namen wie "Hornjoserbsce (Obersorbisch)" brauchen
   rund 220px), darunter Name im Player und die Knoepfe. Eine Zeile erst ab 680px Abschnittsbreite. */
.live-track {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-areas: "num lang lang" ". name btns";
  gap: 6px 8px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.live-track > span:first-child { grid-area: num; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.live-track select { grid-area: lang; }
.live-track input { grid-area: name; }
.live-track select, .live-track input { min-width: 0; width: 100%; }
.live-track-btns { grid-area: btns; display: flex; gap: 4px; }
.live-track-btns button { min-width: 36px; min-height: 36px; padding: 0 8px; }
.live-track-btns .btn-danger { margin-left: 6px; }
@container (min-width: 680px) {
  .live-track {
    grid-template-columns: 56px minmax(0, 1fr) minmax(0, 1fr) auto;
    grid-template-areas: "num lang name btns";
    padding-bottom: 0; border-bottom: 0;
  }
}
@media (max-width: 760px) { .live-track-btns button { min-width: 40px; min-height: 40px; } }
.live-guide { border: 1px solid var(--line); border-radius: var(--radius-md, 10px); padding: 0 12px; }
.live-guide > summary { padding: 0; }
.live-guide ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 6px; font-size: 0.88rem; line-height: 1.45; }
.live-guide code { font-family: var(--mono, ui-monospace, Menlo, monospace); font-size: 0.82rem; background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 4px; }
.live-stat.is-warn b { color: var(--warn, #f0b95a); }
.live-monitor { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; font-size: 0.88rem; }
.live-monitor select { min-width: 0; max-width: 100%; }
.live-subhead { margin: 4px 0 0; font-size: 0.82rem; color: var(--muted); font-weight: 600; letter-spacing: 0.03em; }

/* ---- Studio: Grundbausteine, die das Admin-Stylesheet sonst liefert (nur innerhalb .studio-live) ---- */
.studio-live .field-hint { margin: 0; color: var(--muted); font-size: 0.82rem; }
.studio-live .field-hint.is-error { color: var(--danger); }
.studio-live .editor-form { display: grid; gap: 12px; }
.studio-live .editor-form label:not(.checkbox-row, .choice-card) { display: grid; gap: 6px; font-size: 0.85rem; color: var(--muted); }
.studio-live .editor-form label:not(.checkbox-row, .choice-card) > span:first-child { font-weight: 600; }
.studio-live .editor-form :is(input:not([type="checkbox"], [type="radio"], [type="file"]), textarea, select) { width: 100%; }

/* Das Admin-Stylesheet zieht .field-hint im Editor unter das vorige Feld; in der Konsole
   stehen Hinweise frei im Raster und wuerden sonst die Zeile darueber ueberdecken. */
.live-event .field-hint, .live-sec-body > .field-hint, .live-sec-body > p, .live-newform > .field-hint { margin: 0; }


/* ---- Stream-Health (Ampel, Gruende, Bitrate-Kurve, Kennzahlen) ---- */
.live-health { margin: 0 0 12px; padding: 12px 16px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); display: grid; gap: 10px; }
.live-health-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.live-health-head h4 { margin: 0; font-size: 0.9rem; font-weight: 600; }
.live-health-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }
.live-health-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.live-health-badge.is-ok { background: rgba(61, 220, 132, 0.14); color: #5fe39a; }
.live-health-badge.is-warn { background: rgba(240, 185, 90, 0.16); color: #f3c46d; }
.live-health-badge.is-critical { background: rgba(255, 106, 120, 0.16); color: #ff8a96; }
.live-health-badge.is-offline { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.live-health-reasons { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.86rem; line-height: 1.4; }
.live-health-reasons:empty { display: none; }
.live-spark { display: grid; gap: 2px; }
.live-spark svg { width: 100%; height: 48px; display: block; }
.live-spark .line { fill: none; stroke: #8fb8ff; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.live-spark .area { fill: rgba(143, 184, 255, 0.12); stroke: none; }
.live-spark-scale, .live-spark-empty { margin: 0; color: var(--muted); font-size: 0.74rem; }
.live-health-stats { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.live-stat.is-warn b { color: #f3c46d; }
@media (prefers-reduced-motion: reduce) { .live-health-badge { transition: none; } }
