/* Exit Intent Promo Popup — frontend styles */

.eip-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--eip-zindex, 999999);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	box-sizing: border-box;
	/* No background-color or opacity here — the darkened backdrop lives entirely in
	   ::before below, so overlay_opacity (0 to 1) genuinely controls how dark it is,
	   independent of the popup's own fade-in animation (which is on .eip-popup, not
	   this element). Previously this element ALSO had its own background-color +
	   opacity transition, which stacked on top of ::before and stayed visible even
	   when overlay_opacity was set to 0 — that was the bug. */
	pointer-events: none;
}

.eip-overlay.eip-visible {
	pointer-events: auto;
}

.eip-overlay::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: var(--eip-overlay, #000000);
	opacity: 0;
	transition: opacity 0.3s ease;
	z-index: -1;
	pointer-events: none;
}

.eip-overlay.eip-visible::before {
	/* The backdrop fades in to overlay_opacity (user-configurable, 0–1) — not a
	   hardcoded 1 — so a value of 0 now genuinely means "no darkening at all". */
	opacity: var(--eip-overlay-opacity, 0.6);
}

.eip-popup {
	position: relative;
	width: 100%;
	max-width: var(--eip-width, 600px);
	max-height: 90vh;
	overflow-y: auto;
	background: var(--eip-bg, #ffffff);
	color: var(--eip-text, #1a1a1a);
	border-radius: var(--eip-radius, 12px);
	box-shadow: var(--eip-shadow, 0 10px 40px rgba(0, 0, 0, 0.25));
	padding: 32px 24px 24px;
	box-sizing: border-box;
	transform: scale(0.95);
	opacity: 0;
	transition: transform 0.3s ease, opacity 0.3s ease;
}

.eip-overlay.eip-visible .eip-popup {
	transform: scale(1);
	opacity: 1;
}

/* Animation variants — overlay fade is shared, popup gets extra transform per variant. */
.eip-anim-zoom .eip-popup {
	transform: scale(0.7);
}
.eip-anim-zoom.eip-visible .eip-popup {
	transform: scale(1);
}

.eip-anim-slide-up .eip-popup {
	transform: translateY(60px);
}
.eip-anim-slide-up.eip-visible .eip-popup {
	transform: translateY(0);
}

.eip-anim-slide-down .eip-popup {
	transform: translateY(-60px);
}
.eip-anim-slide-down.eip-visible .eip-popup {
	transform: translateY(0);
}

.eip-close-btn {
	position: absolute;
	top: 10px;
	right: 14px;
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: var(--eip-close, #666666);
	padding: 4px 8px;
}

.eip-close-btn:hover {
	opacity: 0.7;
}

.eip-cards {
	display: flex;
	flex-direction: column;
	margin-top: 8px;
}

/* Base card link — both featured and secondary cards share this as their <a> wrapper. */
.eip-card-featured,
.eip-card-secondary {
	display: flex;
	flex-direction: column;
	text-align: center;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
}

/* Featured row: the first visible card, full width, larger image and type. */
.eip-card-featured {
	padding-bottom: 20px;
	margin-bottom: 20px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* If there's only one card total (no secondary row exists), the featured card
   shouldn't show a trailing divider with nothing below it. */
.eip-cards-count-1 .eip-card-featured {
	padding-bottom: 0;
	margin-bottom: 0;
	border-bottom: none;
}

.eip-card-featured .eip-card-image img {
	height: 180px;
}

.eip-card-featured .eip-card-title {
	font-size: 21px;
}

.eip-card-featured .eip-card-desc {
	font-size: 15px;
}

/* Secondary row: everything after the featured card, laid out as equal-width columns
   with a vertical divider between them. Wrapped in a flex row via :has() fallback below
   for browsers that support it; the non-:has() fallback still stacks gracefully. */
.eip-cards-secondary-row {
	display: flex;
	flex-direction: row;
	gap: 0;
}

.eip-card-secondary {
	flex: 1 1 0;
	padding: 0 16px;
}

.eip-card-secondary:first-child {
	padding-left: 0;
}

.eip-card-secondary:last-child {
	padding-right: 0;
}

/* Vertical divider between secondary columns. */
.eip-card-secondary + .eip-card-secondary {
	border-left: 1px solid rgba(0, 0, 0, 0.1);
}

.eip-card-image {
	position: relative;
	margin-bottom: 10px;
	border-radius: calc(var(--eip-radius, 12px) * 0.6);
	overflow: hidden;
}

.eip-card-image img {
	width: 100%;
	height: 110px;
	object-fit: cover;
	display: block;
}

.eip-card-badge {
	position: absolute;
	top: 6px;
	left: 6px;
	background: var(--eip-btn, #e63946);
	color: var(--eip-btn-text, #ffffff);
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 20px;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.eip-card-badge-noimg {
	display: inline-block;
	margin-bottom: 8px;
	align-self: center;
}

.eip-card-body {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
}

.eip-card-title {
	font-size: 16px;
	font-weight: 700;
	margin: 4px 0;
	line-height: 1.3;
}

.eip-card-desc {
	font-size: 13px;
	opacity: 0.8;
	margin: 0 0 12px;
	line-height: 1.4;
	flex-grow: 1;
}

.eip-card-cta {
	display: inline-block;
	background: var(--eip-btn, #e63946);
	color: var(--eip-btn-text, #ffffff);
	text-decoration: none;
	font-size: 14px;
	font-weight: 600;
	padding: 10px 16px;
	border-radius: calc(var(--eip-radius, 12px) * 0.4);
	transition: background-color 0.2s ease;
	margin-top: auto;
}

.eip-card-featured:hover .eip-card-cta,
.eip-card-secondary:hover .eip-card-cta {
	background: var(--eip-btn-hover, #c1121f);
}

/* Responsive */
@media (max-width: 640px) {
	.eip-popup {
		padding: 26px 16px 18px;
	}

	.eip-card-featured .eip-card-image img {
		height: 140px;
	}

	.eip-card-featured .eip-card-title {
		font-size: 18px;
	}

	/* Secondary columns stack on very small screens instead of squeezing side by side. */
	.eip-cards-secondary-row {
		flex-direction: column;
		gap: 16px;
	}

	.eip-card-secondary {
		padding: 0 !important;
	}

	.eip-card-secondary + .eip-card-secondary {
		border-left: none;
		border-top: 1px solid rgba(0, 0, 0, 0.1);
		padding-top: 16px !important;
	}
}
