/**
 * Cockpit v2 — Inline-Edit-Styles.
 *
 * Aktiv, wenn body.edit-mode-on gesetzt ist.
 * Paradigm (04.07.2026): KEINE Modals für Text. Inline: hover-highlight
 * in Vereins-Rot + Stift-Icon; Klick öffnet Feld direkt inline mit Save/Cancel-
 * Controls am Feld. Nur News-Neueintrag darf Panel sein.
 */

/* ─────────────────────────────────────────────────
   Cockpit-Leiste (Toolbar)
   B2: fixed am unteren Rand statt oben. Safe-Area beachten (iOS-Notch).
   ───────────────────────────────────────────────── */
.edit-toolbar {
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  left: 12px;
  right: 12px;
  z-index: var(--z-cockpit-toolbar);
  pointer-events: none;
}
.edit-toolbar__inner {
  pointer-events: auto;
  max-width: 1200px;
  margin: 0 auto;
  background: rgba(26, 14, 10, 0.94);
  color: var(--c-bg);
  border-radius: 14px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  backdrop-filter: blur(10px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.18);
}
.edit-toolbar__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 500 12px var(--font-body);
  letter-spacing: 0.04em;
  color: rgba(245, 242, 237, 0.72);
  text-transform: uppercase;
}
.edit-toolbar__nav-select {
  background: rgba(245, 242, 237, 0.10);
  color: var(--c-bg);
  border: 1px solid rgba(245, 242, 237, 0.28);
  border-radius: 6px;
  padding: 5px 26px 5px 10px;
  font: 500 13px var(--font-body);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23f5f2ed' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.edit-toolbar__nav-select option {
  background: #1a0e0a;
  color: var(--c-bg);
}
.edit-toolbar__status {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 500 14px var(--font-body);
}
.edit-toolbar__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-muted);
  transition: background-color .15s, box-shadow .15s;
}
.edit-toolbar__dot.is-on {
  background: #4caf50;
  box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.18);
}
.edit-toolbar__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.edit-toolbar .btn--ghost-light {
  border-color: rgba(245, 242, 237, 0.35);
  font-size: 13px;
  padding: 6px 12px;
}
.edit-toolbar .btn--ghost-light[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.edit-toolbar__undo-counter {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 6px;
  border-radius: 9px;
  background: rgba(245, 242, 237, 0.18);
  font: 500 11px var(--font-body);
  text-align: center;
  line-height: 18px;
}

body.edit-mode-on {
  /* B2: Toolbar unten → Padding-Bottom, damit Content nicht verdeckt wird. */
  padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
}

/* ─────────────────────────────────────────────────
   Editierbare Felder — Hover-Highlight (Ruhe-Zustand im Edit-Modus)
   :where() hat Spezifität 0 — legt fuer static-Elemente position:relative,
   damit `::after`-Highlights einen positioning-context haben.
   Historie: hier stand eine Ausnahme-Regel `.hero__media { position:
   absolute }` fuer das alte Video-Full-Bleed-Layout. Mit dem D-Hero
   (2026-08-13, festgelegt) ist `.hero__media` ein flex-Kind — die absolute-
   Ausnahme killt die Reihenfolge im Edit-Modus (Media + Stack overlappen
   auf top:0). Deshalb entfernt. Falls wieder ein absolute-Hero eingefuehrt
   wird: die Ausnahme dort lokal wieder eintragen, nicht global.
   ───────────────────────────────────────────────── */
body.edit-mode-on :where([data-edit], [data-edit-image]) {
  position: relative;
}

/* ─────────────────────────────────────────────────
   Leere Felder brauchen im Edit-Modus eine Klickflaeche
   Ein <p data-edit> ohne Inhalt hat Hoehe 0 und ist nicht anklickbar.
   Der Klick-Handler in main.js ist inhaltsagnostisch (er nimmt jedes
   [data-edit]), er bekommt den Klick nur nie, weil nichts zu treffen ist.
   Gemessen 25.09.2026: mit.model.jugend.body, Hoehe 0 Pixel, im Edit-Modus
   unveraendert 0. Der Vorstand haette das Feld im Cockpit nicht befuellen
   koennen, ohne zu wissen, dass es existiert.

   :not([hidden]) ist Pflicht. Auf /mannschaften/ liegt ein bewusst
   verstecktes <span data-edit="plaetze.trainings" hidden> als Hydration-
   Marker. Ohne den Ausschluss wuerde diese Regel es sichtbar machen.

   Nur im Edit-Modus, fuer Besucher aendert sich nichts.
   ───────────────────────────────────────────────── */
body.edit-mode-on [data-edit]:empty:not([hidden]) {
  display: block;
  min-height: 2.4em;
  border: 1px dashed rgba(200, 42, 21, 0.4);
  border-radius: 4px;
  cursor: pointer;
}
body.edit-mode-on [data-edit]:empty:not([hidden])::after {
  content: 'Klicke, um Text hinzuzufügen';
  display: block;
  padding: 6px 10px;
  font: 400 13px/1.4 var(--font-body);
  color: var(--c-muted);
  pointer-events: none;
  /* Die Stift-Markierung weiter unten ([data-edit]::after) nutzt dasselbe
     Pseudo-Element: absolut, 28x28, opacity 0. Ohne diese Ruecksetzung steckt
     der Hinweis unsichtbar in diesem Knopf. Befund 28.09.
     ACHTUNG: Die Ruecksetzung gewinnt nur ueber Spezifitaet (0,4,2 gegen 0,2,2),
     nicht ueber die Reihenfolge. Wer :empty oder :not([hidden]) aus dem
     Selektor entfernt, macht den Hinweis wieder unsichtbar. (Prüfbefund 28.09.) */
  position: static;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  box-shadow: none;
  opacity: 1;
  transform: none;
}
/* Waehrend des Tippens verschwindet der Hinweis, sonst steht er hinter dem Cursor. */
body.edit-mode-on [data-edit].is-editing:empty:not([hidden])::after {
  display: none;
}

/* Edit-Hint: sichtbar NUR im Edit-Mode. Kein Layout-Sprung fuer Public-User,
 * kleiner Deep-Link fuer Admin (z.B. "News verwalten → App"). */
.edit-hint {
  display: none;
}
body.edit-mode-on .edit-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 20px;
  padding: 8px 14px;
  font: 500 12px/1 var(--font-body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-red);
  background: rgba(200, 42, 21, 0.06);
  border: 1px solid rgba(200, 42, 21, 0.24);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
body.edit-mode-on .edit-hint a { color: inherit; text-decoration: none; }
body.edit-mode-on .edit-hint:hover { background: var(--c-red); color: var(--c-bg); }
body.edit-mode-on .edit-hint:hover a { color: var(--c-bg); }
body.edit-mode-on [data-edit],
body.edit-mode-on [data-edit-image] {
  transition:
    background-color .15s var(--ease-quick),
    box-shadow .15s var(--ease-quick),
    outline-color .15s var(--ease-quick);
  outline: 1.5px solid transparent;
  outline-offset: 6px;
  border-radius: 4px;
}
body.edit-mode-on [data-edit] {
  cursor: text;
}
body.edit-mode-on [data-edit-image] {
  cursor: pointer;
}

/* Hover: dezenter Vereins-Rot Rahmen + leichte Tönung */
body.edit-mode-on [data-edit]:hover,
body.edit-mode-on [data-edit-image]:hover {
  outline-color: rgba(217, 19, 20, 0.55);
  background-color: rgba(217, 19, 20, 0.04);
  box-shadow: 0 0 0 6px rgba(217, 19, 20, 0.04);
}

/* Bild-Container: Tönung als Overlay statt background (funktioniert über img) */
body.edit-mode-on [data-edit-image]:hover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(217, 19, 20, 0.08);
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
}

