.scpf-modal {
	--scpf-bg: rgba(15, 23, 42, 0.82);
	--scpf-panel: #ffffff;
	--scpf-text: #0f172a;
	--scpf-muted: #64748b;
	--scpf-accent: #2563eb;
	--scpf-radius: 12px;
	--scpf-shadow: 0 24px 48px rgba(15, 23, 42, 0.28);

	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	box-sizing: border-box;
}

.scpf-modal[hidden] {
	display: none !important;
}

.scpf-modal__overlay {
	position: absolute;
	inset: 0;
	background: var(--scpf-bg);
	backdrop-filter: blur(2px);
}

.scpf-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1400px, 98vw);
	height: min(920px, 96vh);
	max-height: 96vh;
	background: var(--scpf-panel);
	border-radius: var(--scpf-radius);
	box-shadow: var(--scpf-shadow);
	overflow: hidden;
}

.scpf-modal__header,
.scpf-modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid #e2e8f0;
	flex-shrink: 0;
}

.scpf-modal__footer {
	border-bottom: 0;
	border-top: 1px solid #e2e8f0;
}

.scpf-modal__title {
	margin: 0;
	flex: 1 1 auto;
	min-width: 0;
	font-size: 1rem;
	font-weight: 600;
	color: var(--scpf-text);
}

.scpf-modal__actions {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

.scpf-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--scpf-muted);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.scpf-modal__close:hover,
.scpf-modal__close:focus-visible {
	background: #f1f5f9;
	color: var(--scpf-text);
	outline: none;
}

.scpf-modal__body {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 12px;
	background: #cbd5e1;
	overflow: hidden;
}

.scpf-flipbook-viewport {
	flex: 1 1 auto;
	min-height: 0;
	width: 100%;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	-webkit-overflow-scrolling: touch;
}

.scpf-flipbook-viewport.is-zoomed {
	align-items: flex-start;
}

.scpf-flipbook-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
}

.scpf-flipbook {
	width: 100%;
	max-width: 1200px;
	height: 100%;
	min-height: 520px;
	touch-action: none;
	cursor: grab;
}

.scpf-flipbook.is-dragging {
	cursor: grabbing;
}

.scpf-page {
	background: #fff;
	overflow: hidden;
}

.scpf-page-canvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	opacity: 1 !important;
	pointer-events: none;
	user-select: none;
}

.scpf-flipbook .stf__parent {
	margin: 0 auto;
	background: #fff;
	isolation: isolate;
}

.scpf-flipbook .stf__wrapper,
.scpf-flipbook .stf__block,
.scpf-flipbook .stf__item,
.scpf-flipbook .stf__hard,
.scpf-flipbook .stf__hardInner,
.scpf-flipbook .stf__outer,
.scpf-flipbook .stf__inner {
	background: #fff !important;
}

.scpf-flipbook .stf__block {
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.scpf-flipbook .stf__item .scpf-page-canvas {
	display: block;
	width: 100%;
	height: 100%;
	background: #fff;
	opacity: 1 !important;
}

.scpf-status {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	text-align: center;
	color: var(--scpf-muted);
	font-size: 0.95rem;
	background: rgba(203, 213, 225, 0.96);
	z-index: 5;
	pointer-events: auto;
}

.scpf-status[hidden] {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

.scpf-status--error {
	color: #b91c1c;
}

.scpf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 96px;
	padding: 8px 14px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	background: #fff;
	color: var(--scpf-text);
	font-size: 0.875rem;
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.scpf-btn:hover,
.scpf-btn:focus-visible {
	background: #f8fafc;
	border-color: #94a3b8;
	outline: none;
}

.scpf-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.scpf-btn--primary {
	border-color: var(--scpf-accent);
	background: var(--scpf-accent);
	color: #fff;
}

.scpf-btn--primary:hover,
.scpf-btn--primary:focus-visible {
	background: #1d4ed8;
	border-color: #1d4ed8;
	color: #fff;
}

.scpf-btn--icon {
	min-width: 36px;
	width: 36px;
	height: 36px;
	padding: 0;
	font-size: 1.25rem;
	line-height: 1;
}

.scpf-btn--compact {
	min-width: auto;
	padding-inline: 10px;
}

.scpf-footer-center {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex: 1 1 auto;
	min-width: 0;
}

.scpf-zoom-controls {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.scpf-zoom-label {
	display: inline-block;
	min-width: 48px;
	text-align: center;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--scpf-text);
}

.scpf-page-indicator {
	text-align: center;
	font-size: 0.875rem;
	color: var(--scpf-muted);
}

body.scpf-modal-open {
	overflow: hidden;
}

@media (max-width: 768px) {
	.scpf-modal {
		padding: 8px;
	}

	.scpf-modal__dialog {
		width: 100%;
		height: 98vh;
		max-height: 98vh;
	}

	.scpf-flipbook {
		min-height: 380px;
	}

	.scpf-modal__footer {
		flex-wrap: wrap;
		justify-content: center;
	}

	.scpf-footer-center {
		order: -1;
		width: 100%;
	}
}
