/**
 * Universal Tool Popups — the modal shell public/js/tools-popup.js builds.
 * Directly mirrors Forms Pro's public/css/forms-popup.css (same suite
 * design tokens, same native <dialog>/fallback shell structure) with
 * .rep-tools-popup class names instead of .rep-forms-popup. Always loaded
 * site-wide alongside tools-popup.js.
 */

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

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

/* Fallback shell for browsers without <dialog> (see tools-popup.js). */
.rep-tools-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-tools-popup-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.rep-tools-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, 760px);
	overflow-y: auto;
	position: relative;
	padding: 32px 28px 28px;
	animation: rep-tools-popup-in 0.18s ease;
}

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

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

.rep-tools-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-tools-popup__close:hover,
.rep-tools-popup__close:focus-visible {
	background: rgba( 0, 0, 0, 0.06 );
	color: var( --rep-ink, #111827 );
}

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

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

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

body.rep-tools-popup-open {
	overflow: hidden;
}

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