/* PDF Flipbook Viewer */
.pdffb-no-scroll { overflow: hidden !important; }

.pdffb-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 17, 22, 0.9);
	backdrop-filter: blur(4px);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	opacity: 0;
	transition: opacity .25s ease;
}
.pdffb-overlay.pdffb-open { display: flex; opacity: 1; }

.pdffb-modal {
	position: relative;
	width: 96vw;
	height: 94vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
}

.pdffb-close {
	position: absolute;
	top: 0;
	right: 0;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: rgba(255,255,255,0.14);
	color: #fff;
	font-size: 26px;
	border-radius: 50%;
	cursor: pointer;
	transition: background .2s;
	z-index: 10;
}
.pdffb-close:hover { background: rgba(255,255,255,0.3); }

.pdffb-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	flex: 1;
	min-height: 0;
}

/* The book is sized in JS to match the PDF aspect ratio exactly */
.pdffb-book {
	position: relative;
	perspective: 2200px;
	flex: 0 0 auto;
}

.pdffb-pages {
	position: relative;
	width: 100%;
	height: 100%;
	transform-style: preserve-3d;
	transition: transform .72s cubic-bezier(.42,0,.2,1);
}

.pdffb-spread {
	display: flex;
	width: 100%;
	height: 100%;
	border-radius: 2px;
}

.pdffb-leaf {
	position: relative;
	overflow: hidden;
}
.pdffb-leaf:not(:empty) {
	background: #fff;
	box-shadow: 0 22px 60px rgba(0,0,0,0.55);
}
.pdffb-page-img { display: block; object-fit: fill; }

/* Subtle spine shading on a two-page spread (fades in so it never pops) */
.pdffb-double .pdffb-leaf-left::after,
.pdffb-double .pdffb-leaf-right::before {
	content: "";
	position: absolute;
	top: 0; bottom: 0;
	width: 26px;
	pointer-events: none;
	opacity: 0;
	animation: pdffb-spine-fade .6s ease .15s forwards;
}
@keyframes pdffb-spine-fade { to { opacity: 1; } }
.pdffb-double .pdffb-leaf-left::after {
	right: 0;
	background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.16) 100%);
}
.pdffb-double .pdffb-leaf-right::before {
	left: 0;
	background: linear-gradient(to left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.16) 100%);
}

/* ---------- Page-turn flip ---------- */
.pdffb-flip {
	position: absolute;
	top: 0;
	transform-style: preserve-3d;
	transition: transform .72s cubic-bezier(.42,0,.2,1);
	will-change: transform;
}
/* Forward turn: right half lifts and rotates toward the spine (left) */
.pdffb-flip-right {
	right: 0;
	transform-origin: left center;
	transform: rotateY(0deg);
}
.pdffb-flip-right.pdffb-flip-go { transform: rotateY(-180deg); }

/* Backward turn: left half lifts and rotates toward the spine (right) */
.pdffb-flip-left {
	left: 0;
	transform-origin: right center;
	transform: rotateY(0deg);
}
.pdffb-flip-left.pdffb-flip-go { transform: rotateY(180deg); }

/* Cover open/close: the cover sits centred (left slot via the page-layer offset)
   and hinges on its left edge, swinging left like a book cover. */
.pdffb-flip-cover {
	left: 0;
	transform-origin: left center;
	transform: rotateY(0deg);
}
.pdffb-flip-cover.pdffb-flip-go { transform: rotateY(-180deg); }

/* Final lone page: pinned to the LEFT slot, hinges on its right edge and swings
   right (used when leaving the last page backward). */
.pdffb-flip-final {
	left: 0;
	transform-origin: right center;
	transform: rotateY(0deg);
}
.pdffb-flip-final.pdffb-flip-go { transform: rotateY(180deg); }

.pdffb-flip-face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 0 18px rgba(0,0,0,0.25);
}
.pdffb-flip-face img { width: 100%; height: 100%; display: block; object-fit: fill; }
.pdffb-flip-front { transform: rotateY(0deg); z-index: 2; }
.pdffb-flip-back  { transform: rotateY(180deg); }

/* Moving shadow that sweeps across the turning page (eases in then out) */
.pdffb-flip-shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(to right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.05) 60%, rgba(0,0,0,0.32) 100%);
	opacity: 0;
	pointer-events: none;
}
.pdffb-flip-go .pdffb-flip-shade { animation: pdffb-shade-sweep .72s ease forwards; }
@keyframes pdffb-shade-sweep {
	0%   { opacity: 0; }
	45%  { opacity: 1; }
	100% { opacity: 0; }
}

/* ---------- Nav buttons (icons centered) ---------- */
.pdffb-nav {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	width: 54px;
	height: 54px;
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba(255,255,255,0.16);
	color: #fff;
	font-size: 24px;
	cursor: pointer;
	transition: background .2s, transform .15s;
	z-index: 10;
}
.pdffb-prev { left: 22px; }
.pdffb-next { right: 22px; }
.pdffb-nav:hover:not(:disabled) { background: rgba(255,255,255,0.34); transform: translateY(-50%) scale(1.06); }
.pdffb-nav:disabled { opacity: .25; cursor: default; }

/* ---------- Toolbar ---------- */
.pdffb-toolbar {
	margin-top: 14px;
	display: flex;
	align-items: center;
	gap: 22px;
	color: #fff;
	font-size: 14px;
}
.pdffb-counter { opacity: .9; }
.pdffb-download {
	color: #fff;
	text-decoration: none;
	border: 1px solid rgba(255,255,255,0.4);
	padding: 6px 16px;
	border-radius: 20px;
	cursor: pointer;
	transition: background .2s;
}
.pdffb-download:hover { background: rgba(255,255,255,0.92); color: #15171a; border-color: rgba(255,255,255,0.92); }

/* ---------- Loader ---------- */
.pdffb-loader {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	color: #fff;
	z-index: 5;
}
.pdffb-spinner {
	width: 46px;
	height: 46px;
	border: 4px solid rgba(255,255,255,0.25);
	border-top-color: #fff;
	border-radius: 50%;
	animation: pdffb-spin 0.9s linear infinite;
}
@keyframes pdffb-spin { to { transform: rotate(360deg); } }
.pdffb-loader-text { font-size: 14px; opacity: .85; }

.pdffb-error { color: #fff; padding: 40px; text-align: center; }

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
	.pdffb-nav { width: 42px; height: 42px; font-size: 18px; }
	.pdffb-stage { gap: 4px; }
	.pdffb-toolbar { flex-direction: column; gap: 8px; }
}
