/* Modul Produkte, Produktbilder (Bauplan Produktbilder): das Blatt „Bilder“ eines Artikels (pb-…), der Zuschnitt (pb-zs-…),
   die Großansicht (pb-gross-…) und der Kopf des Abschnitts „Bilder“ der Akte (pr-bild…). Gleiche Marken wie oo.css: Ecken 3 px,
   Haarlinien, Blau nur für Auswahl und Fokus. Eingebunden in Dokument.razor nach oo.produkte.css; nichts aus oo.css wird
   überschrieben außer am eigenen Blatt (#pb-blatt) und an den eigenen Dialogen (.pb-zs, .pb-gross). */

/* ── Akte: Kopf des Abschnitts und Bilder als Knöpfe ───────────────────────────── */
.pr-bildkopf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.pr-bildkopf h3 { margin-bottom: 0; }
.pr-bildknopf { height: 24px; padding: 0 6px; font-size: 12px; text-decoration: none; white-space: nowrap; }
.pr-bild { display: block; min-width: 0; padding: 0; border: 0; border-radius: 3px; background: transparent; cursor: zoom-in; }
.pr-bild:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* ── Blatt: ohne Sprungleiste, der Inhalt rollt als Ganzes ─────────────────────── */
#pb-blatt .bl-nav { display: none; }
#pb-blatt .bl-rumpf { grid-template-columns: minmax(0, 1fr); }
#pb-blatt .bl-inhalt { padding: 0 18px 24px; }
#pb-blatt .bl-fuss .stand { color: var(--tinte-4); }
/* Jeder Schritt speichert sofort: dieses Blatt hat kein „Speichern“. Der Baustein lässt den Knopf verborgen stehen (hidden),
   .kn setzt aber display und zeigte ihn sonst gesperrt. */
#pb-blatt .bl-fuss .kn[hidden] { display: none; }
/* Dieses Blatt bleibt nach jedem Schritt offen: die Meldungen unten rechts („1 Bild hinzugefügt“) lägen sonst sekundenlang
   über „Schließen“. Solange das Blatt offen ist, stehen sie über seinem Fuß (48 px). Browser ohne :has zeigen sie wie bisher. */
body:has(#pb-blatt) .oo-meldungen { bottom: 60px; }

.pb-kopf { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 0 10px; }
.pb-hoch { cursor: pointer; white-space: nowrap; }
.pb-hoch.gesperrt { opacity: .55; cursor: default; pointer-events: none; }
/* Das Dateifeld selbst ist nicht zu sehen (der Knopf davor ist seine Beschriftung), bleibt aber mit Tab erreichbar. */
.pb-datei { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; clip-path: inset(50%); }
.pb-kopf:focus-within .pb-hoch { box-shadow: 0 0 0 3px var(--akzent-schein); }
.pb-annahme, .pb-zahl { color: var(--tinte-5); font-size: 12px; }

.bl-meldung.pb-hinweise { position: relative; margin: 0 0 10px; padding-right: 40px; background: var(--warn-grund); color: var(--warn); }
.pb-hinweise > button { position: absolute; top: 4px; right: 4px; color: inherit; }
.pb-hinweise > div + div { margin-top: 4px; }

.pb-rumpf { display: grid; grid-template-columns: minmax(0, 1fr) 252px; align-items: start; gap: 16px; }

/* ── Galerie ───────────────────────────────────────────────────────────────────── */
.pb-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); align-content: start; gap: 10px; min-height: 240px; padding: 10px;
  border: 1px solid var(--linie); border-radius: 3px; background: var(--grund); }
.pb-galerie.leer { grid-template-columns: minmax(0, 1fr); place-items: center; border-style: dashed; }
.pb-galerie.datei-ziel { border-color: var(--akzent); box-shadow: inset 0 0 0 1px var(--akzent); }
/* Während das Gerät Fotos verkleinert (oo.js bilderVerkleinern, Bauplan Überlastschutz Ü9): ein Satz unten in der Galerie. */
.pb-galerie.pb-bereitet { position: relative; }
.pb-galerie.pb-bereitet::after { content: attr(data-bereitet); position: absolute; left: 10px; right: 10px; bottom: 10px; padding: 6px 10px;
  border: 1px solid var(--linie); border-radius: 3px; background: var(--flaeche); color: var(--tinte-3); font-size: 13px; }
.pb-leer { display: grid; justify-items: center; gap: 6px; max-width: 380px; padding: 28px 16px; color: var(--tinte-5); text-align: center; }
.pb-leer strong { color: var(--tinte-3); font-weight: 600; }

