/* Map Container Styles */
#boundary-map,
#boundary-display-map {
    width: 100%;
    height: 500px;
    border-radius: 8px;
    border: 2px solid #dee2e6;
    position: relative;
    background-color: #f8f9fa;
}

/* Responsive map height */
@media (max-width: 768px) {
    #boundary-map,
    #boundary-display-map {
        height: 400px;
    }
}

/* Map loading overlay */
#map-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

#map-loading .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Mapbox controls customization */
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right {
    margin-top: 10px;
}

.mapboxgl-ctrl-top-left {
    margin-left: 10px;
}

.mapboxgl-ctrl-top-right {
    margin-right: 10px;
}

/* Geocoder search box */
.mapboxgl-ctrl-geocoder {
    min-width: 280px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .mapboxgl-ctrl-geocoder {
        min-width: 200px;
    }
}

/* Draw control buttons */
.mapbox-gl-draw_ctrl-draw-btn {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.mapbox-gl-draw_ctrl-draw-btn:hover {
    background-color: #f8f9fa;
}

.mapbox-gl-draw_ctrl-draw-btn.active {
    background-color: #3bb2d0;
    color: #fff;
}

/* Boundary area display */
#boundary-area-display {
    margin-top: 1rem;
    min-height: 60px;
}

#boundary-area-display .alert {
    margin-bottom: 0;
}

/* Map instructions */
.map-instructions {
    background-color: #e7f5ff;
    border-left: 4px solid #3bb2d0;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.map-instructions ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.map-instructions li {
    margin-bottom: 0.5rem;
}

/* Clear boundary button */
#clear-boundary-btn {
    margin-top: 0.5rem;
}

#clear-boundary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Geocode button */
#geocode-location-btn {
    white-space: nowrap;
}

/* Boundary popup styles */
.boundary-popup {
    font-family: Arial, sans-serif;
}

.boundary-popup h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #3bb2d0;
}

.boundary-popup p {
    font-size: 14px;
    color: #495057;
}

/* Map error container */
#map-error {
    margin-bottom: 1rem;
}

/* Map section card */
.map-section-card {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.map-section-card h5 {
    color: #0d6efd;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Boundary stats badge */
.boundary-stats {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #e7f5ff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    color: #0c63e4;
}

.boundary-stats i {
    font-size: 1.2rem;
}

/* Optional features toggle */
.map-features-toggle {
    margin-top: 1rem;
}

.map-features-toggle .btn-group {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.map-loading-text {
    animation: pulse 1.5s ease-in-out infinite;
    margin-top: 1rem;
    color: #6c757d;
    font-weight: 500;
}

/* Fix for Mapbox GL controls on small screens */
@media (max-width: 576px) {
    .mapboxgl-ctrl-geocoder {
        width: calc(100vw - 120px);
        min-width: unset;
        font-size: 14px;
    }

    .mapboxgl-ctrl-group {
        margin: 5px;
    }
}

/* Ensure map canvas fills container */
.mapboxgl-canvas {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Style for map attribution */
.mapboxgl-ctrl-attrib {
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
}

/* Compact controls on mobile */
@media (max-width: 768px) {
    .mapboxgl-ctrl-group button {
        width: 30px;
        height: 30px;
    }

    .mapboxgl-ctrl-icon {
        transform: scale(0.8);
    }
}
