/* =====================================================================
   PDF to Flipbook — frontend viewer styles
   ===================================================================== */

.ptfb-flipbook-root {
	--ptfb-bg: #2b2b2b;
	--ptfb-controls: #ffffff;
	position: relative;
	box-sizing: border-box;
	overflow: hidden;
	border-radius: 6px;
	background: var(--ptfb-bg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	outline: none;
}

.ptfb-flipbook-root * {
	box-sizing: border-box;
}

.ptfb-flipbook-root.ptfb-standalone {
	width: 100% !important;
	height: 100vh !important;
	border-radius: 0;
}

.ptfb-flipbook-root:fullscreen {
	width: 100% !important;
	height: 100% !important;
	border-radius: 0;
}

/* ---------------------------------------------------------------------
   Loading state
   --------------------------------------------------------------------- */
.ptfb-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	z-index: 5;
}

.ptfb-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: rgba(255, 255, 255, 0.9);
	border-radius: 50%;
	animation: ptfb-spin 0.8s linear infinite;
}

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

/* ---------------------------------------------------------------------
   Stage / book
   --------------------------------------------------------------------- */
.ptfb-stage {
	position: relative;
	width: 100%;
	height: calc(100% - 48px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	overflow: auto;
}

.ptfb-book {
	position: relative;
	perspective: 2400px;
	max-width: 100%;
	max-height: 100%;
	transition: transform 0.25s ease;
	transform-origin: center;
	touch-action: pan-y;
}

.ptfb-book.is-zoomed {
	cursor: grab;
}

.ptfb-book-inner {
	position: relative;
	display: flex;
	height: min(100%, 78vh);
	width: auto;
	transform-style: preserve-3d;
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
	background: #fff;
}

.ptfb-static-page {
	position: relative;
	height: 100%;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	background-color: #fff;
}

.ptfb-side-left,
.ptfb-side-right {
	width: 50vw;
	max-width: 480px;
}

.ptfb-side-full {
	width: auto;
	max-width: 100%;
}

.ptfb-book.ptfb-single .ptfb-book-inner {
	width: auto;
}

.ptfb-book.ptfb-double .ptfb-book-inner::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 0;
	width: 10px;
	margin-left: -5px;
	background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.18));
	pointer-events: none;
	z-index: 3;
}

/* ---------------------------------------------------------------------
   Classic 3D flip + page curl
   --------------------------------------------------------------------- */
.ptfb-sheet {
	position: absolute;
	top: 0;
	height: 100%;
	width: 50vw;
	max-width: 480px;
	transform-style: preserve-3d;
	transition: transform 0.75s cubic-bezier(0.45, 0.05, 0.55, 0.95);
	z-index: 4;
	will-change: transform;
}

.ptfb-book.ptfb-single .ptfb-sheet {
	width: 100%;
	max-width: 100%;
}

.ptfb-sheet-right {
	right: 0;
	transform-origin: left center;
	box-shadow: -8px 0 24px rgba(0, 0, 0, 0.25);
}

.ptfb-sheet-left {
	left: 0;
	transform-origin: right center;
	box-shadow: 8px 0 24px rgba(0, 0, 0, 0.25);
}

.ptfb-face {
	position: absolute;
	inset: 0;
	backface-visibility: hidden;
	background-size: contain;
	background-repeat: no-repeat;
	background-position: center;
	background-color: #fff;
}

.ptfb-face-back {
	transform: rotateY(180deg);
}

/* Page-curl: same 3D mechanics as classic, with an added shading overlay
   that fakes a curling edge during the turn. */
.ptfb-effect-curl .ptfb-sheet {
	transition-timing-function: ease-in-out;
}

.ptfb-effect-curl .ptfb-face::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(100deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.16) 80%, rgba(0, 0, 0, 0.32) 100%);
	pointer-events: none;
}

.ptfb-effect-curl .ptfb-sheet-left .ptfb-face::after {
	background: linear-gradient(260deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.16) 80%, rgba(0, 0, 0, 0.32) 100%);
}

/* ---------------------------------------------------------------------
   Slide effect
   --------------------------------------------------------------------- */
.ptfb-slide-out-left {
	transition: transform 0.42s ease, opacity 0.42s ease;
	transform: translateX(-100%);
	opacity: 0;
	position: absolute !important;
	top: 0;
}

.ptfb-slide-out-right {
	transition: transform 0.42s ease, opacity 0.42s ease;
	transform: translateX(100%);
	opacity: 0;
	position: absolute !important;
	top: 0;
}

.ptfb-slide-incoming {
	position: absolute;
	top: 0;
	left: 0;
	display: flex;
	height: 100%;
	transition: transform 0.42s ease;
	z-index: 2;
}

