/* ===========================================
   LAYOUT PRINCIPAL - CSS GRID
   =========================================== */
body {
    margin: 0;
    padding: 0;
    height: 100vh;
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header  header"
        "map     sidebar"
        "footer  footer";
    color: #000000;
    font: 300 14px/19px 'Poppins', 'Source Sans Pro', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ===========================================
   HEADER
   =========================================== */
.titre {
    grid-area: header;
    padding: 20px 40px 10px;
    font-size: 25px;
    font-weight: 600;
    line-height: 1;
    color: #000000;
    background-color: #f3f3f3;
}

/* ===========================================
   MAP
   =========================================== */
#map {
    grid-area: map;
    position: relative;
    min-height: 0; /* Important pour grid */
}

/* ===========================================
   SIDEBAR
   =========================================== */
.sidebar2 {
    grid-area: sidebar;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    font-weight: 450;
    text-align: left;
    background-color: #f3f3f3;
    overflow: hidden;
    min-height: 0; /* Important pour grid */
}

/* ===========================================
   BARRE DE RECHERCHE
   =========================================== */
.search-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.search-container input {
    flex: 1;
    padding: 10px 12px;
    border: 0.4px solid #c1c1c1;
    border-radius: 4px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9em;
    box-sizing: border-box;
}

.search-container input:focus {
    outline: none;
    border-color: #5d6ed1;
    box-shadow: 0 0 0 2px rgba(93, 110, 209, 0.2);
}

.search-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    font-size: 20px;
    font-weight: 300;
    color: #545454;
    background-color: #f6f6f6;
    border: 0.4px solid #c1c1c1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 150ms ease;
    opacity: 0;
    pointer-events: none;
}

.search-reset.visible {
    opacity: 1;
    pointer-events: auto;
}

.search-reset:hover {
    background-color: #5d6ed1;
    border-color: #5d6ed1;
    color: #ffffff;
}

.sidebar2 .listing {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
}

.sidebar2 .listing > * {
    display: block;
    padding: 5px 10px;
    margin: 0;
}

.sidebar2 .listing a {
    color: #000000;
    text-decoration: none;
    font-size: 0.9em;
    background-color: #ffffff;
}

.sidebar2 .listing a:last-child {
    border: none;
}

.sidebar2 .listing a:hover {
    background: #5d6ed1;
    color: #ffffff;
}

/* ===========================================
   SYNTHESE (fiche média)
   =========================================== */
.synthese {
    display: none;
    padding: 15px;
    background-color: #fdfdfd;
    border: 0.4px solid #c1c1c1;
    border-radius: 4px;
    color: #2a2a2a;
    text-align: left;
}

.synthese-media {
    font-size: 18px;
    font-weight: 600;
    color: #eb0000;
}

.synthese-type {
    font-weight: 600;
}

.synthese-dep {
    font-weight: 300;
}

/* ===========================================
   SECTIONS SIDEBAR
   =========================================== */
.section-title {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #878787;
    margin-bottom: 8px;
}

.outremer {
    padding: 8px 0;
}

.territory-select {
    width: 100%;
    padding: 10px 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95em;
    font-weight: 450;
    color: #3a3a3a;
    background-color: #fcfcfc;
    border: 0.4px solid #c1c1c1;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23545454' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 150ms ease;
}

.territory-select:hover {
    background-color: #5d6ed1;
    color: #ffffff;
    border-color: #5d6ed1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.territory-select:focus {
    outline: none;
    border-color: #5d6ed1;
    box-shadow: 0 0 0 2px rgba(93, 110, 209, 0.2);
}

.territory-select option {
    background-color: #ffffff;
    color: #3a3a3a;
    padding: 8px;
}

.listing-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* ===========================================
   FOOTER
   =========================================== */
.infos {
    grid-area: footer;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    background-color: #f3f3f3;
    border-top: 0.4px solid #f2f2f2;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    width: 110px;
}

.text-infos {
    font-size: 0.7rem;
}

.alerte {
    display: none;
}

