/* PDF-Tafel */

/* ---------- Tagesdienstpläne: Raster 2 × 4, optimiert für Querformat ---------- */
.pdft-raster {
	--pdft-hoehe: 90vh;
	--pdft-format: 1.4142;   /* Breite / Höhe einer PDF-Seite (A4 quer) */
	--pdft-spalten: 4;
	--pdft-reihen: 2;
	--pdft-abstand: 10px;
	width: 100%;
	background: transparent;
	box-sizing: border-box;
}
.pdft-gitter {
	position: relative;
	display: grid;
	grid-template-columns: repeat(var(--pdft-spalten), minmax(0, 1fr));
	grid-template-rows: repeat(var(--pdft-reihen), minmax(0, 1fr));
	gap: var(--pdft-abstand);
	width: min(100%, calc(var(--pdft-hoehe) * var(--pdft-format) * var(--pdft-spalten) / var(--pdft-reihen)));
	aspect-ratio: calc(var(--pdft-format) * var(--pdft-spalten) / var(--pdft-reihen));
	margin: 0 auto;
	background: transparent;
	box-sizing: border-box;
}
.pdft-raster:fullscreen {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--pdft-abstand);
	background: #000;
}
.pdft-raster:-webkit-full-screen {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--pdft-abstand);
	background: #000;
}
.pdft-raster:fullscreen .pdft-gitter {
	width: min(100%, calc((100vh - 2 * var(--pdft-abstand)) * var(--pdft-format) * var(--pdft-spalten) / var(--pdft-reihen)));
}
.pdft-raster:-webkit-full-screen .pdft-gitter {
	width: min(100%, calc((100vh - 2 * var(--pdft-abstand)) * var(--pdft-format) * var(--pdft-spalten) / var(--pdft-reihen)));
}
.pdft-zelle {
	position: relative;
	overflow: hidden;
	min-width: 0;
	min-height: 0;
	background: transparent;
}
.pdft-zelle .pdft-blatt {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
	opacity: 0;
	transition: opacity .6s ease;
}
.pdft-zelle .pdft-blatt.ist-sichtbar { opacity: 1; }
.pdft-zelle:not(.ist-leer) { cursor: zoom-in; }
.pdft-zelle:not(.ist-leer):hover .pdft-blatt { box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 2px 10px rgba(0, 0, 0, .5); }

/* Vergrößerte Ansicht */
.pdft-lupe {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, .88);
	animation: pdft-ein .18s ease;
}
.pdft-lupe[hidden] { display: none; }
@keyframes pdft-ein { from { opacity: 0; } to { opacity: 1; } }
.pdft-lupe-buehne {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}
.pdft-lupe-blatt {
	display: block;
	background: #fff;
	box-shadow: 0 6px 30px rgba(0, 0, 0, .6);
}
.pdft-lupe-fehler { color: #ddd; font: 15px system-ui, sans-serif; }
.pdft-lupe-knopf {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 58px;
	height: 58px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .16);
	color: #fff;
	font: 400 34px/1 system-ui, sans-serif;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}
