/*
 * Elite Crypto Signal - signup popup.
 * Four styles (modal, slide-in right/left, top bar) and three entrance animations,
 * all chosen in Appearance > Customize > Popup Lead Form.
 */

.ecs-popup {
	--ecs-pop-from: translateY(26px);
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	pointer-events: none;
}

.ecs-popup[hidden] {
	display: none !important;
}

.ecs-popup[data-anim='fade'] {
	--ecs-pop-from: none;
}

.ecs-popup[data-anim='zoom'] {
	--ecs-pop-from: scale(0.93);
}

/* Scroll lock (modal only, and only when the setting is on) */

html.ecs-popup-open {
	overflow: hidden;
	padding-right: var(--ecs-sbw, 0);
}

/* Overlay */

.ecs-popup__overlay {
	position: absolute;
	inset: 0;
	background: rgba(var(--ecs-bg-rgb), var(--ecs-popup-overlay, 0.7));
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	pointer-events: auto;
	transition: opacity 0.35s ease;
}

.ecs-popup.is-open .ecs-popup__overlay {
	opacity: 1;
}

/* Box */

.ecs-popup__box {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: minmax(0, 1fr);
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow: hidden;
	border: 1px solid var(--ecs-border);
	border-radius: var(--ecs-radius);
	background: var(--ecs-surface);
	box-shadow: var(--ecs-shadow), 0 0 0 1px rgba(var(--ecs-heading-rgb), 0.02) inset;
	pointer-events: auto;
	opacity: 0;
	transform: var(--ecs-pop-from);
	transition: opacity 0.38s var(--ecs-ease), transform 0.5s var(--ecs-ease);
}

.ecs-popup__box::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 2;
	height: 3px;
	background: linear-gradient(90deg, var(--ecs-accent), var(--ecs-accent-2));
}

.ecs-popup__box:focus {
	outline: none;
}

.ecs-popup.is-open .ecs-popup__box {
	opacity: 1;
	transform: none;
}

.ecs-popup__box.has-image {
	max-width: 880px;
}

/* Close button */

.ecs-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--ecs-border);
	border-radius: var(--ecs-radius);
	background: rgba(var(--ecs-bg-rgb), 0.6);
	color: var(--ecs-text);
	cursor: pointer;
	transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.ecs-popup__close:hover {
	border-color: var(--ecs-accent);
	background: var(--ecs-surface-2);
	color: var(--ecs-accent);
}

/* Media (optional side image) */

.ecs-popup__media {
	display: none;
	position: relative;
	min-height: 100%;
	background: var(--ecs-surface-2);
}

.ecs-popup__media::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(var(--ecs-bg-rgb), 0) 55%, rgba(var(--ecs-bg-rgb), 0.55));
	pointer-events: none;
}

.ecs-popup__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Body */

.ecs-popup__body {
	min-width: 0;
	padding: 38px 34px 30px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.ecs-popup__title {
	margin: 0 0 12px;
	padding-right: 36px;
	font-size: clamp(1.3rem, 2.6vw, 1.7rem);
	line-height: 1.2;
}

.ecs-popup__text {
	margin: 0 0 22px;
	color: var(--ecs-text);
	font-size: 0.98rem;
	line-height: 1.6;
}

.ecs-popup__fields {
	display: block;
}

.ecs-popup .ecs-fieldrow {
	margin-bottom: 14px;
}

.ecs-popup__submit {
	width: 100%;
	justify-content: center;
}

.ecs-popup__submit[disabled] {
	opacity: 0.65;
	cursor: progress;
}

.ecs-popup__status {
	min-height: 1.3em;
	margin: 12px 0 0;
	font-size: 0.92rem;
	line-height: 1.4;
}

.ecs-popup__status.is-error {
	color: var(--ecs-down);
}

.ecs-popup__status.is-ok {
	color: var(--ecs-up);
}

.ecs-popup__note {
	margin: 8px 0 0;
	font-size: 0.82rem;
	color: var(--ecs-muted);
}

.ecs-popup__form[hidden],
.ecs-popup__success[hidden] {
	display: none !important;
}

/* Success panel */

.ecs-popup__success {
	padding: 10px 0 2px;
	text-align: center;
}

.ecs-popup__success:focus {
	outline: none;
}

.ecs-popup__success .ecs-popup__title {
	padding-right: 0;
}

.ecs-popup__tick {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin: 0 0 18px;
	border: 1px solid rgba(var(--ecs-up-rgb), 0.5);
	border-radius: 50%;
	background: rgba(var(--ecs-up-rgb), 0.1);
	color: var(--ecs-up);
}

.ecs-popup__success .ecs-btn {
	margin-top: 6px;
}

/* ----------------------------------------------------------------- Slide-in */

.ecs-popup[data-style='slide-right'],
.ecs-popup[data-style='slide-left'] {
	align-items: flex-end;
	padding: 20px;
}

.ecs-popup[data-style='slide-right'] {
	justify-content: flex-end;
}

.ecs-popup[data-style='slide-left'] {
	justify-content: flex-start;
}

.ecs-popup[data-style='slide-right'] .ecs-popup__overlay,
.ecs-popup[data-style='slide-left'] .ecs-popup__overlay,
.ecs-popup[data-style='bar'] .ecs-popup__overlay {
	display: none;
}

.ecs-popup[data-style='slide-right'] .ecs-popup__box,
.ecs-popup[data-style='slide-left'] .ecs-popup__box {
	max-width: 400px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), var(--ecs-shadow);
}

