html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

#carte-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-rows: 1fr;
    height: 100dvh;
    font-family: system-ui, -apple-system, sans-serif;
}

/* ── Sidebar ──────────────────────────────────────────────── */

#filtre-bar {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100vh;
    overflow-y: auto;
    background: #fff;
    border-right: 1px solid #e5e7eb;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
    z-index: 10;
    transition: transform 0.25s ease;
}

.logo-nice {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-decoration: none;
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.filtre-section {
    padding: 0.85rem 1rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.filtre-section-titre {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 0.6rem;
}

.filtre-pied {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid #f0f0f0;
}

.filtre-stats {
    font-size: 0.8rem;
    color: #6b7280;
}

/* ── Filtre source ───────────────────────────────────────── */

.filtre-source {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filtre-source-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #374151;
    transition: background 0.12s, border-color 0.12s;
}

.filtre-source-option:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.filtre-source-option input[type="radio"] {
    accent-color: #1e40af;
    margin: 0;
}

.filtre-source-option:has(input:checked) {
    background: #eef2ff;
    border-color: #1e40af;
    color: #1e3a8a;
    font-weight: 600;
}

/* ── Chips secteurs ──────────────────────────────────────── */

#filtre-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    max-height: 9rem;
    overflow-y: auto;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem 0.2rem 0.4rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.chip:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chip--actif {
    color: #fff;
    font-weight: 600;
    border-color: transparent;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

.chip--actif:hover {
    filter: brightness(1.08);
    background: inherit;
}

.chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: currentColor;
    opacity: 0.6;
}

.chip--actif .chip-dot {
    background: rgba(255, 255, 255, 0.7);
    opacity: 1;
}

.chip-libelle {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Autocomplete activités ──────────────────────────────── */

.autocomplete {
    position: relative;
}

.tags-input {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.35rem;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    min-height: 2.1rem;
    cursor: text;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.tags-input:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #fff;
}

.tags-liste {
    display: contents;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.1rem 0.25rem 0.1rem 0.55rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    font-size: 0.82rem;
    line-height: 1.3;
    max-width: 100%;
}

.tag-libelle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 11rem;
}

.tag-code {
    color: #818cf8;
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.tag-suppr {
    appearance: none;
    background: transparent;
    border: 0;
    color: #6366f1;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    border-radius: 999px;
}

.tag-suppr:hover {
    background: #c7d2fe;
    color: #3730a3;
}

.filtre-champ input.tags-input-saisie,
input.tags-input-saisie {
    flex: 1;
    min-width: 7rem;
    border: 0;
    outline: none;
    padding: 0.2rem 0.25rem;
    font-size: 0.9rem;
    background: transparent;
    border-radius: 0;
    color: #111827;
}

.tags-input-saisie::placeholder {
    color: #9ca3af;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    margin: 3px 0 0;
    padding: 0;
    list-style: none;
    max-height: 16rem;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.875rem;
}

.autocomplete-list[hidden] {
    display: none;
}

.autocomplete-item {
    padding: 0.35rem 0.65rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item[aria-selected='true'] {
    background: #eef2ff;
}

.autocomplete-item-libelle mark {
    background: #fef08a;
    color: inherit;
    padding: 0;
    border-radius: 2px;
}

.autocomplete-item-code {
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 0.8rem;
}

.autocomplete-vide {
    padding: 0.5rem 0.65rem;
    color: #9ca3af;
    font-style: italic;
}

/* ── Pills code postal ───────────────────────────────────── */

.cp-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.cp-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: 0.8rem;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.cp-pill:hover {
    border-color: #6366f1;
    color: #6366f1;
    background: #eef2ff;
}

.cp-pill--actif {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    font-weight: 600;
}

.cp-pill--actif:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

/* ── Input rue ───────────────────────────────────────────── */

.filtre-rue-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.35rem 0.6rem;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #111827;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}

.filtre-rue-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #fff;
}

.filtre-rue-input::placeholder {
    color: #9ca3af;
}

/* ── Carte ───────────────────────────────────────────────── */

#carte {
    grid-column: 2;
    position: relative;
    z-index: 0;
    width: 100%;
    height: 100dvh;
}

.carte-invite {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    font-size: 0.95rem;
    color: #6b7280;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    max-width: 85vw;
    text-align: center;
    white-space: normal;
}

.carte-invite[hidden] {
    display: none;
}

/* ── Clusters ────────────────────────────────────────────── */

.cluster-icone {
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.1s;
}

.cluster-icone:hover {
    transform: scale(1.12);
}

/* ── Bouton hamburger (mobile) ───────────────────────────── */

#sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 2000;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    border: 1.5px solid #d1d5db;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #374151;
    transition: background 0.12s;
}

#sidebar-toggle:hover {
    background: #f3f4f6;
}

/* ── Backdrop mobile ─────────────────────────────────────── */

#sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 40;
    cursor: pointer;
}

/* ── Responsive mobile ───────────────────────────────────── */

@media (max-width: 768px) {
    #carte-page {
        grid-template-columns: 1fr;
    }

    #filtre-bar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(300px, 85vw);
        height: 100dvh;
        transform: translateX(-100%);
        z-index: 50;
    }

    #filtre-bar.--ouvert {
        transform: translateX(0);
    }

    #carte {
        grid-column: 1;
    }

    #sidebar-toggle {
        display: flex;
    }
}

/* ── Popup SIRET ────────────────────────────────────────── */

.popup-siret {
    color: #6b7280;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}
