/* ==========================================================================
   PDF FlipBook — frontend viewer
   ========================================================================== */

.pdffb-viewer {
	--pdffb-bg: #f4f5f7;
	--pdffb-toolbar-bg: #1f2430;
	--pdffb-toolbar-fg: #e7eaf0;
	--pdffb-accent: #4a7dff;
	--pdffb-radius: 10px;
	position: relative;
	display: flex;
	flex-direction: column;
	max-width: 100%;
	margin: 1.2em auto;
	background: var(--pdffb-bg);
	border-radius: var(--pdffb-radius);
	box-shadow: 0 6px 30px rgba(17, 22, 34, 0.12);
	overflow: hidden;
	box-sizing: border-box;
	-webkit-user-select: none;
	user-select: none;
}

.pdffb-viewer *,
.pdffb-viewer *::before,
.pdffb-viewer *::after {
	box-sizing: border-box;
}

/* --- Stage (where the book lives) --------------------------------------- */
.pdffb-stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 22px;
	overflow: hidden;
}

.pdffb-book-wrap {
	position: relative;
	transition: transform 0.25s ease;
	transform-origin: center center;
	will-change: transform;
	max-width: 100%;
	max-height: 100%;
}

.pdffb-book {
	touch-action: pan-y;
}

/* Page images inside StPageFlip */
.pdffb-book .pdffb-page {
	background: #fff;
	overflow: hidden;
}

.pdffb-book .pdffb-page img {
	width: 100%;
	height: 100%;
	display: block;
	pointer-events: none;
}

.pdffb-page-shadow-tint {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* --- Floating nav arrows ------------------------------------------------- */
.pdffb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 6;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba(31, 36, 48, 0.55);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease, transform 0.1s ease;
	backdrop-filter: blur(4px);
}

.pdffb-viewer:hover .pdffb-nav {
	opacity: 1;
}

.pdffb-nav:hover {
	background: var(--pdffb-accent);
}

.pdffb-nav:active {
	transform: translateY(-50%) scale(0.94);
}

.pdffb-nav[disabled] {
	opacity: 0 !important;
	pointer-events: none;
}

.pdffb-nav-prev { left: 12px; }
.pdffb-nav-next { right: 12px; }

/* --- Loader ------------------------------------------------------------- */
.pdffb-loader {
	position: absolute;
	inset: 0;
	z-index: 8;
	display: flex;
	flex-direction: column;
	gap: 14px;
	align-items: center;
	justify-content: center;
	background: var(--pdffb-bg);
	color: #5a6072;
	font-size: 14px;
	transition: opacity 0.35s ease;
}

.pdffb-loader.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.pdffb-spinner {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: 3px solid rgba(90, 96, 114, 0.25);
	border-top-color: var(--pdffb-accent);
	animation: pdffb-spin 0.8s linear infinite;
}

.pdffb-loader-text .pdffb-pct {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	color: #2a2f3a;
}

@keyframes pdffb-spin {
	to { transform: rotate(360deg); }
}

.pdffb-viewer.is-error .pdffb-loader {
	color: #c0392b;
}

/* --- Thumbnails --------------------------------------------------------- */
.pdffb-thumbs {
	position: absolute;
	left: 0;
	top: 0;
	bottom: 52px;
	z-index: 7;
	width: 148px;
	padding: 12px 10px;
	overflow-y: auto;
	background: rgba(20, 24, 33, 0.92);
	backdrop-filter: blur(6px);
	transform: translateX(-100%);
	transition: transform 0.28s ease;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.pdffb-thumbs.is-open {
	transform: translateX(0);
}

.pdffb-thumb {
	border: 2px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	background: #fff;
	line-height: 0;
	transition: border-color 0.15s ease, transform 0.15s ease;
	position: relative;
}

.pdffb-thumb:hover { transform: translateY(-2px); }

.pdffb-thumb.is-active {
	border-color: var(--pdffb-accent);
}

.pdffb-thumb img {
	width: 100%;
	display: block;
}

.pdffb-thumb-num {
	position: absolute;
	right: 3px;
	bottom: 3px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 10px;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 3px;
}

/* --- Toolbar ------------------------------------------------------------ */
.pdffb-toolbar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 7px 10px;
	background: var(--pdffb-toolbar-bg);
	color: var(--pdffb-toolbar-fg);
	z-index: 9;
}

.pdffb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 7px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.pdffb-btn:hover {
	background: rgba(255, 255, 255, 0.12);
}

.pdffb-btn:active {
	background: rgba(255, 255, 255, 0.2);
}

.pdffb-btn[disabled] {
	opacity: 0.35;
	cursor: default;
	pointer-events: none;
}

.pdffb-btn.is-active {
	background: var(--pdffb-accent);
	color: #fff;
}

.pdffb-sound.is-off .pdffb-sound-wave {
	display: none;
}

.pdffb-spacer {
	flex: 1 1 auto;
}

.pdffb-pageinfo {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0 6px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}

.pdffb-page-input {
	width: 44px;
	text-align: center;
	border: 1px solid rgba(255, 255, 255, 0.2);
	background: rgba(255, 255, 255, 0.08);
	color: inherit;
	border-radius: 5px;
	padding: 4px 2px;
	font-size: 13px;
	-moz-appearance: textfield;
}

.pdffb-page-input::-webkit-outer-spin-button,
.pdffb-page-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.pdffb-page-sep { opacity: 0.5; }
.pdffb-page-total { min-width: 1.5em; }

/* --- Fullscreen --------------------------------------------------------- */
.pdffb-viewer:fullscreen {
	width: 100% !important;
	height: 100% !important;
	margin: 0;
	border-radius: 0;
	max-width: none;
}

.pdffb-viewer:-webkit-full-screen {
	width: 100% !important;
	height: 100% !important;
	margin: 0;
	border-radius: 0;
}

.pdffb-viewer.pdffb-faux-fullscreen {
	position: fixed !important;
	inset: 0;
	width: 100% !important;
	height: 100% !important;
	margin: 0;
	border-radius: 0;
	z-index: 999999;
}

/* --- Admin notice bubble ------------------------------------------------ */
.pdffb-notice {
	border: 1px dashed #c3c4c7;
	background: #fff8e5;
	color: #8a6d3b;
	padding: 14px 16px;
	border-radius: 8px;
	font-size: 14px;
	margin: 1em 0;
}

/* --- Small screens ------------------------------------------------------ */
@media (max-width: 600px) {
	.pdffb-stage { padding: 12px; }
	.pdffb-nav { width: 38px; height: 38px; }
	.pdffb-btn { width: 30px; height: 30px; }
	.pdffb-thumbs { width: 116px; }
}

@media (prefers-reduced-motion: reduce) {
	.pdffb-book-wrap,
	.pdffb-nav,
	.pdffb-thumb { transition: none; }
}
