/* ========================================================== */
/* PAGE LOADER STYLES
/* ========================================================== */

/* ========================================================== */
/* 1. BODY LOADING STATE
/* ========================================================== */
body.loading {overflow: hidden !important; margin: 0; height: 100%; width: 100%; position: fixed;}

/* ========================================================== */
/* 2. LOADER OVERLAY
/* ========================================================== */
.FL-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--b);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity 0.5s ease;
}

/* ========================================================== */
/* IMPORTANT: Show default cursor on entire loader
/* ========================================================== */
.FL-loader,
.FL-loader * {
    cursor: auto !important;
}

/* ========================================================== */
/* 3. LOGO WRAPPER & LOGO
/* ========================================================== */
.FL-logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
}

.FL-logo {width: 220px; object-fit: contain;}

/* Fade-in animation for logo - آروم‌تر (1.2 ثانیه) */
.FL-logo-inner {
    opacity: 0;
    animation: logoFadeIn 1.2s ease-out 0s forwards;
}

@keyframes logoFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.96);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.FL-logo svg {width: 70%; height: auto; display: block; margin: 0 auto;}

/* ========================================================== */
/* 4. PROGRESS BAR
/* ========================================================== */
.FL-progress-container {
    width: 60%;
    max-width: 220px;
    height: 6px;
    background: var(--tg-6);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 0 10px var(--tg-6);
    opacity: 0;
    animation: progressFadeIn 0.8s ease-out 0.15s forwards;
}

@keyframes progressFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.FL-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(135deg, #E2E0C3 0%, var(--c-4) 100%);
    border-radius: 10px;
    transition: width 0.1s linear;
}

.FL-percent-text {
    color: var(--w); 
    font-size: 14px; 
    letter-spacing: 0.4px; 
    margin-top: 8px;
    opacity: 0;
    animation: textFadeIn 0.8s ease-out 0.3s forwards;
}

@keyframes textFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================================== */
/* 5. CLOSE BUTTON
/* ========================================================== */
.FL-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    color: var(--w);
    font-size: 24px;
    border: none;
    padding: 10px;
    z-index: 1000000;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    cursor: pointer !important;
    animation: closeFadeIn 0.6s ease-out 0.45s forwards;
}

@keyframes closeFadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }
    to {
        opacity: 0.8;
        transform: translateX(0);
    }
}

.FL-close:hover {
    opacity: 1;
    transform: scale(1.1);
    cursor: pointer !important;
}

/* ========================================================== */
/* 6. FADE OUT ANIMATIONS (برای محو شدن لودر)
/* ========================================================== */
.FL-fade-away {
    animation: FL_fadeOutLogo 1.5s ease forwards;
}

.FL-fade-progress {
    animation: FL_fadeOutProgress 0.2s ease forwards;
}

.FL-fade-bg {
    animation: FL_fadeBackground 1s ease forwards;
}

.FL-hidden {
    display: none !important;
}

@keyframes FL_fadeOutLogo {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.92);
        visibility: hidden;
    }
}

@keyframes FL_fadeOutProgress {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes FL_fadeBackground {
    from {
        background: var(--b);
        opacity: 1;
    }
    to {
        background: var(--tg-0);
        opacity: 0;
        visibility: hidden;
    }
}

/* ========================================================== */
/* 7. RESPONSIVE BREAKPOINTS
/* ========================================================== */
@media (max-width: 768px) {
    .FL-progress-container {
        width: 80%;
    }
}

@media (min-width: 1601px) {
    .FL-logo {
        width: 320px;
    }
    .FL-progress-container {
        max-width: 320px;
    }
}