/* ========================================================
   RK ANBU DRIVING SCHOOL - TRAFFIC SIGNALS & DRIVING CAR ANIMATIONS
   ======================================================== */

/* 1. Realistic Traffic Signal Light Component */
.traffic-signal-box {
    background: linear-gradient(145deg, #181d24, #0b0e12);
    border: 2px solid #2d3748;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.45), inset 0 1px 1px rgba(255,255,255,0.15);
    padding: 6px 7px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    user-select: none;
}

.traffic-signal-box.horizontal {
    flex-direction: row;
    padding: 5px 8px;
    gap: 7px;
}

/* Signal Visor / Hood over each lens */
.signal-lamp-socket {
    position: relative;
    background: #090c10;
    border-radius: 50%;
    padding: 2px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.9);
}

.signal-lamp-socket::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 10%;
    right: 10%;
    height: 4px;
    background: #1f2937;
    border-radius: 4px 4px 0 0;
    z-index: 2;
}

/* Signal Lamps (Lenses) */
.signal-lamp {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
}

.signal-lamp.lamp-lg {
    width: 32px;
    height: 32px;
}

.signal-lamp.lamp-xl {
    width: 48px;
    height: 48px;
}

/* Glass specular reflection on lens */
.signal-lamp::after {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 35%;
    height: 25%;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    filter: blur(0.5px);
    pointer-events: none;
}

/* Red Lamp States */
.signal-lamp.red {
    background: #450a0a;
    border: 1px solid #7f1d1d;
    opacity: 0.35;
}
.signal-lamp.red.active {
    background: radial-gradient(circle, #f87171 0%, #ef4444 60%, #b91c1c 100%);
    border-color: #fca5a5;
    opacity: 1;
    box-shadow: 0 0 16px #ef4444, 0 0 32px rgba(239, 68, 68, 0.6), inset 0 0 8px #ffffff;
    animation: pulse-red-glow 2s infinite ease-in-out;
}

/* Yellow / Amber Lamp States */
.signal-lamp.yellow {
    background: #451a03;
    border: 1px solid #78350f;
    opacity: 0.35;
}
.signal-lamp.yellow.active {
    background: radial-gradient(circle, #fde047 0%, #f59e0b 60%, #b45309 100%);
    border-color: #fef08a;
    opacity: 1;
    box-shadow: 0 0 16px #f59e0b, 0 0 32px rgba(245, 158, 11, 0.6), inset 0 0 8px #ffffff;
    animation: pulse-yellow-glow 2s infinite ease-in-out;
}

/* Green Lamp States */
.signal-lamp.green {
    background: #064e3b;
    border: 1px solid #065f46;
    opacity: 0.35;
}
.signal-lamp.green.active {
    background: radial-gradient(circle, #4ade80 0%, #10b981 60%, #047857 100%);
    border-color: #86efac;
    opacity: 1;
    box-shadow: 0 0 16px #10b981, 0 0 32px rgba(16, 185, 129, 0.6), inset 0 0 8px #ffffff;
    animation: pulse-green-glow 2s infinite ease-in-out;
}

/* Pulsing Keyframe Animations */
@keyframes pulse-red-glow {
    0%, 100% { box-shadow: 0 0 14px #ef4444, 0 0 24px rgba(239, 68, 68, 0.6), inset 0 0 6px #fff; }
    50% { box-shadow: 0 0 24px #dc2626, 0 0 42px rgba(239, 68, 68, 0.9), inset 0 0 10px #fff; }
}
@keyframes pulse-yellow-glow {
    0%, 100% { box-shadow: 0 0 14px #f59e0b, 0 0 24px rgba(245, 158, 11, 0.6), inset 0 0 6px #fff; }
    50% { box-shadow: 0 0 24px #d97706, 0 0 42px rgba(245, 158, 11, 0.9), inset 0 0 10px #fff; }
}
@keyframes pulse-green-glow {
    0%, 100% { box-shadow: 0 0 14px #10b981, 0 0 24px rgba(16, 185, 129, 0.6), inset 0 0 6px #fff; }
    50% { box-shadow: 0 0 24px #059669, 0 0 42px rgba(16, 185, 129, 0.9), inset 0 0 10px #fff; }
}

/* 2. Animated Driving Road Strip */
.animated-road-strip {
    height: 38px;
    background: #1e293b;
    border-top: 2px solid #475569;
    border-bottom: 2px solid #475569;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
}

.animated-road-strip .road-lane-marks {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 3px;
    background: repeating-linear-gradient(90deg, #f8fafc 0, #f8fafc 24px, transparent 24px, transparent 48px);
    transform: translateY(-50%);
    animation: road-scroll 1.2s linear infinite;
}

@keyframes road-scroll {
    0% { transform: translateY(-50%) translateX(0); }
    100% { transform: translateY(-50%) translateX(-48px); }
}

/* 3. Driving Car Symbol & Motion */
.driving-car-symbol {
    position: relative;
    display: inline-block;
    transition: transform 0.4s ease;
}

.driving-car-cruising {
    animation: car-bounce 0.6s infinite alternate ease-in-out;
}

@keyframes car-bounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2px); }
}

/* Headlight beam effect */
.car-headlight-beam {
    position: absolute;
    right: -24px;
    top: 6px;
    width: 28px;
    height: 14px;
    background: linear-gradient(90deg, rgba(254, 240, 138, 0.75), transparent);
    clip-path: polygon(0 35%, 100% 0, 100% 100%, 0 65%);
    pointer-events: none;
    animation: headlight-flicker 3s infinite;
}

@keyframes headlight-flicker {
    0%, 100% { opacity: 0.85; }
    40% { opacity: 0.7; }
    45% { opacity: 0.95; }
    50% { opacity: 0.75; }
}

/* Spinning Wheel Caps */
.wheel-spinning {
    animation: wheel-spin 0.5s linear infinite;
    transform-origin: center;
}

@keyframes wheel-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 4. Interactive Exam Track (Car moving along road as customer progresses) */
.exam-road-track {
    background: #0f172a;
    border-radius: 16px;
    border: 2px solid #334155;
    position: relative;
    padding: 12px 16px 14px 16px;
    overflow: hidden;
    box-shadow: inset 0 3px 10px rgba(0,0,0,0.5);
}

.exam-road-track::before {
    content: '';
    position: absolute;
    bottom: 12px;
    left: 0;
    right: 0;
    height: 2px;
    background: repeating-linear-gradient(90deg, #cbd5e1 0, #cbd5e1 16px, transparent 16px, transparent 32px);
}

.exam-car-runner {
    position: absolute;
    bottom: 6px;
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 10;
}

/* 5. Speedometer / Exam Score Gauge Card */
.score-speedometer {
    width: 140px;
    height: 140px;
    position: relative;
    margin: 0 auto;
}

/* 6. Creative Traffic Badge Pills */
.badge-signal-green {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border: 1px solid #86efac;
}

.badge-signal-yellow {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.badge-signal-red {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* 7. Confetti celebration for passing exam */
@keyframes confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(300px) rotate(720deg); opacity: 0; }
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    animation: confetti-fall 2.5s ease-out forwards;
}

