/**
 * Vision Event registration popup shell (iframe hosts Gravity Forms).
 * Card chrome matches the Figma popup; form controls are styled in form-embed.css.
 */

.vision-popup {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px 16px;
	direction: rtl;
	font-family: var(--vision-reg-font, var(--vision-font, 'Yekan Bakh FaNum', Tahoma, sans-serif));
}

.vision-popup.is-open {
	display: flex;
}

.gform_validation_errors{
	display: none;
}

.vision-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.45);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.vision-popup__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: min(720px, 100%);
	max-width: 100%;
	max-height: min(92vh, 920px);
	overflow-x: hidden;
	overflow-y: hidden;
	padding: 28px 32px 24px;
	border: 1px solid #d1d5db;
	border-radius: 20px;
	background: #ffffff;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
	text-align: right;
}

.vision-popup__head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
	flex-shrink: 0;
}

#vision-popup-title,
.vision-popup__title {
	margin: 0;
	color: #111827;
	font-family: var(--vision-reg-morabba, var(--vision-font-morabba, 'Morabba', sans-serif)) !important;
	font-size: 22px !important;
	font-weight: 700;
	line-height: 1.4;
}

.vision-popup__logo {
	width: 36px;
	height: 38px;
	object-fit: contain;
	flex-shrink: 0;
}

.vision-popup__close {
	position: absolute;
	top: 14px;
	left: 14px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: #f3f4f6;
	color: #111827;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.vision-popup__frame-wrap {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	background: #ffffff;
}

.vision-popup__loader {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: none;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: rgba(255, 255, 255, 0.92);
}

.vision-popup.is-loading .vision-popup__loader {
	display: flex;
}

.vision-popup.is-loading .vision-popup__frame {
	visibility: hidden;
}

.vision-popup__loader-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid #f3d4de;
	border-top-color: #c40038;
	border-radius: 50%;
	animation: vision-popup-spin 0.75s linear infinite;
}

.vision-popup__loader-text {
	margin: 0;
	color: #374151;
	font-size: 14px;
	font-weight: 600;
}

@keyframes vision-popup-spin {
	to {
		transform: rotate(360deg);
	}
}

.vision-popup__frame {
	display: block;
	flex: 1 1 auto;
	width: 100%;
	max-width: 100%;
	min-height: 340px;
	height: 100%;
	border: 0;
	background: #ffffff;
}

/* Desktop only: extra iframe room when a coupon or GF field errors are showing. */
@media (min-width: 641px) {
	.vision-popup.has-applied-coupon .vision-popup__frame {
		min-height: 372px;
	}

	.vision-popup.has-field-errors .vision-popup__frame {
		min-height: 394px;
	}
}

.vision-popup__message {
	margin: 12px 0 0;
	min-height: 0;
	color: #b91c1c;
	font-size: 14px;
	font-weight: 600;
}

.vision-popup__message:empty {
	display: none;
}

.vision-popup__message.is-success {
	color: #047857;
}

body.vision-popup-open {
	overflow: hidden;
}

body.vision-popup-open > *:not(.vision-popup) {
	filter: blur(2px);
}

@media (max-width: 640px) {
	/* Tight overlay padding so the card can use almost the full phone screen. */
	.vision-popup {
		align-items: stretch;
		padding: 8px;
	}

	/* Card fills the overlay; iframe area grows via flex, not inline height. */
	.vision-popup__dialog {
		box-sizing: border-box;
		flex: 1 1 auto;
		width: 100%;
		max-width: 100%;
		height: auto;
		max-height: calc(100dvh - 16px);
		padding: 16px 16px 12px;
		padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
		border-radius: 16px;
		overflow-x: hidden;
		overflow-y: hidden;
	}

	/* Close sits on the physical left; title stays on the right in RTL. */
	.vision-popup__close {
		top: 10px;
		left: 10px;
	}

	/* Smaller gap under the title so more pixels go to the form. */
	.vision-popup__head {
		margin-bottom: 12px;
		padding-left: 40px;
	}

	.vision-popup__title {
		font-size: 18px !important;
	}

	/* Iframe wrap fills the dialog body below the title. */
	.vision-popup__frame-wrap {
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		min-height: 0;
	}

	.vision-popup__frame {
		flex: 1 1 auto;
		width: 100%;
		min-height: 0;
		height: 100%;
	}
}
