/* Loader container - Full screen overlay */

.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #323232;
    /* ADD THESE TWO LINES */
    opacity: 1;
    transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}


/* ADD THIS NEW CLASS */

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

.loader-wrapper {
    text-align: center;
}

.truck-loader {
    position: relative;
    width: 200px;
    height: 150px;
    margin: 0 auto 30px;
}

.loader-container .truck {
    width: 80px;
    height: 50px;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    animation: moveTruck 2s ease-in-out infinite;
}

.loader-container .truck-body {
    position: relative;
    width: 100%;
    height: 100%;
}


/* Truck cabin */

.loader-container .cabin {
    position: absolute;
    right: 0;
    bottom: 8px;
    width: 25px;
    height: 30px;
    background: #fff;
    border-radius: 0 4px 0 0;
}

.loader-container .cabin::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 30px 10px;
    border-color: transparent transparent #fff transparent;
}


/* Truck cargo */

.loader-container .cargo {
    position: absolute;
    left: 0;
    bottom: 8px;
    width: 45px;
    height: 28px;
    background: #fff;
    border-radius: 2px 0 0 0;
}


/* Wheels */

.loader-container .wheel {
    position: absolute;
    bottom: 0;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: rotateWheel 0.5s linear infinite;
}

.loader-container .wheel-front {
    right: 5px;
}

.loader-container .wheel-back {
    left: 12px;
}


/* Speed lines */

.loader-container .speed-lines {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 100%;
}

.loader-container .line {
    position: absolute;
    height: 2px;
    background: #7c061a;
    animation: moveLine 1s ease-out infinite;
}

.loader-container .line:nth-child(1) {
    top: 35%;
    animation-delay: 0s;
}

.loader-container .line:nth-child(2) {
    top: 50%;
    animation-delay: 0.2s;
}

.loader-container .line:nth-child(3) {
    top: 65%;
    animation-delay: 0.4s;
}


/* Progress bar */

.loader-container .progress-bar {
    width: 100%;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    overflow: hidden;
}

.loader-container .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c061a, #93162b);
    animation: fillProgress 2s ease-in-out infinite;
}

.loader-container .loading-text {
    color: #fff;
    margin-top: 20px;
    font-size: 16px;
    animation: pulse 1.5s ease-in-out infinite;
}


/* Animations */

@keyframes moveTruck {
    0%,
    100% {
        left: 20%;
    }
    50% {
        left: 80%;
    }
}

@keyframes rotateWheel {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes moveLine {
    0% {
        left: 60%;
        width: 30px;
        opacity: 1;
    }
    100% {
        left: 0%;
        width: 10px;
        opacity: 0;
    }
}

@keyframes fillProgress {
    0% {
        width: 0%;
    }
    50% {
        width: 100%;
    }
    100% {
        width: 0%;
    }
}

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