/* Produktfotos haben meist weißen Grund: die Kachel bleibt auch im Dunkeln weiß (wie die Bilder der Akte). */
.pb-kachel { position: relative; aspect-ratio: 1; border: 1px solid var(--linie-stark); border-radius: 3px; background: #fff; cursor: pointer; user-select: none; -webkit-user-select: none; }
.pb-kachel img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 2px; pointer-events: none; }
.pb-kachel:hover { border-color: var(--tinte-5); }
.pb-kachel.an { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent); }
.pb-kachel:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
/* Einfügemarke beim Ziehen: ein Strich vor oder hinter der Kachel unter dem Zeiger (setzt das Skript). */
.pb-kachel.vor::before, .pb-kachel.nach::after { content: ""; position: absolute; top: -3px; bottom: -3px; width: 3px; border-radius: 2px; background: var(--akzent); }
.pb-kachel.vor::before { left: -7px; }
.pb-kachel.nach::after { right: -7px; }
.pb-nr { position: absolute; left: 4px; top: 4px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; border-radius: 3px;
  background: rgba(15, 23, 42, .74); color: #fff; font-size: 11px; font-weight: 600; line-height: 1; }
.pb-haupt { position: absolute; left: 4px; bottom: 4px; }
.pb-haken { position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; display: grid; place-items: center; padding: 0; border: 1px solid var(--linie-stark);
  border-radius: 3px; background: rgba(255, 255, 255, .94); color: transparent; cursor: pointer; opacity: 0; }
.pb-kachel:hover .pb-haken, .pb-kachel:focus-visible .pb-haken, .pb-kachel.an .pb-haken { opacity: 1; }
.pb-kachel.an .pb-haken { border-color: var(--akzent); background: var(--akzent); color: #fff; }
/* Ohne Maus (Finger) gibt es kein Überfahren: der Haken steht immer da. */
@media (hover: none) { .pb-haken { opacity: 1; } }
.pb-ersatz { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 8px; border-radius: 2px;
  background: var(--flaeche-2); color: var(--tinte-5); font-size: 12px; text-align: center; }

/* ── Auswahlspalte ─────────────────────────────────────────────────────────────── */
.pb-wahl { position: sticky; top: 8px; min-width: 0; }
.pb-wahl h3 { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.pb-vorschau { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--linie); border-radius: 3px; background: #fff; cursor: zoom-in; }
.pb-vorschau img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pb-vorschau:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.pb-name { margin: 6px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--tinte-5); font-size: 12px; }
.pb-gruppe { display: grid; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--linie); }
.pb-gruppe h4 { margin: 0; color: var(--tinte-5); font-size: 11.5px; font-weight: 600; }
.pb-gruppe .kn { width: 100%; justify-content: flex-start; }
.pb-paar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
.pb-paar .kn { justify-content: center; padding: 0 6px; overflow: hidden; white-space: nowrap; }
.pb-weg:not(:disabled) { color: var(--alarm); }
.pb-hinweis { margin: 10px 0 0; color: var(--tinte-5); font-size: 12px; }

/* Schmal: erst die Galerie, darunter die Aktionen; Vorschau und Tastenhinweis entfallen. */
@media (max-width: 760px) {
  .pb-rumpf { grid-template-columns: minmax(0, 1fr); }
  .pb-galerie { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); min-height: 150px; }
  .pb-wahl { position: static; }
  .pb-vorschau, .pb-tasten, .pb-annahme { display: none; }
  #pb-blatt .bl-inhalt { padding: 0 12px 20px; }
}

/* ── Zuschneiden ───────────────────────────────────────────────────────────────── */
.oo-dialog.pb-zs { top: 5vh; width: min(820px, calc(100vw - 24px)); }
.oo-dialog .pb-hinweis { margin: 8px 0 12px; white-space: normal; }
.pb-zs-leiste { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 6px 0 10px; }
.pb-zs-leiste .wl { margin-right: 6px; color: var(--tinte-5); font-size: 12px; }
.pb-zs-flaeche { display: grid; place-items: center; padding: 10px; border: 1px solid var(--linie); border-radius: 3px; background: var(--flaeche-2); }
/* Die Bühne ist genau so groß wie das gezeigte Bild: der Rahmen rechnet in Anteilen davon. */
.pb-zs-buehne { position: relative; display: inline-block; max-width: 100%; line-height: 0; overflow: hidden; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.pb-zs-buehne img { display: block; max-width: 100%; max-height: 58vh; pointer-events: none; }
.pb-zs-rahmen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; box-sizing: border-box; border: 1px solid #fff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .6), 0 0 0 9999px rgba(15, 23, 42, .5); cursor: move; }
.pb-zs-rahmen:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }
.pb-zs-ecke { position: absolute; width: 14px; height: 14px; border: 1px solid rgba(15, 23, 42, .7); border-radius: 2px; background: #fff; }
.pb-zs-ecke.nw { left: -1px; top: -1px; cursor: nwse-resize; }
.pb-zs-ecke.ne { right: -1px; top: -1px; cursor: nesw-resize; }
.pb-zs-ecke.sw { left: -1px; bottom: -1px; cursor: nesw-resize; }
.pb-zs-ecke.se { right: -1px; bottom: -1px; cursor: nwse-resize; }
@media (pointer: coarse) { .pb-zs-ecke { width: 24px; height: 24px; } }

/* ── Großansicht ───────────────────────────────────────────────────────────────── */
.oo-dialog.pb-gross { top: 4vh; width: min(1080px, calc(100vw - 24px)); padding-bottom: 16px; }
.pb-gross-flaeche { position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px; align-items: center; gap: 8px; margin-top: 8px; }
.pb-gross-bild { display: grid; place-items: center; height: min(76vh, 780px); border: 1px solid var(--linie); border-radius: 3px; background: #fff; overflow: hidden; }
.pb-gross-bild img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.pb-gross-zu { position: absolute; right: 0; top: -38px; }
.pb-gross-pfeil { width: 34px; height: 44px; }
@media (max-width: 560px) {
  .pb-gross-flaeche { grid-template-columns: 30px minmax(0, 1fr) 30px; gap: 4px; }
  .pb-gross-pfeil { width: 30px; }
}
