/* ========================================
   Professional Page Loader System
   ======================================== */

/* Preload critical styles to prevent FOUC */
.page-loader-active {
    overflow: hidden !important;
}

/* Main overlay container */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 1;
    visibility: visible;
}

#page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Loading spinner container */
.loader-content {
    text-align: center;
    color: white;
}

/* Modern spinner animation */
.loader-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 25px;
    position: relative;
}

.loader-spinner::before,
.loader-spinner::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: white;
}

.loader-spinner::before {
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    animation: spin 1s linear infinite;
}

.loader-spinner::after {
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border-top-color: rgba(255, 255, 255, 0.5);
    animation: spin 0.8s linear infinite reverse;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Loading text */
.loader-text {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loader-subtext {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 300;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Dots animation */
.loader-dots {
    display: inline-flex;
    gap: 5px;
    margin-left: 5px;
}

.loader-dots span {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    display: inline-block;
    animation: dot-bounce 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loader-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dot-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 1;
    }
    30% {
        transform: translateY(-10px);
        opacity: 0.7;
    }
}

/* Logo/Icon container */
.loader-icon {
    margin-bottom: 20px;
    font-size: 48px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Progress bar (optional) */
.loader-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 20px auto 0;
    overflow: hidden;
}

.loader-progress-bar {
    height: 100%;
    background: white;
    border-radius: 10px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% {
        width: 0%;
        opacity: 0.5;
    }
    50% {
        width: 70%;
        opacity: 1;
    }
    100% {
        width: 100%;
        opacity: 0.5;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .loader-spinner {
        width: 50px;
        height: 50px;
    }

    .loader-text {
        font-size: 16px;
    }

    .loader-subtext {
        font-size: 12px;
    }

    .loader-icon {
        font-size: 40px;
    }
}

/* Alternative minimal loader (uncomment to use) */
/*
.loader-minimal {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
*/
