/* ==========================================================================
   PDF Book Flip — Glassmorphism UI
   ========================================================================== */

.pbf-wrapper {
	--pbf-accent: #7c5cff;
	--pbf-glass-bg: rgba(255, 255, 255, 0.18);
	--pbf-glass-border: rgba(255, 255, 255, 0.35);
	--pbf-text: #1f2430;
	--pbf-height: 600px;

	position: relative;
	width: 100%;
	margin: 0 auto;
	box-sizing: border-box;
}

.pbf-wrapper *,
.pbf-wrapper *::before,
.pbf-wrapper *::after {
	box-sizing: border-box;
}

.pbf-skin-dark {
	--pbf-glass-bg: rgba(20, 20, 30, 0.35);
	--pbf-glass-border: rgba(255, 255, 255, 0.12);
	--pbf-text: #f2f2f7;
}

.pbf-glass-panel {
	position: relative;
	width: 100%;
	min-height: var(--pbf-height);
	border-radius: var(--pbf-radius, 24px);
	background: var(--pbf-glass-bg);
	border: 1px solid var(--pbf-glass-border);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	box-shadow:
		0 8px 32px rgba(31, 38, 135, 0.18),
		inset 0 1px 0 rgba(255, 255, 255, 0.25);
	padding: 28px 24px 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	color: var(--pbf-text);
}

.pbf-stage-bg {
	position: absolute;
	inset: 0;
	z-index: 0;
	border-radius: inherit;
	pointer-events: none;
}

/* ---------------- Realistic page-stack edges (right side of book) ---------------- */
.pbf-has-edges .pbf-book-container {
	position: relative;
}

.pbf-has-edges .pbf-book-container::after {
	content: '';
	position: absolute;
	top: 3%;
	right: -6px;
	width: 10px;
	height: 94%;
	background: repeating-linear-gradient(
		to bottom,
		#f4f4f4 0px,
		#f4f4f4 2px,
		#dcdcdc 2px,
		#dcdcdc 3px
	);
	border-radius: 0 4px 4px 0;
	box-shadow: 2px 0 6px rgba(0, 0, 0, 0.15);
	z-index: -1;
	pointer-events: none;
}

/* ---------------- Corner style ---------------- */
.pbf-corner-hard .pbf-page {
	border-radius: 0 !important;
}

.pbf-corner-soft .pbf-page {
	border-radius: 3px;
}

/* ---------------- Idle hint (invites user to flip) ---------------- */
@keyframes pbf-corner-wiggle {
	0%, 100% { clip-path: inset(0 0 0 0); }
	50% { clip-path: polygon(0 0, 78% 0, 100% 22%, 100% 100%, 0 100%); }
}

.pbf-corner-wiggle {
	animation: pbf-corner-wiggle 0.9s ease-in-out 2;
}

.pbf-glass-panel::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(circle at 20% 0%, rgba(124, 92, 255, 0.18), transparent 55%),
		radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.12), transparent 45%);
	pointer-events: none;
	z-index: 0;
}

/* ---------------- Loader ---------------- */
.pbf-loader {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 300px;
	z-index: 1;
}

.pbf-spinner {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: 3px solid rgba(124, 92, 255, 0.2);
	border-top-color: var(--pbf-accent);
	animation: pbf-spin 0.9s linear infinite;
}

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

.pbf-loader-text {
	font-size: 14px;
	opacity: 0.8;
}

/* ---------------- Error ---------------- */
.pbf-error,
.pbf-notice {
	padding: 16px 20px;
	border-radius: 14px;
	background: rgba(255, 90, 90, 0.12);
	border: 1px solid rgba(255, 90, 90, 0.35);
	color: #d43f3f;
	font-size: 14px;
	text-align: center;
	z-index: 1;
}

/* ---------------- Book Stage ---------------- */
.pbf-book-stage {
	position: relative;
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1;
	flex: 1;
	perspective: 2400px;
}

.pbf-book-container {
	transition: transform 0.35s ease;
	transform-origin: center center;
	filter: drop-shadow(0 25px 45px rgba(0, 0, 0, 0.35));
}

