#mapMFR {
    width: 100%;
    height: 580px;
    border: 1px solid #DDD;
}

#mapMfrDescription {
    width: 100%;
    height: 300px;
    border: 0px solid #DDD;
    margin-top: 1rem;
    padding: 0;
    margin-bottom: 1rem;
}

.map-wrapper {
    position: relative;
}

/* Boutons outils en overlay sur la carte (liste-mfr) */
.map-tools-bar {
    position: absolute;
    top: 10px;
    left: 50px;
    right: 10px;
    z-index: 1;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

#search-form .fr-select, #search-form .fr-input {
    background-color: white;
}

#selectionMFRLaunch {
    margin-top:0rem !important;
}

#search-form .fr-fieldset {
    margin-bottom:0rem !important;
}

.pBold span.value {
    font-weight: normal;
}

#titreLegende {
    margin: 0px 0px 0.75rem 0px;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Conteneur du contrôle zoom */
.ol-zoom {
    background: none;
    padding: 0;
    border-radius: 0.25rem;
    box-shadow: none;
}

/* Boutons icône sur la carte */
.toggle-map-btn,
.export-map-btn,
.shape-map-btn,
.layer-map-btn-liste-mfr,
.layer-map-btn-selection-mfr {
    border: 0px solid var(--border-default-grey);
    background-color: var(--background-default-grey);
    color: var(--text-action-high-blue-france);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.toggle-map-btn::before,
.export-map-btn::before,
.shape-map-btn::before,
.layer-map-btn-liste-mfr::before,
.layer-map-btn-selection-mfr::before {
    margin: 0 !important;
}

/* Positionnement individuel */
.toggle-map-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
}

.export-map-btn {
    position: absolute;
    top: 40px;
    right: 10px;
    z-index: 1;
}

.shape-map-btn {
    position: absolute;
    top: 70px;
    right: 10px;
    z-index: 1;
}

.map-overlay-controls {
    position: absolute;
    left: 9px;
    z-index: 1;
}

.map-overlay-controls--liste, .map-overlay-controls--selection {
    top: 80px;
}

.map-filter-btns {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1;
    display: flex;
    flex-direction: row;
    gap: 4px;
}

.map-filter-btns .fr-checkbox-group {
    background-color: var(--background-default-grey);
    border: 1px solid var(--border-default-grey);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
}


/* Panneau de couches : apparaît au-dessus du bouton */
.map-layers-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.map-layers-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background-color: var(--background-default-grey);
    border: 1px solid var(--border-default-grey);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    min-width: 200px;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 10;
}

.map-layers-separator {
    border: none;
    border-top: 1px solid var(--border-default-grey);
    margin: 0.2rem 0;
    margin-bottom: -1.2rem;
}

.map-layers-group {
    margin-top: 0.1rem;
    font-size: 0.75rem;

}

.map-layers-group > summary {
    cursor: pointer;
    list-style: none;
}

.map-layers-select-all {
    border-bottom: 1px solid var(--border-default-grey);
    padding-bottom: 0.2rem;
    margin-bottom: 0.1rem;
}
.map-layers-group > summary::before {
    transition: transform 0.2s ease;
}
details[open].map-layers-group > summary::before {
    transform: rotate(180deg);
}

.map-layers-sublist {
    padding-left: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-left: 2px solid var(--border-default-grey);
    margin-top: 0.2rem;
}

/* Conteneur du contrôle zoom */
.ol-zoom {
    background: none;
    padding: 0;
    border-radius: 0.25rem;
    box-shadow: none;
}

/* Boutons + / - */
.ol-zoom button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 2rem;
    height: 2rem;

    padding: 0;
    margin: 0;

    border: 1px solid var(--border-default-grey);
    background-color: var(--background-default-grey);
    color: var(--text-action-high-blue-france);

    font-size: 1.25rem;
    font-weight: 500;

    cursor: pointer;
}

/* Empilement collé */
.ol-zoom button+button {
    border-top: 0;
}

.ol-zoom {
    border-radius: 0px;
}

/* Coins arrondis DSFR */
.ol-zoom-in {
    border-radius: 0;
}

.ol-zoom-out {
    border-radius: 0;
}

/* Hover */
.ol-zoom button:hover {

    background: rgb(246, 246, 246);
    outline: 0px solid white;
}

/* Active */
.ol-zoom button:active {
    background-color: rgb(246, 246, 246);
}

/* Focus accessible */
.ol-zoom button:focus-visible {
    outline: 0px solid white;
    outline-offset: 0px;
}

/* Position ident considerée comme bouton fullscreen */
.ol-zoom {
    top: 0.5rem;
    left: 0.5rem;
}

.ol-popup {
    position: absolute;
    background-color: var(--background-default-grey);
    border: 0px solid var(--border-default-grey);
    border-radius: 0;
    padding: 1rem;
    min-width: 380px;
    bottom: 12px;
    left: -190px;

    /* DROP SHADOW */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Triangle (pointeur) */
.ol-popup::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -10px;
    margin-top: -1px;
    border-width: 10px;
    border-style: solid;
    border-color: var(--background-default-grey) transparent transparent transparent;
}

