/* =============================== 
   CSS RESPONSIVE STABLE - PC & MOBILE 
================================ */

/* CONTENEUR PRINCIPAL */
.ecofin-graph-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    box-sizing: border-box;
    width: 100%;
    flex-wrap: wrap; /* permet aux graphes groupes de ne pas disparaître */
}

/* BOX DE CHAQUE GRAPHE */
.ecofin-graph-box {
    flex: 1 1 calc(25% - 12px); /* 4 graphes max par ligne */
    max-width: calc(25% - 12px);
    aspect-ratio: 7 / 8;
    text-align: center;
    background: none;
    padding: 6px;
    border-radius: 8px;
    box-shadow: none;
    box-sizing: border-box;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    transition: transform 0.3s;
}

/* CANVAS */
.ecofin-graph-canvas {
    width: 100% !important;
    height: 200px !important; /* fixe pour groupes */
    object-fit: contain;
}

/* CENTRE DU DOUGHNUT */
.ecofin-type-doughnut .ecofin-graph-center {
    font-size: 12px;
    margin-bottom: 2px;
}

/* CENTRE POUR BAR / LINE */
.ecofin-type-bar .ecofin-graph-center,
.ecofin-type-line .ecofin-graph-center {
    font-size: 11px;
    margin: 2px 0;
}

/* TITRE ET INFO */
.ecofin-graph-title {
    margin: 2px 0;
    font-size: 10px;
}

.ecofin-graph-info {
    font-size: 9px;
    margin: 2px 0;
    line-height: 1.1;
}

/* NAVIGATION BOUTONS */
.ecofin-graph-nav button {
    font-size: 8px;
    padding: 1px 3px;
    margin: 0 1px;
}

/* ===============================
   GRAPHE SOLO
================================ */
.ecofin-graph-box.ecofin-graph-solo {
    width: 700px;
    max-width: 100%;
    margin: 0 auto;
    aspect-ratio: auto !important;
    padding: 6px; /* padding uniforme */
}

/* Canvas solo */
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-canvas {
    width: 100% !important;
    height: 400px !important;
}

/* Texte et titre solo */
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-center {
    font-size: 18px;
    margin: 4px 0; /* texte proche du graphe */
}

.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-info {
    margin: 2px 0;
    line-height: 1.1;
    font-size: 10px;
    text-align: center;
}

.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-title {
    font-size: 14px;
    margin: 2px 0;
}

/* Navigation solo */
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-nav {
    margin-top: 2px;
}

/* Couleurs vert foncé solo */
.ecofin-graph-box.ecofin-graph-solo,
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-center,
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-info,
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-info strong,
.ecofin-graph-box.ecofin-graph-solo .ecofin-graph-title {
    color: #145a32 !important;
}

/* ===============================
   GRAPHES GROUPES - texte blanc et objectif jaune moutarde
================================ */
.ecofin-graph-box:not(.ecofin-graph-solo),
.ecofin-graph-box:not(.ecofin-graph-solo) .ecofin-graph-center,
.ecofin-graph-box:not(.ecofin-graph-solo) .ecofin-graph-title,
.ecofin-graph-box:not(.ecofin-graph-solo) .ecofin-graph-nav button {
    color: #fff !important;
}

.ecofin-graph-box:not(.ecofin-graph-solo) .ecofin-graph-info strong {
    color: #E1AD01 !important; /* objectif du mois en jaune moutarde */
}

/* ===============================
   MOBILE FIX - slide horizontal pour groupes
================================ */
@media (max-width: 600px) {
    .ecofin-graph-container {
        flex-wrap: nowrap; /* slide horizontal */
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 5px;
    }

    /* Graphes groupes en scroll horizontal */
    .ecofin-graph-box:not(.ecofin-graph-solo) {
        min-width: 140px;
        max-width: 140px;
        flex: 0 0 auto;
        width: 140px !important;
        height: auto !important;
    }

    /* Canvas groupes */
    .ecofin-graph-box:not(.ecofin-graph-solo) .ecofin-graph-canvas {
        height: 180px !important;
    }

    /* Solo responsive */
    .ecofin-graph-box.ecofin-graph-solo {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
    }

    .ecofin-graph-box.ecofin-graph-solo .ecofin-graph-canvas {
        height: 300px !important;
    }

    .ecofin-graph-box.ecofin-graph-solo .ecofin-graph-center {
        margin: 4px 0; /* proche du graphe */
    }
}
