/**
 * Preloader Styles
 * Separated to reduce render-blocking CSS
 */

/* Preloader Dynamic CSS Variables */
:root {
    --preloader-primary: #0d6efd;
    --preloader-secondary: #ffc107;
    --preloader-background: #ffffff;
    --preloader-text: #0d6efd;
    --preloader-speed: 2s;
    --preloader-fade: 0.5s;
}

/* Preloader Styles */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--preloader-background) 0%, rgba(248, 249, 250, 0.5) 100%);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: opacity var(--preloader-fade) ease-out;
}

#preloader.hidden {
    opacity: 0;
    visibility: hidden;
}

.preloader-car {
    position: relative;
    width: 200px;
    height: 120px;
    margin-bottom: 30px;
}

.car-body {
    position: absolute;
    bottom: 30px;
    left: 20px;
    width: 160px;
    height: 50px;
    background: linear-gradient(135deg, var(--preloader-primary) 0%, color-mix(in srgb, var(--preloader-primary) 85%, black) 100%);
    border-radius: 15px 25px 10px 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: carFloat var(--preloader-speed) ease-in-out infinite;
}

.car-top {
    position: absolute;
    bottom: 80px;
    left: 40px;
    width: 100px;
    height: 40px;
    background: linear-gradient(135deg, var(--preloader-primary) 0%, color-mix(in srgb, var(--preloader-primary) 85%, black) 100%);
    border-radius: 20px 20px 0 0;
    animation: carFloat var(--preloader-speed) ease-in-out infinite;
}

.car-window {
    position: absolute;
    bottom: 85px;
    left: 50px;
    width: 80px;
    height: 30px;
    background: #e3f2fd;
    border-radius: 15px 15px 0 0;
    animation: carFloat var(--preloader-speed) ease-in-out infinite;
}

.car-wheel {
    position: absolute;
    bottom: 10px;
    width: 30px;
    height: 30px;
    background: #212529;
    border-radius: 50%;
    border: 3px solid var(--preloader-primary);
    animation: wheelSpin 1s linear infinite;
}

.car-wheel.front {
    left: 30px;
}

.car-wheel.back {
    right: 30px;
}

.car-headlight {
    position: absolute;
    bottom: 40px;
    right: 15px;
    width: 15px;
    height: 10px;
    background: var(--preloader-secondary);
    border-radius: 5px 10px 10px 5px;
    box-shadow: 0 0 20px var(--preloader-secondary);
    animation: lightPulse 1s ease-in-out infinite alternate;
}

@keyframes carFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes wheelSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes lightPulse {
    0% { opacity: 0.6; box-shadow: 0 0 10px var(--preloader-secondary); }
    100% { opacity: 1; box-shadow: 0 0 30px var(--preloader-secondary); }
}

.preloader-text {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--preloader-text);
    margin-top: 20px;
    letter-spacing: 2px;
    animation: textFade 1.5s ease-in-out infinite;
}

@keyframes textFade {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.progress-bar {
    width: 200px;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 20px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--preloader-primary) 0%, color-mix(in srgb, var(--preloader-primary) 85%, black) 100%);
    width: 0%;
    animation: progressAnimation var(--preloader-speed) ease-in-out infinite;
    border-radius: 2px;
}

@keyframes progressAnimation {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}
