/**
 * PopUP by End Soft Design — frontend styles.
 * Scoped under .esd-popup-* so it does not leak into the theme.
 */

.esd-popup-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none; /* toggled to flex by JS */
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba( 0, 0, 0, 0.6 );
	opacity: 0;
	transition: opacity 0.25s ease;
	box-sizing: border-box;
	overflow-y: auto;
}

.esd-popup-overlay.esd-popup-visible {
	opacity: 1;
}

.esd-popup-box {
	position: relative;
	width: 100%;
	max-width: 560px;
	max-height: 90vh;
	overflow-y: auto;
	background: #fff;
	color: #1d2327;
	border-radius: 12px;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.35 );
	transform: translateY( 16px ) scale( 0.98 );
	transition: transform 0.25s ease;
	box-sizing: border-box;
	-webkit-overflow-scrolling: touch;
}

.esd-popup-overlay.esd-popup-visible .esd-popup-box {
	transform: translateY( 0 ) scale( 1 );
}

.esd-popup-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	line-height: 1;
	color: #555;
	background: rgba( 255, 255, 255, 0.85 );
	border: none;
	border-radius: 50%;
	cursor: pointer;
	z-index: 2;
	transition: background 0.15s ease, color 0.15s ease;
}

.esd-popup-close:hover {
	background: #f0f0f1;
	color: #000;
}

.esd-popup-content {
	padding: 28px;
}

.esd-popup-image-wrap {
	text-align: center;
	margin: 0 0 16px;
}

.esd-popup-image {
	display: block;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
	border-radius: 8px;
}

.esd-popup-body {
	font-size: 15px;
	line-height: 1.6;
	word-wrap: break-word;
}

.esd-popup-body img {
	max-width: 100%;
	height: auto;
}

.esd-popup-body a.button,
.esd-popup-body .esd-btn {
	display: inline-block;
	margin-top: 8px;
	padding: 10px 18px;
	background: #2271b1;
	color: #fff;
	text-decoration: none;
	border-radius: 6px;
}

/* ------------------------------------------------------------------ *
 * Style "image": large image, no white box, dark translucent frame.
 * ------------------------------------------------------------------ */
.esd-popup-style-image .esd-popup-box {
	background: transparent;
	box-shadow: none;
	border-radius: 0;
	width: auto;
	max-width: 920px;
	overflow: visible;
}

.esd-popup-style-image .esd-popup-content {
	padding: 0;
}

.esd-popup-style-image .esd-popup-image-wrap {
	margin: 0;
	padding: 14px;                          /* the dark frame thickness */
	background: rgba( 40, 40, 40, 0.55 );   /* dark gray, semi-transparent */
	border-radius: 12px;
	font-size: 0; /* kill inline-image whitespace */
}

.esd-popup-style-image .esd-popup-image {
	max-width: 100%;
	max-height: 86vh;
	width: auto;
	border-radius: 6px;
}

/* Any text/buttons under the image sit on their own dark translucent panel. */
.esd-popup-style-image .esd-popup-body {
	margin-top: 12px;
	padding: 14px 18px;
	background: rgba( 40, 40, 40, 0.55 );
	border-radius: 10px;
	color: #fff;
	text-align: center;
}

.esd-popup-style-image .esd-popup-body:empty {
	display: none;
}

/* Close button sits just outside the frame's top-right corner. */
.esd-popup-style-image .esd-popup-close {
	top: -14px;
	right: -14px;
}

/* Prevent background scroll while a popup is open. */
body.esd-popup-open {
	overflow: hidden;
}

@media ( max-width: 600px ) {
	.esd-popup-overlay {
		padding: 12px;
	}
	.esd-popup-content {
		padding: 20px;
	}
	.esd-popup-box {
		max-height: 92vh;
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.esd-popup-overlay,
	.esd-popup-box {
		transition: none;
	}
}