/* St.PageFlip generated pages */
.pbf-page {
	background: #fff;
	overflow: hidden;
}

.pbf-page-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
}

.pbf-page-content img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	-webkit-user-drag: none;
	user-select: none;
}

.pbf-page-mini-spinner {
	display: none;
	position: absolute;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 3px solid rgba(124, 92, 255, 0.2);
	border-top-color: var(--pbf-accent);
	animation: pbf-spin 0.9s linear infinite;
}

.pbf-page-pending {
	background: #f2f2f5;
}

.pbf-page-pending .pbf-page-mini-spinner {
	display: block;
}

.pbf-page-pending img {
	opacity: 0;
}

/* ---------------- Controls ---------------- */
.pbf-controls {
	position: relative;
	z-index: 2;
	margin-top: 18px;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px;
	border-radius: 999px;
	background: var(--pbf-glass-bg);
	border: 1px solid var(--pbf-glass-border);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
	flex-wrap: wrap;
	justify-content: center;
}

.pbf-btn {
	width: 46px;
	height: 46px;
	border-radius: 50%;
	border: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.35);
	color: var(--pbf-text);
	cursor: pointer;
	transition: transform 0.15s ease, background 0.2s ease;
}

.pbf-skin-dark .pbf-btn {
	background: rgba(255, 255, 255, 0.08);
}

.pbf-btn svg {
	width: 24px;
	height: 24px;
	fill: currentColor;
}

.pbf-btn:hover {
	background: var(--pbf-accent);
	color: #fff;
	transform: translateY(-2px);
}

.pbf-btn:active {
	transform: translateY(0) scale(0.94);
}

.pbf-page-indicator {
	font-size: 13px;
	font-weight: 600;
	min-width: 56px;
	text-align: center;
	opacity: 0.85;
}

/* ---------------- Fullscreen ---------------- */
.pbf-wrapper.pbf-fullscreen-active {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	z-index: 999999 !important;
	max-width: 100vw !important;
	width: 100vw !important;
	height: 100vh !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: #0b0b12;
}

.pbf-wrapper:fullscreen,
.pbf-wrapper:-webkit-full-screen,
.pbf-wrapper:-moz-full-screen {
	max-width: 100vw !important;
	width: 100vw !important;
	height: 100vh !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: #0b0b12;
}

.pbf-wrapper.pbf-fullscreen-active .pbf-glass-panel,
.pbf-wrapper:fullscreen .pbf-glass-panel,
.pbf-wrapper:-webkit-full-screen .pbf-glass-panel,
.pbf-wrapper:-moz-full-screen .pbf-glass-panel {
	border-radius: 0;
	width: 100%;
	height: 100%;
	min-height: 100vh;
	max-height: 100vh;
	background: rgba(10, 10, 15, 0.92);
}

.pbf-wrapper.pbf-fullscreen-active .pbf-book-stage,
.pbf-wrapper:fullscreen .pbf-book-stage,
.pbf-wrapper:-webkit-full-screen .pbf-book-stage,
.pbf-wrapper:-moz-full-screen .pbf-book-stage {
	flex: 1 1 auto;
	width: 100%;
	height: 100%;
	min-height: 0;
}

.pbf-wrapper.pbf-fullscreen-active .pbf-book-container,
.pbf-wrapper:fullscreen .pbf-book-container,
.pbf-wrapper:-webkit-full-screen .pbf-book-container,
.pbf-wrapper:-moz-full-screen .pbf-book-container {
	width: 100%;
	height: 100%;
}

/* ---------------- Editor preview (Elementor) ---------------- */
.pbf-editor-preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 260px;
	opacity: 0.8;
}

.pbf-editor-preview .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
}

/* ---------------- Mobile ---------------- */
@media (max-width: 768px) {
	.pbf-glass-panel {
		padding: 18px 12px 16px;
		border-radius: 18px;
	}

	.pbf-book-stage {
		perspective: 1400px;
	}

	.pbf-btn {
		width: 42px;
		height: 42px;
	}

	.pbf-btn svg {
		width: 20px;
		height: 20px;
	}

	.pbf-controls {
		gap: 6px;
		padding: 8px 12px;
	}

	.pbf-page-indicator {
		font-size: 12px;
		min-width: 46px;
	}
}

