/**
 * Smart Ad Loader - CSS Styles
 * 
 * Provides a full-screen loading overlay with spinner animation.
 * Uses CSS-only animations (no external assets or JavaScript animations).
 */

/* Main loader container */
#ad-loader {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 999999;
	background-color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
	opacity: 1;
	visibility: visible;
	margin: 0;
	padding: 0;
	/* Ensure loader is always on top and blocking */
	pointer-events: auto;
	/* Prevent any interaction with content behind */
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Overlay background */
.ad-loader__overlay {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #ffffff;
}

/* Loader content container */
.ad-loader__content {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.5rem;
}

/* Spinner animation */
.ad-loader__spinner {
	width: 60px;
	height: 60px;
	border: 5px solid #f3f3f3;
	border-top: 5px solid #3498db;
	border-radius: 50%;
	animation: ad-loader-spin 1s linear infinite;
}

/* Spinner rotation animation */
@keyframes ad-loader-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Loader message container */
.ad-loader__message {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
	color: #333333;
}

/* Loader text */
.ad-loader__text {
	font-size: 1.125rem;
	font-weight: 400;
	letter-spacing: 0.5px;
}

/* Hidden state (fade out) */
.ad-loader--hidden {
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

/* Accessibility: Ensure loader is announced by screen readers */
#ad-loader[aria-live="polite"] {
	/* ARIA live region - screen readers will announce updates */
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
	.ad-loader__spinner {
		animation: none;
		border-top-color: #3498db;
	}
	
	#ad-loader {
		transition: opacity 0.1s ease-out, visibility 0.1s ease-out;
	}
	
	.ad-loader--hidden {
		transition: opacity 0.1s ease-out, visibility 0.1s ease-out;
	}
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.ad-loader__overlay {
		background-color: #000000;
	}
	
	.ad-loader__message {
		color: #ffffff;
	}
	
	.ad-loader__spinner {
		border-color: #ffffff;
		border-top-color: #ffffff;
	}
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
	.ad-loader__overlay {
		background-color: #1a1a1a;
	}
	
	.ad-loader__message {
		color: #ffffff;
	}
	
	.ad-loader__spinner {
		border-color: #333333;
		border-top-color: #3498db;
	}
}

/* Ensure loader is above all other content */
#ad-loader {
	position: fixed !important;
	z-index: 999999 !important;
}

/* Hide body scroll while loader is active */
body.ad-loader-active {
	overflow: hidden !important;
	height: 100vh !important;
	position: fixed !important;
	width: 100% !important;
	-webkit-overflow-scrolling: touch !important;
	/* Prevent scrolling on all devices */
	touch-action: none !important;
	/* Prevent text selection while loading */
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	-ms-user-select: none !important;
	user-select: none !important;
}

/* Prevent interaction with page content while loader is active */
body.ad-loader-active * {
	pointer-events: none !important;
}

/* Allow interaction with loader itself */
body.ad-loader-active #ad-loader,
body.ad-loader-active #ad-loader * {
	pointer-events: auto !important;
}

