/* Modern ERP Loader Styles */
#loader {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    /* Start after the sidebar */
    width: calc(100% - var(--sidebar-width));
    /* Occupy remaining width */
    height: 100%;
    background: #0f172a;
    /* Deep dark blue/slate */
    z-index: 1000;
    /* High, but typically lower than sidebar (1050) or modals */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

/* On mobile or when sidebar is hidden, loader should cover full screen or adjust */
body.sidebar-hidden #loader {
    left: 0;
    width: 100%;
}

@media (max-width: 768px) {
    #loader {
        left: 0;
        width: 100%;
        z-index: 2000;
        /* Cover sidebar on mobile */
    }
}

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

.loader-content {
    text-align: center;
    position: relative;
    /* Adjust center visually since it's now off-center relative to screen */
    margin-top: -5%;
}

/* Logo / Icon Container */
.loader-icon-box {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.loader-icon-box i {
    font-size: 40px;
    color: white;
    z-index: 2;
}

/* Shine effect on logo */
.loader-icon-box::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
            transparent 45%,
            rgba(255, 255, 255, 0.1) 50%,
            transparent 55%);
    animation: shine 3s infinite ease-in-out;
}

@keyframes shine {
    0% {
        transform: translate(-30%, -30%) rotate(45deg);
    }

    100% {
        transform: translate(30%, 30%) rotate(45deg);
    }
}

/* Brand Name */
.loader-brand {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.loader-subtitle {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 32px;
}

/* Progress Bar Container */
.loader-progress-wrapper {
    width: 240px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

/* Animated Progress Bar */
.loader-progress-bar {
    width: 30%;
    height: 100%;
    background: #3b82f6;
    border-radius: 4px;
    position: absolute;
    left: -30%;
    animation: indeterminate 1.5s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

@keyframes indeterminate {
    0% {
        left: -30%;
        width: 30%;
    }

    50% {
        left: 25%;
        width: 50%;
    }

    100% {
        left: 100%;
        width: 30%;
    }
}

/* Loading Text Status */
.loader-status {
    margin-top: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: #475569;
}