@media (max-width: 420px) {
	.pbf-controls {
		width: 100%;
	}
}

/* ==========================================================================
   Showcase — Multiple Books Grid + Modal
   ========================================================================== */

.pbf-showcase {
	--pbf-accent: #7c5cff;
	width: 100%;
	box-sizing: border-box;
}

.pbf-showcase *,
.pbf-showcase *::before,
.pbf-showcase *::after {
	box-sizing: border-box;
}

.pbf-showcase-grid {
	display: grid;
	grid-template-columns: repeat(var(--pbf-showcase-cols, 3), 1fr);
	gap: 28px;
}

@media (max-width: 900px) {
	.pbf-showcase-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 560px) {
	.pbf-showcase-grid {
		grid-template-columns: 1fr 1fr;
		gap: 16px;
	}
}

.pbf-showcase-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	cursor: pointer;
	padding: 18px 14px 20px;
	border-radius: 20px;
	background: rgba(255, 255, 255, 0.18);
	border: 1px solid rgba(255, 255, 255, 0.3);
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
	box-shadow: 0 8px 26px rgba(31, 38, 135, 0.14);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	outline: none;
}

.pbf-skin-dark.pbf-showcase .pbf-showcase-card {
	background: rgba(20, 20, 30, 0.35);
	border-color: rgba(255, 255, 255, 0.1);
	color: #f2f2f7;
}

.pbf-showcase-card:hover,
.pbf-showcase-card:focus-visible {
	transform: translateY(-8px);
	box-shadow: 0 18px 40px rgba(31, 38, 135, 0.22);
}

.pbf-showcase-book {
	perspective: 900px;
	margin-bottom: 14px;
}

.pbf-showcase-cover {
	position: relative;
	width: 140px;
	aspect-ratio: 3 / 4;
	border-radius: 4px 8px 8px 4px;
	overflow: hidden;
	box-shadow:
		-6px 0 0 -2px rgba(0, 0, 0, 0.06),
		6px 10px 20px rgba(0, 0, 0, 0.28);
	transform: rotateY(-18deg);
	transition: transform 0.35s ease;
	background: #eee;
}

.pbf-showcase-card:hover .pbf-showcase-cover {
	transform: rotateY(-6deg);
}

.pbf-showcase-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pbf-showcase-cover-loading {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

.pbf-showcase-spine {
	position: absolute;
	top: 0;
	left: 0;
	width: 8px;
	height: 100%;
	background: linear-gradient(to right, rgba(0, 0, 0, 0.35), transparent);
}

.pbf-showcase-title {
	font-size: 15px;
	font-weight: 700;
	margin: 0 0 4px;
}

.pbf-showcase-desc {
	font-size: 12.5px;
	opacity: 0.75;
	margin: 0 0 12px;
	line-height: 1.4;
}

.pbf-showcase-read-btn {
	margin-top: auto;
	border: none;
	padding: 8px 20px;
	border-radius: 999px;
	background: var(--pbf-accent);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: transform 0.15s ease, opacity 0.2s ease;
}

.pbf-showcase-read-btn:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

/* ---------------- Modal ---------------- */
.pbf-showcase-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.pbf-showcase-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 20, 0.6);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.pbf-showcase-modal-inner {
	position: relative;
	width: 100%;
	max-width: 900px;
	max-height: 92vh;
	overflow: auto;
	z-index: 1;
}

.pbf-showcase-modal-close {
	position: absolute;
	top: -14px;
	right: -14px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	border: none;
	background: #fff;
	color: #1f2430;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
	z-index: 2;
}

.pbf-showcase-modal-close svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.pbf-showcase-modal-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 300px;
}

body.pbf-fs-lock,
body.pbf-modal-open {
	overflow: hidden;
}

.pbf-showcase-editor-preview {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 200px;
	opacity: 0.8;
}

.pbf-showcase-editor-preview .dashicons {
	font-size: 40px;
	width: 40px;
	height: 40px;
}