/* Stift-Icon on hover — floating rechts oben.
 * A5: Icon INNERHALB des Containers (top:8px, right:8px), damit overflow:hidden-
 * Containers (Cards, Gallery-Kacheln) das Icon nicht abschneiden. */
body.edit-mode-on [data-edit]::after,
body.edit-mode-on [data-edit-image]::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    var(--c-red)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z'/%3E%3C/svg%3E")
    center / 14px no-repeat;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity .15s var(--ease-quick), transform .15s var(--ease-quick);
  pointer-events: none;
  z-index: 6;
}
body.edit-mode-on [data-edit]:hover::after,
body.edit-mode-on [data-edit]:focus-within::after,
body.edit-mode-on [data-edit-image]:hover::after {
  opacity: 1;
  transform: scale(1);
}

/* ─────────────────────────────────────────────────
   Aktiver Edit-State: Feld gerade in Bearbeitung
   ───────────────────────────────────────────────── */
body.edit-mode-on [data-edit].is-editing,
body.edit-mode-on [data-edit-image].is-editing {
  outline-color: var(--c-red);
  outline-width: 2px;
  background-color: rgba(217, 19, 20, 0.06);
  box-shadow: 0 0 0 6px rgba(217, 19, 20, 0.06);
}
body.edit-mode-on [data-edit].is-editing::after {
  opacity: 0;
}
body.edit-mode-on [data-edit][contenteditable="true"] {
  cursor: text;
  min-width: 40px;
}
body.edit-mode-on [data-edit][contenteditable="true"]:focus {
  outline-color: var(--c-red);
  outline-style: solid;
  outline-width: 2px;
}

