.cpa-wrapper {
    display: flex;
    flex-wrap: wrap; /* Permet de passer en colonne sur mobile */
    height: auto; /* Hauteur auto pour s'adapter */
    width: 100%;
    border: 1px solid #ddd;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
}

#cpa-map-container {
    min-height: 500px;
    height: 600px;
    flex-grow: 1; /* La carte prend toute la place disponible */
    width: 65%; /* Prend 65% de la largeur par défaut */
}

#cpa-info-panel {
    width: 35%; /* Prend 35% de la largeur par défaut */
    min-width: 400px; /* Largeur minimum */
    flex-shrink: 0;
    height: 600px; /* Même hauteur que la carte */
    background: #f9f9f9;
    transition: transform 0.4s ease-in-out;
    transform: translateX(0);
    overflow-y: auto;
    border-left: 1px solid #ddd;
    position: relative;
    box-sizing: border-box; /* Inclut le padding et la bordure dans la largeur */
}

#cpa-info-panel.cpa-panel-hidden {
    display: none; /* On cache simplement le panneau */
}

/* Quand le panneau est caché, la carte prend toute la place */
#cpa-map-container.full-width {
    width: 100%;
}


.cpa-panel-placeholder {
    padding: 20px;
    color: #888;
    text-align: center;
    margin-top: 40%;
}

#cpa-close-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 22px;
    line-height: 35px;
    cursor: pointer;
    text-align: center;
    z-index: 1000;
    transition: background-color 0.2s;
}
#cpa-close-panel:hover {
    background: rgba(0,0,0,0.8);
}


.cpa-panel-header {
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: #e9e9e9;
    border-bottom: 1px solid #ddd;
}

.cpa-panel-content {
    padding: 25px;
}

.cpa-panel-content h2 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
    font-size: 24px;
    color: #333;
}

.cpa-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 25px 0;
    font-size: 14px;
}

.cpa-info-grid div {
    background-color: #fff;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #eee;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cpa-info-grid strong {
    display: block;
    color: #555;
    margin-bottom: 5px;
}

.cpa-pdf-section {
    margin-top: 30px;
    border-top: 1px solid #ddd;
    padding-top: 25px;
    text-align: center;
}

.cpa-pdf-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #444;
}

.cpa-button {
    display: inline-block;
    background-color: #0073aa;
    color: #fff;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.cpa-button:hover {
    background-color: #005a87;
    color: #fff;
}

/* --- Responsive pour les mobiles --- */
@media (max-width: 850px) {
    .cpa-wrapper {
        flex-direction: column;
        height: auto;
    }

    #cpa-map-container, #cpa-info-panel {
        width: 100%;
        height: auto;
    }
    
    #cpa-map-container {
        height: 400px; /* Hauteur fixe pour la carte sur mobile */
    }

    #cpa-info-panel {
        min-width: unset;
        border-left: none;
        border-top: 2px solid #ddd;
    }
    
    .cpa-info-grid {
        grid-template-columns: 1fr;
    }
}
/* ==========================================================================
   Légende de la carte
   ========================================================================== */

.cpa-legend {
    margin: 20px auto 0;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #f9f9f9;
    max-width: 90%;
    box-sizing: border-box;
}

.cpa-legend h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    font-size: 18px;
    text-align: center;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.cpa-legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px 25px;
}

.cpa-legend li {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #555;
}

.cpa-legend .color-box {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 4px;
    flex-shrink: 0;
}

/* ---- NOUVEAU : Couleurs spécifiques pour la légende ---- */
.cpa-legend .color-box.vert   { background-color: #28a745; }
.cpa-legend .color-box.violet { background-color: #8a2be2; }
.cpa-legend .color-box.rouge  { background-color: #dc3545; }
.cpa-legend .color-box.gris   { background-color: #cccccc; }