/**
 * RWA Radio Loading Screen
 *
 * A radio-themed preloader with a microphone SVG + equalizer bars.
 * Injected inline via wp_body_open for immediate display.
 * Fades out once the page is fully loaded.
 *
 * @package RadioWebAsi
 * @since 2.5.0
 */

/* ── Overlay ── */
.rwa-preloader {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: var(--rwa-bg, #0a0a1a);
	transition: opacity .5s ease, visibility .5s ease;
}

.rwa-preloader.rwa-preloader--hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* ── Microphone icon ── */
.rwa-preloader__mic {
	width: 64px;
	height: 64px;
	margin-bottom: 24px;
	color: var(--rwa-primary, #00f5d4);
	filter: drop-shadow(0 0 18px rgba(0, 245, 212, 0.4));
	animation: rwa-mic-pulse 1.5s ease-in-out infinite;
}

@keyframes rwa-mic-pulse {
	0%, 100% { transform: scale(1);    opacity: 1; }
	50%      { transform: scale(1.08); opacity: .85; }
}

/* ── Mini equalizer bars ── */
.rwa-preloader__eq {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	height: 32px;
	margin-bottom: 20px;
}

.rwa-preloader__bar {
	width: 5px;
	border-radius: 2px;
	background: linear-gradient(
		to top,
		var(--rwa-primary, #00f5d4),
		var(--rwa-secondary, #7b2ff7)
	);
	transform-origin: bottom center;
	animation: rwa-preloader-bar 1s ease-in-out infinite alternate;
}

.rwa-preloader__bar:nth-child(1) { height: 60%;  animation-delay: 0s; }
.rwa-preloader__bar:nth-child(2) { height: 100%; animation-delay: .15s; }
.rwa-preloader__bar:nth-child(3) { height: 40%;  animation-delay: .30s; }
.rwa-preloader__bar:nth-child(4) { height: 80%;  animation-delay: .45s; }
.rwa-preloader__bar:nth-child(5) { height: 55%;  animation-delay: .60s; }

@keyframes rwa-preloader-bar {
	0%   { transform: scaleY(.3); }
	100% { transform: scaleY(1); }
}

/* ── "On Air" text ── */
.rwa-preloader__text {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: 13px;
	letter-spacing: 3px;
	text-transform: uppercase;
	color: rgba(255, 255, 255, .5);
	animation: rwa-text-blink 1.2s ease-in-out infinite;
}

@keyframes rwa-text-blink {
	0%, 100% { opacity: .5; }
	50%      { opacity: 1; }
}

/* ── Light mode ── */
body.rwa-light-mode .rwa-preloader,
html.rwa-light-mode .rwa-preloader {
	background: #f5f7fa;
}

body.rwa-light-mode .rwa-preloader__mic,
html.rwa-light-mode .rwa-preloader__mic {
	color: #7b2ff7;
	filter: drop-shadow(0 0 14px rgba(123, 47, 247, 0.3));
}

body.rwa-light-mode .rwa-preloader__text,
html.rwa-light-mode .rwa-preloader__text {
	color: rgba(0, 0, 0, .45);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
	.rwa-preloader__mic,
	.rwa-preloader__bar,
	.rwa-preloader__text {
		animation: none !important;
	}
	.rwa-preloader__bar {
		transform: scaleY(.6) !important;
	}
}