/* ===========================================
   FILTRES PAR TYPE (dans la sidebar)
   =========================================== */
.filter-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 5px;
}

.filter-group input[type='checkbox'] {
    display: none;
}

.filter-group input[type='checkbox'] + label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 3px 10px;
    font-size: 0.85em;
    font-weight: 500;
    text-align: center;
    color: #545454;
    background-color: #F6F6F6;
    border: 0.4px solid #c1c1c1;
    border-radius: 3px;
    transition: all 150ms ease;
}

.filter-group input[type='checkbox'] + label:hover {
    background-color: #5d6ed1af;
    color: #ffffff;
}

.filter-group input[type='checkbox']:checked + label {
    color: #ffffff;
    background-color: #5D6ED1;
    border-color: #5D6ED1;
}

.filter-group input[type='checkbox']:checked + label:hover {
    background-color: #5d6ed1af;
}

.filter-group input[type='checkbox']:checked + label::before {
    content: '✔';
    margin-right: 5px;
}


/* ===========================================
   LIENS
   =========================================== */
a {
    color: #000000;
    text-decoration: underline;
}

a:hover {
    color: #101010;
}

/* ===========================================
   MAPBOX POPUPS
   =========================================== */
.mapboxgl-popup {
    padding-bottom: 0;
    width: 180px;
}

.mapboxgl-popup-close-button {
    color: #fcfcfc;
}

.mapboxgl-popup-content {
    padding: 3px 8px;
    font: 500 14px/20px 'Poppins', 'Source Sans Pro', 'Helvetica Neue', sans-serif;
    color: #5D6ED1;
    background-color: #ffffffc2;
}

.mapboxgl-popup-content div {
    padding: 10px;
    width: 200px;
}

.mapboxgl-popup-tip {
    color: #3d3d3dd6;
}

.mapboxgl-popup-anchor-top .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-top-right .mapboxgl-popup-tip {
    border-bottom-color: #3d3d3dd6;
}

.mapboxgl-popup-anchor-bottom .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-left .mapboxgl-popup-tip,
.mapboxgl-popup-anchor-bottom-right .mapboxgl-popup-tip {
    border-top-color: #ffffffda;
}

.mapboxgl-popup-anchor-left .mapboxgl-popup-tip {
    border-right-color: #ffffffda;
}

.mapboxgl-popup-anchor-right .mapboxgl-popup-tip {
    border-left-color: #ffffffda;
}

.mapboxgl-popup-anchor-top > .mapboxgl-popup-content {
    margin-top: 0;
}

.mapboxgl-popup-anchor-top > .mapboxgl-popup-tip {
    border-bottom-color: #ffffff;
}

/* ===========================================
   SCROLLBAR
   =========================================== */
::-webkit-scrollbar {
    width: 7px;
    height: 3px;
    border-left: 0;
    background: none;
}

::-webkit-scrollbar-track {
    background: #ffffff;
}

::-webkit-scrollbar-thumb {
    background: #323232;
    border-radius: 0;
}

/* ===========================================
   RESPONSIVE - Écrans peu hauts
   =========================================== */
@media screen and (max-height: 500px) {
    body {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "map"
            "footer";
    }

    .sidebar2 {
        display: none;
    }

    .text-infos {
        padding-right: 25px;
    }
}

/* ===========================================
   RESPONSIVE - Mobile (< 720px)
   =========================================== */
@media screen and (max-width: 720px) {
    body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "header"
            "map"
            "footer";
    }

    .titre {
        padding: 10px 20px;
        font-size: 18px;
        font-weight: 400;
        background-color: #f8f8f875;
    }

    .sidebar2 {
        display: none;
    }

    .text-infos {
        font-size: 0.6rem;
        padding-right: 25px;
    }

    .alerte {
        display: block;
        position: fixed;
        bottom: 70px;
        right: 10px;
        padding: 10px;
        font-weight: 400;
        color: #545454;
        text-align: right;
        background-color: #f3f3f3b0;
        border: 0.4px solid #c1c1c1;
        border-radius: 3px;
    }
}
