/**
 * Map Styles
 *
 * This file contains all Leaflet map-specific styles including:
 * - Map container and layout
 * - Leaflet customizations
 * - Popup styles
 * - Cluster markers
 * - Search autocomplete
 * - Map controls
 */

/* ============================================
   MAP CONTAINER
   ============================================ */

#leaflet-map {
    flex: 1;
    height: 100%;
    width: 100%;
    z-index: 100000;
    position: relative;
}

.map-container {
    position: relative;
    height: 400px;
    z-index: 1;
}

.map-area {
    position: relative;
    background: transparent;
    height: 400px;
}

/* ============================================
   LEAFLET CUSTOMIZATIONS
   ============================================ */

/* Prevent Leaflet from styling <a> tags globally */
a {
    text-decoration: none;
    color: inherit;
}

.leaflet-container a {
    text-decoration: none;
    color: #17a2b8;
}

.leaflet-popup-content {
    width: 400px;
}

/* ============================================
   MODAL MAPS
   ============================================ */

#uploadModalMap {
    position: static;
    height: 400px;
}

#projectModalMap {
    position: static;
    height: 400px;
}

/* ============================================
   MAP LOADER
   ============================================ */

/* MapMapLoader - Show during loading */
#MapMapLoader {
    position: fixed !important;
    font-size: 15px !important;
    top: 0 !important;
    left: 50% !important;
    width: 50% !important;
    height: 100vh !important;
    background: rgba(250, 250, 250, 0.95) !important;
    padding: 20px !important;
    z-index: 1000000000 !important;
    border-radius: 0 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.3s ease !important;
}

/* Hide when .hidden class is applied */
#MapMapLoader.hidden,
body #MapMapLoader.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -999999 !important;
}

/* ============================================
   CLUSTER MARKERS
   ============================================ */

.image-count-cluster-level1 {
    background-color: red;
    color: white;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    opacity: 0.9;
}

.image-count-cluster-level2 {
    background-color: orange;
    color: white;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    opacity: 0.9;
}

.image-count-cluster-level3 {
    background-color: green;
    color: white;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    opacity: 0.9;
}

.image-count-cluster:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.marker-cluster-small .image-count-cluster {
    width: 40px;
    height: 40px;
    line-height: 40px;
}

/* ============================================
   SELECTED POLYGON
   ============================================ */

.selected-polygon-map-container {
    display: none;
    margin-bottom: 15px;
}

.selected-polygon-map {
    height: 200px;
}

/* ============================================
   POPUP CONTENT
   ============================================ */

.popup-content {
    text-align: center;
    font-family: Arial, sans-serif;
}

/* ============================================
   AUTOCOMPLETE SEARCH
   ============================================ */

.autocomplete-results-map {
    max-height: 120px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
}

.autocomplete-results-map div {
    padding: 10px;
    cursor: pointer;
}

.autocomplete-results-map div:hover {
    background-color: #f1f1f1;
}

.map-search-container {
    position: relative;
}

.autocomplete-container-map {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-width: 500px;
    max-height: 300px;
    z-index: 10000;
    background-color: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#searchResultsMap {
    display: none;
}

/* ============================================
   CITY SELECTOR
   ============================================ */

.select-city-div {
    position: absolute;
    bottom: 0;
    margin: 28px;
    left: auto;
    right: 25px;
    pointer-events: auto;
    z-index: 1000;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

#loader {
    padding: 10px;
}

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

.loading-label {
    font-size: 16px;
    margin-bottom: 10px;
}
