/**
 * Simple PDF Viewer & Export – Styles.
 * CSS-Variablen erlauben einfaches Überschreiben über Theme/Builder.
 */

.pvex-viewer {
	--pvex-bg: #f3f4f6;
	--pvex-toolbar-bg: #861020;        /* Markenrot */
	--pvex-toolbar-fg: #ffffff;
	--pvex-btn-hover: rgba( 255, 255, 255, 0.15 );
	--pvex-border: #e5e7eb;
	--pvex-radius: 8px;

	width: var( --pvex-width, 100% );
	max-width: 100%;
	min-width: 0;                      /* in Flex-Layouts schrumpfen dürfen */
	box-sizing: border-box;
	border: 1px solid var( --pvex-border );
	border-radius: var( --pvex-radius );
	overflow: hidden;
	background: var( --pvex-bg );
	box-shadow: 0 1px 3px rgba( 0, 0, 0, 0.08 );
	font-family: inherit;
}

/* ---------- Toolbar ---------- */
.pvex-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 8px 12px;
	background: var( --pvex-toolbar-bg );
	color: var( --pvex-toolbar-fg );
	flex-wrap: wrap;
}

.pvex-toolbar-group {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}

.pvex-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease;
	-webkit-tap-highlight-color: transparent;
}

.pvex-btn:hover,
.pvex-btn:focus-visible {
	background: var( --pvex-btn-hover );
	outline: none;
}

.pvex-pageinfo {
	font-size: 14px;
	min-width: 64px;
	text-align: center;
	white-space: nowrap;
}

/* Download-Button mit Beschriftung */
.pvex-btn-download {
	gap: 8px;
	padding: 0 14px;
	font-size: 14px;
	font-weight: 600;
	background: rgba( 255, 255, 255, 0.16 );
	white-space: nowrap;
}

.pvex-btn-download:hover,
.pvex-btn-download:focus-visible {
	background: rgba( 255, 255, 255, 0.30 );
}

.pvex-dl-icon { font-size: 18px; line-height: 1; }
.pvex-dl-label { line-height: 1; }

/* ---------- Canvas / PDF-Fläche ---------- */
/* Äußerer Rahmen: feste Größe, clippt. Bestimmt die Maße – unabhängig vom Inhalt. */
.pvex-canvas-wrap {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
	height: var( --pvex-height, 800px );
	max-height: 90vh;
	overflow: hidden;            /* clippt – kann NICHT mit dem Inhalt wachsen */
	background: var( --pvex-bg );
}

/* Innere Scroll-Fläche: absolut an den Rahmen gebunden -> kann keine Eltern
   aufblähen. Ein beliebig großes PDF wird hier rein gescrollt. */
.pvex-canvas-scroll {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;   /* sanftes Scrollen auf iOS */
	display: flex;
	justify-content: safe center;        /* zentriert wenn es passt, sonst scrollbar */
	align-items: flex-start;
	padding: 16px;
	box-sizing: border-box;
}

.pvex-canvas {
	display: block;
	max-width: none;        /* darf breiter als die Fläche sein -> wird gescrollt */
	height: auto;
	flex: 0 0 auto;         /* echte Rendergröße behalten, nicht stauchen */
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.15 );
	background: #fff;
}

.pvex-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	font-size: 14px;
	color: #6b7280;
}

/* Hinweis-Box (nur für Redakteure sichtbar). */
.pvex-notice {
	padding: 12px 16px;
	border: 1px dashed #f59e0b;
	background: #fffbeb;
	color: #92400e;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.5;
}
.pvex-notice code {
	background: rgba( 0, 0, 0, 0.06 );
	padding: 1px 5px;
	border-radius: 4px;
	font-size: 13px;
}

/* ---------- Export-Button ---------- */
.pvex-export-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: none;
	border-radius: 8px;
	background: #861020;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.pvex-export-btn:hover:not( :disabled ) {
	background: #6b0d1a;
}

.pvex-export-btn:disabled,
.pvex-export-btn.pvex-busy {
	opacity: 0.7;
	cursor: progress;
}

/* ---------- Mobile / Responsive ---------- */
@media ( max-width: 768px ) {
	.pvex-toolbar {
		padding: 6px 8px;
		gap: 6px;
		justify-content: center;
	}
	.pvex-btn {
		min-width: 42px;     /* fingerfreundlich */
		height: 42px;
	}
	.pvex-btn-download {
		padding: 0 12px;
		font-size: 13px;
	}
	.pvex-canvas-wrap {
		max-height: 80vh;
	}
	.pvex-canvas-scroll {
		padding: 8px;
	}
	.pvex-pageinfo {
		font-size: 13px;
		min-width: 54px;
	}
}

@media ( max-width: 400px ) {
	.pvex-toolbar {
		gap: 4px;
	}
	.pvex-btn-download {
		padding: 0 10px;
		font-size: 12px;
	}
}
