/**
 * Page Loader Styles
 * Configurable loading effects with browser compatibility
 *
 * Usage: <html data-loader="progress|fade|spinner|overlay">
 */
/* Feature detection - only apply if browser supports required features */
@supports (animation: spin 1s linear) and (--test: 1) {
/* ========================================
   Shared Styles
   ======================================== */
.page-loader {
    position: fixed;
    z-index: 99999;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.page-loader.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
/* ========================================
   1. Progress Bar (Default)
   ======================================== */
.page-loader-progress {
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--primary, #2563eb);
    box-shadow: 0 0 10px var(--primary, #2563eb), 0 0 5px var(--primary, #2563eb);
    transition: width 0.2s ease-out;
}
.page-loader-progress.active {
    animation: progressPulse 2s ease-in-out infinite;
}
@keyframes progressPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
/* Progress trickle effect - handled by JS but CSS backup */
.page-loader-progress.loading {
    animation: progressTrickle 10s ease-out forwards, progressPulse 2s ease-in-out infinite;
}
@keyframes progressTrickle {
    0% { width: 0; }
    10% { width: 30%; }
    50% { width: 60%; }
    80% { width: 80%; }
    95% { width: 90%; }
    100% { width: 95%; }
}
.page-loader-progress.done {
    width: 100% !important;
    animation: none;
    transition: width 0.1s ease-out, opacity 0.3s ease 0.1s;
}
/* ========================================
   2. Fade Transition
   ======================================== */
.page-loader-fade {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gray-50, #f9fafb);
}
.page-loader-fade.active {
    animation: fadeIn 0.2s ease-out forwards;
}
.page-loader-fade.done {
    animation: fadeOut 0.3s ease-out forwards;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
/* ========================================
   3. Center Spinner
   ======================================== */
.page-loader-spinner {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
}
.page-loader-spinner::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200, #e5e7eb);
    border-top-color: var(--primary, #2563eb);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
/* ========================================
   4. Overlay Mask
   ======================================== */
.page-loader-overlay {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}
.page-loader-overlay::after {
    content: '';
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
/* ========================================
   Reduced Motion Support
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .page-loader,
    .page-loader-progress,
    .page-loader-fade,
    .page-loader-spinner::after,
    .page-loader-overlay::after {
        animation: none !important;
        transition: none !important;
    }
    .page-loader-progress.loading {
        width: 50% !important;
    }
}
} /* End @supports */