
/* =====================================================
   VARIABLES
===================================================== */
@import url('https://fonts.googleapis.com/css2?family=Barlow');
@import url('https://fonts.googleapis.com/css2?family=Epilogue:wght@100..900');

:root {
    --filters-bg: #f1eee7;
    --filters-card: #ffffff;
    --filters-blue: #005d7dFF;
    --filters-blue-dark: #006487;
    --filters-gold: #a99332FF;
    --filters-text: #171717;
    --filters-muted: #757575;
    --filters-border: #dedede;
    --filters-radius: 22px;
    --filters-family: Barlow;
    --filters-familyH2: Epilogue;
}


/* =====================================================
   PANNEAU PRINCIPAL
===================================================== */

.filters-panel {
    width: 100%;
    max-width: 510px;
    height: 100vh;
    height: 100dvh;

    display: flex;
    flex-direction: column;

    background: var(--filters-bg);
    color: var(--filters-text);

    font-family: var(--filters-family);
    font-size: 16px;

    overflow: hidden;
    box-sizing: border-box;
}

.filters-panel *,
.filters-panel *::before,
.filters-panel *::after {
    box-sizing: border-box;
}


/* =====================================================
   EN-TÊTE : FILTRES / RÉINITIALISER
===================================================== */

.filters-header {
    flex-shrink: 0;

    min-height: 104px;
    padding: 22px 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    background: var(--filters-bg);
    border: 0;
}

.filters-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filters-title h2 {
    margin: 0;
    font-size: 30px;
    font-weight: 600;
    line-height: 30px;
    font-family: var(--filters-familyH2);
    display: flex;
}

