/* Universal Page Loader - Souq al'Ard */
/* Lightweight, performant, and accessible */

.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a365d 0%, #2d5a8f 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    width: 120px;
    height: auto;
    margin-bottom: 30px;
    animation: pulse 2s ease-in-out infinite;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #38a169;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-text {
    margin-top: 20px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    letter-spacing: 1px;
    animation: fadeInOut 1.5s ease-in-out infinite;
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

@keyframes fadeInOut {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Accessibility */
.page-loader[aria-hidden="true"] {
    display: none;
}

/* Performance optimization */
.page-loader * {
    will-change: transform, opacity;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .loader-logo {
        width: 100px;
    }

    .loader-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
    }

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

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .page-loader {
        transition: none;
    }

    .loader-logo,
    .loader-spinner,
    .loader-text {
        animation: none;
    }

    .loader-spinner {
        border-top-color: #38a169;
        opacity: 0.7;
    }
}

/* Print styles */
@media print {
    .page-loader {
        display: none !important;
    }
}