/**
 * Interactive Components CSS
 * Styles for all registered interactive educational components
 * 
 * @version 1.0.0
 */

/* ========================================
   PHB (Pedestrian Hybrid Beacon) Component
   ======================================== */

.ic-phb-container {
    margin: 30px auto;
    max-width: 400px;
}

.ic-phb-wrapper {
    background: #f7f3e9;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 3px solid #0077ff;
}

.ic-phb-demo-banner {
    background: #0077ff;
    color: white;
    padding: 8px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.9em;
}

.ic-phb-title {
    margin: 0 0 15px 0;
    font-size: 1.2em;
    color: #1f2937;
}

.ic-phb-housing {
    width: 180px;
    background: #222;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px auto;
}

.ic-phb-red-section {
    display: flex;
    justify-content: space-around;
    width: 100%;
}

.ic-phb-light {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #333;
    opacity: 0.25;
    transition: all 0.3s;
    margin: 5px;
}

.ic-phb-light.red.on {
    background: #ef4444;
    opacity: 1;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
}

.ic-phb-light.yellow.on {
    background: #fbbf24;
    opacity: 1;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.8);
}

.ic-phb-button {
    margin-top: 25px;
    padding: 15px 35px;
    background: linear-gradient(to bottom, #0088ff, #0066cc);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 
        0 6px 0 #004488,
        0 8px 15px rgba(0, 68, 136, 0.4);
    transform: translateY(0);
    transition: all 0.1s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ic-phb-button:hover:not(:disabled) {
    background: linear-gradient(to bottom, #0099ff, #0077dd);
    box-shadow: 
        0 6px 0 #004488,
        0 10px 20px rgba(0, 68, 136, 0.5);
}

.ic-phb-button:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 
        0 2px 0 #004488,
        0 4px 8px rgba(0, 68, 136, 0.3);
}

.ic-phb-button:disabled {
    background: linear-gradient(to bottom, #999, #777);
    cursor: not-allowed;
    box-shadow: 
        0 6px 0 #555,
        0 8px 15px rgba(85, 85, 85, 0.3);
}

.ic-phb-demo-note {
    margin-top: 10px;
    color: #dc2626;
    font-weight: bold;
    text-transform: uppercase;
    animation: ic-blink 1.2s infinite alternate;
    font-size: 0.85em;
}

.ic-phb-walk-signal {
    margin-top: 20px;
    font-size: 1.3em;
    color: #1f2937;
    min-height: 1.5em;
    font-weight: bold;
}

@keyframes ic-blink {
    from { opacity: 1; }
    to { opacity: 0.5; }
}

/* ========================================
   Traffic Light Component
   ======================================== */

.ic-traffic-light-container {
    display: inline-block;
    text-align: center;
}

.ic-traffic-light-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ic-tl-housing {
    background: linear-gradient(to bottom, #2d2d2d, #1a1a1a);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.ic-tl-light {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #333;
    opacity: 0.3;
    transition: all 0.3s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.ic-tl-light.red.on {
    background: radial-gradient(circle at 30% 30%, #ff6b6b, #dc2626);
    opacity: 1;
    box-shadow: 
        0 0 20px rgba(220, 38, 38, 0.8),
        0 0 40px rgba(220, 38, 38, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.ic-tl-light.yellow.on {
    background: radial-gradient(circle at 30% 30%, #fde047, #eab308);
    opacity: 1;
    box-shadow: 
        0 0 20px rgba(234, 179, 8, 0.8),
        0 0 40px rgba(234, 179, 8, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.ic-tl-light.green.on {
    background: radial-gradient(circle at 30% 30%, #4ade80, #16a34a);
    opacity: 1;
    box-shadow: 
        0 0 20px rgba(22, 163, 74, 0.8),
        0 0 40px rgba(22, 163, 74, 0.4),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

.ic-tl-pole {
    width: 12px;
    height: 60px;
    background: linear-gradient(to right, #555, #333, #555);
    margin-top: -5px;
    border-radius: 0 0 4px 4px;
}

/* Traffic Light Sizes */
.ic-traffic-light-small .ic-tl-light {
    width: 30px;
    height: 30px;
}

.ic-traffic-light-small .ic-tl-housing {
    padding: 10px;
    gap: 6px;
}

.ic-traffic-light-large .ic-tl-light {
    width: 70px;
    height: 70px;
}

.ic-traffic-light-large .ic-tl-housing {
    padding: 20px;
    gap: 15px;
}

/* ========================================
   Road Animation - Side View
   ======================================== */

.ic-road-container {
    margin: 30px auto;
}

.ic-road-side-view {
    max-width: 600px;
}

.ic-road-side-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.ic-road-surface {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #444;
}

.ic-road-lane-divider {
    position: absolute;
    top: 0;
    width: 8px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        white 0,
        white 20px,
        transparent 20px,
        transparent 40px
    );
}

.ic-road-lane-divider.left { left: 33%; }
.ic-road-lane-divider.right { left: 66%; }

.ic-road-car {
    --car-color: #dc2626;
    position: absolute;
    bottom: 30px;
    left: -100px;
    width: 80px;
    height: 35px;
}

.ic-road-car-body {
    width: 100%;
    height: 100%;
    background: var(--car-color);
    border-radius: 5px 15px 5px 5px;
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}

.ic-road-car-wheel {
    position: absolute;
    bottom: -6px;
    width: 16px;
    height: 16px;
    background: #222;
    border-radius: 50%;
    border: 2px solid #444;
}

.ic-road-car-wheel.front { left: 10px; }
.ic-road-car-wheel.back { right: 10px; }

.ic-road-car.animate-drive {
    animation: ic-drive 4s linear infinite;
}

@keyframes ic-drive {
    0% {
        left: -100px;
        transform: translateY(0);
    }
    25% {
        transform: translateY(-5px);
    }
    50% {
        transform: translateY(0);
    }
    75% {
        transform: translateY(-5px);
    }
    100% {
        left: calc(100% + 20px);
        transform: translateY(0);
    }
}

/* ========================================
   Road Animation - 3D Perspective
   ======================================== */

.ic-road-perspective {
    max-width: 600px;
}

.ic-road-perspective-wrapper {
    position: relative;
    width: 100%;
    height: 350px;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    perspective: 800px;
}

.ic-road-sky {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to bottom, #60a5fa, #bfdbfe);
}

.ic-road-3d {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 350px;
    height: 70%;
    background: #444;
    transform: translateX(-50%) rotateX(50deg);
    transform-origin: bottom center;
    border-left: 6px solid #555;
    border-right: 6px solid #555;
    overflow: hidden;
}

.ic-road-lane-markings {
    position: absolute;
    top: 0;
    left: 50%;
    width: 8px;
    height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        white 0,
        white 25px,
        transparent 25px,
        transparent 50px
    );
    transform: translateX(-50%);
}

.ic-road-lane-markings.animate-scroll {
    animation: ic-road-scroll 1s linear infinite;
}

@keyframes ic-road-scroll {
    from { background-position-y: 0; }
    to { background-position-y: 50px; }
}

.ic-road-car-3d {
    position: absolute;
    bottom: 30px;
    left: 50%;
    width: 80px;
    height: 45px;
    transform: translateX(-50%) rotateX(-50deg) translateZ(15px);
    animation: ic-bounce 0.5s ease-in-out infinite alternate;
}

.ic-road-car-body-3d {
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, #dc2626, #b91c1c);
    border-radius: 8px;
    position: relative;
    box-shadow: 0 8px 20px rgba(185, 28, 28, 0.5);
}

.ic-road-car-roof {
    position: absolute;
    top: -12px;
    left: 15px;
    width: 50px;
    height: 12px;
    background: linear-gradient(to right, #b91c1c, #991b1b);
    border-radius: 4px 4px 0 0;
}

.ic-road-car-window {
    position: absolute;
    top: 5px;
    left: 12px;
    width: 56px;
    height: 18px;
    background: linear-gradient(to bottom, #60a5fa, #3b82f6);
    border-radius: 3px;
    opacity: 0.9;
}

.ic-road-car-wheel-3d {
    position: absolute;
    bottom: -6px;
    width: 16px;
    height: 16px;
    background: #1f2937;
    border-radius: 50%;
    border: 2px solid #374151;
}

.ic-road-car-wheel-3d.left { left: 8px; }
.ic-road-car-wheel-3d.right { right: 8px; }

.ic-road-car-wheel-3d.animate-spin {
    animation: ic-spin 0.3s linear infinite;
}

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

@keyframes ic-bounce {
    from { transform: translateX(-50%) rotateX(-50deg) translateZ(15px); }
    to { transform: translateX(-50%) rotateX(-50deg) translateZ(20px); }
}

/* ========================================
   Paused State
   ======================================== */

.ic-road-paused * {
    animation-play-state: paused !important;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (max-width: 480px) {
    .ic-phb-wrapper {
        padding: 20px;
    }
    
    .ic-phb-housing {
        width: 140px;
        padding: 15px;
    }
    
    .ic-phb-light {
        width: 45px;
        height: 45px;
    }
    
    .ic-phb-button {
        padding: 12px 25px;
        font-size: 14px;
    }
    
    .ic-road-side-wrapper {
        height: 150px;
    }
    
    .ic-road-perspective-wrapper {
        height: 280px;
    }
    
    .ic-road-3d {
        width: 280px;
    }
}

/* ========================================
   Accessibility - Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .ic-phb-demo-note,
    .ic-road-car.animate-drive,
    .ic-road-lane-markings.animate-scroll,
    .ic-road-car-3d,
    .ic-road-car-wheel-3d.animate-spin {
        animation: none !important;
    }
    
    .ic-road-car {
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .ic-phb-button,
    .ic-phb-demo-note,
    .ic-phb-demo-banner {
        display: none !important;
    }
    
    .ic-road-car.animate-drive,
    .ic-road-lane-markings.animate-scroll {
        animation: none !important;
    }
}
