/* SB - Live Preview Modal */

/* Lock Page Scroll When Modal Is Open */
html.sb-lp-lock,
body.sb-lp-lock {
	overflow: hidden;
	height: 100%;
}

/* Overlay */
.sb-lp-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.55);
	display: none;
	z-index: 99999;
	overscroll-behavior: contain;
	touch-action: none;
}
.sb-lp-modal-overlay.is-open {
	display: block;
}

/* Modal: Centered, Fixed */
.sb-lp-modal{
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	/* Make Width Responsive But Not Too Wide */
	width: min(1020px, 90vw);
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0,0,0,0.45);
	padding: 0;
	overflow: hidden;
}

/* Header Stage Just Passes Through flex; Ensure It Can Shrink */
.sb-lp-stage {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-height: 0;
}

.sb-lp-title {
	text-align: center;
	font-weight: 600;
	font-size: 16px;
	color: #e70000;
	padding: 12px 48px 10px;
	border-bottom: 1px solid #e70000;
	margin: 0;
}

/* Close (X) – Top-Right */
.sb-lp-modal-close {
	position: absolute !important;
	top: 4px !important;
	right: 0 !important;
	left: auto !important;
	float: none !important;
	font-size: 20px;
	line-height: 1;
	border: 0;
	background: transparent !important;
	cursor: pointer;
	padding: 4px;
	z-index: 2;
	color: #e70000 !important;
}

.sb-lp-modal-close:hover,
.sb-lp-modal-close:focus,
.sb-lp-modal-close:active {
	color: #e70000;
	background: transparent;
}

/* Base Image + Canvas Sizing */
.sb-lp-base {
	display: block;
	max-width: 100%;
	max-height: 100%;
	height: auto;
	width: auto;
	border-radius: 12px;
}

/* Body Area Holding The Image/Canvas */
.sb-lp-canvas-wrap {
	position: relative;
	padding: 10px;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	min-height: 0;
	border-radius: 12px;
}

/* Canvas: Center It On The Same Point As The Image */
.sb-lp-canvas {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	pointer-events: none;
	max-width: 100%;
	max-height: 100%;
	border-radius: 12px;
}

/* Small Note Text Under Preview */
.sb-lp-note {
	display: inline-block;
	margin: 8px auto 8px;
	text-align: center;
}

/* Navigation Control */
.sb-lp-nav {
	position:absolute;
	top:50%;
	transform:translateY(-50%);
	border:0;
	background:#0008;
	color:#fff;
	padding:.5rem .65rem;
	font-size:24px;
	line-height:1;
	border-radius:6px;cursor:pointer
}

.sb-lp-prev {
	left:8px
}

.sb-lp-next {
	right:8px
}

.sb-lp-nav:focus {
	outline:2px solid #fff8;
	outline-offset:2px
}

/* Prevent Flicker Of Small Modal Before Correct Sizing */
.sb-lp-modal-overlay:not(.is-open) .sb-lp-stage {
	visibility: hidden;
}

/* Spinner + Dimmer Over The Shape/Canvas Area While Overlays Generate */
.sb-lp-stage[aria-busy="true"] .sb-lp-canvas-wrap::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(255,255,255,0.55); /* soft dim */
	pointer-events: none;
}

.sb-lp-stage[aria-busy="true"] .sb-lp-canvas-wrap::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 44px;
	height: 44px;
	margin-left: -22px;
	margin-top: -22px;
	border-radius: 50%;
	border: 3px solid rgba(0,0,0,0.15);
	border-top-color: #e70000;
	animation: sbLpSpin 0.9s linear infinite;
	pointer-events: none;
}

@keyframes sbLpSpin {
	to { transform: rotate(360deg); }
}