/**
 * Step Quiz Popup — front-end styles.
 *
 * Everything is scoped under .sqpOverlay so themes can't leak in and the popup
 * can't leak out. Colours come from --sqp-from / --sqp-to, injected inline by
 * SQP_Frontend::enqueue().
 */

/* ── Scroll lock ───────────────────────────────────────────────────── */

html.sqp-lock {
	overflow: hidden;
}

body.sqp-lock {
	position: fixed;
	left: 0;
	right: 0;
	width: 100%;
	overflow: hidden;
	overscroll-behavior: none;
}

/* ── Overlay ───────────────────────────────────────────────────────── */

.sqpOverlay {
	--sqp-from: #e81d8e;
	--sqp-to: #7d2fd0;
	--sqp-ink: #0d1b3e;

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	background: rgba( 0, 0, 0, 0.55 );
	backdrop-filter: blur( 10px );
	-webkit-backdrop-filter: blur( 10px );
	opacity: 0;
	transition: opacity 0.3s ease;
	overscroll-behavior: contain;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	transform: translateZ( 0 );
}

.sqpOverlay.is-open {
	display: flex;
}

.sqpOverlay.is-visible {
	opacity: 1;
}

.sqpOverlay,
.sqpOverlay * {
	box-sizing: border-box;
}

/* ── Loader ────────────────────────────────────────────────────────── */

.sqpLoader {
	display: none;
	align-items: center;
	justify-content: center;
	width: 480px;
	max-width: 94vw;
	padding: 60px 32px;
	background: #fff;
	border-radius: 20px;
	opacity: 0;
	transition: opacity 0.2s ease;
	box-shadow: 0 12px 48px rgba( 0, 0, 0, 0.18 );
}

.sqpLoader.is-active {
	display: flex;
}

.sqpLoader.is-visible {
	opacity: 1;
}

.sqpSpinner {
	width: 48px;
	height: 48px;
	border: 5px solid #e8eaf0;
	border-top-color: #6c7ee1;
	border-radius: 50%;
	animation: sqpSpin 0.85s linear infinite;
}

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

/* ── Box ───────────────────────────────────────────────────────────── */

.sqpBox {
	position: relative;
	display: none;
	width: 460px;
	max-width: 94vw;
	max-height: 90vh;
	padding: 30px 30px 28px;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border-radius: 22px;
	text-align: left;
	opacity: 0;
	transition: opacity 0.2s ease;
	box-shadow: 0 18px 60px rgba( 13, 27, 62, 0.28 );
}

.sqpBox.is-active {
	display: block;
}

.sqpBox.is-visible {
	opacity: 1;
}

