/* =========================================================
   Scholar Modern — PDF flipbook modal
   Author  : Edi Suherlan | audhighasu.com | audhighasu@gmail.com
   ========================================================= */
body.sm-pdf-open {
	overflow: hidden !important;
}

.sm-pdf-modal[hidden] {
	display: none !important;
}

.sm-pdf-modal {
	position: fixed !important;
	inset: 0 !important;
	top: 0 !important;
	right: 0 !important;
	bottom: 0 !important;
	left: 0 !important;
	z-index: 10000 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	padding: 0.35rem;
	box-sizing: border-box;
}

.sm-pdf-modal__backdrop {
	position: absolute;
	inset: 0;
	background:
		radial-gradient(circle at 20% 10%, rgba(var(--sm-primary-rgb), 0.35), transparent 45%),
		radial-gradient(circle at 90% 80%, color-mix(in srgb, var(--sm-accent) 22%, transparent), transparent 40%),
		rgba(var(--sm-deep-rgb), 0.72);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.sm-pdf-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(96vw, 1480px);
	height: min(96vh, 100%);
	border-radius: 22px;
	overflow: hidden;
	background: linear-gradient(165deg, var(--sm-deep) 0%, var(--sm-primary-3) 42%, var(--sm-deep-2) 100%);
	border: 1px solid rgba(255, 255, 255, 0.14);
	box-shadow:
		0 30px 80px rgba(0, 0, 0, 0.45),
		0 0 0 1px color-mix(in srgb, var(--sm-accent) 18%, transparent),
		inset 0 1px 0 rgba(255, 255, 255, 0.12);
	animation: smPdfPop 0.34s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.sm-pdf-modal__header,
.sm-pdf-modal__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.85rem 1rem;
	background: rgba(8, 28, 32, 0.35);
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sm-pdf-modal__toolbar {
	border-bottom: 0;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	justify-content: center;
}

.sm-pdf-modal__heading {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-width: 0;
}

.sm-pdf-modal__badge {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.4rem;
	padding: 0.25rem 0.55rem;
	border-radius: 999px;
	background: #f2c14e;
	color: #0c2428;
	font-size: 0.72rem;
	font-weight: 800;
	letter-spacing: 0.04em;
}

.sm-pdf-modal__title {
	margin: 0;
	color: #fff;
	font-size: clamp(0.95rem, 2.4vw, 1.15rem);
	font-weight: 700;
	line-height: 1.25;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.sm-pdf-modal__actions {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	flex: 0 0 auto;
}

.sm-pdf-modal__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0.4rem 0.95rem;
	border: 1px solid rgba(255, 255, 255, 0.2);
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.1);
	color: rgba(255, 255, 255, 0.96);
	font-size: 0.88rem;
	font-weight: 700;
	text-decoration: none !important;
	cursor: pointer;
	transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.sm-pdf-modal__btn:hover,
.sm-pdf-modal__btn:focus {
	background: rgba(255, 255, 255, 0.18);
	border-color: color-mix(in srgb, var(--sm-accent) 65%, transparent);
	color: #f2c14e;
	outline: none;
	transform: translateY(-1px);
}

.sm-pdf-modal__btn--ghost {
	background: transparent;
}

.sm-pdf-modal__btn--icon {
	width: 42px;
	padding: 0;
	font-size: 1.45rem;
	line-height: 1;
}

.sm-pdf-modal__stage {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: block;
	padding: 0;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	background:
		radial-gradient(ellipse at center, rgba(var(--sm-primary-rgb), 0.18), transparent 60%),
		linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(8, 28, 32, 0.25));
}

.sm-pdf-modal__book-wrap {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-width: 100%;
	min-height: 100%;
	width: max-content;
	height: max-content;
	margin: 0 auto;
	padding: 0.75rem;
	perspective: 1800px;
}

.sm-pdf-modal__book {
	margin: 0 auto;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.sm-pdf-modal__book .stf__block {
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.sm-pdf-modal__book .stf__item {
	overflow: hidden !important;
	background: #f7f4ee;
	background-size: contain !important;
	background-repeat: no-repeat !important;
	background-position: center center !important;
}

.sm-pdf-modal__book .stf__item img,
.sm-pdf-modal__book img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-height: 100%;
	object-fit: contain !important;
	object-position: center center !important;
	background: #f7f4ee;
}

.sm-pdf-modal__loading,
.sm-pdf-modal__error {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.85rem;
	padding: 1.5rem;
	text-align: center;
	color: rgba(255, 255, 255, 0.92);
	background: rgba(12, 36, 40, 0.72);
}

.sm-pdf-modal__loading[hidden],
.sm-pdf-modal__error[hidden] {
	display: none !important;
}

.sm-pdf-modal__loading p,
.sm-pdf-modal__error p {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 600;
}

.sm-pdf-modal__spinner {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: #f2c14e;
	animation: smPdfSpin 0.8s linear infinite;
}

.sm-pdf-modal__pager {
	margin: 0 1rem;
	min-width: 5.5rem;
	text-align: center;
	color: rgba(255, 255, 255, 0.92);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

@keyframes smPdfPop {
	from { opacity: 0; transform: translateY(18px) scale(0.96); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes smPdfSpin {
	to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
	.sm-pdf-modal {
		padding: 0;
	}

	.sm-pdf-modal__dialog {
		width: 100%;
		height: 100%;
		border-radius: 0;
	}

	.sm-pdf-modal__title {
		max-width: 42vw;
	}

	.sm-pdf-modal__stage {
		padding: 0.4rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sm-pdf-modal__dialog,
	.sm-pdf-modal__spinner {
		animation: none !important;
	}
}
