/* Pixel Art Driver Character - Ryan Gosling Wojak Style */

.driver-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 350px;
    height: 350px;
    pointer-events: none;
}

/* Main character sprite */
.pixel-driver {
    position: relative;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* Car interior frame */
.car-interior {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('../img/driver-character/car-interior.png') no-repeat center;
    background-size: contain;
    z-index: 1;
}

/* Driver character */
.driver-sprite {
    position: absolute;
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: url('../img/driver-character/driver-sprite.png') no-repeat;
    background-size: 1000px 200px; /* Sprite sheet with 5 frames */
    z-index: 2;
    transition: none;
}

/* Static state for logged out users */
.driver-static .driver-sprite {
    background-position: 0 0; /* First frame */
}

/* Steering wheel element */
.steering-wheel {
    position: absolute;
    width: 80px;
    height: 80px;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: url('../img/driver-character/steering-wheel.png') no-repeat center;
    background-size: contain;
    z-index: 3;
    transform-origin: center center;
    transition: transform 0.3s ease-out;
}

/* Animation states */
.driver-active .driver-sprite {
    animation: driveAnimation 2s steps(5) infinite;
}

.driver-active .steering-wheel {
    animation: steeringAnimation 4s ease-in-out infinite;
}

/* Subtle highway mode */
.driver-highway .driver-sprite {
    animation: highwayDrive 10s steps(2) infinite;
}

.driver-highway .steering-wheel {
    animation: highwaySteering 10s ease-in-out infinite;
}

.driver-highway .car-interior {
    animation: subtleVibration 5s ease-in-out infinite;
}

/* Animations */
@keyframes driveAnimation {
    0% { background-position: 0 0; }
    20% { background-position: -200px 0; }
    40% { background-position: -400px 0; }
    60% { background-position: -600px 0; }
    80% { background-position: -800px 0; }
    100% { background-position: 0 0; }
}

@keyframes steeringAnimation {
    0%, 100% { transform: translateX(-50%) rotate(0deg); }
    25% { transform: translateX(-50%) rotate(-15deg); }
    50% { transform: translateX(-50%) rotate(0deg); }
    75% { transform: translateX(-50%) rotate(15deg); }
}

@keyframes highwayDrive {
    0%, 90% { background-position: 0 0; }
    95% { background-position: -200px 0; }
    100% { background-position: 0 0; }
}

@keyframes highwaySteering {
    0%, 45%, 55%, 100% { transform: translateX(-50%) rotate(0deg); }
    50% { transform: translateX(-50%) rotate(2deg); }
}

@keyframes subtleVibration {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(1px); }
}

/* Neon glow effect */
.driver-container::before {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(ellipse at center bottom, 
        rgba(255, 0, 255, 0.1) 0%, 
        transparent 70%);
    filter: blur(20px);
    z-index: -1;
    opacity: 0.5;
    animation: neonPulse 4s ease-in-out infinite;
}

@keyframes neonPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

/* Toothpick in mouth detail */
.toothpick {
    position: absolute;
    width: 20px;
    height: 2px;
    background: #d4a373;
    top: 120px;
    left: 140px;
    transform: rotate(-20deg);
    z-index: 4;
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

/* Gloves detail */
.driving-gloves {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('../img/driver-character/gloves-overlay.png') no-repeat center;
    background-size: contain;
    z-index: 3;
    opacity: 0.9;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .driver-container {
        width: 200px;
        height: 200px;
        bottom: 10px;
    }
    
    .driver-sprite {
        width: 150px;
        height: 150px;
        background-size: 750px 150px;
    }
    
    .steering-wheel {
        width: 60px;
        height: 60px;
        bottom: 30px;
    }
}

/* Hide on very small screens */
@media (max-width: 480px) {
    .driver-container {
        display: none;
    }
}

/* Fade in effect */
.driver-container {
    opacity: 0;
    animation: fadeIn 1s ease-out forwards;
    animation-delay: 0.5s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}