/*
 * 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: 460px;
	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 */

body.ecs-theme .ecs-popup__close,
.ecs-popup__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	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;
}

body.ecs-theme .ecs-popup__close:hover,
body.ecs-theme .ecs-popup__close:focus,
.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: a compact form that fits a laptop screen without scrolling. */

.ecs-popup__body {
	min-width: 0;
	padding: 30px 28px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
	scrollbar-color: var(--ecs-border) transparent;
}

.ecs-popup__body::-webkit-scrollbar {
	width: 8px;
}

.ecs-popup__body::-webkit-scrollbar-track {
	background: transparent;
}

.ecs-popup__body::-webkit-scrollbar-thumb {
	border-radius: 8px;
	background: var(--ecs-border);
}

.ecs-popup .ecs-eyebrow {
	margin-bottom: 10px;
}

/* body.ecs-theme: site-wide heading and paragraph rules from a page builder must not resize the popup. */
body.ecs-theme .ecs-popup__title,
.ecs-popup__title {
	margin: 0 0 8px;
	padding-right: 40px;
	font-family: var(--ecs-font-heading);
	font-size: clamp(1.25rem, 2.1vw, 1.5rem);
	font-style: normal;
	font-weight: var(--ecs-heading-weight);
	line-height: 1.22;
	letter-spacing: -0.018em;
	text-transform: none;
	color: var(--ecs-heading);
}

body.ecs-theme .ecs-popup__text,
.ecs-popup__text {
	margin: 0 0 16px;
	color: var(--ecs-text);
	font-size: 0.94rem;
	line-height: 1.5;
}

.ecs-popup__fields {
	display: block;
}

body.ecs-theme .ecs-popup .ecs-fieldrow,
.ecs-popup .ecs-fieldrow {
	gap: 5px;
	margin-bottom: 11px;
}

body.ecs-theme .ecs-popup .ecs-fieldrow input:not([type='checkbox']):not([type='radio']),
body.ecs-theme .ecs-popup .ecs-fieldrow select {
	min-height: 44px;
	padding-top: 0.55em;
	padding-bottom: 0.55em;
}

body.ecs-theme .ecs-popup .ecs-consent,
.ecs-popup .ecs-consent {
	margin: 2px 0 12px;
	font-size: 0.8rem;
	line-height: 1.45;
}

body.ecs-theme .ecs-popup__submit,
.ecs-popup__submit {
	width: 100%;
	justify-content: center;
	margin-top: 4px;
	padding-top: 1em;
	padding-bottom: 1em;
}

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

body.ecs-theme .ecs-popup__status,
.ecs-popup__status {
	min-height: 1.3em;
	margin: 10px 0 0;
	font-size: 0.9rem;
	line-height: 1.4;
}

/* No message, no gap. */
body.ecs-theme .ecs-popup__status:empty,
.ecs-popup__status:empty {
	min-height: 0;
	margin: 0;
}

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

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

body.ecs-theme .ecs-popup__note,
.ecs-popup__note {
	margin: 10px 0 0;
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--ecs-muted);
	text-align: center;
}

.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;
}

body.ecs-theme .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: 28px 24px 22px;
}

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

.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;
}

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

body.ecs-theme .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;
}

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

.ecs-popup[data-style='bar'] .ecs-popup__fields .ecs-fieldrow--phone {
	flex: 2 1 280px;
}

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

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

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

.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;
}

body.ecs-theme .ecs-popup[data-style='bar'] .ecs-popup__success .ecs-popup__title,
body.ecs-theme .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: 26px 18px 20px;
	}

	body.ecs-theme .ecs-popup__title {
		font-size: 1.22rem;
	}

	body.ecs-theme .ecs-popup__text {
		margin-bottom: 14px;
		font-size: 0.92rem;
	}

	.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;
	}

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

	body.ecs-theme .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;
	}
}

/* ------------------------------------- Short screens (small laptops, landscape phones) */

@media (max-height: 640px) {
	.ecs-popup {
		padding-top: 10px;
		padding-bottom: 10px;
	}

	.ecs-popup__box {
		max-height: calc(100vh - 20px);
		max-height: calc(100dvh - 20px);
	}

	.ecs-popup__body {
		padding-top: 22px;
		padding-bottom: 18px;
	}

	.ecs-popup .ecs-eyebrow {
		margin-bottom: 6px;
	}

	body.ecs-theme .ecs-popup__text {
		margin-bottom: 12px;
	}

	body.ecs-theme .ecs-popup .ecs-fieldrow {
		margin-bottom: 9px;
	}
}

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

/* ------------------------------------------ A Fluent Form inside the popup */

/* Picked in Appearance > ECS Setup. Same compact spacing as the theme's own fields. */

.ecs-popup__form--ff .ecs-ff {
	margin: 0;
}

body.ecs-theme .ecs-popup .fluentform .ff-el-group {
	margin-bottom: 11px;
}

body.ecs-theme .ecs-popup .fluentform .ff-el-input--label {
	margin-bottom: 5px;
}

body.ecs-theme .ecs-popup .fluentform .ff-el-form-control:not([type='checkbox']):not([type='radio']) {
	min-height: 44px;
	padding-top: 0.55em;
	padding-bottom: 0.55em;
}

body.ecs-theme .ecs-popup .fluentform textarea.ff-el-form-control:not([type='checkbox']):not([type='radio']) {
	min-height: 84px;
}

body.ecs-theme .ecs-popup .fluentform .ff-t-container {
	gap: 10px;
}

body.ecs-theme .ecs-popup .fluentform .ff_submit_btn_wrapper {
	margin: 6px 0 0;
}

body.ecs-theme .ecs-popup .fluentform .ff-btn-submit {
	width: 100%;
}

body.ecs-theme .ecs-popup .ff-message-success {
	margin-top: 0;
}

/* The top-bar style lays the theme's fields out in one row; a Fluent Form keeps its own layout. */
.ecs-popup[data-style='bar'] .ecs-popup__form--ff {
	display: block;
}

@media (max-height: 640px) {
	body.ecs-theme .ecs-popup .fluentform .ff-el-group {
		margin-bottom: 9px;
	}
}