/* Bord du triangle (placé derrière) */
.ol-popup::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -11px;

    border-width: 11px;
    border-style: solid;
    border-color: var(--border-default-grey) transparent transparent transparent;

    z-index: -1;
    /* ← LA CLÉ */
}


.ol-popup-closer {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1rem;
    height: 1rem;
    text-decoration: none;
    cursor: pointer;
    text-decoration: none;
    background-image: none;
    opacity: 0.2;
}

.ol-popup-closer:hover,
.ol-popup-closer:focus {
    text-decoration: none;
}

.ol-popup-closer::before,
.ol-popup-closer::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 2px;
    background-color: var(--text-default-grey);
    transform-origin: center;
}

.ol-popup-closer::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ol-popup-closer::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.ol-popup-closer:hover::before,
.ol-popup-closer:hover::after {
    background-color: var(--text-action-high-blue-france);
}

#popupContent h6,
#popup-content h6 {
    margin: 0px;
}

#popupContent .item,
#popup-content .item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0px;
}

#popupContent .item .label,
#popup-content .item .label {
    color: #6F6F6F;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
}

#popupContent .item .h_spacer,
#popup-content .item .h_spacer {
    border-top: 1px dotted #C9C9C9;
    flex: 1;
    margin-left: 10px;
    margin-right: 10px;
}

#popupContent .item .value,
#popup-content .item .value {
    color: #000;
    font-size: 12px;
    text-align: right;
}

.legend-list {
    list-style: none;
    /* supprime les puces */
    padding-left: 0;
    margin: 5px 0;
    font-size: 13px;
}

.legend-list li {
    display: flex;
    align-items: center;
    margin-bottom: 0rem;
    padding-bottom: 0px;
}

.legend-cond {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5em;
    height: 1.5em;
    margin-right: 0.5rem;
    font-size: 0.9em;
    color: #3f51b5;
    border: 2px solid #3f51b5;
    background: repeating-linear-gradient(45deg, #fff, #fff 2px, transparent 2px, transparent 4px);
}

.legend-color {
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.5rem;
}

.groupeLegende {
    display: block;
    margin-right: 20px;
    font-size: 15px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-default-grey);
}

.pBold {
    font-weight: bold;
    margin-bottom: 0.3rem;
}

.panelMFR {
  overflow-y: auto;
  border-right:1px solid #dddddd;
}

/* Masquage de la section résultats jusqu'au premier submit */
.is-results-hidden {
    display: none;
}

#results-section {
    margin-top: 2rem;
}

/* Grille résultats : colonnes égales en hauteur */
.mfr-results-grid {
    align-items: stretch;
}

/* Colonne gauche : carte + légende empilées */
.mfr-map-col {
    display: flex;
    flex-direction: column;
}

#mapLegend {
    flex-shrink: 0;
}

/* Colonne droite : tabs pleine hauteur */
.mfr-side-col {
    display: flex;
    flex-direction: column;
}

.mfr-tabs-wrapper {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.mfr-side-col .fr-tabs__panel {
    overflow-y: auto;
    height: 625px
}

/* Bouton outil carte actif */
.fr-btn.tool-active {
    background-color: #00a3a6 !important;
    color: #ffffff !important;
}
.fr-btn.tool-active:hover {
    background-color: #00a3a6 !important;
}

/* Centrer verticalement les ... dans la pagination DSFR */
.fr-pagination__item--ellipsis {
    display: inline-flex;       /* inline pour garder le flow horizontal */
    align-items: center;        /* centre verticalement */
    justify-content: center;    /* centre horizontalement si besoin */
    height: 100%;               /* optionnel, pour s'assurer que ça prend toute la hauteur du parent */
    margin-top: -17px;
}

/* Filtres colonnes discrets */
#table-0 thead th {
    position: relative;
    white-space: nowrap;
}

.filter-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 0 0 3px;
    vertical-align: middle;
    color: var(--text-default-grey);
    opacity: 0.35;
    line-height: 1;
}

.filter-icon-btn:hover {
    opacity: 0.7;
}

.filter-icon-btn.filter-active {
    opacity: 1;
    color: #CE0500;
}

.filter-popover {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 100;
    background-color: var(--background-default-grey);
    border: 1px solid var(--border-default-grey);
    border-radius: 4px;
    padding: 0.5rem;
    min-width: 180px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Barre de recherche dans le caption du tableau */
.table-caption-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.table-caption-search {
    max-width: 400px;
}

/* Ligne pagination + sélecteur lignes par page */
.table-pagination-row {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-page-size {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    white-space: nowrap;
}

.table-page-size .fr-select {
    width: auto;
    min-width: 0;
}

/* Styles pour le spinner de chargement */
#spinner {
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.75rem;
    width: 2rem;
    height: 2rem;
    border: 3px solid #e3e3fd;
    border-top-color: #000091;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#view-advanced .fr-icon-question-line {
    font-weight: normal;
    color:rgb(0, 0, 145);
}