/* ==========================================================
   Alerts-Modul (Chat-Nachricht + Video-Alert pro Event-Typ)
   Eigenstaendiges Stylesheet, unabhaengig von alert.css (das bleibt
   ausschliesslich fuer /commands im Einsatz).

   Vorgabe: Border-Radius in diesem Modul ist ueberall maximal 3px -
   auch dort, wo globale Basis-Regeln (basis.css/formulare.css) von sich
   aus 4px+ oder Pill-Formen verwenden. Die Ueberschreibungen dafuer
   stehen gebuendelt im Abschnitt "Radius-Cap" unten.
   ========================================================== */

#alertsPage { display: flex; flex-direction: column; gap: 18px; }

/* ---------- OBS-Link-Zeile ---------- */
#alertsPage .au-topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 3px; padding: 12px 16px;
}
#alertsPage .au-topbar label {
  color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; flex-shrink: 0;
}
#alertsPage .au-topbar .url-box { flex: 1; min-width: 220px; }

/* ---------- Layout ---------- */
#alertsPage .au-layout { display: flex; gap: 20px; align-items: flex-start; }

#alertsPage .au-sidebar {
  flex: 0 0 210px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 3px; padding: 10px; display: flex; flex-direction: column; gap: 2px;
}
#alertsPage .au-sidebar-label {
  color: var(--text-faint); font-size: 12px; font-weight: 700; text-transform: uppercase;
  padding: 8px 10px 6px; letter-spacing: .5px;
}
#alertsPage .au-type {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px; border-radius: 3px; cursor: pointer; font-size: 14.5px; color: var(--text-tertiary);
}
#alertsPage .au-type:hover { background: var(--bg-raised); }
#alertsPage .au-type.active { background: var(--accent); color: #fff; }
#alertsPage .au-type-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#alertsPage .au-dots { display: flex; gap: 4px; flex-shrink: 0; }
#alertsPage .au-dot { width: 7px; height: 7px; border-radius: 3px; background: #4a4a52; }
#alertsPage .au-dot.chat.on { background: #8ab4ff; }
#alertsPage .au-dot.video.on { background: var(--success); }
#alertsPage .au-legend { display: flex; gap: 12px; padding: 10px 10px 2px; font-size: 11px; color: var(--text-faint); }
#alertsPage .au-legend span { display: flex; align-items: center; gap: 5px; }
#alertsPage .au-legend .au-dot { width: 6px; height: 6px; }

#alertsPage .au-right { flex: 1; min-width: 0; }
#alertsPage .au-content { display: flex; gap: 20px; align-items: flex-start; }
#alertsPage .au-panel { flex: 1.35; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
#alertsPage .au-side { flex: 1; min-width: 0; position: sticky; top: 20px; display: flex; flex-direction: column; gap: 14px; }

#alertsPage .au-panelhead { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
#alertsPage .au-panelhead h2 { margin: 0; font-size: 19px; color: var(--text-primary); }
#alertsPage .au-panelhead .au-ph-sub { color: var(--text-faint); font-size: 13px; }
#alertsPage .au-panelhead code {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 3px;
  padding: 1px 6px; color: #c9a4ff; font-family: var(--font-mono);
}

/* ---------- Karten & Tabs außerhalb ---------- */
#alertsPage .au-card-wrapper {
  display: flex;
  flex-direction: column;
}

#alertsPage .au-card-wrapper .tabs {
  display: flex;
  gap: 6px;
  padding-left: 2px;
}

#alertsPage .au-card-wrapper .tabs .tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  transition: all 0.2s ease;
}

#alertsPage .au-card-wrapper .tabs .tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

#alertsPage .au-card-wrapper .tabs .tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-card);
  border-color: var(--border);
  border-bottom-color: var(--bg-card);
  margin-bottom: -1px;
  z-index: 2;
}

/* Die Video-Tab-Karte (.au-videotab-card) stapelt beide Tab-Panels
   UEBEREINANDER in derselben Grid-Zelle statt das inaktive per
   display:none komplett aus dem Layout zu nehmen - dadurch bestimmt immer
   das hoehere der beiden Panels (Audio/Video) die Kartenhoehe, egal
   welcher Tab gerade aktiv ist (kein Hoehen-Sprung beim Umschalten,
   analog zu #commandsPage .au-videotab-card in style/commands.css). */
