/**
 * Frontend popup styles for Exit Intent for WooCommerce.
 *
 * Mobile-first, GPU-accelerated transitions, system font stack, and a small
 * footprint to respect the performance budget. Honors reduced-motion.
 */

:root {
	--eifw-primary: #6366f1;
	--eifw-background: #ffffff;
	--eifw-text: #1f2937;
	--eifw-text-light: #6b7280;
	--eifw-overlay: rgba( 0, 0, 0, 0.6 );
}

.eifw-overlay {
	position: fixed;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: var( --eifw-overlay );
	opacity: 0;
	visibility: hidden;
	transition: opacity 300ms cubic-bezier( 0.4, 0, 0.2, 1 );
	z-index: 999999;
}

.eifw-overlay--visible {
	opacity: 1;
	visibility: visible;
}

.eifw-popup {
	position: relative;
	width: 100%;
	max-width: 500px;
	padding: 20px;
	background: var( --eifw-background );
	color: var( --eifw-text );
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.25 );
	transform: scale( 0.95 );
	transition: transform 300ms cubic-bezier( 0.4, 0, 0.2, 1 );
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	text-align: center;
}

.eifw-overlay--visible .eifw-popup {
	transform: scale( 1 );
}

.eifw-popup__close {
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28px;
	line-height: 1;
	color: var( --eifw-text-light );
	background: transparent;
	border: 0;
	cursor: pointer;
}

.eifw-popup__close:hover,
.eifw-popup__close:focus {
	color: var( --eifw-text );
}

.eifw-popup__headline {
	margin: 8px 0 12px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	color: var( --eifw-text );
}

.eifw-popup__subheading {
	margin: 0 0 20px;
	font-size: 16px;
	font-weight: 400;
	color: var( --eifw-text-light );
}

.eifw-popup__cta {
	display: inline-block;
	padding: 12px 32px;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	background: var( --eifw-primary );
	border: 0;
	border-radius: 8px;
	cursor: pointer;
	transition: filter 150ms ease;
}

.eifw-popup__cta:hover,
.eifw-popup__cta:focus {
	filter: brightness( 0.92 );
}

.eifw-popup__code {
	display: inline-block;
	margin: 4px 0 16px;
	padding: 12px 24px;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: 1px;
	color: var( --eifw-primary );
	background: rgba( 99, 102, 241, 0.08 );
	border: 2px dashed var( --eifw-primary );
	border-radius: 8px;
	outline: none;
}

.eifw-popup__input {
	width: 100%;
	margin: 0 0 12px;
	padding: 12px 14px;
	font-size: 16px;
	color: var( --eifw-text );
	border: 1px solid #d1d5db;
	border-radius: 8px;
	box-sizing: border-box;
}

.eifw-popup__input[aria-invalid="true"] {
	border-color: #dc2626;
}

.eifw-progress {
	width: 100%;
	height: 12px;
	margin: 0 0 20px;
	background: #e5e7eb;
	border-radius: 999px;
	overflow: hidden;
}

.eifw-progress__bar {
	display: block;
	height: 100%;
	background: var( --eifw-primary );
	transition: width 400ms cubic-bezier( 0.4, 0, 0.2, 1 );
}

.eifw-products {
	display: flex;
	gap: 12px;
	margin: 0 0 20px;
	padding: 0;
	list-style: none;
	justify-content: center;
}

.eifw-products__item {
	flex: 1 1 0;
	max-width: 33%;
}

.eifw-products__link {
	display: block;
	color: var( --eifw-text );
	text-decoration: none;
	font-size: 13px;
}

.eifw-products__link img {
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.eifw-products__name {
	display: block;
	margin: 6px 0 2px;
}

.eifw-survey {
	margin: 0 0 20px;
	padding: 0;
	border: 0;
	text-align: left;
}

.eifw-survey__option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	font-size: 15px;
	cursor: pointer;
}

@media ( min-width: 768px ) {
	.eifw-popup {
		padding: 32px;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.eifw-overlay,
	.eifw-popup {
		transition: none;
	}
}

/* Second-chance floating teaser */
.eifw-teaser {
	position: fixed;
	left: 16px;
	bottom: 16px;
	display: flex;
	align-items: center;
	gap: 4px;
	z-index: 999998;
	opacity: 0;
	transform: translateY( 12px );
	transition: opacity 250ms ease, transform 250ms ease;
}

.eifw-teaser--visible {
	opacity: 1;
	transform: translateY( 0 );
}

.eifw-teaser__open {
	padding: 12px 18px;
	font-size: 14px;
	font-weight: 700;
	color: #ffffff;
	background: var( --eifw-primary );
	border: 0;
	border-radius: 999px;
	box-shadow: 0 8px 24px rgba( 0, 0, 0, 0.18 );
	cursor: pointer;
}

.eifw-teaser__dismiss {
	width: 28px;
	height: 28px;
	font-size: 18px;
	line-height: 1;
	color: var( --eifw-text-light );
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 999px;
	cursor: pointer;
}

/* Sticky discount bar (Pro) */
body.eifw-has-sticky-bar {
	padding-top: 52px;
}

.eifw-sticky-bar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	padding: 10px 48px 10px 16px;
	background: var( --eifw-primary );
	color: #ffffff;
	z-index: 999997;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
	font-size: 14px;
}

.eifw-sticky-bar__text {
	flex: 1 1 auto;
	text-align: center;
}

.eifw-sticky-bar__code {
	margin: 0 4px;
	padding: 2px 8px;
	background: rgba( 255, 255, 255, 0.18 );
	border-radius: 4px;
}

.eifw-sticky-bar__timer {
	font-variant-numeric: tabular-nums;
}

.eifw-sticky-bar__cta {
	flex: 0 0 auto;
	padding: 8px 16px;
	font-weight: 600;
	color: var( --eifw-primary );
	background: #ffffff;
	border-radius: 6px;
	text-decoration: none;
	white-space: nowrap;
}

.eifw-sticky-bar__close {
	position: absolute;
	top: 50%;
	right: 12px;
	transform: translateY( -50% );
	width: 32px;
	height: 32px;
	font-size: 22px;
	line-height: 1;
	color: #ffffff;
	background: transparent;
	border: 0;
	cursor: pointer;
}

/* Multi-step popup panels */
.eifw-popup__step-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.eifw-popup__cta--secondary {
	background: transparent;
	color: var( --eifw-primary );
	border: 2px solid var( --eifw-primary );
}

@media ( max-width: 782px ) {
	.eifw-sticky-bar {
		flex-wrap: wrap;
		padding-top: 12px;
		padding-bottom: 12px;
	}

	body.eifw-has-sticky-bar {
		padding-top: 88px;
	}

	.eifw-teaser {
		left: 12px;
		bottom: 12px;
	}
}
