.apfb-pdf-flipbook {
	--apfb-height: 720px;
	--apfb-bg: #111827;
	--apfb-accent: #ef4444;
	--apfb-toolbar-bg: rgba(255,255,255,0.10);
	--apfb-toolbar-text: #ffffff;
	--apfb-page-bg: #ffffff;
	--apfb-radius: 24px;
	width: 100%;
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.apfb-book-header {
	text-align: center;
	margin-bottom: 22px;
}

.apfb-book-title {
	margin: 0 0 8px;
	font-size: 34px;
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -0.03em;
	color: #111827;
}

.apfb-book-description {
	margin: 0;
	font-size: 16px;
	line-height: 1.7;
	color: #4b5563;
}

.apfb-book-shell {
	position: relative;
	overflow: hidden;
	padding: 22px;
	border-radius: var(--apfb-radius);
	background:
		radial-gradient(circle at top left, color-mix(in srgb, var(--apfb-accent) 45%, transparent), transparent 35%),
		linear-gradient(135deg, color-mix(in srgb, var(--apfb-bg) 88%, #ffffff 12%), var(--apfb-bg));
	box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
	isolation: isolate;
}

.apfb-book-shell:before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		linear-gradient(135deg, rgba(255,255,255,0.12), transparent 35%),
		linear-gradient(315deg, rgba(0,0,0,0.28), transparent 50%);
	z-index: 0;
}

.apfb-toolbar {
	position: relative;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 9px;
	padding: 12px;
	margin-bottom: 16px;
	border: 1px solid rgba(255,255,255,0.14);
	border-radius: 18px;
	background: var(--apfb-toolbar-bg);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	color: var(--apfb-toolbar-text);
}

.apfb-btn,
.apfb-btn:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 999px;
	background: rgba(255,255,255,0.14);
	color: var(--apfb-toolbar-text);
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none !important;
	cursor: pointer;
	transition: transform 220ms ease, background 220ms ease, color 220ms ease, opacity 220ms ease;
	appearance: none;
	-webkit-appearance: none;
}

.apfb-btn:hover,
.apfb-btn:focus {
	background: var(--apfb-accent);
	color: #ffffff;
	transform: translateY(-1px);
	outline: none;
}

.apfb-btn[disabled] {
	opacity: 0.38;
	cursor: not-allowed;
	transform: none;
}

.apfb-page-status,
.apfb-zoom-status {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 82px;
	height: 40px;
	padding: 0 14px;
	border-radius: 999px;
	background: rgba(0,0,0,0.16);
	color: var(--apfb-toolbar-text);
	font-size: 14px;
	font-weight: 700;
}

.apfb-stage {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 340px;
	height: var(--apfb-height);
	padding: 24px;
	border-radius: 20px;
	background:
		linear-gradient(90deg, rgba(0,0,0,0.30), transparent 11%, transparent 89%, rgba(0,0,0,0.30)),
		radial-gradient(circle at center, rgba(255,255,255,0.14), rgba(0,0,0,0.18));
	perspective: 1800px;
	overflow: hidden;
}

.apfb-stage:before {
	content: "";
	position: absolute;
	top: 8%;
	bottom: 8%;
	left: 50%;
	width: 2px;
	transform: translateX(-50%);
	background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.26), transparent);
	box-shadow: 0 0 28px rgba(0,0,0,0.35);
	z-index: 0;
	pointer-events: none;
}

.apfb-pages {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0;
	max-width: 100%;
	max-height: 100%;
	transform-style: preserve-3d;
	transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), opacity 260ms ease;
}

.apfb-page {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 80px;
	min-height: 120px;
	background: var(--apfb-page-bg);
	box-shadow: 0 24px 65px rgba(0,0,0,0.28);
	overflow: hidden;
}

.apfb-page-left {
	border-radius: 12px 0 0 12px;
	transform-origin: right center;
}

.apfb-page-right {
	border-radius: 0 12px 12px 0;
	transform-origin: left center;
}

.apfb-page-left:after,
.apfb-page-right:before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	width: 34px;
	pointer-events: none;
	z-index: 2;
}

.apfb-page-left:after {
	right: 0;
	background: linear-gradient(to left, rgba(0,0,0,0.18), transparent);
}

.apfb-page-right:before {
	left: 0;
	background: linear-gradient(to right, rgba(0,0,0,0.18), transparent);
}

.apfb-page canvas {
	display: block;
	max-width: 100%;
	max-height: 100%;
	background: #ffffff;
}

.apfb-loader {
	position: absolute;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: calc(100% - 40px);
	padding: 14px 20px;
	border-radius: 999px;
	background: rgba(255,255,255,0.92);
	color: #111827;
	font-size: 14px;
	font-weight: 700;
	box-shadow: 0 18px 45px rgba(0,0,0,0.22);
	text-align: center;
}

.apfb-loaded .apfb-loader {
	display: none;
}

.apfb-error .apfb-loader {
	display: flex;
	background: #fee2e2;
	color: #991b1b;
}

.apfb-single-mode .apfb-stage:before {
	display: none;
}

.apfb-single-mode .apfb-page-left {
	border-radius: 14px;
}

.apfb-single-mode .apfb-page-left:after,
.apfb-single-mode .apfb-page-right,
.apfb-hide-right .apfb-page-right {
	display: none;
}

.apfb-turning-next .apfb-pages {
	animation: apfbPageNext 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

.apfb-turning-prev .apfb-pages {
	animation: apfbPagePrev 460ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes apfbPageNext {
	0% { transform: rotateY(0deg) translateX(0); opacity: 1; }
	45% { transform: rotateY(-16deg) translateX(-10px); opacity: 0.74; }
	100% { transform: rotateY(0deg) translateX(0); opacity: 1; }
}

@keyframes apfbPagePrev {
	0% { transform: rotateY(0deg) translateX(0); opacity: 1; }
	45% { transform: rotateY(16deg) translateX(10px); opacity: 0.74; }
	100% { transform: rotateY(0deg) translateX(0); opacity: 1; }
}

.apfb-pdf-flipbook:fullscreen {
	padding: 24px;
	background: #0b1120;
	overflow: auto;
}

.apfb-pdf-flipbook:fullscreen .apfb-stage {
	height: calc(100vh - 120px);
}

@supports not (color: color-mix(in srgb, #000 50%, transparent)) {
	.apfb-book-shell {
		background: linear-gradient(135deg, #1f2937, var(--apfb-bg));
	}
}

@media (max-width: 767px) {
	.apfb-book-title {
		font-size: 26px;
	}

	.apfb-book-description {
		font-size: 14px;
	}

	.apfb-book-shell {
		padding: 14px;
	}

	.apfb-toolbar {
		justify-content: center;
		gap: 7px;
	}

	.apfb-btn,
	.apfb-page-status,
	.apfb-zoom-status {
		min-width: 36px;
		height: 36px;
		padding: 0 11px;
		font-size: 13px;
	}

	.apfb-stage {
		height: min(var(--apfb-height), 72vh);
		padding: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.apfb-pages,
	.apfb-btn {
		transition: none;
	}

	.apfb-turning-next .apfb-pages,
	.apfb-turning-prev .apfb-pages {
		animation: none;
	}
}