#alertsPage .au-card-wrapper.au-videotabs .au-videotab-card { display: grid; }
#alertsPage .au-card-wrapper .tab-panel {
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  pointer-events: none;
}

#alertsPage .au-card-wrapper .tab-panel.active {
  visibility: visible;
  pointer-events: auto;
}

/* ---------- Karten ----------
   Basis (Hintergrund/Rahmen/Radius/Schatten) kommt vom globalen .card
   (boxen.css) - hier bleiben nur die Akzentfarbe pro Alert-Typ und der
   Body-Ausblend-Zustand. */
#alertsPage .au-card--chat { border-left-color: #4a6fff; }
#alertsPage .au-card--video { border-left-color: var(--success); }
#alertsPage .au-cardbody { display: flex; flex-direction: column; gap: 12px; transition: opacity .15s; }
#alertsPage .au-cardbody.is-off { opacity: .42; pointer-events: none; }

#alertsPage .au-botwarning {
  display: flex; align-items: center; gap: 8px; background: rgba(242,185,12,.08);
  border: 1px solid #6b5a17; border-radius: 3px; padding: 8px 11px; font-size: 12.5px; color: #e8cf7a;
}
#alertsPage .au-botwarning a { color: inherit; text-decoration: underline; }
/* Chat-Absprache: Schriftfarbe im Light-Mode auf Schwarz, da #e8cf7a
   (helles Gelb) dort kaum lesbar ist - analog zum :root[data-theme="light"]
   Muster aus variablen.css/paneleditor.css. */
:root[data-theme="light"] #alertsPage .au-botwarning { color: #000; }

/* ---------- Chat-Zeilen ---------- */
#alertsPage .au-chatlines { display: flex; flex-direction: column; gap: 8px; }
#alertsPage .au-chatline { display: flex; align-items: center; gap: 8px; }
#alertsPage .au-linebadge {
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 3px; background: var(--bg-raised);
  border: 1px solid var(--border-strong); color: var(--text-muted); font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
#alertsPage .au-chatline input { font-family: var(--font-mono); font-size: 13.5px; }
#alertsPage .au-linedel {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 3px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text-faint); cursor: pointer; font-size: 14px; line-height: 1;
}
#alertsPage .au-linedel:hover { color: var(--danger); border-color: var(--danger); }
#alertsPage .au-linedel[disabled] { visibility: hidden; }
#alertsPage .au-addline {
  align-self: flex-start; background: transparent; border: 1px dashed var(--border-strong); color: var(--text-muted);
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 3px; cursor: pointer;
}
#alertsPage .au-addline:hover { border-color: var(--accent); color: #fff; }
#alertsPage .au-addline[disabled] { opacity: .4; cursor: default; pointer-events: none; }
#alertsPage .au-hint { font-size: 12px; color: var(--text-faint); }

/* ---------- Grids ---------- */
#alertsPage .au-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* Der Darstellung-Tab reiht mehrere .au-grid2-Zeilen (Animation/Schriftart,
   Anzeigedauer/Outline-Staerke, Farben, ...) + eine .switch-group direkt
   untereinander - ohne eigenen vertikalen Abstand wirkten die Reihen zu
   gedrungen (Label direkt am Slider der Zeile darueber, siehe
   Screenshot-Feedback). Jede Feld-Spalte (Label+Control) bekommt zusaetzlich
   selbst einen kleinen internen Abstand, sonst kleben Label und Control
   trotz Zeilenabstand aneinander. */
#alertsPage .au-grid2 > div { display: flex; flex-direction: column; gap: 6px; }
#alertsPage [data-videopanel="style"] { display: flex; flex-direction: column; gap: 20px; }
#alertsPage .au-grid2 + .au-grid2 { margin-top: 0; }
#alertsPage .switch-group { margin-top: 0; }
/* Grossbuchstaben/Fett/Kursiv/Unterstrichen im Darstellung-Tab sollen immer
   in einer Zeile stehen statt bei schmaler Spaltenbreite (halbe Grid-Breite
   neben Akzent-Staerke) umzubrechen - kleinerer Abstand statt Wrap. */
