/* =============================================
   Elite Kit Popup Extension Styles
   ---------------------------------
   Uses CSS Custom Properties to cleanly
   separate positioning from animation:
     --ek-tx / --ek-ty : position translate
     --ek-ax / --ek-ay : animation offset
     --ek-scale        : animation scale
   The final transform composes all three,
   so there are zero specificity conflicts.
   ============================================= */

/* --- Base modal --- */
.ek-popup-modal {
	position: fixed;
	inset: auto;
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;

	/* Custom property defaults (overridden by position / animation classes) */
	--ek-tx: 0px;
	--ek-ty: 0px;
	--ek-ax: 0px;
	--ek-ay: 0px;
	--ek-scale: 1;
	--ek-duration: 400ms;
	--ek-easing: cubic-bezier(0.19, 1, 0.22, 1);

	/* Single unified transform — position + animation offset + scale */
	transform: translate(calc(var(--ek-tx) + var(--ek-ax)), calc(var(--ek-ty) + var(--ek-ay))) scale(var(--ek-scale));

	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	will-change: opacity, transform, visibility;
	box-sizing: border-box;
	margin: 0;

	/* Transition the composed transform + opacity for smooth animation */
	transition:
		opacity var(--ek-duration) var(--ek-easing),
		transform var(--ek-duration) var(--ek-easing),
		visibility var(--ek-duration);
}

.ek-popup-modal.ek-popup-active {
	/* Active state: animation offsets return to zero */
	--ek-ax: 0px;
	--ek-ay: 0px;
	--ek-scale: 1;
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* "None" animation: instant, no transition */
.ek-popup-modal.ek-popup-anim-none {
	transition: opacity 0s, visibility 0s;
}

/* --- Position classes (set --ek-tx / --ek-ty, top/left/right/bottom) --- */
.ek-popup-pos-top-left {
	top: 0;
	left: 0;
	--ek-tx: 0px;
	--ek-ty: 0px;
}

.ek-popup-pos-top-center {
	top: 0;
	left: 50%;
	--ek-tx: -50%;
	--ek-ty: 0px;
}

.ek-popup-pos-top-right {
	top: 0;
	right: 0;
	--ek-tx: 0px;
	--ek-ty: 0px;
}

.ek-popup-pos-center-left {
	top: 50%;
	left: 0;
	--ek-tx: 0px;
	--ek-ty: -50%;
}

.ek-popup-pos-center-center {
	top: 50%;
	left: 50%;
	--ek-tx: -50%;
	--ek-ty: -50%;
}

.ek-popup-pos-center-right {
	top: 50%;
	right: 0;
	--ek-tx: 0px;
	--ek-ty: -50%;
}

.ek-popup-pos-bottom-left {
	bottom: 0;
	left: 0;
	--ek-tx: 0px;
	--ek-ty: 0px;
}

.ek-popup-pos-bottom-center {
	bottom: 0;
	left: 50%;
	--ek-tx: -50%;
	--ek-ty: 0px;
}

.ek-popup-pos-bottom-right {
	bottom: 0;
	right: 0;
	--ek-tx: 0px;
	--ek-ty: 0px;
}

/* --- Animation classes (set initial --ek-ax / --ek-ay / --ek-scale) ---
   These define the STARTING offset that the modal animates FROM.
   When .ek-popup-active is added, the offsets reset to 0 and the
   transition animates the transform from offset → zero. --- */

.ek-popup-anim-fade {
	/* No transform offset, only opacity fades */
	--ek-ax: 0px;
	--ek-ay: 0px;
	--ek-scale: 1;
}

.ek-popup-anim-slide-up {
	/* Starts 60px below, slides up into place */
	--ek-ax: 0px;
	--ek-ay: 60px;
	--ek-scale: 1;
}

.ek-popup-anim-slide-down {
	/* Starts 60px above, slides down into place */
	--ek-ax: 0px;
	--ek-ay: -60px;
	--ek-scale: 1;
}

.ek-popup-anim-scale {
	/* Starts slightly smaller, scales up */
	--ek-ax: 0px;
	--ek-ay: 0px;
	--ek-scale: 0.85;
}

/* --- Overlay ---
   Expands vertically from the center outward (scaleY 0 → 1)
   combined with a smooth opacity fade. */
.ek-popup-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.7);

	/* Start collapsed at vertical center, invisible */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: scaleY(0);
	transform-origin: center center;
	will-change: opacity, transform, visibility;

	transition:
		opacity var(--ek-duration, 400ms) ease,
		transform var(--ek-duration, 400ms) cubic-bezier(0.19, 1, 0.22, 1),
		visibility var(--ek-duration, 400ms);
}

