/* Wrapper flex */
.carto-flex {
    display: flex;
    flex-direction: row;
    gap: 0;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    height: 800px; /* Hauteur commune */
    max-height: 100vh;
}

/* Colonne liste */
#site-list-container {
    width: 30%;
    background: #fff;
    box-sizing: border-box;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    flex: 1 1 0;
}

/* Colonne carte */
#map {
    /*width: 800px;*/
    width: 70%;
    min-width: 320px;
    max-width: 100%;
    /*flex: 1 1 0;*/
    margin: 0;
    min-height: 0;
    max-height: none;
}

#site-list-container, #map {
    height: auto !important;
}



.leaflet-container {
        font-family: Open Sans, Arial, sans-serif !important;
}

/*Marker carto*/
.fa-marker {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.fa-marker::before {
    display: none !important;
}

/* Icône marker centralisé */
.carto-marker-icon {
    display: inline-block;
    margin-right: 8px;
    vertical-align: middle;
    font-size: 1.2em;
    line-height: 1;
}

/* Barre de filtres */
.carto-filters-bar {
    background: #092872;
    color: #fff;
    padding: 10px 18px 10px 18px;
    min-height: 56px;
    font-size: 1rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}
.carto-filters-bar .filters {
    display: flex;
   justify-content: flex-end;
   margin-right: 20px;
   gap:20px
}
.carto-filters-bar label{
    color: #fff;
    font-weight: 500;
    font-size: 15px;
    text-align: right;
}
.carto-filters-bar select {
    background: #fff;
    color: #092872;
    border-radius: 4px;
    border: none;
    padding: 4px 10px;
    margin-left: 8px;
    font-size: 13px;
    width: 240px;
}

/* Légende */
.carto-legend {
    background: #f8f7f5;
    padding: 10px 30px;
    margin-bottom: 0;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
        padding: 12px 30px 8px 30px;
}
.carto-legend-item {
    display: flex;
    align-items: center;
    margin-right: 18px;
    margin-bottom: 4px;
}
.carto-legend-color {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 7px;
    border: 1px solid #ccc;
}

:root {
    --milieu-lacustres: #054096;
    --milieu-alluviaux: #7dde42;
    --milieu-forestiers: #2e8f54;
    --milieu-marais: #0082d9;
    --milieu-pelouses: #fab533;
    --milieu-tourbieres: #ab4500;
}

#carto-sites-wrapper,
.carto-flex {
    width: 100vw;
    max-width: 100vw;
    margin: 0;
}

/* Popup des marqueurs */
.marker-popup { }
.marker-title { font-weight: bold; font-size: 1.5em; margin-bottom: 10px; color :#054096}
.marker-year { }
.marker-row { margin-bottom: 3px; }
.marker-label { color: #666; }
.marker-value { color: #222;}

/* Sidebar styles */

#sidebar-list {
    flex: 1 1 0;
    overflow-y: auto;
    margin: 10px 20px;
    padding-right: 6px;
    /* Pour la scrollbar stylée */
    scrollbar-width: thin;
    scrollbar-color: #054096 #f5f5f5; 
    max-height: 100%;
}
.sidebar-item {
    padding: 20px;
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
    background: #fff;
    border-radius: 6px;
    transition: box-shadow 0.2s, transform 0.2s, background 0.2s;
    cursor: pointer;
}

.sidebar-item:hover {
    background: #f0f6ff;
    box-shadow: 0 2px 12px 0 rgba(5,64,150,0.08);
    /*transform: translateY(-2px) scale(1.015);*/
    
}

.sidebar-marker-icon {
    margin-right: 8px;
    vertical-align: middle;
    font-size: 1.2em;
    line-height: 1;
}

.sidebar-title {
  display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 20px;
    margin-bottom: 10px;
    color: #054096;
}
.sidebar-row {
    font-size: 0.95em;
}
.sidebar-label {
    color: #666;
}
.sidebar-value {
    color: #222;
}
.sidebar-value .detail{
    font-style: 11px;
}

/* Scrollbar stylée pour Chrome/Edge/Safari */
#sidebar-list::-webkit-scrollbar {
    width: 10px;
    background: #e3f2fd;
}
#sidebar-list::-webkit-scrollbar-thumb {
    background: #092872;
    border-radius: 6px;
}

.no-results{
    margin: 50px;
}


.carto-btn{       
    color: #FFFFFF !important;
    padding: 5px 15px;
    margin-right: 5px;;
    border-radius: 30px;
    font-weight: 600 !important;
}

.sidebar-links{
    margin-top: 10px;;
}

.marker-links{
    margin-top: 20px;;
}

.sidebar-links .carto-btn{
    font-size: 13px;
}

.marker-links .carto-btn{
    font-size: 11px;
}

.marker-links .carto-btn.chantier{}

.sidebar-links .carto-btn.chantier{}

.carto-btn.chantier{
background-color: #EF7D00
    
}

.carto-btn.vv{
background-color: #78B700;
}


.carto-btn.custom{
background-color: #ab9476;
}



/*legend*/
.leaflet-control-attribution {
    padding : 5px 20px;
    margin: 0 10px 5px 0 !important;
}

.leaflet-control-scale-line {

}

.carto-site-count {
    margin-left: 20px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: #092872;
    
    text-align: left;
    margin-bottom: 0;
}

#site-legend-mobile {
    display: none;
}