/* WICHTIG: .switch-group ist selbst ein direktes Kind von .au-grid2 (keine
   eigene Wrapper-Spalte) - die generische ".au-grid2 > div { flex-direction:
   column }"-Regel oben (fuer Label+Feld-Spalten gedacht) greift daher
   ebenfalls hier und kippt die Switches trotz .switch-group's eigenem
   "display:flex" (Zeile) in eine Spalte. flex-direction muss deshalb hier
   explizit zurueck auf row gesetzt werden, nicht nur flex-wrap. */
#alertsPage [data-videopanel="style"] .switch-group { flex-direction: row; flex-wrap: nowrap; gap: 10px; }
/* Darstellung-Tab: zwei Spalten (links Schrift/Text, rechts Box/Animation) */
#alertsPage .au-style-cols { align-items: start; gap: 20px; }
#alertsPage .au-style-col { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Video-Alert: Tabs "Audio/Video" / "Darstellung" ----------
   Nutzt das bereits vorbereitete, bis jetzt ungenutzte Tab-Muster oben
   (.au-card-wrapper .tabs .tab-btn / .tab-panel) - siehe Zeilen 65-110. */
#alertsPage .au-videotabs { margin-top: 4px; }
#alertsPage .au-videotab-card { border-left-color: var(--border); }

/* ---------- Audio/Video-Tab: Design wie module/commands/index.php ----------
   Kein eigener Kartenrahmen mehr (BG/Border/Padding/Radius entfernt, siehe
   #commandsPage .klipyPickerBox in style/commands.css) - nur noch gap:6px
   wie die linke (Sound-)Spalte (.row, siehe style/basis.css), damit beide
   Spalten gleich wirken. */
#alertsPage .klipyPickerBox { gap: 6px; }
#alertsPage .klipyLinkRow { display: flex; gap: 8px; margin-top: 6px; }
#alertsPage .klipyBrowseBtn { font-size: 11px; color: var(--accent); text-decoration: none; background: rgba(145,70,255,0.1); padding: 3px 8px; border-radius: 3px; }
#alertsPage .klipyResolveStatus { font-size: 11px; color: var(--warning); display: block; margin-top: 4px; }
/* Leer keinen Platz beanspruchen (sonst zusaetzliche Zeile ggue. der
   Sound-Spalte, die dieses Element gar nicht hat - Gap-Konsistenz). */
#alertsPage .klipyResolveStatus:empty { display: none; margin-top: 0; }

/* Groessere 16:9-Vorschau statt des kleinen Commands-Thumbnails - bessere
   Erkennbarkeit, sobald ein Video/GIF ausgewaehlt ist; bleibt Alert-eigen. */
#alertsPage .au-mediapreview {
  position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 3px; overflow: hidden;
  border: 1px solid var(--border-strong); background: #0e0e10;
  display: flex; align-items: center; justify-content: center;
}
#alertsPage .au-mediapreview img, #alertsPage .au-mediapreview video {
  width: 100%; height: 100%; object-fit: contain; display: block; background: #000;
}
#alertsPage .au-mediapreview--empty { border-style: dashed; }
#alertsPage .au-mediapreview .au-placeholder { font-size: 34px; opacity: .5; }
#alertsPage .au-mediapreview .au-fmt {
  position: absolute; top: 6px; left: 6px; font-size: 9.5px; font-weight: 800; letter-spacing: .3px;
  background: rgba(0,0,0,.6); color: #fff; padding: 2px 5px; border-radius: 3px; text-transform: uppercase;
}
#alertsPage .au-minislider { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-faint); }
#alertsPage .au-minislider input[type=range] { flex: 1; }

/* ---------- Darstellung Bereich ---------- */
#alertsPage .au-rangerow { display: flex; flex-direction: column; gap: 6px; }
#alertsPage .au-rangetop { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
#alertsPage .au-rangetop .au-val { color: #fff; font-weight: 700; text-transform: none; letter-spacing: 0; }