.filters-title h2::before {
    content: "";
    background-image: url('../images/filtresicone.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

    width: 30px;
    height: 30px;
    flex: 0 0 40px;
    display: inline-flex;
}

.filters-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 8px 0;
    border: 0;
    background: transparent;

    color: var(--filters-blue-dark);
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.filters-reset::before {
    content: "↻";
    font-size: 30px;
    font-weight: 400;
}

.filters-reset:hover {
    color: #004c69;
}


/* =====================================================
   FILTRES ACTIFS
===================================================== */

.active-filters {
    flex-shrink: 0;
    padding: 0 20px 12px;
}

.active-filters:empty {
    display: none;
}

.active-filters-title {
    margin-bottom: 8px;
    color: var(--filters-muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    max-width: 100%;
    padding: 7px 10px;

    background: #e1edf0;
    border-radius: 18px;

    color: #075d78;
    font-size: 18px;
}

.filter-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-chip button {
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 17px;
    cursor: pointer;
}


/* =====================================================
   ZONE DÉFILANTE DES GROUPES
===================================================== */

.filters-container {
    flex: 1;
    min-height: 0;

    overflow-y: auto;
    overflow-x: hidden;

    padding: 0 20px 18px;

    scrollbar-width: thin;
    scrollbar-color: #858585 transparent;
}


/* =====================================================
   CARTES DES FILTRES
===================================================== */

.filter-group {
    margin-bottom: 18px;

    background: var(--filters-card);
    border: 0;
    border-radius: var(--filters-radius);

    overflow: hidden;
    box-shadow: 0 1px 2px rgb(0 0 0 / 2%);
}

.filter-group:last-child {
    margin-bottom: 12px;
}


/* =====================================================
   TITRE DE CHAQUE CARTE
===================================================== */

.filter-group-header {
    width: 100%;
    min-height: 78px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 16px 22px;

    border: 0;
    background: #fff;

    text-align: left;
    cursor: pointer;
}

.filter-group-header:hover {
    background: #fcfcfc;
}

.filter-group-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
}

/* Icônes décoratives par catégorie */
.filter-group[data-filter-group="textes"]
.filter-group-title::before {
    content:"";
    background-image: url('../images/recherche.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

}

.filter-group[data-filter-group="communes"]
.filter-group-title::before {
    content:"";
    background-image: url('../images/communes.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

}

.filter-group[data-filter-group="territoires"]
.filter-group-title::before {
    content:"";
    background-image: url('../images/territoires.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

}

.filter-group[data-filter-group="annees"]
.filter-group-title::before {
    content:"";
    background-image: url('../images/annees.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

}

.filter-group[data-filter-group="thematiques"]
.filter-group-title::before {
    content:"";
    background-image: url('../images/themes.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;

}

.filter-group-title::before {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    font-weight: 400;
}

/* Les icônes de Communes et Années sont dorées */
.filter-group[data-filter-group="communes"]
.filter-group-title::before,
.filter-group[data-filter-group="annees"]
.filter-group-title::before {
    /*background: var(--filters-gold);*/
}

.filter-selected-count {
    min-width: 34px;
    height: 34px;
    padding: 0 7px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: #f0eee8;
    color: #292929;

    font-size: 14px;
    font-weight: 500;
}

.filter-group.is-selected
.filter-selected-count {
    background: var(--filters-blue);
    color: #fff;
}


/* =====================================================
   CHEVRON OUVERT / FERMÉ
===================================================== */

.filter-group-arrow {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-group-arrow span {
    width: 12px;
    height: 12px;

    /*border-top: 2px solid var(--filters-blue);
    border-left: 2px solid var(--filters-blue);

    transform: translateY(3px) rotate(45deg);
    transition: transform .2s ease;*/
}

.filter-group.is-open
.filter-group-arrow span {
    transform: translateY(-3px) rotate(225deg);
}


/* =====================================================
   CONTENU DES CARTES
===================================================== */

.filter-group-content {
    display: none;
    padding: 0 22px 22px;
}

.filter-group.is-open .filter-group-content {
    display: block;
}


/* =====================================================
   RECHERCHE TEXTES
===================================================== */

.text-filter-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;

    min-height: 56px;
    padding: 0 0 0 20px;

    border: 2px solid #e5e5e5;
    border-radius: 32px;
    background: white;
}

.text-filter-input {
    flex: 1;
    min-width: 0;
    height: 50px;

    padding: 0 8px 0 0;
    border: 0;
    outline: 0;
    background: transparent;

    color: var(--filters-text);
    font-size: 16px;
}

.text-filter-input::placeholder {
    color: #929292;
}

.text-filter-input:focus {
    box-shadow: none;
}

.text-filter-add {
    /*width: 52px;
    height: 52px;
    flex: 0 0 52px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 50%;
    background: var(--filters-blue);

    color: white;
    font-size: 0;
    cursor: pointer;*/
}

.text-filter-add::before {
    /*content: "⌕";
    font-size: 32px;
    line-height: 1;*/
}

.text-filter-add:hover {
    /*background: #005a78;*/
}


/* =====================================================
   TAGS DES TEXTES
===================================================== */

.text-filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.text-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    padding: 8px 12px;
    border-radius: 20px;
    background: #e4f0f3;

    color: var(--filters-blue-dark);
    font-size: 13px;
}

.text-filter-tag button {
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
}


/* =====================================================
   RECHERCHE COMMUNES / ANNÉES
===================================================== */

.filter-search-wrapper {
    position: relative;
    margin-bottom: 14px;
}

.filter-inner-search {
    width: 100%;
    height: 56px;

    padding: 0 66px 0 54px;

    border: 2px solid #e5e5e5;
    border-radius: 32px;
    outline: none;

    background: #fff;
    color: var(--filters-text);
    font-size: 16px;
}

.filter-inner-search::placeholder {
    color: #929292;
}

.filter-inner-search:focus {
    border-color: #b7d4de;
}

.filter-search-icon {
    position: absolute;
    left: 22px;
    top: 50%;

    transform: translateY(-50%);
    color: #8b8b8b;
    font-size: 0;
    pointer-events: none;
}

.filter-search-icon::before {
    content: "⌕";
    font-size: 22px;
}

.filter-search-wrapper::after {
    /*content: "⌕";

    position: absolute;
    top: 2px;
    right: 2px;

    width: 52px;
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    background: var(--filters-blue);
    color: white;

    font-size: 30px;
    pointer-events: none;*/
}


/* =====================================================
   LISTES DE CHOIX
===================================================== */

.filter-options {
    max-height: 260px;
    overflow-y: auto;
    overflow-x: hidden;

    scrollbar-width: thin;
    scrollbar-color: #858585 transparent;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 42px;
    padding: 5px 8px;

    color: #252525;
    font-size: 16px;
    line-height: 1.35;

    cursor: pointer;
}

.filter-option:hover {
    background: #f8f8f6;
    border-radius: 7px;
}

.filter-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.custom-checkbox {
    width: 23px;
    height: 23px;
    flex: 0 0 23px;

    position: relative;

    border: 1.5px solid #b8b8b8;
    border-radius: 5px;
    background: #fff;
}

.filter-option input:checked + .custom-checkbox {
    border-color: var(--filters-blue);
    background: var(--filters-blue);
}

.filter-option input:checked + .custom-checkbox::after {
    content: "";

    position: absolute;
    left: 7px;
    top: 3px;

    width: 6px;
    height: 11px;

    border-right: 2px solid white;
    border-bottom: 2px solid white;

    transform: rotate(45deg);
}

.filter-option input:focus-visible + .custom-checkbox {
    outline: 3px solid rgb(8 115 151 / 25%);
    outline-offset: 2px;
}

.filter-option-label {
    min-width: 0;
}


/* =====================================================
   LIEN "VOIR PLUS"
   À utiliser si tu ajoutes ce bouton au HTML
===================================================== */

.filter-see-more {
    display: inline-flex;
    align-items: center;
    gap: 12px;

    margin-top: 14px;
    padding: 0;

    border: 0;
    background: transparent;

    color: var(--filters-blue-dark);
    font-size: 15px;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.filter-see-more::after {
    content: "+";

    width: 30px;
    height: 30px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 2px solid var(--filters-blue);
    border-radius: 50%;

    font-size: 23px;
    line-height: 1;
    text-decoration: none;
}


/* =====================================================
   ARBRE DES THÉMATIQUES
===================================================== */

.thematics-tree {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.thematic-node {
    position: relative;
}

.thematic-children {
    margin-left: 22px;
    padding-left: 12px;
    border-left: 1px solid #dedede;
}

.thematic-children .filter-option {
    font-size: 15px;
}


/* =====================================================
   BARRE FIXE EN BAS
===================================================== */

/*
   Le JS actuel place le compteur dans .filters-results.
   Cette règle garde la barre visible en bas du panneau.
*/

.filters-results {
    flex-shrink: 0;
    min-height: 66px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 12px 28px;

    border-top: 1px solid #dedbd4;
    background: var(--filters-bg);

    color: #252525;
    font-size: 15px;
}

.filters-results strong {
    color: var(--filters-blue);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
    font-family: var(--filters-familyH2);
}


/* =====================================================
   SCROLLBARS
===================================================== */

.filters-panel ::-webkit-scrollbar {
    width: 7px;
}

.filters-panel ::-webkit-scrollbar-track {
    background: transparent;
}

.filters-panel ::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 10px;
}


/* =====================================================
   TABLETTES
===================================================== */

@media (max-width: 1100px) {
    .filters-panel {
        max-width: 420px;
    }

    .filters-header {
        padding: 20px;
    }

    .filters-title h2 {
        font-size: 30px;
    }

    .filters-container {
        padding-right: 14px;
        padding-left: 14px;
    }

    .filter-group-title {
        font-size: 18px;
    }

    .filter-group-title::before {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        font-size: 25px;
    }
}


/* =====================================================
   MOBILES
===================================================== */

@media (max-width: 980px) {
    .filters-panel {
        position: absolute;
        z-index: 1000;

        left: 0;
        right: 0;
        bottom: 200px;

        width: 100%;
        max-width: none;
        height: fit-content;

        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 35px rgb(0 0 0 / 12%);

        transform: translateY(100%);
        transition: transform .25s ease;
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 30px;
        box-shadow: 0px -4px 8.899999618530273px 0px #00000040;
    }

    .filters-panel.is-visible {
        transform: translateY(0);
    }

    .filters-header {
        min-height: 76px;
        padding: 15px 18px;
    }

    .filters-title h2 {
        font-size: 27px;
    }

    .filters-title h2::before {
        font-size: 30px;
    }

    .filters-reset {
        font-size: 13px;
    }

    .filters-reset::before {
        font-size: 23px;
    }

    .filters-container {
        padding: 0 12px 12px;
    }

    .filter-group {
        margin-bottom: 12px;
        border-radius: 17px;
    }

    .filter-group-header {
        min-height: 65px;
        padding: 12px 15px;
    }

    .filter-group-title {
        gap: 9px;
        font-size: 17px;
    }

    .filter-group-title::before {
        width: 22px;
        height: 22px;
        flex-basis: 22px;
        font-size: 22px;
    }

    .filter-selected-count {
        min-width: 27px;
        height: 27px;
        font-size: 12px;
    }

    .filter-group-content {
        padding: 0 15px 16px;
    }

    .filter-option {
        min-height: 39px;
        font-size: 14px;
    }

    .filters-results {
        min-height: 60px;
        padding: 10px 18px;
    }

    .filters-results strong {
        font-size: 28px;
    }
}

/* Empêche les cartes de filtres de se comprimer */
.filters-container {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    align-items: stretch;
}

.filter-group {
    flex: 0 0 auto;
    flex-shrink: 0;
}

/* Les en-têtes gardent leur hauteur */
.filter-group-header {
    flex-shrink: 0;
}

/* La barre inférieure garde sa hauteur */
.filters-header,
.active-filters,
.filters-results {
    flex-shrink: 0;
}

#mapApres, #mapAvant, #mapPop {
    background-color: var(--filters-bg);
}

.minifiche-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    /*width: 100%;
    max-width: 405px;*/
    margin: 0 auto;
    padding: 3px;
    background: var(--filters-bg);
    /*border-radius: 50px;*/
    box-sizing: border-box;
}

.minifiche-buttons button {
    /*flex: 1;*/
    min-width: 0;
    height: 48px;
    padding: 0 15px;
    border: none;
    border-radius: 50px;
    background: white;
    color: #171717;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding-left: 30px;
    padding-right: 30px;
    font-family: var(--filters-family);
}

.minifiche-buttons button.active {
    background: var(--filters-blue);
    color: #fff;
    z-index: 100;
}

.minifiche-buttons button:not(.active):hover {
    background: #f2f2f2;
}

.minifiche-header {
    height: 80px!important;
    font-family: var(--filters-familyH2);
    font-weight: 700;
    line-height: 1.2;
    background: var(--filters-blue)!important;
    color: white;
    font-size: 25px;
}

.minifiche-buttons {
    padding-top: 30px;
}

.label {
    box-shadow: 0px 0px 4.599999904632568px 0px #00000066;
    border-radius: 5px 5px 5px 5px;
    font-size: 18px;
    font-weight: 500;
    font-family: var(--filters-family);
}


#filters-show {
    display: flex;
    justify-content: center;
    align-items: center;
}

#filters-show img {
    display:none;
}

.ismove {
    background-color: var(--filters-blue)!important;
}

.ismove img {
    display: block!important;
}

.lieu {
    font-family: var(--filters-family);
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    padding-top: 10px;
    padding-bottom: 10px;
}

.leaflet-popup-content p {
    color: white;
    text-decoration: unset;
    cursor: pointer;
    background-color: var(--filters-blue);
    width: 40px;
    height: 40px;
    text-align: center;
    line-height: 32px;
    border-radius: 50%;
    font-size: 30px;
    margin: 0;
    position: absolute;
    right: 20px;
    bottom: 10px;
}

.leaflet-popup-close-button {
    font-size: 38px !important;
    color: #222 !important;
    top: 10px !important;
    right: 10px !important;
    font-family: var(--filters-family) !important;
}

#analyse p {
    font-family: var(--filters-family);
    font-size: 18px;
    font-weight: 500;
    padding: 0 30px;
}

.series-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700!important;
    font-family: var(--filters-family);
}

.choice-number {
    position: absolute;
    top: 10px;
    left: 10px;
    /*width: 36px;*/
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 5%;
    color: white;
    font-size: 18px;
    font-weight: 600;
    background-color: var(--filters-gold);
    box-shadow: 0px 0px 4.599999904632568px 0px #00000099;
    padding: 5px 10px;
    font-family: var(--filters-family);
}


.series-card.selected-second .series-image {
    outline-color: var(--filters-gold)!important;
}

.series-card.selected-first .series-image {
    outline-color: var(--filters-gold)!important;
}

#series-title {
    font-size: 20px;
    font-weight: 700 !important;
    font-family: var(--filters-family);
    padding-left: 50px;
    padding-top: 20px;
}

#series-title b {
    color: var( --filters-muted);
}