.ptfb-slide-in-right {
	transform: translateX(100%);
}

.ptfb-slide-in-left {
	transform: translateX(-100%);
}

.ptfb-slide-incoming.is-settled {
	transform: translateX(0);
}

/* ---------------------------------------------------------------------
   Fade effect
   --------------------------------------------------------------------- */
.ptfb-fade-incoming {
	position: absolute;
	inset: 0;
	display: flex;
	transition: opacity 0.38s ease;
	z-index: 2;
}

/* ---------------------------------------------------------------------
   Prev / Next nav arrows
   --------------------------------------------------------------------- */
.ptfb-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.ptfb-nav:hover {
	background: rgba(0, 0, 0, 0.65);
}

.ptfb-nav-prev { left: 10px; }
.ptfb-nav-next { right: 10px; }

.ptfb-nav.is-disabled {
	opacity: 0.25;
	pointer-events: none;
}

/* ---------------------------------------------------------------------
   Toolbar
   --------------------------------------------------------------------- */
.ptfb-toolbar {
	position: relative;
	height: 48px;
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 0 10px;
	background: rgba(0, 0, 0, 0.82);
	z-index: 7;
}

.ptfb-tbtn {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	color: var(--ptfb-controls);
	text-decoration: none;
	transition: background 0.15s ease;
}

.ptfb-tbtn:hover {
	background: rgba(255, 255, 255, 0.12);
}

.ptfb-tbtn svg {
	width: 18px;
	height: 18px;
	fill: var(--ptfb-controls);
}

.ptfb-page-indicator {
	color: var(--ptfb-controls);
	font-size: 13px;
	opacity: 0.85;
	white-space: nowrap;
	margin-left: 6px;
}

.ptfb-spacer {
	flex: 1;
}

/* ---------------------------------------------------------------------
   Thumbnails panel
   --------------------------------------------------------------------- */
.ptfb-thumbs-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 48px;
	width: 220px;
	background: rgba(20, 20, 20, 0.95);
	transform: translateX(100%);
	transition: transform 0.25s ease;
	z-index: 8;
	overflow-y: auto;
	padding: 12px;
}

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

.ptfb-thumbs-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 10px;
}

.ptfb-thumb {
	position: relative;
	aspect-ratio: 3 / 4;
	background-size: cover;
	background-position: center;
	background-color: #444;
	border: 2px solid transparent;
	border-radius: 3px;
	cursor: pointer;
	padding: 0;
}

.ptfb-thumb:hover {
	border-color: #fff;
}

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

/* ---------------------------------------------------------------------
   Share / embed modal
   --------------------------------------------------------------------- */
.ptfb-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	z-index: 9;
}

.ptfb-modal-overlay.is-open {
	opacity: 1;
	pointer-events: auto;
}

.ptfb-modal {
	width: min(92%, 420px);
	background: #fff;
	border-radius: 8px;
	padding: 18px 20px 22px;
	color: #222;
	max-height: 86%;
	overflow-y: auto;
}

.ptfb-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 10px;
}

.ptfb-modal-head h3 {
	margin: 0;
	font-size: 16px;
}

.ptfb-modal-close {
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #666;
}

.ptfb-modal label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	color: #777;
	margin: 14px 0 6px;
}

.ptfb-copy-row {
	display: flex;
	gap: 6px;
}

.ptfb-copy-row input,
.ptfb-copy-row textarea {
	flex: 1;
	font-size: 12px;
	font-family: Consolas, Monaco, monospace;
	padding: 7px 8px;
	border: 1px solid #ddd;
	border-radius: 4px;
	resize: none;
}

.ptfb-copy-row button {
	padding: 0 12px;
	border-radius: 4px;
	border: 1px solid #ccc;
	background: #f6f6f6;
	cursor: pointer;
	font-size: 12px;
}

.ptfb-social-row {
	display: flex;
	gap: 8px;
	margin-top: 16px;
}

.ptfb-social-btn {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: #f0f0f0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ptfb-social-btn svg {
	width: 16px;
	height: 16px;
	fill: #333;
}

.ptfb-social-btn:hover {
	background: #e2e2e2;
}

/* ---------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------- */
@media (max-width: 760px) {
	.ptfb-stage {
		padding: 10px;
	}
	.ptfb-nav {
		width: 36px;
		height: 36px;
	}
	.ptfb-thumbs-panel {
		width: 70%;
	}
	.ptfb-side-left,
	.ptfb-side-right,
	.ptfb-sheet {
		max-width: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ptfb-sheet,
	.ptfb-slide-incoming,
	.ptfb-slide-out-left,
	.ptfb-slide-out-right,
	.ptfb-fade-incoming {
		transition-duration: 0.01ms !important;
	}
}
