/* TurretAttacks.css */

/* Debug Line Visibility Control */
:root {
    --debug-lines-opacity: 0;  /* Set to 1 to see debug lines */
}

/* Debug Lines */
.debug-line {
    position: absolute;
    height: 2px;
    transform-origin: left center;
    pointer-events: none;
    will-change: transform;
    opacity: var(--debug-lines-opacity);
}

.debug-line.turret-facing-line {
    background: rgba(0, 0, 0, 0.75);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.debug-line.turret-target-line {
    background: rgba(255, 0, 0, 0.75);
    box-shadow: 0 0 4px rgba(255, 0, 0, 0.3);
    z-index: 1000;
}

/* Turret Targeting Animation */
@keyframes turret-track {
    0% { 
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); 
    }
    50% { 
        box-shadow: 0 0 0 8px rgba(255, 0, 0, 0.3); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(255, 0, 0, 0); 
    }
}

.defense-turret-overlay.tracking {
    animation: turret-track 2s ease-in-out infinite;
}

/* Turret Lock-on Effect */
@keyframes turret-lock {
    0% { 
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0); 
    }
    50% { 
        box-shadow: 0 0 0 12px rgba(0, 255, 0, 0.3); 
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(0, 255, 0, 0); 
    }
}

.defense-turret-overlay.locked {
    animation: turret-lock 1s ease-in-out infinite;
}

/* Vehicle Destruction Effects */
@keyframes vehicle-destruction {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    10% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    30% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.9;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.vehicle-destruction {
    position: absolute;
    background: radial-gradient(
        circle,
        rgba(255, 200, 50, 0.8) 0%,
        rgba(255, 100, 50, 0.6) 50%,
        rgba(255, 50, 50, 0) 100%
    );
    animation: vehicle-destruction 1s ease-out forwards;
    pointer-events: none;
    z-index: 2000;
}

/* Vehicle Destruction Debris */
@keyframes debris-scatter {
    0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(var(--scatter-x), var(--scatter-y)) rotate(var(--rotation));
        opacity: 0;
    }
}

.vehicle-debris {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #ff6600;
    border-radius: 50%;
    animation: debris-scatter 1s ease-out forwards;
    pointer-events: none;
}

/* Turret Fire Effect */
@keyframes turret-fire {
    0% {
        transform: scaleX(0.3);
        opacity: 1;
    }
    100% {
        transform: scaleX(1);
        opacity: 0;
    }
}

.turret-fire {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, 
        rgba(255, 200, 50, 1) 0%,
        rgba(255, 100, 50, 0.8) 50%,
        rgba(255, 50, 50, 0) 100%
    );
    transform-origin: left center;
    animation: turret-fire 0.3s ease-out forwards;
    pointer-events: none;
    z-index: 1001;
}

/* Turret Base Rotation */
.turret-weapon-layer {
    transition: transform 0.2s ease-out;
}

/* Targeting Highlight Effect */
@keyframes targeting-highlight {
    0% {
        box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(255, 0, 0, 0.5);
    }
    100% {
        box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.3);
    }
}

.vehicle-targeted {
    animation: targeting-highlight 1s ease-in-out infinite;
}

/* Hit Marker Effect */
@keyframes hit-marker {
    0% {
        transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5) rotate(45deg);
        opacity: 0;
    }
}

.hit-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 1002;
}

.hit-marker::before,
.hit-marker::after {
    content: '';
    position: absolute;
    background: #ff0000;
}

.hit-marker::before {
    left: 50%;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.hit-marker::after {
    top: 50%;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.hit-marker.active {
    animation: hit-marker 0.5s ease-out forwards;
}

/* Light Theme Adjustments */
.theme-light .debug-line.turret-facing-line {
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
}

.theme-light .debug-line.turret-target-line {
    background: rgba(220, 38, 38, 0.5);
    box-shadow: 0 0 4px rgba(220, 38, 38, 0.2);
}

/* Vehicle Smoke Trail */
@keyframes smoke-fade {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.3;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

.vehicle-smoke-particle {
    animation: smoke-fade 1s ease-out forwards;
}

/* Vehicle Crash Animation */
.vehicle-crash {
    transition: transform 1.5s ease-in, opacity 1.5s ease-out;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .debug-line {
        height: 1px; /* Thinner lines on mobile */
    }

    .bomber-destruction {
        transform-origin: center center; /* Better mobile performance */
    }

    .turret-fire {
        height: 1px; /* Thinner fire effect on mobile */
    }
}

@keyframes spark-fade {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) scale(0);
        opacity: 0;
    }
}

.vehicle-spark {
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 4px #FFA500;
}

/* Dust Effect Styles */
.dust-particle {
    z-index: 999;
    filter: blur(1px);
    will-change: transform, opacity;
}

.dust-ripple {
    z-index: 999;
    will-change: transform, opacity;
}

/* Turret Placement Animation */
.defense-turret-overlay {
    will-change: transform, opacity;
}



/* Health Indicator Lights */
.health-indicators {
    position: absolute;
    display: flex;
    gap: 4px;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001;
}

.health-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e; /* Green */
    transition: background-color 0.3s ease;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.5);
}

.health-light.depleted {
    background: #ef4444; /* Red */
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

/* Turret Death Animation */
@keyframes turret-death {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }
}

.defense-turret-overlay.dying {
    animation: turret-death 0.8s ease-out forwards;
}