/* ==========================================================================
   APM GLOBAL LOGISTICS - OFFICIAL ERP PAGE LOADER STYLESHEET
   Clean, Minimal, Premium Brand Identity Centered on the APM Logo
   ========================================================================== */

/* Fullscreen Overlay - Starts Visible by Default for Initial Page Render */
.apm-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #ffffff;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

/* Hidden State */
.apm-loader-overlay.apm-loader-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Active Trigger State */
.apm-loader-overlay.apm-loader-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Main Loader Center Container */
.apm-loader-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    /* Gentle entrance reveal animation */
    animation: apmLogoReveal 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* APM Logo Box Wrapper */
.apm-logo-wrapper {
    position: relative;
    width: 280px;
    max-width: 85vw;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
}

/* Exact APM Logo Image - Preserved 100% Unmodified */
.apm-logo-img {
    width: 100%;
    height: auto;
    max-height: 170px;
    object-fit: contain;
    display: block;
}

/* Refined Aerodynamic Light Sweep along the Red Swoosh Arrow */
.apm-swoosh-light-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    border-radius: 12px;
}

.apm-swoosh-light-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -70%;
    width: 45%;
    height: 200%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.7) 45%,
        rgba(255, 255, 255, 0.95) 50%,
        rgba(255, 255, 255, 0.7) 55%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(32deg);
    animation: apmSwooshSweep 2.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Minimal Elegant Loading Text & Pulse */
.apm-loader-text-group {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.apm-loader-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2b2456;
    letter-spacing: 0.5px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: apmTextPulse 1.8s ease-in-out infinite;
}

/* Animated Dot Ellipsis */
.apm-loader-dots span {
    display: inline-block;
    animation: apmDotBlink 1.4s infinite;
    opacity: 0.2;
}
.apm-loader-dots span:nth-child(1) { animation-delay: 0.0s; }
.apm-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.apm-loader-dots span:nth-child(3) { animation-delay: 0.4s; }

.apm-loader-subtitle {
    font-size: 0.78rem;
    font-weight: 600;
    color: #e51a24;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    opacity: 0.9;
}

/* Minimal Sleek Progress Bar Indicator directly under logo */
.apm-loader-progress-bar-container {
    width: 160px;
    height: 3px;
    background: #e2e8f0;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
    position: relative;
}

.apm-loader-progress-bar-fill {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, #2b2456 0%, #e51a24 100%);
    border-radius: 4px;
    position: absolute;
    animation: apmIndeterminateProgress 1.5s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

/* Keyframe Animations */
@keyframes apmLogoReveal {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes apmSwooshSweep {
    0% {
        left: -80%;
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    60% {
        left: 120%;
        opacity: 1;
    }
    100% {
        left: 120%;
        opacity: 0;
    }
}

@keyframes apmTextPulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 1; }
}

@keyframes apmDotBlink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

@keyframes apmIndeterminateProgress {
    0% { left: -45%; width: 45%; }
    50% { left: 25%; width: 55%; }
    100% { left: 105%; width: 45%; }
}

/* Mobile Responsiveness */
@media (max-width: 576px) {
    .apm-logo-wrapper {
        width: 220px;
    }
    .apm-loader-title {
        font-size: 1rem;
    }
    .apm-loader-progress-bar-container {
        width: 130px;
    }
}