.ek-popup-overlay.ek-popup-active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: scaleY(1);
}

/* --- Close button --- */
.ek-popup-close-btn {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 32px;
	height: 32px;
	min-width: 32px;
	min-height: 32px;
	padding: 0;
	border: 0;
	background: rgba(0, 0, 0, 0.55);
	color: #ffffff;
	font-size: 18px;
	line-height: 1;
	border-radius: 50%;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
	transition: background 0.2s ease, transform 0.2s ease, color 0.2s ease;
	-webkit-appearance: none;
	appearance: none;
}

.ek-popup-close-btn:hover,
.ek-popup-close-btn:focus {
	background: rgba(0, 0, 0, 0.8);
	color: #fff;
	transform: rotate(90deg);
	outline: none;
}

/* A keyboard needs to see where it is; the hover look alone is not enough. */
.ek-popup-close-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.8);
}

@media (prefers-reduced-motion: reduce) {
	.ek-popup-close-btn:hover,
	.ek-popup-close-btn:focus {
		transform: none;
	}
}

.ek-popup-close-btn::before {
	content: "";
	position: absolute;
	width: 14px;
	height: 2px;
	background-color: currentColor;
	transform: rotate(45deg);
}

.ek-popup-close-btn::after {
	content: "";
	position: absolute;
	width: 14px;
	height: 2px;
	background-color: currentColor;
	transform: rotate(-45deg);
}

/* --- Mobile responsive --- */
@media (max-width: 767px) {
	.ek-popup-modal {
		max-width: 92vw;
	}
}

/* --- Body no-scroll while popup active --- */
body.ek-popup-no-scroll {
	overflow: hidden !important;
}

/* --- Content padding so close button doesn't overlap --- */
.ek-popup-modal.ek-popup-has-close > .elementor-widget-container,
.ek-popup-modal.ek-popup-has-close > .elementor-container,
.ek-popup-modal.ek-popup-has-close > .e-container,
.ek-popup-modal.ek-popup-has-close > .e-con {
	padding: 20px;
	box-sizing: border-box;
}

/* =============================================
   Content / Saved-Template popup modal
   ============================================= */
.ek-popup-modal.ek-popup-content-modal {
	background: #ffffff;
	color: #1f1f1f;
	max-width: 600px;
	width: calc(100% - 32px);
	max-height: 85vh;
	overflow-y: auto;
	padding: 28px;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
	z-index: 99991;
}

/* Content modals are always centered */
.ek-popup-modal.ek-popup-content-modal.ek-popup-pos-center-center {
	top: 50%;
	left: 50%;
	--ek-tx: -50%;
	--ek-ty: -50%;
}

/* Sane typography for injected WYSIWYG content */
.ek-popup-modal.ek-popup-content-modal > *:first-child {
	margin-top: 0;
}

.ek-popup-modal.ek-popup-content-modal > *:last-child {
	margin-bottom: 0;
}

.ek-popup-modal.ek-popup-content-modal a {
	color: inherit;
}

.ek-popup-modal.ek-popup-content-modal img {
	max-width: 100%;
	height: auto;
}

.ek-popup-modal.ek-popup-content-modal > .elementor {
	margin: 0;
}
