/**
 * ListMap Front-end Styles
 * Optimized for map and list display.
 */
.listmap-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    color: #333;
}

.listmap-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    height: 700px; /* Hauteur fixe pour aligner les colonnes */
}

.listmap-panel {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 10px);
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow-y: auto;
    height: 100%; /* Même hauteur que le conteneur */
}

.listmap-map {
    flex: 1 1 calc(50% - 20px);
    max-width: calc(50% - 10px);
    height: 100%; /* Même hauteur que le conteneur */
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.listmap-map-inner {
    width: 100%;
    height: 100%;
}

/* Forcer la hauteur de l'élément avec data-role="map" et garantir une hauteur minimale */
.listmap-map [data-role="map"] {
    width: 100%;
    height: 100%;
    min-height: 400px; /* Assure une hauteur même en cas de problème de dimensionnement */
}

/* Filtres - structure en colonne */
.listmap-filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

/* Ligne pour les champs ville + distance */
.listmap-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

/* Conteneur du champ de recherche (ville) */
.listmap-origin-wrap {
    flex: 70 1 0;
    min-width: 150px;
    position: relative;
}

/* Champ distance */
.listmap-radius {
    flex: 25 1 0;
    min-width: 80px;
}

/* Style de base pour inputs et selects */
.listmap-filters select,
.listmap-filters input,
.listmap-filters button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    width: 100%;
}

.listmap-filters button {
    background: #007cba;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.listmap-filters button:hover {
    background: #005a87;
}

.listmap-filters .listmap-btn-primary {
    background: #007cba;
}

.listmap-filters .listmap-btn-primary:hover {
    background: #005a87;
}

/* Multi‑select (détails) */
.listmap-multi-wrap {
    display: block;
    width: 100%;
}

.listmap-multi {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
}

.listmap-multi summary {
    padding: 8px 12px;
    cursor: pointer;
    font-weight: 600;
}

.lm-multi-box {
    padding: 8px 12px;
    border-top: 1px solid #eee;
    max-height: 200px;
    overflow-y: auto;
}

.lm-multi-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.lm-multi-item input[type="checkbox"] {
    width: auto;
    margin: 0;
}

/* Champ de recherche avec suggestion */
.listmap-suggest {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.listmap-suggest .lm-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.listmap-suggest .lm-item[aria-selected="true"] {
    background: #007cba;
    color: white;
}

.listmap-suggest .lm-item .lm-title {
    font-weight: 600;
}

.listmap-suggest .lm-item .lm-sub {
    font-size: 12px;
    color: #666;
}

.listmap-suggest .lm-item[aria-selected="true"] .lm-sub {
    color: #eee;
}

/* Liste des marqueurs */
.listmap-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.listmap-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.listmap-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.listmap-item .name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 5px;
}

.listmap-item .meta {
    font-size: 13px;
    color: #555;
}

.listmap-item .meta div {
    margin: 3px 0;
}

.listmap-item a {
    color: #007cba;
    text-decoration: none;
}

.listmap-item a:hover {
    text-decoration: underline;
}

/* Compteur */
.listmap-count {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
}

/* Message vide */
.listmap-empty {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
}

/* Popup Leaflet personnalisée */
.listmap-popup .listmap-item {
    min-width: 200px;
    box-shadow: none;
    padding: 0;
    cursor: default;
}

.listmap-popup .listmap-item:hover {
    transform: none;
}

/* Responsive */
@media (max-width: 768px) {
    .listmap-wrap {
        flex-direction: column;
        height: auto;
        min-height: 600px; /* peut être augmenté si besoin */
    }
    .listmap-panel,
    .listmap-map {
        flex: 1 1 100%;
        max-width: 100%;
        height: auto;
    }
    .listmap-panel {
      max-height: 60vh; /* augmentez cette valeur pour un panneau plus grand */
    }
    .listmap-map {
        height: 400px; /* hauteur fixe de la carte, vous pouvez aussi l'ajuster */
    }
    .listmap-list {
          max-height: calc(60vh - 120px);  /* la liste occupe presque tout le panneau (500 - 40px de padding/filtres) */
    }
    /* Optionnel : ajuster la hauteur minimale de la carte si besoin */
    .listmap-map [data-role="map"] {
        min-height: 400px;
    }
    .listmap-row {
        flex-direction: column;
        gap: 8px;
    }
    .listmap-origin-wrap,
    .listmap-radius {
        flex: 1 1 auto;
        width: 100%;
        min-width: auto;
    }
}