@media (max-width: 900px) { 
    
    #site-legend-mobile { display: block; }
    #site-legend{ display: none;}
    .carto-legend{ padding: 10px; }
   
    .carto-legend-item{
        display: inline-block;
        margin-right: 0;
        font-size: 13px;
    }

    .carto-legend table{ border: 0 !important; margin:0 !important;}
    .carto-legend td{ padding: 5px 10px !important;}

    .carto-flex {
        flex-direction: column;
        height: auto;
        max-height: none;
    }
    #site-list-container, #map {
        width: 100% !important;
        min-width: 0;
        max-width: 100%;
        height: 400px !important; /* ou auto si tu veux que la liste s'adapte */
        max-height: none !important;
        flex: none !important;
    }
  #site-filters,
  #map,
  #site-list-container {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box;
  }
  #map {
    height: 400px !important;
    margin-bottom: 16px;
            flex: none !important;
  }

  #site-list-container {
    margin-bottom: 16px;
    height: auto !important;
    max-height: 100% !important;
  }
  
  #sidebar-list {
    margin: 10px;
    padding : 0;
  }
  
  /* Réordonne les blocs pour mobile */
  #carto-sites-wrapper{
    display: flex;
    flex-direction: column;
  }

  #site-filters { order: 1;}
  .carto-flex { order: 2;} 

    .carto-flex {
        flex-direction: column;
    }
    #map{
        order: 1;
    }
    #site-legend-mobile{
        order: 2;
    }
    #site-list-container{
        order: 3;
    }


  /* Si le parent n'est pas flex, on force le flux colonne */
  #map, #site-filters, #site-list-container {
    display: block;
  }

    .carto-site-count {
        padding: 14px 10px 6px 10px;
        text-align: center;
        margin-left: 0;
    }
    
    .carto-filters-bar .filters {
        display: block;
        margin: 20px 0;
    }

    .carto-filters-bar label {
        display: block;
        width: 100%;
        text-align: left;
        margin-top: 10px;
        margin: 10px 0 5px 10px;
    }
    .carto-filters-bar select {
        width: 95%;
    }

    .carto-btn {
        font-size: 11px;
        padding: 5px 10px;
    }

}
.carto-downloads {
    margin: 16px 30px 0 0;

}
.carto-maj{
    font-style: italic;
}


/* Aligne les deux div à droite */
.carto-maj,
.carto-downloads {
    display: inline-block;
    float: right;
    margin: 16px 30px 0 0;
    text-align: right;   
    font-size: 13px;
}

/* Sur mobile, tu peux les remettre à gauche ou les masquer */
@media (max-width: 900px) {
    .carto-maj,
    .carto-downloads {
        float: none;
        display: block;
        text-align: left;
        margin-left: 20px;
    }
}