.ecs-popup[data-style='slide-right'] .ecs-popup__body,
.ecs-popup[data-style='slide-left'] .ecs-popup__body {
	padding: 30px 26px 24px;
}

.ecs-popup[data-style='slide-right'] .ecs-popup__title,
.ecs-popup[data-style='slide-left'] .ecs-popup__title {
	font-size: 1.28rem;
}

.ecs-popup[data-style='slide-right'] .ecs-popup__media,
.ecs-popup[data-style='slide-left'] .ecs-popup__media {
	display: none !important;
}

/* ------------------------------------------------------------------ Top bar */

.ecs-popup[data-style='bar'] {
	--ecs-pop-from: translateY(-100%);
	inset: 0 0 auto 0;
	align-items: flex-start;
	padding: 0;
}

.ecs-popup[data-style='bar'][data-anim='fade'] {
	--ecs-pop-from: none;
}

.ecs-popup[data-style='bar'] .ecs-popup__box {
	max-width: none;
	max-height: 88vh;
	border-width: 0 0 1px;
	border-radius: 0;
}

.ecs-popup[data-style='bar'] .ecs-popup__box::before {
	top: auto;
	bottom: 0;
}

.ecs-popup[data-style='bar'] .ecs-popup__body {
	width: 100%;
	max-width: var(--ecs-container);
	margin: 0 auto;
	padding: 20px 64px 22px 24px;
}

.ecs-popup[data-style='bar'] .ecs-popup__close {
	top: 50%;
	right: 18px;
	transform: translateY(-50%);
}

.ecs-popup[data-style='bar'] .ecs-popup__media {
	display: none !important;
}

.ecs-popup[data-style='bar'] .ecs-eyebrow {
	margin-bottom: 4px;
}

.ecs-popup[data-style='bar'] .ecs-popup__title {
	margin-bottom: 4px;
	padding-right: 0;
	font-size: 1.15rem;
}

.ecs-popup[data-style='bar'] .ecs-popup__text {
	margin-bottom: 14px;
	font-size: 0.92rem;
}

.ecs-popup[data-style='bar'] .ecs-popup__form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 6px 14px;
}

.ecs-popup[data-style='bar'] .ecs-popup__form > .ecs-eyebrow,
.ecs-popup[data-style='bar'] .ecs-popup__form > .ecs-popup__title,
.ecs-popup[data-style='bar'] .ecs-popup__form > .ecs-popup__text {
	flex: 1 1 100%;
}

.ecs-popup[data-style='bar'] .ecs-popup__fields {
	display: flex;
	flex: 1 1 520px;
	flex-wrap: wrap;
	gap: 0 12px;
}

.ecs-popup[data-style='bar'] .ecs-popup__fields .ecs-fieldrow {
	flex: 1 1 170px;
	margin-bottom: 8px;
}

.ecs-popup[data-style='bar'] .ecs-consent {
	flex: 1 1 100%;
	margin: 0 0 6px;
}

.ecs-popup[data-style='bar'] .ecs-popup__submit {
	flex: 0 0 auto;
	width: auto;
	margin-bottom: 8px;
}

.ecs-popup[data-style='bar'] .ecs-popup__status,
.ecs-popup[data-style='bar'] .ecs-popup__note {
	flex: 1 1 100%;
	margin: 0;
}

.ecs-popup[data-style='bar'] .ecs-popup__success {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 22px;
	text-align: left;
}

.ecs-popup[data-style='bar'] .ecs-popup__success[hidden] {
	display: none;
}

.ecs-popup[data-style='bar'] .ecs-popup__tick {
	width: 44px;
	height: 44px;
	margin: 0;
}

.ecs-popup[data-style='bar'] .ecs-popup__success .ecs-popup__title,
.ecs-popup[data-style='bar'] .ecs-popup__success .ecs-popup__text {
	margin: 0;
}

/* --------------------------------------------------------------- Wide modal */

@media (min-width: 761px) {
	.ecs-popup__box.has-image {
		grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
	}

	.ecs-popup__box.has-image .ecs-popup__media {
		display: block;
	}
}

/* ------------------------------------------------------------------ Phones */

@media (max-width: 640px) {
	.ecs-popup {
		padding: 12px;
		align-items: flex-end;
	}

	.ecs-popup[data-style='modal'] {
		align-items: center;
	}

	.ecs-popup__body {
		padding: 32px 20px 22px;
	}

	.ecs-popup__title {
		font-size: 1.28rem;
	}

	.ecs-popup[data-style='slide-right'],
	.ecs-popup[data-style='slide-left'] {
		padding: 10px;
		justify-content: center;
	}

	.ecs-popup[data-style='slide-right'] .ecs-popup__box,
	.ecs-popup[data-style='slide-left'] .ecs-popup__box {
		max-width: none;
	}

	.ecs-popup[data-style='bar'] .ecs-popup__body {
		padding: 18px 16px 18px;
	}

	.ecs-popup[data-style='bar'] .ecs-popup__close {
		top: 10px;
		right: 10px;
		transform: none;
	}

	.ecs-popup[data-style='bar'] .ecs-popup__title {
		padding-right: 40px;
	}

	.ecs-popup[data-style='bar'] .ecs-popup__submit {
		flex: 1 1 100%;
		width: 100%;
	}

	.ecs-popup[data-style='bar'] .ecs-popup__success {
		justify-content: flex-start;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ecs-popup__overlay,
	.ecs-popup__box {
		transition: none;
		transform: none;
	}
}
