/* jmol-seite – Darstellung der Seiten aus dem JSmol-Seitenbaukasten
   Birgit Lachner, superlehrer.de
   Farben: Schulcampus RLP (UI Style Guide) */

:root {
  --js-text: #2F3A48;
  --js-leiste: #F4F4F4;
  --js-linie: #E3E3E5;
  --js-rahmen: #A7ADB1;
  --js-knopf: #0583C9;
  --js-knopf-hover: #009CEE;
  --js-fokus: #00B2F9;
  --js-hinweis: #EFB640;
}

html, body {
  margin: 0;
  height: 100%;
  background: #FFFFFF;
  color: var(--js-text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Die Seite füllt das iframe: Modell oben, Leiste darunter, Skript-Knöpfe rechts oder unten */
.js-seite {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto auto;
  height: 100%;
  min-height: 260px;
  background: #FFFFFF;
}
.js-seite.js-knoepfe-rechts {
  /* Knopfspalte so breit wie die längste Beschriftung, die Zeichnung bekommt den Rest */
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
}

.js-modell {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  background: #FFFFFF;
}
.js-modell > div { position: absolute; inset: 0; }

/* Standard-Bedienleiste */
.js-leiste {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 8px 10px;
  background: var(--js-leiste);
  border-top: 1px solid var(--js-linie);
}
.js-leiste:empty { display: none; }

.js-gruppe {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.js-leiste label { cursor: pointer; user-select: none; }

.js-leiste input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--js-knopf);
  cursor: pointer;
}

.js-leiste select {
  font: inherit;
  color: var(--js-text);
  background: #FFFFFF;
  border: 1px solid var(--js-rahmen);
  border-radius: 6px;
  padding: 3px 6px;
  cursor: pointer;
}

.js-leiste button {
  font: inherit;
  color: #FFFFFF;
  background: var(--js-knopf);
  border: 0;
  border-radius: 6px;
  padding: 4px 11px;
  cursor: pointer;
  white-space: nowrap;
}
.js-leiste button:hover { background: var(--js-knopf-hover); }
.js-leiste button.js-zoom { min-width: 34px; padding: 4px 8px; font-weight: 600; }

.js-leiste :focus-visible,
.js-knoepfe :focus-visible {
  outline: 2px solid var(--js-fokus);
  outline-offset: 2px;
}

/* Knöpfe der Leiste rechts zusammenhalten */
.js-rechts { margin-left: auto; }

/* Eigene Skript-Knöpfe */
.js-knoepfe {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  padding: 10px;
  background: var(--js-leiste);
  border-top: 1px solid var(--js-linie);
}
.js-knoepfe-rechts .js-knoepfe { flex-direction: column; flex-wrap: nowrap; max-width: 45vw; }
.js-knoepfe button {
  font: inherit;
  border: 0;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
.js-knoepfe button:disabled { opacity: 0.5; cursor: default; }
/* Schalter: aus = weiß mit blauem Rand, an = blau gefüllt */
.js-knoepfe .js-schalter {
  color: var(--js-knopf);
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px var(--js-knopf);
}
.js-knoepfe .js-schalter[aria-pressed="true"] { color: #FFFFFF; background: var(--js-knopf); }
/* Einmalige Knöpfe: hellblau, ohne gedrückten Zustand */
.js-knoepfe .js-einmalig { color: var(--js-text); background: #DCEFFA; }
.js-knoepfe button:not(:disabled):hover { color: #FFFFFF; background: var(--js-knopf-hover); }
.js-knoepfe-rechts .js-knoepfe {
  grid-column: 2;
  grid-row: 1 / span 2;
  border-top: 0;
  border-left: 1px solid var(--js-linie);
  overflow-y: auto;
}
.js-knoepfe:empty { display: none; }
.js-knoepfe-rechts:has(.js-knoepfe:empty) { grid-template-columns: 1fr; }

/* Schmale Bildschirme: Knöpfe von rechts nach unten */
@media (max-width: 560px) {
  .js-seite.js-knoepfe-rechts {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto auto;
  }
  .js-knoepfe-rechts .js-knoepfe {
    grid-column: 1;
    grid-row: auto;
    flex-direction: row;
    flex-wrap: wrap;
    max-width: none;
    border-left: 0;
    border-top: 1px solid var(--js-linie);
  }
}

/* Vollbild */
.js-seite:fullscreen { width: 100vw; height: 100vh; }

/* Hinweis, wenn das Grundpaket fehlt (steht direkt in der HTML-Datei, damit er auch ohne CSS wirkt) */
.js-fehler {
  margin: 16px;
  padding: 12px 16px;
  border-left: 5px solid var(--js-hinweis);
  background: #FFF8E8;
}