/* ---------- Vorschau-Spalte ---------- */
#alertsPage .au-stage {
  background: #09090c; border: 1px solid var(--border); border-radius: 3px;
  height: 340px; box-sizing: border-box; padding: 20px;
  display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden;
  background-image:
    linear-gradient(45deg,#141418 25%,transparent 25%), linear-gradient(-45deg,#141418 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#141418 75%), linear-gradient(-45deg,transparent 75%,#141418 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
#alertsPage .au-stage .au-stagehint { color: var(--text-faint); font-size: 13px; }
#alertsPage .au-popup {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px;
  max-width: 100%; max-height: 100%; min-height: 0; box-sizing: border-box;
  border-radius: 3px;
  background: var(--alert-bg, rgba(20,20,24,0.92));
  border: var(--alert-border-width, 2px) solid var(--alert-color, var(--accent));
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  overflow: hidden;
}
#alertsPage .au-popup img, #alertsPage .au-popup video {
  flex: 0 1 auto; min-height: 0; min-width: 0;
  max-width: 360px; max-height: 260px; border-radius: 3px; object-fit: contain;
}
#alertsPage .au-popup .au-poptext { flex: 0 0 auto; font-size: 19px; font-weight: 700; text-align: center; max-width: 360px; color: #fff; text-shadow: none; }

@keyframes auFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes auFadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes auLeft { from { opacity: 0; transform: translateX(-60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes auZoom { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: scale(1); } }
@keyframes auBounce { 0% { opacity: 0; transform: translateY(-26px) scale(.9); } 60% { opacity: 1; transform: translateY(5px) scale(1.03); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
#alertsPage .au-popup.a-fade { animation: auFade .35s ease both; }
#alertsPage .au-popup.a-fadeUp { animation: auFadeUp .4s ease both; }
#alertsPage .au-popup.a-slideLeft { animation: auLeft .45s cubic-bezier(.25,.8,.35,1) both; }
#alertsPage .au-popup.a-slideRight { animation: auRight .45s cubic-bezier(.25,.8,.35,1) both; }
#alertsPage .au-popup.a-zoom { animation: auZoom .35s cubic-bezier(.34,1.56,.64,1) both; }
#alertsPage .au-popup.a-bounce { animation: auBounce .55s cubic-bezier(.34,1.56,.64,1) both; }
#alertsPage .au-popup.out { animation: auFade .4s ease reverse forwards; }

#alertsPage .au-chatpreview { background: var(--bg-card); border: 1px solid var(--border); border-radius: 3px; padding: 11px 13px; min-height: 64px; display: flex; flex-direction: column; gap: 6px; }
#alertsPage .au-chatpreview .au-cptitle { font-size: 11.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 2px; }
#alertsPage .au-bubble {
  font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: 3px; padding: 6px 9px; color: var(--text-primary); opacity: 0; transform: translateY(4px);
  transition: opacity .25s, transform .25s;
}
#alertsPage .au-bubble.show { opacity: 1; transform: translateY(0); }
#alertsPage .au-bubble .au-bottag { color: #8ab4ff; font-weight: 700; margin-right: 5px; }
#alertsPage .au-cpempty { color: var(--text-faint); font-size: 12.5px; }

#alertsPage .au-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
#alertsPage .au-status { font-size: 13px; color: var(--mono-text); font-weight: 600; }

/* ---------- Radius-Cap: max. 3px, auch fuer global geerbte Formularelemente ---------- */
#alertsPage select,
#alertsPage input[type="text"],
#alertsPage input[type="number"],
#alertsPage input[type="color"],
#alertsPage textarea,
#alertsPage .url-box,
#alertsPage .back-btn,
#alertsPage button {
  border-radius: 3px;
}

@media (max-width: 980px) {
  #alertsPage .au-layout, #alertsPage .au-content { flex-direction: column; }
  #alertsPage .au-sidebar { flex: 0 0 auto; width: 100%; }
  #alertsPage .au-type { flex: 1; }
  #alertsPage .au-side { position: static; width: 100%; }
  #alertsPage .au-grid2 { grid-template-columns: 1fr; }
  #alertsPage .fieldRow { grid-template-columns: 1fr !important; }
}