/* ==========================================================================
   Click Page Loader – Frontend Overlay Styles
   ========================================================================== */

:root {
	--cpl-primary: #4C6FFF;
	--cpl-secondary: #FFB020;
	--cpl-bg: #0B0E1A;
	--cpl-bg-opacity: 0.55;
	--cpl-size: 56px;
	--cpl-speed: 900ms;
}

.cpl-overlay {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cpl-overlay.cpl-active {
	opacity: 1;
	visibility: visible;
	pointer-events: all;
}

.cpl-overlay:not(.cpl-model-bar)::before {
	content: '';
	position: absolute;
	inset: 0;
	background-color: var(--cpl-bg);
	opacity: var(--cpl-bg-opacity);
}

.cpl-center {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
}

.cpl-text {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
	font-size: 14px;
	letter-spacing: 0.02em;
	color: #ffffff;
	text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ---- مدل: حلقه چرخان (ring) ---- */
.cpl-ring {
	width: var(--cpl-size);
	height: var(--cpl-size);
	border-radius: 50%;
	border: calc(var(--cpl-size) * 0.1) solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--cpl-primary);
	animation: cpl-spin var(--cpl-speed) linear infinite;
}

/* ---- مدل: حلقه دوگانه (dual-ring) ---- */
.cpl-dual-ring {
	position: relative;
	width: var(--cpl-size);
	height: var(--cpl-size);
}
.cpl-dual-ring::before,
.cpl-dual-ring::after {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	border: calc(var(--cpl-size) * 0.09) solid transparent;
}
.cpl-dual-ring::before {
	border-top-color: var(--cpl-primary);
	border-bottom-color: var(--cpl-primary);
	animation: cpl-spin var(--cpl-speed) linear infinite;
}
.cpl-dual-ring::after {
	inset: calc(var(--cpl-size) * 0.16);
	border-left-color: var(--cpl-secondary);
	border-right-color: var(--cpl-secondary);
	animation: cpl-spin-reverse calc(var(--cpl-speed) * 0.75) linear infinite;
}

/* ---- مدل: نقطه‌های پرشی (dots) ---- */
.cpl-dots {
	display: flex;
	gap: calc(var(--cpl-size) * 0.18);
	align-items: flex-end;
	height: var(--cpl-size);
}
.cpl-dots span {
	width: calc(var(--cpl-size) * 0.24);
	height: calc(var(--cpl-size) * 0.24);
	border-radius: 50%;
	background: var(--cpl-primary);
	animation: cpl-bounce var(--cpl-speed) ease-in-out infinite;
}
.cpl-dots span:nth-child(2) { background: var(--cpl-secondary); animation-delay: calc(var(--cpl-speed) * 0.15); }
.cpl-dots span:nth-child(3) { animation-delay: calc(var(--cpl-speed) * 0.3); }

/* ---- مدل: دایره ضربان‌دار (pulse) ---- */
.cpl-pulse {
	width: var(--cpl-size);
	height: var(--cpl-size);
	border-radius: 50%;
	background: var(--cpl-primary);
	animation: cpl-pulse var(--cpl-speed) ease-in-out infinite;
	box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
}

/* ---- مدل: لوگوی سفارشی (logo) ---- */
.cpl-logo {
	width: var(--cpl-size);
	height: var(--cpl-size);
	object-fit: contain;
	animation: cpl-spin var(--cpl-speed) linear infinite;
	filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35));
}

/* ---- مدل: نوار پیشرفت بالای صفحه (bar) ---- */
.cpl-bar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 4px;
	background: rgba(255, 255, 255, 0.12);
	overflow: hidden;
}
.cpl-bar span {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 40%;
	background: linear-gradient(90deg, var(--cpl-secondary), var(--cpl-primary));
	border-radius: 4px;
	animation: cpl-bar-slide var(--cpl-speed) ease-in-out infinite;
}

/* ---- Keyframes ---- */
@keyframes cpl-spin {
	to { transform: rotate(360deg); }
}
@keyframes cpl-spin-reverse {
	to { transform: rotate(-360deg); }
}
@keyframes cpl-bounce {
	0%, 80%, 100% { transform: translateY(0); opacity: 0.6; }
	40% { transform: translateY(-60%); opacity: 1; }
}
@keyframes cpl-pulse {
	0% { transform: scale(0.75); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
	70% { transform: scale(1); box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); }
	100% { transform: scale(0.75); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}
@keyframes cpl-bar-slide {
	0% { left: -40%; }
	100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.cpl-ring, .cpl-dual-ring::before, .cpl-dual-ring::after, .cpl-dots span, .cpl-pulse, .cpl-logo, .cpl-bar span {
		animation-duration: calc(var(--cpl-speed) * 2);
	}
}
