/* Map Container */
.map-container {
    position: relative;
    height: calc(100vh - 70px);
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-controls .btn {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vehicle List Panel */
.vehicle-list-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 380px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1.5rem rgba(15, 23, 42, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.2rem;
    border-bottom: 1px solid #e0e0e0;
}

.panel-header h5 {
    margin: 0 0 0.8rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.panel-header i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

.panel-body {
    overflow-y: auto;
    padding: 1rem;
    flex: 1;
}

/* Vehicle Groups */
.vehicle-group h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.vehicle-group h6 i {
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Vehicle Items */
.vehicle-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.6rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.vehicle-item:hover {
    background: #e9ecef;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.vehicle-item.selected {
    background: rgba(255, 140, 0, 0.1);
    border-color: var(--primary-color);
}

/* Status Indicator */
.vehicle-status {
    margin-right: 0.8rem;
}

.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-moving {
    background-color: var(--success-color);
}

.status-stopped {
    background-color: var(--warning-color);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Vehicle Info */
.vehicle-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.vehicle-info strong {
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-family: 'Courier New', monospace;
}

.vehicle-info small {
    font-size: 0.8rem;
    color: #6c757d;
    display: block;
}

.vehicle-info .location {
    color: var(--primary-color);
    font-weight: 500;
}

/* Vehicle Speed */
.vehicle-speed {
    text-align: center;
    padding-left: 0.8rem;
    border-left: 2px solid #dee2e6;
}

.vehicle-speed .speed {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
}

.vehicle-speed small {
    font-size: 0.7rem;
    color: #6c757d;
}

/* Map Legend */
.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.map-legend h6 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
    color: var(--secondary-color);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.legend-marker {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.8rem;
    flex-shrink: 0;
}

.legend-marker.truck-active {
    background-color: var(--success-color);
}

.legend-marker.truck-stopped {
    background-color: var(--warning-color);
}

.legend-marker.pickup-active {
    background-color: var(--info-color);
}

.legend-marker.project {
    background-color: var(--primary-color);
    border-radius: 0;
    transform: rotate(45deg);
}

/* Leaflet Popup Customization */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.custom-popup {
    padding: 0.5rem;
}

.custom-popup h6 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.custom-popup .info-row {
    display: flex;
    align-items: center;
    margin: 0.3rem 0;
    font-size: 0.85rem;
}

.custom-popup .info-row i {
    width: 20px;
    color: var(--primary-color);
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .vehicle-list-panel {
        width: calc(100% - 40px);
        max-height: 40vh;
    }

    .map-legend {
        bottom: auto;
        top: 20px;
        left: 20px;
        right: auto;
    }

    .map-controls {
        top: auto;
        bottom: 20px;
        flex-direction: row;
    }
}

/* Scrollbar */
.panel-body::-webkit-scrollbar {
    width: 6px;
}

.panel-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.panel-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}
