/* =====================================================
   Escape Academy Formulare – PopUp & schwebender Button
   ===================================================== */

/* ── Felder im PopUp theme-fest sichtbar erzwingen ──
   Das PopUp liegt im Footer innerhalb von Divis #page-container. Regeln wie
   "#page-container input { display:none }" hätten höhere Spezifität als eine
   reine Klassen-Regel. Mit dem ID-Selektor #eaf-popup-overlay erzwingen wir die
   Sichtbarkeit zuverlässig (auch gegen !important via höhere Spezifität).
   Checkbox/Radio werden selbst gezeichnet (siehe eaf-frontend.css) und das
   „Anderes"-Textfeld per JS ein-/ausgeblendet – beide hier ausgenommen. */
#eaf-popup-overlay .eaf-form input:not(.eaf-checkbox):not(.eaf-radio):not(.eaf-other-text):not([type="hidden"]),
#eaf-popup-overlay .eaf-form select,
#eaf-popup-overlay .eaf-form textarea {
	display: revert !important;
	visibility: visible !important;
	opacity: 1 !important;
	position: static !important;
	height: auto !important;
	max-height: none !important;
	pointer-events: auto !important;
	clip: auto !important;
	clip-path: none !important;
	transform: none !important;
}

/* Horizontale Anordnung der Optionen auch im PopUp theme-fest erzwingen */
#eaf-popup-overlay .eaf-form .eaf-radio-group.eaf-radio-horizontal,
#eaf-popup-overlay .eaf-form .eaf-checkbox-group.eaf-checkbox-horizontal {
	display: flex !important;
	flex-wrap: wrap !important;
	gap: 8px 28px;
}

#eaf-popup-overlay .eaf-form .eaf-checkbox-option,
#eaf-popup-overlay .eaf-form .eaf-radio-option {
	display: flex !important;
	align-items: flex-start;
}

/* ── Schwebender Trigger-Button ── */
.eaf-popup-trigger {
	position: fixed;
	z-index: 999998;
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: 0;
	border: none;
	cursor: pointer;
	background: var(--eaf-btn-color, #5ac8c8);
	color: var(--eaf-btn-text, #ffffff);
	border-radius: 9999px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	overflow: hidden;
	font-family: inherit;
	font-size: 16px;
	line-height: 1;
	-webkit-tap-highlight-color: transparent;
	transition: box-shadow 0.25s ease, transform 0.2s ease;
}

.eaf-popup-trigger:hover {
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

.eaf-popup-trigger__icon {
	width: 58px;
	height: 58px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.eaf-popup-trigger__icon svg {
	width: 26px;
	height: 26px;
	display: block;
}

.eaf-popup-trigger__text {
	max-width: 0;
	opacity: 0;
	overflow: hidden;
	white-space: nowrap;
	font-weight: 600;
	transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
				opacity 0.3s ease,
				padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Text bei Hover/Fokus aufklappen */
.eaf-popup-trigger:hover .eaf-popup-trigger__text,
.eaf-popup-trigger:focus-visible .eaf-popup-trigger__text {
	max-width: 260px;
	opacity: 1;
}

.eaf-popup-trigger--right:hover .eaf-popup-trigger__text,
.eaf-popup-trigger--right:focus-visible .eaf-popup-trigger__text {
	padding-right: 24px;
}

.eaf-popup-trigger--left {
	flex-direction: row-reverse;
}

.eaf-popup-trigger--left:hover .eaf-popup-trigger__text,
.eaf-popup-trigger--left:focus-visible .eaf-popup-trigger__text {
	padding-left: 24px;
}

/* ── Positionierung ── */
.eaf-popup-trigger--right  { right: var(--eaf-offset-x, 16px); }
.eaf-popup-trigger--left   { left:  var(--eaf-offset-x, 16px); }
.eaf-popup-trigger--top    { top:    var(--eaf-offset-y, 16px); }
.eaf-popup-trigger--bottom { bottom: var(--eaf-offset-y, 16px); }

.eaf-popup-trigger--middle {
	top: calc(50% + var(--eaf-offset-y, 0px));
	transform: translateY(-50%);
}

.eaf-popup-trigger:active            { transform: scale(0.97); }
.eaf-popup-trigger--middle:active    { transform: translateY(-50%) scale(0.97); }

/* ── Overlay ── */
.eaf-popup-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: var(--eaf-overlay-bg, rgba(0, 0, 0, 0.72));
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	padding: 20px;
	align-items: center;
	justify-content: center;
}

.eaf-popup-overlay.eaf-popup-open {
	display: flex;
	animation: eafPopupFade 0.28s ease forwards;
}

/* ── PopUp-Fenster ── */
.eaf-popup-window {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 520px;
	max-width: 94vw;
	max-height: 90vh;
	background: var(--eaf-popup-bg, #ffffff);
	border-radius: 14px;
	box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.06);
	overflow: hidden;
	animation: eafPopupSlide 0.4s cubic-bezier(0.34, 1.28, 0.64, 1) forwards;
}

.eaf-popup-body {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 44px 34px 34px;
	box-sizing: border-box;
}

/* ── Schließen-Button ── */
.eaf-popup-close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 5;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	line-height: 1;
	color: #ffffff;
	background: rgba(0, 0, 0, 0.55);
	-webkit-backdrop-filter: blur(4px);
	backdrop-filter: blur(4px);
	transition: transform 0.15s ease, background 0.2s ease;
}

.eaf-popup-close:hover {
	transform: scale(1.1);
	background: rgba(0, 0, 0, 0.78);
}

/* ── Responsive ── */
@media (max-width: 600px) {
	.eaf-popup-overlay {
		padding: 0;
		align-items: flex-end;
	}

	.eaf-popup-window {
		width: 100%;
		max-width: 100%;
		height: 92vh;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
		animation: eafPopupSlideMobile 0.36s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
	}

	.eaf-popup-body {
		padding: 44px 20px 24px;
	}

	/* Button auf Mobil etwas kompakter */
	.eaf-popup-trigger__icon {
		width: 52px;
		height: 52px;
	}
}

/* ── Animationen ── */
@keyframes eafPopupFade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes eafPopupSlide {
	from { opacity: 0; transform: translateY(32px) scale(0.96); }
	to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes eafPopupSlideMobile {
	from { opacity: 0; transform: translateY(100%); }
	to   { opacity: 1; transform: translateY(0);    }
}

/* ── Reduzierte Bewegung respektieren ── */
@media (prefers-reduced-motion: reduce) {
	.eaf-popup-trigger,
	.eaf-popup-trigger__text,
	.eaf-popup-close {
		transition: none;
	}
	.eaf-popup-overlay.eaf-popup-open,
	.eaf-popup-window {
		animation: none;
	}
}
