/**
 * «فعال سازی SPA»: router progress bar and the admin debug box.
 * View-transition CSS is printed inline by Hafez_Spa_Navigation (it depends on settings).
 */

html.hafez-spa-loading,
html.hafez-spa-loading * {
	cursor: progress;
}

html.hafez-spa-loading::before {
	content: "";
	position: fixed;
	inset-block-start: 0;
	inset-inline: 0;
	block-size: 3px;
	z-index: 2147483000;
	background: linear-gradient(90deg, transparent, var(--e-global-color-primary, #2563eb), transparent);
	background-size: 50% 100%;
	background-repeat: no-repeat;
	animation: hafez-spa-progress 1s linear infinite;
	pointer-events: none;
}

@keyframes hafez-spa-progress {
	from {
		background-position: -50% 0;
	}

	to {
		background-position: 150% 0;
	}
}

.hafez-spa-debug {
	position: fixed;
	inset-block-end: 12px;
	inset-inline-start: 12px;
	z-index: 2147483001;
	inline-size: min(320px, calc(100vw - 24px));
	max-block-size: 60vh;
	overflow: auto;
	padding: 10px 12px;
	border-radius: 10px;
	background: rgba(17, 24, 39, 0.92);
	color: #f9fafb;
	font: 12px/1.6 Tahoma, sans-serif;
	box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
	direction: rtl;
	text-align: start;
}

.hafez-spa-debug[hidden] {
	display: none;
}

.hafez-spa-debug__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-block-end: 6px;
}

.hafez-spa-debug__close {
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 6px;
	border-radius: 6px;
}

.hafez-spa-debug__close:focus-visible {
	outline: 2px solid #93c5fd;
	outline-offset: 1px;
}

.hafez-spa-debug dl {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 2px 10px;
	margin: 0;
}

.hafez-spa-debug dt {
	opacity: 0.75;
}

.hafez-spa-debug dd {
	margin: 0;
	word-break: break-word;
}

@media (prefers-reduced-motion: reduce) {
	html.hafez-spa-loading::before {
		animation: none;
		background-size: 100% 100%;
	}
}
