/* GPVL Book Reading — teaser + modal + flip book shell */

.gpvl-br {
	--gpvl-br-radius: 10px;
	--gpvl-br-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
	font-family: inherit;
}

.gpvl-br--error {
	color: #b91c1c;
	padding: 0.75rem;
}

.gpvl-br__teaser {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.65rem;
	max-width: 420px;
	margin: 0 auto;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	text-align: center;
	color: inherit;
}

.gpvl-br__teaser:focus-visible {
	outline: 2px solid #2563eb;
	outline-offset: 4px;
	border-radius: var(--gpvl-br-radius);
}

.gpvl-br__teaser-inner {
	position: relative;
	width: 100%;
	max-width: 320px;
	border-radius: var(--gpvl-br-radius);
	overflow: hidden;
	box-shadow: var(--gpvl-br-shadow);
	background: #f8fafc;
	transform: perspective(900px) rotateY(-4deg);
	transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.gpvl-br__teaser:hover .gpvl-br__teaser-inner,
.gpvl-br__teaser:focus-visible .gpvl-br__teaser-inner {
	transform: perspective(900px) rotateY(0deg) translateY(-2px);
	/* box-shadow:
		0 10px 28px rgba(15, 23, 42, 0.1),
		0 4px 12px rgba(37, 99, 235, 0.07); */
}

.gpvl-br__cover {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	background: #f8fafc;
}

.gpvl-br__cover--placeholder {
	min-height: 220px;
}

.gpvl-br__shine {
	pointer-events: none;
	position: absolute;
	inset: 0;
	background: linear-gradient(
		115deg,
		transparent 40%,
		rgba(255, 255, 255, 0.12) 48%,
		rgba(255, 255, 255, 0.22) 50%,
		rgba(255, 255, 255, 0.08) 54%,
		transparent 62%
	);
	mix-blend-mode: screen;
	opacity: 0.85;
}

.gpvl-br__title {
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.35;
}

.gpvl-br__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.45rem 1.1rem;
	border-radius: 999px;
	background: #2563eb;
	color: #fff;
	font-size: 0.9rem;
	font-weight: 600;
	box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.gpvl-br__teaser:hover .gpvl-br__btn {
	filter: brightness(1.05);
}

.gpvl-br__teaser:hover {
	background-color: unset;
}

/* Modal */
body.gpvl-br-modal-open {
	overflow: hidden;
}

.gpvl-br__backdrop {
	position: fixed;
	inset: 0;
	z-index: 100050;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	background: rgba(15, 23, 42, 0.55);
	backdrop-filter: blur(2px);
	animation: gpvl-br-fade 0.25s ease;
}

@keyframes gpvl-br-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.gpvl-br__dialog {
	position: relative;
	width: min(96vw, 1100px);
	height: min(92vh, 900px);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	background: #0f172a;
	border-radius: 14px;
	box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	animation: gpvl-br-pop 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes gpvl-br-pop {
	from {
		opacity: 0;
		transform: scale(0.94) translateY(12px);
	}
	to {
		opacity: 1;
		transform: scale(1) translateY(0);
	}
}

.gpvl-br__topbar {
	padding: 0.4rem 0.55rem 0.35rem;
	background: linear-gradient(180deg, #1e293b, #0f172a);
	border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.gpvl-br__topbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: nowrap;
	width: 100%;
}

.gpvl-br__toolbar {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex: 1;
	min-width: 0;
}

.gpvl-br__bottombar {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 0.55rem 0.75rem 0.65rem;
	background: linear-gradient( 0deg, #0f172a 0%, #151f33 100% );
	border-top: 1px solid rgba( 148, 163, 184, 0.18 );
}

.gpvl-br__toolbar.gpvl-br__toolbar--footer {
	flex: 0 1 auto;
	justify-content: center;
	flex-wrap: wrap;
	min-width: 0;
}

.gpvl-br__nav {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.35rem 0.65rem;
	border-radius: 8px;
	border: 1px solid rgba(148, 163, 184, 0.35);
	background: rgba(255, 255, 255, 0.06);
	color: #e2e8f0;
	font-size: 0.82rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.gpvl-br__nav:hover:not( :disabled ) {
	background: rgba(255, 255, 255, 0.12);
}

.gpvl-br__nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.gpvl-br__nav-icon {
	font-size: 0.75rem;
	line-height: 1;
}

@media ( max-width: 480px ) {
	.gpvl-br__nav-text {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
}

.gpvl-br__popout {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.35rem 0.7rem;
	border-radius: 8px;
	border: 1px solid rgba( 148, 163, 184, 0.35 );
	background: rgba( 255, 255, 255, 0.06 );
	color: #e2e8f0;
	font-size: 0.82rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 1;
	min-width: 0;
	max-width: min( 72vw, 420px );
}

.gpvl-br__popout:hover {
	background: rgba( 255, 255, 255, 0.12 );
	color: #f8fafc;
}

.gpvl-br__popout:hover .gpvl-br__popout-svg {
	color: #e2e8f0;
	opacity: 1;
}

.gpvl-br__popout-svg {
	flex-shrink: 0;
	display: block;
	width: 16px;
	height: 16px;
	opacity: 0.92;
	color: #94a3b8;
}

@media ( max-width: 480px ) {
	.gpvl-br__popout-text {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
}

.gpvl-br__pageinfo {
	font-size: 0.85rem;
	font-weight: 600;
	color: #cbd5e1;
	padding: 0 0.25rem;
	min-width: 6.5rem;
	text-align: center;
	flex-shrink: 0;
}

.gpvl-br__progress {
	height: 4px;
	background: rgba(148, 163, 184, 0.2);
	margin: 0 0.55rem 0;
	border-radius: 999px;
	overflow: hidden;
	flex-shrink: 0;
}

.gpvl-br__progress-fill {
	height: 100%;
	width: 0%;
	border-radius: 999px;
	background: linear-gradient(90deg, #38bdf8, #2563eb);
	transition: width 0.35s ease;
}

.gpvl-br__close {
	flex-shrink: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0;
	border: 1px solid rgba( 148, 163, 184, 0.35 );
	border-radius: 50%;
	background: rgba( 15, 23, 42, 0.65 );
	color: #cbd5e1;
	cursor: pointer;
	box-shadow: 0 1px 0 rgba( 255, 255, 255, 0.06 ) inset;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
		box-shadow 0.15s ease, transform 0.15s ease;
}

.gpvl-br__close-inner {
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 0;
}

.gpvl-br__close-icon {
	display: block;
}

.gpvl-br__close:hover {
	background: rgba( 239, 68, 68, 0.18 );
	border-color: rgba( 248, 113, 113, 0.55 );
	color: #fecaca;
	box-shadow: 0 0 0 3px rgba( 248, 113, 113, 0.12 );
}

.gpvl-br__close:focus-visible {
	outline: 2px solid #38bdf8;
	outline-offset: 2px;
}

.gpvl-br__close:active {
	transform: scale( 0.96 );
}

.gpvl-br__stage {
	flex: 1;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 0;
	padding: 0.5rem 0.75rem 0.65rem;
	overflow: auto;
	background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0b1120 65%);
}

.gpvl-br__loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #e2e8f0;
	font-size: 0.95rem;
	z-index: 2;
}

.gpvl-br__flip-root {
	position: relative;
	z-index: 1;
}

.gpvl-br__flip-root--foliate {
	width: 100%;
	flex: 1;
	min-height: 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
}

.gpvl-br__foliate-frame {
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	max-width: 100%;
	flex: 0 0 auto;
}

.gpvl-br__foliate-view {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 0;
	box-sizing: border-box;
}

/* Chế độ Foliate: stage xếp dọc, footer reader.js-style */
.gpvl-br__stage.gpvl-br__stage--foliate-chrome {
	flex-direction: column;
	align-items: stretch;
	justify-content: flex-start;
	padding-bottom: 0;
}

.gpvl-br__foliate-footer {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.4rem 0.65rem 0.55rem;
	margin: 0 -0.75rem -1rem;
	background: rgba(15, 23, 42, 0.96);
	border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.gpvl-br__foliate-arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.35rem;
	height: 2.35rem;
	padding: 0;
	border: 1px solid rgba(148, 163, 184, 0.35);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
	color: #e2e8f0;
	cursor: pointer;
	flex-shrink: 0;
}

.gpvl-br__foliate-arrow:hover {
	background: rgba(255, 255, 255, 0.12);
}

.gpvl-br__foliate-arrow-icon {
	font-size: 1.35rem;
	line-height: 1;
	font-weight: 700;
}

.gpvl-br__foliate-slider-outer {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: center;
	padding: 0 0.15rem;
}

.gpvl-br__foliate-slider {
	width: 100%;
	height: 1.5rem;
	margin: 0;
	accent-color: #94a3b8;
	cursor: pointer;
}

.gpvl-br__foliate-slider::-webkit-slider-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #cbd5e1;
	border: 2px solid #475569;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.gpvl-br__foliate-slider::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 3px;
	background: linear-gradient(
		90deg,
		rgba(148, 163, 184, 0.45) 0%,
		rgba(148, 163, 184, 0.2) 100%
	);
}

.gpvl-br__flip-book {
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	border-radius: 6px;
	transform: translateZ(0);
	backface-visibility: hidden;
}

.gpvl-br__flip-book img,
.gpvl-br__flip-book canvas {
	image-rendering: auto;
	image-rendering: -webkit-optimize-contrast; /* Chromium: giữ cạnh sắc khi scale down */
	-webkit-backface-visibility: hidden;
	backface-visibility: hidden;
}

/* PageFlip injects nodes — subtle page edge */
.gpvl-br__flip-book .stf__block {
	border-radius: 2px;
}

.gpvl-br__office-hint {
	color: #cbd5e1;
	font-size: 0.85rem;
	margin: 0 0 0.5rem;
	max-width: 52rem;
}

.gpvl-br__office-frame {
	width: 100%;
	height: min(78vh, 720px);
	border: 0;
	border-radius: 8px;
	background: #fff;
}

.gpvl-br__err {
	color: #fecaca;
	padding: 1rem;
	text-align: center;
}