.sqpClose {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 32px;
	height: 32px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 50%;
	color: #94a3b8;
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.sqpClose:hover,
.sqpClose:focus-visible {
	background: #f1f5f9;
	color: var( --sqp-ink );
}

/* ── Step counter ──────────────────────────────────────────────────── */

.sqpStepCounter {
	display: inline-block;
	margin-bottom: 16px;
	padding: 6px 15px;
	background: linear-gradient( 90deg, #5b6ef0, #8048f0 );
	border-radius: 30px;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.4px;
	box-shadow: 0 5px 14px rgba( 96, 72, 240, 0.35 );
}

/* ── Steps ─────────────────────────────────────────────────────────── */

.sqpStep {
	display: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.sqpStep.is-active {
	display: block;
}

.sqpStep.is-visible {
	opacity: 1;
}

.sqpOverlay .sqpStep h4 {
	margin: 0 0 4px;
	color: var( --sqp-ink );
	font-size: 22px;
	font-weight: 800;
	line-height: 1.32;
}

.sqpStep h4::after {
	content: "";
	display: block;
	width: 16px;
	height: 16px;
	margin: 14px auto 22px;
	border-right: 4px solid #ff7a2b;
	border-bottom: 4px solid #6a5cff;
	border-radius: 2px;
	transform: rotate( 45deg );
	animation: sqpBounce 1.6s ease-in-out infinite;
}

/* ── Option buttons ────────────────────────────────────────────────── */

.sqpOverlay .sqpOptList {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sqpOverlay .sqpOptList li {
	margin-bottom: 12px;
	list-style: none;
	animation: sqpInUp 0.5s cubic-bezier( 0.2, 0.7, 0.3, 1 ) both;
}

.sqpOverlay .sqpOptList li:last-child {
	margin-bottom: 0;
}

.sqpOptList li:nth-child( 1 ) { animation-delay: 0.06s; }
.sqpOptList li:nth-child( 2 ) { animation-delay: 0.16s; }
.sqpOptList li:nth-child( 3 ) { animation-delay: 0.26s; }
.sqpOptList li:nth-child( 4 ) { animation-delay: 0.36s; }
.sqpOptList li:nth-child( 5 ) { animation-delay: 0.46s; }
.sqpOptList li:nth-child( 6 ) { animation-delay: 0.56s; }

.sqpOverlay .sqpOptList li button.sqpBtn {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	height: auto;
	padding: 15px 18px;
	overflow: hidden;
	background: linear-gradient( 90deg, var( --sqp-from ), var( --sqp-to ) );
	border: 0;
	border-radius: 13px;
	text-align: left;
	text-transform: none;
	letter-spacing: 0;
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
	box-shadow: 0 7px 18px rgba( 123, 47, 247, 0.30 );
	-webkit-appearance: none;
	appearance: none;
}

.sqpOverlay .sqpOptList li button.sqpBtn:hover {
	transform: translateY( -2px );
	filter: brightness( 1.06 );
	box-shadow: 0 12px 24px rgba( 123, 47, 247, 0.40 );
}

.sqpOverlay .sqpOptList li button.sqpBtn:active {
	transform: translateY( 0 );
}

.sqpOverlay .sqpOptList li button.sqpBtn:focus-visible {
	outline: 3px solid #fff;
	outline-offset: -6px;
}

.sqpOptList li button.sqpBtn::before {
	content: "\25B6";
	flex: 0 0 auto;
	color: #fff;
	font-size: 16px;
	line-height: 1;
	animation: sqpPulse 1.9s ease-in-out infinite;
}

.sqpOptList li button.sqpBtn::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: -75%;
	z-index: 3;
	width: 55%;
	background: linear-gradient( 120deg, transparent, rgba( 255, 255, 255, 0.40 ), transparent );
	transform: skewX( -22deg );
	opacity: 0;
	pointer-events: none;
}

.sqpOptList li button.sqpBtn:hover::after {
	animation: sqpShine 0.75s ease;
}

.sqpOptLabel {
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.sqpOptSelect {
	margin-left: auto;
	color: rgba( 255, 255, 255, 0.85 );
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

/* ── Reward step ───────────────────────────────────────────────────── */

.sqpAdHint {
	margin: 0 0 20px;
	color: #6b7280;
	font-size: 14px;
	text-align: center;
}

.sqpOverlay .sqpRewardBtn {
	display: block;
	width: 100%;
	height: auto;
	margin-top: 8px;
	padding: 20px 32px;
	background: var( --sqp-ink );
	border: 0;
	border-radius: 14px;
	color: #fff;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: normal;
	letter-spacing: 0;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	cursor: pointer;
	transition: background 0.18s ease, transform 0.1s ease;
	-webkit-appearance: none;
	appearance: none;
}

.sqpOverlay .sqpRewardBtn:hover,
.sqpOverlay .sqpRewardBtn:focus {
	background: #1a2f5e;
	color: #fff;
	text-decoration: none;
}

.sqpOverlay .sqpRewardBtn:hover {
	transform: translateY( -1px );
}

/* ── Animations ────────────────────────────────────────────────────── */

@keyframes sqpInUp {
	from {
		opacity: 0;
		transform: translateY( 16px );
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes sqpPulse {
	0%,
	100% {
		transform: scale( 1 );
	}

	50% {
		transform: scale( 1.18 );
	}
}

@keyframes sqpShine {
	0% {
		left: -75%;
		opacity: 1;
	}

	100% {
		left: 130%;
		opacity: 1;
	}
}

@keyframes sqpBounce {
	0%,
	100% {
		transform: rotate( 45deg ) translate( 0, 0 );
	}

	50% {
		transform: rotate( 45deg ) translate( 3px, 3px );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.sqpOverlay,
	.sqpOverlay *,
	.sqpOverlay *::before,
	.sqpOverlay *::after {
		animation: none !important;
		transition: none !important;
	}
}

/* ── Mobile ────────────────────────────────────────────────────────── */

@media ( max-width: 600px ) {
	.sqpOverlay {
		padding-top: max( 16px, env( safe-area-inset-top ) );
		padding-bottom: max( 16px, env( safe-area-inset-bottom ) );
		overflow-y: auto;
	}

	.sqpBox {
		width: 100%;
		max-width: 100%;
		max-height: none;
		margin: auto;
		padding: 24px 18px 20px;
		border-radius: 14px;
	}

	.sqpLoader {
		max-width: 100%;
		padding: 40px 20px;
	}

	.sqpOverlay .sqpOptList li button.sqpBtn {
		padding: 14px 16px;
	}

	.sqpOverlay .sqpStep h4 {
		font-size: 20px;
	}
}
