/* Biblio PDF Viewer – toate clasele au prefixul .bdpv pentru a nu interfera cu tema sau alte plugin-uri. */
.bdpv {
	--bdpv-h: 640px;
	--bdpv-bg: #3a3d42;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	height: var(--bdpv-h);
	margin-block: 1.5em;
	background: var(--bdpv-bg);
	border-radius: 6px;
	overflow: hidden;
	clear: both;
}
.bdpv.alignfull { border-radius: 0; }
.bdpv.bdpv-auto { height: 480px; } /* până se încarcă documentul; apoi JS calculează înălțimea */
@media (max-width: 600px) {
	.bdpv:not(.bdpv-auto) { height: min(var(--bdpv-h), 85vh); }
}
.bdpv *, .bdpv *::before, .bdpv *::after { box-sizing: border-box; }
/* Izolare față de stilurile temei (teme FSE aplică reguli globale pe canvas, button, input). */
.bdpv-viewer canvas { max-width: none !important; max-height: none !important; margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.bdpv-viewer button, .bdpv-viewer input, .bdpv-viewer a.bdpv-btn {
	all: unset;
	box-sizing: border-box;
	font: inherit;
	line-height: 1;
	cursor: pointer;
}
.bdpv-viewer input { cursor: text; }
.bdpv-viewer, .bdpv-viewer * { letter-spacing: normal; text-transform: none; text-shadow: none; }
.bdpv-modal-box.bdpv { margin: 0; max-width: none; }
.bdpv-missing { color: #b32d2e; font-style: italic; }

.bdpv-viewer {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: var(--bdpv-bg) var(--bdpv-bgi, none) center / cover no-repeat;
	color: #fff;
	font: 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	outline: none;
}
.bdpv-viewer:focus-visible { box-shadow: inset 0 0 0 2px #7cb7ff; }
.bdpv-viewer:fullscreen { width: 100%; height: 100%; }
.bdpv-viewer.bdpv-pseudo-fs { position: fixed; z-index: 2147483000; inset: 0; }
html.bdpv-noscroll, html.bdpv-noscroll body { overflow: hidden !important; }

/* Bara de instrumente */
.bdpv-toolbar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 8px;
	background: rgba(0, 0, 0, .35);
	user-select: none;
}
.bdpv-group { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.bdpv-title {
	flex: 1 1 auto;
	min-width: 0;
	text-align: center;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	opacity: .85;
}
.bdpv-viewer .bdpv-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #fff;
	cursor: pointer;
	text-decoration: none;
	box-shadow: none;
	line-height: 1;
}
.bdpv-viewer .bdpv-btn:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.bdpv-viewer .bdpv-btn:focus-visible { outline: 2px solid #7cb7ff; outline-offset: 1px; }
.bdpv-viewer .bdpv-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.bdpv-viewer .bdpv-btn svg { display: block; }
.bdpv-viewer .bdpv-page-input {
	display: inline-block;
	width: 64px;
	height: 28px;
	margin: 0 2px;
	padding: 2px 4px;
	border: 1px solid rgba(255, 255, 255, .35);
	border-radius: 3px;
	background: rgba(0, 0, 0, .25);
	color: #fff;
	font: inherit;
	text-align: center;
}
.bdpv-total { padding: 0 6px 0 2px; white-space: nowrap; opacity: .85; }
@media (max-width: 560px) {
	.bdpv-title, .bdpv-btn-first, .bdpv-btn-last { display: none !important; }
	.bdpv-viewer .bdpv-btn { width: 30px; }
}

/* Căutare în text */
.bdpv-search {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: rgba(0, 0, 0, .25);
}
.bdpv-search[hidden] { display: none; }
.bdpv-viewer .bdpv-search-input {
	display: inline-block;
	flex: 1 1 auto;
	min-width: 0;
	max-width: 360px;
	height: 30px;
	padding: 2px 8px;
	border: 1px solid rgba(255, 255, 255, .35);
	border-radius: 3px;
	background: rgba(0, 0, 0, .25);
	color: #fff;
	font: inherit;
}
.bdpv-search-count { padding: 0 8px; white-space: nowrap; opacity: .9; font-size: 13px; }
.bdpv-search-count.bdpv-search-warn { color: #ffcf6b; }
.bdpv-viewer .bdpv-btn.bdpv-active { background: rgba(255, 255, 255, .25); }
.bdpv-hl { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.bdpv-hl-r { position: absolute; background: rgba(255, 225, 0, .45); border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 200, 0, .5); }
.bdpv-hl-r.bdpv-hl-cur { background: rgba(255, 130, 0, .6); box-shadow: 0 0 0 2px rgba(255, 100, 0, .8); }
.bdpv-side, .bdpv-slot { overflow: hidden; }

/* Scena */
.bdpv-stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden; /* fără bare de derulare în timpul întoarcerii paginii */
	/* Pe telefon: tragerea verticală derulează pagina web, tragerea orizontală întoarce pagina. */
	touch-action: pan-y pinch-zoom;
}
.bdpv-viewer { touch-action: pan-y pinch-zoom; }
.bdpv-zoomed .bdpv-stage, .bdpv-pseudo-fs .bdpv-stage, .bdpv-viewer:fullscreen .bdpv-stage, .bdpv-modal .bdpv-stage { touch-action: auto; }
.bdpv-zoomed .bdpv-stage { overflow: auto; }

/* Săgeți laterale (mod carte) */
.bdpv-viewer .bdpv-arrow {
	appearance: none;
	position: absolute;
	top: 50%;
	width: 44px;
	height: 72px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 6px;
	transform: translateY(-50%);
	background: rgba(0, 0, 0, .35);
	color: #fff;
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s, background .2s;
	z-index: 5;
	display: none;
	align-items: center;
	justify-content: center;
	box-shadow: none;
}
.bdpv-mode-book .bdpv-arrow { display: flex; }
.bdpv-viewer .bdpv-arrow svg { width: 32px; height: 32px; }
.bdpv-viewer .bdpv-arrow:hover { opacity: 1; background: rgba(0, 0, 0, .55); }
.bdpv-viewer .bdpv-arrow:focus-visible { outline: 2px solid #7cb7ff; }
.bdpv-viewer .bdpv-arrow:disabled { opacity: 0; pointer-events: none; }
.bdpv-viewer .bdpv-arrow-l { left: 6px; }
.bdpv-viewer .bdpv-arrow-r { right: 6px; }
@media (max-width: 560px) {
	.bdpv-viewer .bdpv-arrow { width: 32px; height: 56px; }
}
/* Pe telefon, săgețile s-ar suprapune peste marginea paginii și ar prinde atingerile destinate
   tragerii foii; acolo se răsfoiește prin glisare/atingere sau din bara de instrumente. */
@media (hover: none) and (pointer: coarse) and (max-width: 600px) {
	.bdpv-mode-book .bdpv-arrow { display: none; }
}
.bdpv-mode-book .bdpv-pages, .bdpv-mode-pages .bdpv-book { display: none; }

/* Mod carte */
.bdpv-book {
	position: relative;
	margin: 12px auto;
	perspective: 2400px;
	touch-action: pan-y pinch-zoom;
	cursor: pointer;
}
.bdpv-zoomed .bdpv-book { cursor: default; touch-action: auto; margin-bottom: 12px; }
.bdpv-side {
	position: absolute;
	top: 0;
	height: 100%;
	background: #fff;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}
.bdpv-side.bdpv-empty { background: transparent; box-shadow: none; }
.bdpv-two .bdpv-left { left: 0; width: 50%; }
.bdpv-two .bdpv-right { left: 50%; width: 50%; }
.bdpv-one .bdpv-left { display: none; }
.bdpv-one .bdpv-right { left: 0; width: 100%; }
.bdpv-two .bdpv-left:not(.bdpv-empty)::after,
.bdpv-two .bdpv-right:not(.bdpv-empty)::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 6%;
	pointer-events: none;
}
.bdpv-two .bdpv-left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .18), transparent); }
.bdpv-two .bdpv-right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .18), transparent); }

