/* Map View Styles */

/* Firehouse Container */
.firehouse-container {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Roof */
.firehouse-roof {
    height: 30px;
    background: #8b0000;
    position: relative;
    display: flex;
    justify-content: center;
}

.roof-peak {
    width: 0;
    height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 25px solid #8b0000;
    position: absolute;
    top: -20px;
}

/* Header */
.firehouse-header {
    background: #8b0000;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-bottom: 3px solid #5c0000;
}

.firehouse-title {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Garage Bays Container */
.garage-bays {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    background: #2d2d44;
}

/* Individual Bay */
.garage-bay {
    width: 80px;
    height: 100px;
    background: #1a1a2e;
    border: 2px solid #3d3d5c;
    border-radius: 4px 4px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 5px;
}

/* Bay Door */
.bay-door {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: #4a4a6a;
    border-bottom: 2px solid #3d3d5c;
}

.bay-door-panels {
    display: flex;
    height: 100%;
}

.door-panel {
    flex: 1;
    border-right: 1px solid #3d3d5c;
}

.door-panel:last-child {
    border-right: none;
}

/* Vehicle Base Styles */
.vehicle {
    width: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.vehicle-body {
    width: 50px;
    height: 55px;
    border-radius: 6px 6px 2px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Engine (Fire Truck) */
.vehicle.engine .vehicle-body {
    background: linear-gradient(180deg, #dc3545 0%, #b02a37 100%);
    border: 2px solid #8b0000;
}

/* Ambulance */
.vehicle.ambulance .vehicle-body {
    background: linear-gradient(180deg, #ffffff 0%, #e8e8e8 100%);
    border: 2px solid #ccc;
}

/* Vehicle Cab (windshield area) */
.vehicle-cab {
    width: 40px;
    height: 18px;
    background: linear-gradient(180deg, #1a1a2e 0%, #2d4a6d 100%);
    border-radius: 4px 4px 0 0;
    margin-top: 4px;
    border: 1px solid #0d1b2a;
}

/* Emergency Lights */
.vehicle-lights {
    display: flex;
    gap: 8px;
    margin-top: 3px;
}

.light {
    width: 8px;
    height: 6px;
    border-radius: 2px;
}

.light.red {
    background: #ff4444;
    box-shadow: 0 0 6px #ff4444;
    animation: pulse-light 1.5s ease-in-out infinite;
}

.light.blue {
    background: #4444ff;
    box-shadow: 0 0 6px #4444ff;
    animation: pulse-light 1.5s ease-in-out infinite 0.75s;
}

@keyframes pulse-light {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Grille */
.vehicle-grille {
    width: 36px;
    height: 10px;
    background: linear-gradient(90deg,
        #333 0%, #666 10%, #333 20%,
        #666 30%, #333 40%, #666 50%,
        #333 60%, #666 70%, #333 80%,
        #666 90%, #333 100%);
    margin-top: 4px;
    border-radius: 2px;
}

.vehicle.ambulance .vehicle-grille {
    background: linear-gradient(90deg,
        #999 0%, #ccc 10%, #999 20%,
        #ccc 30%, #999 40%, #ccc 50%,
        #999 60%, #ccc 70%, #999 80%,
        #ccc 90%, #999 100%);
}

/* Bumper */
.vehicle-bumper {
    width: 46px;
    height: 6px;
    background: #444;
    border-radius: 0 0 3px 3px;
    margin-top: auto;
    margin-bottom: 2px;
}

.vehicle.ambulance .vehicle-bumper {
    background: #888;
}

/* Vehicle Label */
.vehicle-label {
    font-size: 0.55rem;
    color: #aaa;
    margin-top: 3px;
    text-align: center;
    font-weight: 500;
}

/* Firehouse Floor */
.firehouse-floor {
    height: 8px;
    background: linear-gradient(90deg, #333 0%, #444 50%, #333 100%);
    border-top: 2px solid #555;
}

/* Map Legend */
.map-legend {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.legend-marker.active-marker {
    background: #dc3545;
    box-shadow: 0 0 8px #dc3545, 0 0 16px rgba(220, 53, 69, 0.5);
    animation: glow-pulse 2s ease-in-out infinite;
}

.legend-marker.resolved-marker {
    background: #6c757d;
    opacity: 0.7;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 8px #dc3545, 0 0 16px rgba(220, 53, 69, 0.5);
    }
    50% {
        box-shadow: 0 0 12px #dc3545, 0 0 24px rgba(220, 53, 69, 0.7);
    }
}

.legend-text {
    font-size: 0.85rem;
    color: #555;
}

/* Map Container */
#incident-map {
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background: #e8e8e8;
}

/* Leaflet Custom Marker Styles */
.active-incident-marker {
    background: #dc3545;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 12px #dc3545, 0 0 24px rgba(220, 53, 69, 0.6);
    animation: marker-pulse 2s ease-in-out infinite;
}

.resolved-incident-marker {
    background: #6c757d;
    border: 2px solid #fff;
    border-radius: 50%;
    opacity: 0.7;
}

@keyframes marker-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 12px #dc3545, 0 0 24px rgba(220, 53, 69, 0.6);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 16px #dc3545, 0 0 32px rgba(220, 53, 69, 0.8);
    }
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.2);
}

.leaflet-popup-content {
    margin: 12px 16px;
}

.incident-popup {
    min-width: 200px;
}

.incident-popup-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.incident-popup-status {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.incident-popup-status.active {
    background: #fff3cd;
    color: #856404;
}

.incident-popup-status.resolved {
    background: #d4edda;
    color: #155724;
}

.incident-popup-meta {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.incident-popup-summary {
    font-size: 0.85rem;
    color: #444;
    font-style: italic;
    border-left: 3px solid #ddd;
    padding-left: 0.5rem;
}

/* Unit badges near pins */
.unit-badge {
    background: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.unit-badge.fire {
    border-left: 3px solid #dc3545;
}

.unit-badge.ems {
    border-left: 3px solid #007bff;
}

/* View Toggle - import from incidents.css */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: white;
    padding: 0.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.view-toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    /* Persistent button affordance — visible grey bg + border so inactive
       tabs always read as buttons (mobile users can't hover). */
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.view-toggle-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.25);
}

.view-toggle-btn.active {
    background-color: #ad1a23;
    border-color: #ad1a23;
    color: white;
}

.view-toggle-btn.active:hover {
    background-color: #c41e28;
    border-color: #c41e28;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .garage-bays {
        gap: 2px;
        padding: 8px;
    }

    .garage-bay {
        width: 70px;
        height: 90px;
    }

    .vehicle-body {
        width: 45px;
        height: 50px;
    }

    .vehicle-cab {
        width: 35px;
        height: 16px;
    }

    .vehicle-grille {
        width: 32px;
        height: 8px;
    }

    .vehicle-bumper {
        width: 40px;
        height: 5px;
    }

    .vehicle-label {
        font-size: 0.5rem;
    }

    #incident-map {
        height: 350px;
    }

    .map-legend {
        gap: 1rem;
        padding: 0.5rem 0.75rem;
    }

    .legend-text {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .garage-bay {
        width: 60px;
        height: 80px;
    }

    .vehicle-body {
        width: 40px;
        height: 45px;
    }

    .vehicle-cab {
        width: 30px;
        height: 14px;
    }

    .vehicle-lights .light {
        width: 6px;
        height: 5px;
    }

    .vehicle-grille {
        width: 28px;
        height: 7px;
    }

    .vehicle-bumper {
        width: 36px;
        height: 4px;
    }

    #incident-map {
        height: 300px;
    }
}