.pdft-lupe-knopf:hover, .pdft-lupe-knopf:focus-visible { background: rgba(255, 255, 255, .32); outline: none; }
.pdft-lupe-knopf[hidden] { display: none; }
.pdft-lupe-zurueck { left: 16px; }
.pdft-lupe-vor { right: 16px; }
.pdft-lupe-zu { top: 16px; right: 16px; transform: none; width: 46px; height: 46px; font-size: 22px; }
.pdft-lupe-info {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	max-width: 90vw;
	padding: 7px 14px;
	border-radius: 18px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font: 14px/1.3 system-ui, sans-serif;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
@media (max-width: 700px) {
	.pdft-lupe-knopf { top: auto; bottom: 56px; transform: none; width: 50px; height: 50px; }
	.pdft-lupe-zu { top: 12px; bottom: auto; }
}
.pdft-zaehler {
	position: absolute;
	right: 6px;
	bottom: 6px;
	z-index: 2;
	font: 500 11px/1 system-ui, sans-serif;
	color: #fff;
	background: rgba(0, 0, 0, .5);
	padding: 3px 6px;
	border-radius: 3px;
}
.pdft-zaehler[hidden] { display: none; }
.pdft-fehler {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font: 13px/1.4 system-ui, sans-serif;
	color: inherit;
	opacity: .7;
	text-align: center;
	padding: 1em;
}
.pdft-vollbild {
	position: absolute;
	right: 4px;
	top: 4px;
	z-index: 3;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 4px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	font-size: 18px;
	cursor: pointer;
	opacity: 0;
	transition: opacity .2s;
}
.pdft-raster:hover .pdft-vollbild,
.pdft-vollbild:focus { opacity: 1; }

@media (max-width: 700px) {
	.pdft-raster { --pdft-spalten: 2; --pdft-reihen: 4; }
}

/* Automatische Anpassung an den Bildschirm (Größe und Anordnung setzt das Script) */
.pdft-raster.pdft-anpassen .pdft-gitter {
	aspect-ratio: auto;
	max-width: none;
}
.pdft-raster.pdft-anpassen .pdft-zelle.ist-aus { display: none; }

/* ---------- ETB: mehrseitiges PDF, optimiert für Hochformat ---------- */
.pdft-dokument {
	--pdft-hoehe: 85vh;
	display: flex;
	flex-direction: column;
	height: var(--pdft-hoehe);
	min-height: 320px;
	background: transparent;
	overflow: hidden;
}
.pdft-dokument.ist-fixiert {
	position: fixed;
	left: 0;
	right: 0;
	bottom: var(--pdft-fuss-platz, 0px);
	top: 0;
	height: auto !important;
	min-height: 0;
	z-index: 5;
}
.pdft-dokument:fullscreen { width: 100vw; height: 100vh !important; background: #000; }
.pdft-dokument:-webkit-full-screen { width: 100vw; height: 100vh !important; background: #000; }
.pdft-doc-flaeche {
	position: relative;
	flex: 1 1 auto;
	overflow: auto;
	padding: 0;
	-webkit-overflow-scrolling: touch;
	scroll-snap-type: y mandatory;     /* Wischen: immer genau eine Seite */
	overscroll-behavior: contain;      /* Seite dahinter scrollt nicht mit */
	scrollbar-width: none;             /* Scrollbalken ausblenden (Firefox) */
	-ms-overflow-style: none;
	outline: none;
}
.pdft-doc-flaeche::-webkit-scrollbar { display: none; width: 0; height: 0; }
.pdft-doc-fach {
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}
.pdft-doc-seite {
	flex: 0 0 auto;
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
	position: relative;
}
.pdft-doc-seite canvas { display: block; }
.pdft-doc-seite[data-status="fehler"]::after {
	content: "Seite konnte nicht geladen werden";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font: 14px system-ui, sans-serif;
}
.pdft-meldung {
	font: 15px/1.4 system-ui, sans-serif;
	color: inherit;
	opacity: .7;
	text-align: center;
	padding: 3em 1em;
}

/* Optionale Steuerleiste ([pdf_tafel_dokument steuerung="ja"]) */
.pdft-doc-leiste {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	background: #323639;
	color: #fff;
	font: 14px/1 system-ui, sans-serif;
	flex-wrap: wrap;
	border-radius: 6px;
}
.pdft-doc-titel {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-weight: 600;
}
.pdft-doc-info { min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }
.pdft-trenner { width: 1px; height: 20px; background: rgba(255, 255, 255, .25); margin: 0 4px; }
.pdft-doc-leiste button {
	min-width: 32px;
	height: 30px;
	padding: 0 8px;
	border: 0;
	border-radius: 4px;
	background: rgba(255, 255, 255, .1);
	color: #fff;
	font: inherit;
	font-size: 16px;
	cursor: pointer;
}
.pdft-doc-leiste button:hover { background: rgba(255, 255, 255, .22); }

/* ---------- Upload-, Verwaltungs- und Anmeldeseite (transparent) ---------- */
.pdft-verwaltung {
	--pdft-linie: rgba(128, 128, 128, .45);
	max-width: 1100px;
	background: transparent;
	color: inherit;
}
.pdft-verwaltung h2 { margin-top: 1.6em; }
.pdft-verwaltung .pdft-karte h2 { margin-top: .6em; }
.pdft-karte {
	background: transparent;
	border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie);
	border-radius: 6px;
	padding: 4px 20px 12px;
	max-width: 640px;
	box-sizing: border-box;
}
/* Anmeldeseite: Inhalt zentriert */
.pdft-anmeldung {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 55vh;
	max-width: none;
	margin: 0 auto;
	text-align: center;
}
.pdft-anmeldung .pdft-karte,
.pdft-anmeldung .pdft-notiz { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
.pdft-anmeldung .pdft-karte { padding: 8px 28px 16px; }
.pdft-anmeldung .pdft-feld { text-align: left; }
.pdft-anmeldung .pdft-knoepfe { justify-content: center; }
.pdft-anmeldung button.pdft-knopf { width: 100%; }
.pdft-feld { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.pdft-feld label { font-weight: 600; }
.pdft-feld select { max-width: 100%; }
.pdft-verwaltung input[type="file"] { color: inherit; }
.pdft-eingabe {
	width: 100%;
	box-sizing: border-box;
	padding: 8px 10px;
	font: inherit;
	color: inherit;
	background: rgba(128, 128, 128, .12);
	border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie);
	border-radius: 4px;
}
.pdft-merken { font-weight: 400; }
.pdft-modus { border: 0; padding: 0; }
.pdft-modus legend { font-weight: 600; margin-bottom: 4px; }
.pdft-modus label { font-weight: 400; display: block; margin: 4px 0; }
.pdft-hinweis { color: inherit; opacity: .75; font-size: .87em; }
.pdft-knoepfe { display: flex; gap: 10px; flex-wrap: wrap; }
.pdft-knopf { cursor: pointer; }
a.pdft-knopf,
.pdft-anmeldung button.pdft-knopf,
.pdft-verwaltung[data-pdft-schrift] button.pdft-knopf {
	display: inline-block;
	padding: 8px 18px;
	border: 1px solid #2271b1;
	border-radius: 4px;
	background: #2271b1;
	color: #fff;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.4;
}
/* Knopfbeschriftung immer weiß (erbt sonst Textfarbe/-webkit-text-fill-color) */
.pdft-verwaltung button.pdft-knopf,
.pdft-verwaltung a.pdft-knopf:not(.pdft-knopf-zweit) { color: #fff !important; -webkit-text-fill-color: #fff !important; }
a.pdft-knopf.pdft-knopf-zweit { background: transparent; color: inherit; border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie); }
.pdft-notiz {
	padding: 10px 14px;
	margin: 0 0 10px;
	border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie);
	border-left: 4px solid #00a32a;
	background: transparent;
	max-width: 640px;
	box-sizing: border-box;
}
.pdft-notiz.ist-fehler { border-left-color: #d63638; }
.pdft-plaetze {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
}
@media (max-width: 900px) { .pdft-plaetze { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pdft-platz {
	background: transparent;
	border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie);
	border-radius: 6px;
	padding: 10px 12px;
	min-width: 0;
}
.pdft-platz h3 { margin: 0 0 8px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pdft-platz-dokument { max-width: 640px; }
.pdft-marke {
	font-size: 11px;
	font-weight: 500;
	background: rgba(34, 113, 177, .18);
	color: inherit;
	padding: 2px 6px;
	border-radius: 10px;
}
.pdft-liste { margin: 0; padding-left: 1.3em; }
.pdft-liste li { margin: 4px 0; }
.pdft-liste li a { overflow-wrap: anywhere; word-break: break-word; vertical-align: middle; }
.pdft-entfernen { display: inline; margin: 0 4px 0 0; vertical-align: middle; }
.pdft-entfernen button {
	border: 0;
	background: none;
	color: #b32d2e;
	cursor: pointer;
	padding: 0 4px;
	font-size: 13px;
}
.pdft-link { font-size: 13px; font-weight: 400; margin-left: 8px; }
.pdft-shortcodes { margin-top: 2em; }

/* Dunkler Hintergrund: helle, gut lesbare Schrift (automatisch erkannt oder schrift="hell") */
.pdft-verwaltung.pdft-dunkel {
	--pdft-linie: rgba(255, 255, 255, .35);
	color: #f2f2f2;
	color-scheme: dark;
}
/* !important, damit Theme-Farben für Überschriften/Text die helle Schrift nicht überschreiben */
.pdft-verwaltung.pdft-dunkel,
.pdft-verwaltung.pdft-dunkel *:not(a):not(button):not(option):not(optgroup) {
	color: #f2f2f2 !important;
	-webkit-text-fill-color: #f2f2f2 !important;
}
.pdft-verwaltung.pdft-dunkel a:not(.pdft-knopf) { color: #9ecbff !important; -webkit-text-fill-color: #9ecbff !important; }
.pdft-verwaltung.pdft-dunkel a.pdft-knopf { color: #fff !important; }
.pdft-verwaltung.pdft-dunkel .pdft-hinweis { opacity: .85; }
.pdft-verwaltung.pdft-dunkel .pdft-entfernen button { color: #ff9b9b !important; }
.pdft-verwaltung.pdft-dunkel code { background: rgba(255, 255, 255, .12); }
.pdft-verwaltung.pdft-dunkel select,
.pdft-verwaltung.pdft-dunkel .pdft-eingabe {
	background: rgba(0, 0, 0, .35) !important;
	border: var(--pdft-linie-dicke, 1px) solid var(--pdft-linie) !important;
}
.pdft-verwaltung.pdft-dunkel option,
.pdft-verwaltung.pdft-dunkel optgroup { background: #222; color: #f2f2f2; }

/* Heller Hintergrund erzwungen (schrift="dunkel") */
.pdft-verwaltung.pdft-hell[data-pdft-schrift="dunkel"],
.pdft-verwaltung.pdft-hell[data-pdft-schrift="dunkel"] *:not(a):not(button):not(option):not(optgroup) {
	color: #1d2327 !important;
	-webkit-text-fill-color: #1d2327 !important;
}

/* ---------- Bilder & Webseiten (Tagesdienstpläne) ---------- */
.pdft-web {
	position: relative;
	overflow: hidden;
	background: #fff;
}
.pdft-web iframe {
	display: block;
	border: 0;
	transform-origin: 0 0;
	pointer-events: none; /* Vorschau im Raster: Klick öffnet die große Ansicht */
	background: #fff;
}
.pdft-web.ist-bedienbar iframe { pointer-events: auto; }
img.pdft-blatt, img.pdft-lupe-blatt { max-width: none; height: auto; }
.pdft-lupe-extern {
	position: absolute;
	right: 16px;
	bottom: 16px;
	padding: 7px 14px;
	border-radius: 18px;
	background: rgba(0, 0, 0, .55);
	color: #fff !important;
	font: 14px/1.3 system-ui, sans-serif;
	text-decoration: none;
}
.pdft-lupe-extern:hover { background: rgba(0, 0, 0, .75); }
.pdft-lupe-extern[hidden] { display: none; }
@media (max-width: 700px) { .pdft-lupe-extern { bottom: 56px; right: 50%; transform: translateX(50%); } }

/* Typ-Kennzeichnung in der Upload-Liste */
.pdft-typ {
	display: inline-block;
	min-width: 2.6em;
	padding: 1px 5px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.5;
	text-align: center;
	text-transform: uppercase;
	vertical-align: middle;
	color: #fff;
	background: #8c8f94;
}
.pdft-typ-pdf { background: #b32d2e; }
.pdft-typ-bild { background: #2271b1; }
.pdft-typ-link { background: #00a32a; }
.pdft-verwaltung .pdft-feld .pdft-eingabe + .pdft-eingabe { margin-top: 4px; }

/* Drucken / Speichern (nur Dienstplanung) */
.pdft-werkzeug { display: flex; gap: 8px; z-index: 6; }
.pdft-werkzeug[hidden] { display: none !important; }
.pdft-wz-knopf { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border: 0; border-radius: 99px;
	background: rgba(0, 5, 71, .82); color: #fff !important; -webkit-text-fill-color: #fff; font: 600 14px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
	cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.pdft-wz-knopf:hover, .pdft-wz-knopf:focus-visible { background: rgba(0, 5, 71, .95); outline: 2px solid #fff; outline-offset: 1px; }
.pdft-dokument { position: relative; }
.pdft-wz-etb { position: absolute; top: 8px; right: 8px; }
.pdft-dokument.ist-fixiert .pdft-wz-etb { position: fixed; top: auto; bottom: calc(var(--pdft-fuss-platz, 0px) + 12px); right: 16px; }
.pdft-wz-lupe { position: absolute; top: 16px; right: 76px; z-index: 3; }
.pdft-wz-lupe .pdft-wz-knopf { background: rgba(255, 255, 255, .18); min-height: 46px; box-shadow: none; }
.pdft-wz-lupe .pdft-wz-knopf:hover { background: rgba(255, 255, 255, .32); }
@media (max-width: 700px) {
	.pdft-wz-lupe { top: 12px; right: auto; left: 12px; }
	.pdft-wz-knopf span { display: none; }
	.pdft-wz-knopf { padding: 8px 12px; font-size: 18px; }
}
@media print { .pdft-werkzeug { display: none !important; } }