.bdpv-canvas {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #fff;
}

/* Coperta stă pe mijloc: cartea se deplasează cu o jumătate de pagină */
.bdpv-book { transition: transform .7s cubic-bezier(.45, .05, .35, 1); }
.bdpv-book.bdpv-shift-l { transform: translateX(-25%); }
.bdpv-book.bdpv-shift-r { transform: translateX(25%); }

/* Foaia 3D (WebGL) desenată peste pagini în timpul întoarcerii */
.bdpv-gl { position: absolute; z-index: 4; pointer-events: none; }
.bdpv-gl[hidden] { display: none; }

/* Grosimea blocului de pagini (muchiile foilor) de o parte și de alta a cărții */
.bdpv-stack {
	position: absolute;
	top: 2px;
	bottom: 0;
	width: 0;
	background: repeating-linear-gradient(to right, #f4f2eb 0 1px, #cdc9bf 1px 2px);
	transition: width .35s ease;
	pointer-events: none;
	z-index: 1;
}
.bdpv-stack-l { right: 100%; border-radius: 3px 0 0 3px; box-shadow: -2px 1px 6px rgba(0, 0, 0, .28); }
.bdpv-stack-r { left: 100%; border-radius: 0 3px 3px 0; box-shadow: 2px 1px 6px rgba(0, 0, 0, .28); }

.bdpv-mode-book .bdpv-book { cursor: grab; }
.bdpv-dragging .bdpv-book, .bdpv-dragging .bdpv-book * { cursor: grabbing !important; }
.bdpv-zoomed .bdpv-book { cursor: default; }

/* Foaia care se întoarce, formată din fâșii imbricate (efect de îndoire) */
.bdpv-leaf {
	position: absolute;
	transform-style: preserve-3d;
	z-index: 3;
	pointer-events: none;
}
.bdpv-seg {
	position: absolute;
	top: 0;
	transform-style: preserve-3d;
	will-change: transform;
}
.bdpv-face {
	position: absolute;
	inset: 0;
	overflow: hidden;
	background: #fff;
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}
.bdpv-face canvas { display: block; width: 100%; height: 100%; }
.bdpv-back { transform: rotateY(180deg); }
.bdpv-shade {
	position: absolute;
	inset: 0;
	background: transparent;
	pointer-events: none;
	transform: translateZ(0.5px);
}
.bdpv-shade-b { transform: rotateY(180deg) translateZ(0.5px); }

/* Mod pagini */
.bdpv-pages {
	position: relative;
	height: 100%;
	overflow: auto;
	padding: 12px 0;
	touch-action: pan-y pinch-zoom;
	-webkit-overflow-scrolling: touch;
}
.bdpv-slot {
	position: relative;
	margin: 0 auto 12px;
	max-width: none;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.bdpv-mode-pages .bdpv-stage { overflow: hidden; }

/* Stare / erori */
.bdpv-status {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	max-width: 90%;
	padding: 10px 16px;
	border-radius: 4px;
	background: rgba(0, 0, 0, .6);
	color: #fff;
	text-align: center;
	display: none;
	pointer-events: none;
}
.bdpv-status.bdpv-show { display: block; }
.bdpv-status.bdpv-err { background: #8a1f1f; }

/* Buton + fereastră modală */
.bdpv-launch { margin-block: 1em; }
.bdpv-modal {
	position: fixed;
	inset: 0;
	z-index: 2147482000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2vh 2vw;
	background: rgba(0, 0, 0, .8);
}
.bdpv-modal[hidden] { display: none; }
.bdpv-modal .bdpv-modal-box { width: 100%; height: 100%; margin: 0; }

@media (prefers-reduced-motion: reduce) {
	.bdpv-book { transition: none; }
}
