.leaflet-sidebar {
    position: absolute;
    height: 85%;
    width: 300px; /* Taille normale */
    box-sizing: border-box;
    padding: 10px;
    z-index: 2000;
    background: white;
    box-shadow: 0 1px 7px rgba(0, 0, 0, 0.65);
    border-radius: 4px;
    transition: left 0.5s, width 0.5s;
}

.leaflet-sidebar.left {
    left: -300px;
}

.leaflet-sidebar.left.visible {
    left: 0;
}

.leaflet-sidebar.right {
    right: -300px;
}

.leaflet-sidebar.right.visible {
    right: 0;
}

.leaflet-sidebar > .leaflet-control {
    height: calc(100% - 40px); /* Ajuste pour l'en-tête */
    width: 100%;
    overflow: auto;
    box-sizing: border-box;
    font-size: 1.1em;
}

.sidebar-header {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 5px;
    background: #f5f5f5;
    border-bottom: 1px solid #ccc;
    height: 40px;
    box-sizing: border-box;
}

.sidebar-header a.close,
.sidebar-header a.minimize,
.sidebar-header a.maximize {
    padding: 4px 8px;
    text-decoration: none;
    font-size: 16px;
    color: #444;
    background-color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1;
}

.sidebar-header a:hover {
    background-color: #ccc;
}

.leaflet-sidebar.collapsed {
    height: 50px; /* Taille réduite */
    bottom: 0; /* Ancrée en bas */
    top: auto; /* Supprime l'ancrage en haut */
    width: 300px; /* Conserve la largeur normale */
}

.leaflet-sidebar.collapsed .leaflet-control {
    display: none; /* Masque le contenu principal */
}

.leaflet-sidebar.collapsed .sidebar-header {
    display: flex; /* Garde l'en-tête visible */
}

.leaflet-sidebar.maximized {
    width: 1000px; /* Taille agrandie */
}

/* Media queries */
@media (max-width: 767px) {
    .leaflet-sidebar {
        width: 100%;
        padding: 0;
    }
    .leaflet-sidebar.left {
        left: -100%;
    }
    .leaflet-sidebar.left.visible {
        left: 0;
    }
    .leaflet-sidebar.right {
        right: -100%;
    }
    .leaflet-sidebar.right.visible {
        right: 0;
    }
    .leaflet-sidebar.maximized {
        width: 100%; /* Maximisé à 100% sur petits écrans */
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .leaflet-sidebar {
        width: 305px;
    }
    .leaflet-sidebar.left {
        left: -305px;
    }
    .leaflet-sidebar.left.visible {
        left: 0;
    }
    .leaflet-sidebar.maximized {
        width: 1000px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .leaflet-sidebar {
        width: 390px;
    }
    .leaflet-sidebar.left {
        left: -390px;
    }
    .leaflet-sidebar.left.visible {
        left: 0;
    }
    .leaflet-sidebar.maximized {
        width: 1000px;
    }
}

@media (min-width: 1200px) {
    .leaflet-sidebar {
        width: 460px;
    }
    .leaflet-sidebar.left {
        left: -460px;
    }
    .leaflet-sidebar.left.visible {
        left: 0;
    }
    .leaflet-sidebar.maximized {
        width: 1000px;
    }
}