/* MapBox Component Styles - Fixed container and marker containment */
.map-wrapper {
    position: relative;
    overflow: hidden;
}

.mapbox-container {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
    min-height: 400px;
    display: block;
}

/* Ensure map containers work properly in Bootstrap tabs */
.tab-pane .mapbox-container {
    width: 100%;
    height: 400px;
    min-height: 400px;
}

.mapbox-container.fullscreen {
    border-radius: 0;
    box-shadow: none;
}

.map-fullscreen-btn {
    pointer-events: auto;
}

.mapbox-marker {
    transition: all 0.2s ease;
    position: absolute !important;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

/* Ensure markers stay within container bounds */
.mapbox-container .mapboxgl-marker {
    position: absolute !important;
}

.mapbox-marker:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4) !important;
}

/* MapBox popup customization */
.mapboxgl-popup-content {
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid #e0e0e0 !important;
}

.mapboxgl-popup-tip {
    border-top-color: #e0e0e0 !important;
}

/* Dark theme support */
[data-bs-theme="dark"] .mapboxgl-popup-content {
    background-color: #2d3748 !important;
    color: #f7fafc !important;
    border-color: #4a5568 !important;
}

[data-bs-theme="dark"] .mapboxgl-popup-tip {
    border-top-color: #4a5568 !important;
}

/* Navigation controls styling */
.mapboxgl-ctrl-group {
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Responsive map container */
.map-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.map-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
}

.map-container.fullscreen .mapbox-map {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
}

/* Map wrapper fullscreen styles */
.map-wrapper.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    background: white !important;
}

.map-wrapper.fullscreen .mapbox-container {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* Loading spinner for map */
.map-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.map-loading.dark {
    background-color: #2d3748;
    border-color: #4a5568;
    color: #f7fafc;
}

/* Map marker clusters */
.mapboxgl-cluster {
    background: #51bbd3;
    border: 2px solid white;
    border-radius: 50%;
    color: white;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    width: 30px;
    height: 30px;
    line-height: 26px;
    cursor: pointer;
}

.mapboxgl-cluster:hover {
    background: #3a94a3;
}

/* Custom marker styles */
.marker-custom {
    background-size: cover;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.marker-custom:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* Geocoder search control (if enabled) */
.mapboxgl-ctrl-geocoder {
    border-radius: 6px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    min-width: 200px;
}

/* Animation for selected markers */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 16px rgba(0,0,0,0.6), 0 0 0 3px #1976d2, 0 0 20px rgba(25,118,210,0.5);
    }
    50% {
        box-shadow: 0 8px 16px rgba(0,0,0,0.6), 0 0 0 6px #1976d2, 0 0 30px rgba(25,118,210,0.8);
    }
    100% {
        box-shadow: 0 8px 16px rgba(0,0,0,0.6), 0 0 0 3px #1976d2, 0 0 20px rgba(25,118,210,0.5);
    }
}