/* ===========================================================================
   SOP-Modul: Verzeichnisbaum (links) + Anleitung (rechts).
   Container/Editor/Inhalt nutzen bewusst die vorhandenen "wiki__*"-Klassen aus
   wiki.css (siehe sop.js) -- hier steht nur, was für den Baum, Bilder im
   Inhalt und die Lightbox wirklich NEU ist. Alle Farben über die
   Design-Tokens aus app.css (Hell/Dunkel automatisch).
   =========================================================================== */

/* ---- Baum ---- */
.sop__tree { flex: 1; overflow-y: auto; padding: 8px; }
.sop__node { display: flex; flex-direction: column; }
.sop__children { margin-left: 9px; border-left: 1px dashed var(--border); padding-left: 5px; }

.sop__row {
  display: flex; align-items: center; gap: 2px;
  border-radius: var(--radius-sm); min-width: 0;
}
.sop__row:hover { background: var(--surface); }
.sop__row.is-active { background: var(--surface); box-shadow: var(--shadow-sm); }
.sop__row.is-active .sop__row-label { font-weight: 600; }

.sop__toggle {
  flex: none; width: 20px; height: 26px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  appearance: none; background: transparent; border: 0; color: var(--text-faint); cursor: pointer;
}
.sop__toggle svg { transition: transform .12s ease; }
.sop__toggle.is-open svg { transform: rotate(90deg); }

.sop__row-label {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px;
  appearance: none; background: transparent; border: 0; color: inherit; font: inherit;
  text-align: left; cursor: pointer; padding: 5px 4px; border-radius: var(--radius-sm);
}
.sop__row-icon { flex: none; display: flex; width: 15px; height: 15px; color: var(--text-faint); }
.sop__row-icon svg { width: 100%; height: 100%; }
.sop__row-title { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sop__status-tag {
  flex: none; padding: 2px 6px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text-faint); font-size: 10px; font-weight: 600; line-height: 1.2;
}
.sop__status-tag.is-freigegeben { color: var(--accent-text); border-color: var(--accent-soft); }

.sop__row-actions { flex: none; display: flex; gap: 1px; opacity: 0; }
.sop__row:hover .sop__row-actions, .sop__row:focus-within .sop__row-actions { opacity: 1; }
/* Geraete ohne Mauszeiger (Tablet in der Praxis, auch im Querformat ueber
   640px): Dort gibt es kein :hover -- die Zeilen-Aktionen waeren unsichtbar
   und nur durch zufaelliges Antippen zu finden (Code-Review 24.08.2026).
   Die Regel unten fuer < 640px bleibt zusaetzlich bestehen; sie deckt auch
   Handys mit Maus-Emulation ab. */
@media (hover: none) {
  .sop__row-actions { opacity: 1; }
}
.sop__row-btn {
  appearance: none; border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  width: 24px; height: 24px; border-radius: var(--radius-sm); font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.sop__row-btn:hover { background: var(--surface-2); color: var(--text); }
.sop__row-btn--danger:hover { color: var(--danger, #c0392b); }

/* ---- Bilder im Inhalt (Ansicht UND Vorschau) ---- */
.sop__content img.sop__img {
  max-width: 100%; height: auto; display: block; margin: 12px 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: zoom-in;
}
.sop__img-broken {
  display: inline-block; margin: 8px 0; padding: 10px 14px; font-size: 13px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
}

/* ---- Lightbox: Bild vergrößert, Klick irgendwo schließt ---- */
.sop__lightbox { align-items: center; cursor: zoom-out; }
.sop__lightbox img { max-width: 100%; max-height: 88vh; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }

/* Verstecktes Datei-Auswahlfeld hinter dem Bild-Knopf der Formatierleiste */
.sop__file-input { display: none; }

/* ---- Handy (nur < 640px): Spalten-/Abstandslogik kommt schon über die
   gemeinsamen "wiki"/"wiki__side"/"wiki__main"-Klassen aus wiki.css mit --
   hier bleibt nur das SOP-Eigene übrig: Zeilen-Aktionen ohne Hover zeigen. */
@media (max-width: 640px) {
  .sop__row-actions { opacity: 1; }
  /* Der Verzeichnisbaum ist neu und auf dem Handy die einzige Möglichkeit,
     zwischen Anleitungen zu wechseln -- Auf-/Zu-Klappen und Zeilen-Aktionen
     brauchen deshalb echte Tippziele statt der knappen Desktop-Maße. */
  .sop__toggle { width: 40px; height: 40px; }
  .sop__row-btn { width: 40px; height: 40px; }
}

/* ---- Kenntnisnahme-Stand (docs/KENNTNISNAHME.md 12.3) ----
   Ruhiger Kasten, kein Alarm-Look -- er zeigt einen Nachweis, keine Warnung. */
.sop__stand {
  margin-top: 20px; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface-2); font-size: 13px;
}
.sop__stand-zeile { margin: 0 0 4px; color: var(--text-soft); }
.sop__stand-personen { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 10px; }
.sop__stand-person {
  display: inline-flex; align-items: center; min-width: 24px; height: 22px; padding: 0 6px;
  border-radius: 11px; font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-faint);
}
.sop__stand-person.is-ok { background: var(--accent-soft); color: var(--accent-text); }

/* ---- Geltungsstatus: sachliche Einordnung, kein Warnhinweis ---- */
.sop__geltung {
  margin: 0 0 10px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-soft); font-size: 13px;
}
.sop__geltung--entwurf { border-style: dashed; color: var(--text-faint); }

/* Drucken: keine eigenen Regeln nötig -- Baum, Kopfzeile usw. tragen die
   "wiki__*"-Klassen (siehe sop.js) und werden bereits über den vorhandenen
   @media print-Block in wiki.css ausgeblendet/gestaltet. */