/* Inline-Save/Cancel-Controls (Floating am Feld, UNTER dem Feld).
 * Alt: top:-46px (ueber dem Feld) — Rückmeldung 2026-08-13: die Toolbar
 * verdeckte den Text darueber (Eyebrow, vorheriges Element), und man konnte
 * beim Tippen nicht sehen, was man schreibt. Neu: unter dem Feld, rechts, mit
 * kleinem Abstand — der editierte Text bleibt garantiert sichtbar. */
.inline-edit-controls {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  z-index: var(--z-cockpit-controls);
  animation: inline-edit-pop .12s var(--ease-quick);
}
@keyframes inline-edit-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.inline-edit-controls__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 5px;
  font: 500 12px var(--font-body);
  border: none;
  cursor: pointer;
  transition: background-color .12s var(--ease-quick);
}
.inline-edit-controls__btn--save {
  background: var(--c-red);
  color: #fff;
}
.inline-edit-controls__btn--save:hover {
  background: var(--c-red-hover, #b30f10);
}
.inline-edit-controls__btn--cancel {
  background: transparent;
  color: var(--c-text);
}
.inline-edit-controls__btn--cancel:hover {
  background: var(--c-bg);
}
.inline-edit-controls__hint {
  font: 400 11px var(--font-body);
  color: var(--c-muted);
  padding: 0 6px;
  align-self: center;
}

/* ─────────────────────────────────────────────────
   Bild-Edit-Panel (Vorher/Nachher)
   A6: Panel als fixed-portal (nicht mehr in-place absolute) — sonst schneidet
   overflow:hidden auf Karten das Panel ab und der Nutzer sieht nichts.
   ───────────────────────────────────────────────── */
.image-edit-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-width: 560px;
  background: #ffffff;
  border: 1px solid var(--c-border);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  padding: 18px;
  z-index: var(--z-cockpit-image-panel);
  animation: inline-edit-pop .14s var(--ease-quick);
}
.image-edit-panel__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.35);
  z-index: var(--z-cockpit-image-backdrop);
  animation: inline-edit-pop .14s var(--ease-quick);
}
/* R5-G2-9: Modus-Umschalter Ausfüllen / Einpassen. */
.image-edit-panel__fit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.image-edit-panel__fit-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border: 1.5px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s var(--ease-quick), background-color .12s var(--ease-quick);
}
.image-edit-panel__fit-btn strong {
  font: 600 13px var(--font-body);
  color: var(--c-text);
}
.image-edit-panel__fit-btn span {
  font: 400 11px/1.3 var(--font-body);
  color: var(--c-muted);
}
.image-edit-panel__fit-btn.is-active {
  border-color: var(--c-red);
  background: rgba(217, 19, 20, 0.06);
}
.image-edit-panel__fit-btn.is-active strong { color: var(--c-red); }

.image-edit-panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.image-edit-panel__slot {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.image-edit-panel__slot-label {
  font: 500 11px var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-muted);
}
.image-edit-panel__thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
}
.image-edit-panel__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* A-R3-2: Vorher-Slot mit Fokuspunkt-Overlay bekommt object-fit:contain,
 * damit User das komplette Original sieht und den Ausschnitt frei wählen kann. */
.image-edit-panel__thumb[data-slot="before"] img {
  object-fit: contain;
}
.image-edit-panel__focus-overlay {
  border-radius: 3px;
  transition: left .08s linear, top .08s linear, width .08s linear, height .08s linear;
}
.image-edit-panel__thumb--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted);
  font: 400 12px var(--font-body);
  text-align: center;
  padding: 12px;
}
.image-edit-panel__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.image-edit-panel__file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  font: 500 12px var(--font-body);
  cursor: pointer;
  color: var(--c-text);
}
.image-edit-panel__file:hover {
  background: rgba(217, 19, 20, 0.06);
  border-color: var(--c-red);
  color: var(--c-red);
}
.image-edit-panel__file input[type="file"] {
  display: none;
}
.image-edit-panel__buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

/* ─────────────────────────────────────────────────
   News-Manager Panel (bewusste Ausnahme)
   ───────────────────────────────────────────────── */
