#carte-cpts-wrapper {
    position: relative;
    width: 100%;
    height: 70vh;
    min-height: 500px;
}

#carte-map {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

#carte-search-container {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    width: 340px;
}

#carte-search-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    border: 2px solid #ccc;
    border-radius: 8px;
    outline: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

#carte-search-input:focus {
    border-color: #2F008C;
}

#carte-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    display: none;
    line-height: 1;
    padding: 4px;
}

#carte-search-clear:hover {
    color: #333;
}

#carte-search-results {
    margin-top: 4px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    display: none;
}

#carte-search-results .search-group-label {
    font-size: 11px;
    font-weight: 700;
    color: #2F008C;
    text-transform: uppercase;
    padding: 8px 14px 4px;
}

#carte-search-results .search-item {
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
}

#carte-search-results .search-item:hover {
    background: #f0edf7;
}

#carte-search-results .search-item .sub {
    font-size: 11px;
    color: #888;
}

/* Overrides MapLibre popup pour s'intégrer au thème */
#carte-cpts-wrapper .maplibregl-popup-content {
    padding: 16px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    max-width: 420px;
}

#carte-cpts-wrapper .maplibregl-popup-close-button {
    font-size: 22px;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    padding: 0;
    right: 4px;
    top: 4px;
}

#carte-cpts-wrapper .popup-title {
    font-size: 16px;
    font-weight: 700;
    color: #2F008C;
    margin-bottom: 8px;
    padding-right: 24px;
}

#carte-cpts-wrapper .popup-info {
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}

#carte-cpts-wrapper .popup-info span {
    font-weight: 600;
}

.popup-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #333;
    line-height: 1.5;
}

.popup-details > span,
.popup-projets > span:first-child {
    font-weight: 600;
}

.popup-details a {
    color: #2F008C;
    text-decoration: none;
    word-break: break-all;
}

.popup-details a:hover {
    text-decoration: underline;
}

.popup-contacts {
    margin-top: 8px;
}

.popup-contacts > span {
    font-weight: 600;
}

.contacts-toggle {
    font-size: 12px;
    font-style: italic;
}

.popup-contact {
    margin-top: 6px;
    padding: 6px 8px;
    background: #f8f7fc;
    border-radius: 4px;
}

.contact-name {
    font-weight: 600;
    font-size: 13px;
}

.contact-role {
    font-size: 11px;
    color: #666;
}

.contact-mail,
.contact-tel {
    font-size: 12px;
}

.projets-toggle {
    font-size: 12px;
    font-style: italic;
    word-break: normal;
}

/* --- Bloc statistiques --- */
#carte-stats {
    position: absolute;
    bottom: 24px;
    left: 12px;
    z-index: 9;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    padding: 12px 16px;
    width: 260px;
    font-family: 'Montserrat', sans-serif;
}

#carte-stats-title {
    font-size: 13px;
    font-weight: 700;
    color: #2F008C;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#carte-stats-numbers {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
}

#carte-stats-numbers .stat-item {
    flex: 1;
}

#carte-stats-numbers .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

#carte-stats-numbers .stat-label {
    font-size: 11px;
    color: #888;
}

#carte-stats-tailles .taille-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #eee;
}

#carte-stats-tailles .taille-segment {
    height: 100%;
    transition: width 0.3s ease;
}

#carte-stats-tailles .taille-segment[data-taille="1"] { background: #3CB44B; }
#carte-stats-tailles .taille-segment[data-taille="2"] { background: #4363D8; }
#carte-stats-tailles .taille-segment[data-taille="3"] { background: #D35400; }
#carte-stats-tailles .taille-segment[data-taille="4"] { background: #C0392B; }

.taille-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin-top: 6px;
    font-size: 10px;
    color: #666;
}

.taille-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.taille-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    #carte-search-container {
        width: calc(100% - 60px);
    }

    #carte-cpts-wrapper {
        height: 60vh;
        min-height: 400px;
    }

    #carte-stats {
        width: calc(100% - 60px);
        bottom: 12px;
    }
}
