/**
 * Universal Popup Forms — the modal shell public/js/forms-popup.js builds.
 * Uses the suite's own design tokens (--rep-*) so a popup form matches
 * whatever template/Design Override is active, same as every other Forms
 * Pro surface. Always loaded site-wide alongside forms-popup.js.
 */

.rep-forms-popup {
	border: none;
	padding: 0;
	background: transparent;
	max-width: min(560px, calc(100vw - 32px));
	width: 100%;
	max-height: min(88vh, 720px);
	border-radius: var( --rep-radius-md, 12px );
	overflow: visible;
}

/* Native <dialog> backdrop. */
.rep-forms-popup::backdrop {
	background: rgba( 12, 16, 22, 0.55 );
	animation: rep-forms-popup-fade 0.15s ease;
}

/* Fallback shell for browsers without <dialog> (see forms-popup.js). */
.rep-forms-popup[role="dialog"] {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba( 12, 16, 22, 0.55 );
	padding: 16px;
}

@keyframes rep-forms-popup-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.rep-forms-popup__panel {
	background: var( --rep-card-bg, #fff );
	border-radius: var( --rep-radius-md, 12px );
	box-shadow: var( --rep-card-shadow, 0 20px 60px -12px rgba( 0, 0, 0, 0.35 ) );
	max-height: min(88vh, 720px);
	overflow-y: auto;
	position: relative;
	padding: 32px 28px 28px;
	animation: rep-forms-popup-in 0.18s ease;
}

@media ( prefers-reduced-motion: reduce ) {
	.rep-forms-popup::backdrop,
	.rep-forms-popup__panel {
		animation: none;
	}
}

@keyframes rep-forms-popup-in {
	from {
		opacity: 0;
		transform: translateY( 8px ) scale( 0.98 );
	}
	to {
		opacity: 1;
		transform: none;
	}
}

.rep-forms-popup__close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	border: none;
	background: transparent;
	color: var( --rep-ink-soft, #6b7280 );
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.rep-forms-popup__close:hover,
.rep-forms-popup__close:focus-visible {
	background: rgba( 0, 0, 0, 0.06 );
	color: var( --rep-ink, #111827 );
}

.rep-forms-popup__body {
	min-height: 80px;
}

.rep-forms-popup__loading {
	text-align: center;
	color: var( --rep-ink-soft, #6b7280 );
	padding: 40px 0;
	margin: 0;
}

.rep-forms-popup__skeleton {
	display: flex;
	flex-direction: column;
	gap: var( --rep-space-sm, 0.75rem );
	padding: 8px 0 24px;
}

/* The trigger a visitor clicked stays visible under the modal but should
   never be reachable by keyboard while the popup is open — every focusable
   element inside it is skipped over automatically once the browser's own
   inert/modal handling kicks in for a native <dialog>; body scroll lock
   (toggled in forms-popup.js) covers the rest for older browsers. */
body.rep-forms-popup-open {
	overflow: hidden;
}

@media ( max-width: 560px ) {
	.rep-forms-popup__panel {
		padding: 26px 18px 20px;
	}
}