.news-panel {
  max-width: 720px;
  width: min(720px, 100%);
}
.news-panel__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.news-panel__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--c-bg);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: border-color .12s var(--ease-quick);
}
.news-panel__item:hover {
  border-color: rgba(217, 19, 20, 0.3);
}
.news-panel__item-meta {
  flex: 1;
  min-width: 0;
}
.news-panel__item-date {
  font: 500 11px var(--font-body);
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.news-panel__item-title {
  font: 500 15px var(--font-body);
  color: var(--c-text);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.news-panel__item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
}
.news-panel__item-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  transition: border-color .14s var(--ease-quick), color .14s var(--ease-quick), background-color .14s var(--ease-quick);
}
.news-panel__item-delete:hover,
.news-panel__item-delete:focus-visible {
  border-color: var(--c-red);
  color: var(--c-red);
  background: rgba(217, 19, 20, 0.06);
  outline: none;
}
.news-panel__item-delete--form {
  width: 40px;
  height: 40px;
}
.news-panel__item-delete--form svg {
  width: 18px;
  height: 18px;
}
.news-panel__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* Cockpit-Masken: Labels ueber dem Feld, Hilfetext direkt unter dem Label
   in voller Breite, Feld darunter volle Modal-Breite (Vorgabe 11.09.).
   Vorher: zweispaltig 140px Label + 1fr Feld — auf Desktop schnitt das lange
   Labels wie "VERÖFFENTLICHUNGSDATUM" ab und quetschte den Hilfetext auf
   sechs Zeilen in die Label-Spalte. Jetzt Flex-Column: Label, Hilfetext (bis
   zu zwei Zeilen in voller Breite), Feld. Groesserer Abstand zwischen Rows
   als innerhalb — siehe .news-panel__form gap 20px. */
.news-panel__form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.news-panel__form-row .field__label {
  margin-bottom: 0;
}
.news-panel__form-row > .news-panel__form-hint {
  font-size: 12px;
  color: var(--c-muted);
  line-height: 1.45;
  margin: 0;
}
.news-panel__form-editor {
  min-height: 140px;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: #fff;
  font: 400 15px var(--font-body);
  line-height: 1.55;
}
.news-panel__form-editor:focus {
  outline: 2px solid var(--c-red);
  outline-offset: -2px;
  border-color: transparent;
}
.news-panel__form-image {
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  border: 1px dashed var(--c-border);
  background: var(--c-bg);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-muted);
  font: 400 13px var(--font-body);
}
.news-panel__form-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ─────────────────────────────────────────────────
   Mobile
   ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  body.edit-mode-on {
    /* Größerer Bottom-Padding wegen mehreren Toolbar-Zeilen mobile */
    padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px));
  }
  .edit-toolbar { bottom: calc(8px + env(safe-area-inset-bottom, 0px)); left: 8px; right: 8px; }
  .edit-toolbar__inner { padding: 10px 12px; gap: 8px; }
  .edit-toolbar__status { font-size: 13px; }
  .edit-toolbar__actions { justify-content: flex-end; }
  .edit-toolbar__nav { font-size: 11px; }
  .edit-toolbar__nav-select { font-size: 12px; padding: 4px 22px 4px 8px; max-width: 140px; }
  .edit-toolbar .btn--ghost-light { padding: 6px 10px; font-size: 12px; }

  body.edit-mode-on [data-edit]::after,
  body.edit-mode-on [data-edit-image]::after {
    width: 24px;
    height: 24px;
    top: 6px;
    right: 6px;
    background-size: 12px;
  }
  /* iPad Mini + kleinere Tablets fallen unter 768px. Der Toolbar-Fix
   * (Controls UNTER dem Feld, sonst verdeckt sichtbare Zeile) muss auch
   * hier gelten — sonst greift der Bugfix desktop-only. iPad-Verify
   * 2026-08-13: Mini 768×1024 sah Controls ueber dem Feld. */
  .inline-edit-controls {
    top: calc(100% + 6px);
    right: 0;
  }
  .inline-edit-controls__hint { display: none; }
  .image-edit-panel__grid { grid-template-columns: 1fr; }
  .news-panel__form-row { grid-template-columns: 1fr; }
}

/* ─────────────────────────────────────────────────
   Kurz-Anleitungen: Schrittlisten im Hilfe-Panel (P3-26, 27.09.2026)
   Die Karten trugen vorher nur "Wird aufgenommen". Jetzt steht in
   jeder eine nummerierte Anleitung, die ohne Video traegt.
   ───────────────────────────────────────────────── */
.help-steps {
  margin: 12px 0 0;
  padding-left: 22px;
  display: grid;
  gap: 8px;
  font: 400 14px/1.6 var(--font-body);
  color: var(--c-ink, #1a1a1a);
}
.help-steps li {
  padding-left: 4px;
}
.help-steps li::marker {
  color: var(--c-red);
  font-weight: 600;
}
