/* ==========================================================================
   GESTION DU TABLEAU DE BORD (DASHBOARD EUDEMIS)
   ========================================================================== */

/* Grille principale du tableau de bord */
.dashboard-grid {
    display: grid;
    grid-template-columns: 3fr 2fr; 
    gap: 5px;                    
    flex-grow: 1;   /* Étire la grille para occuper le fond du main */
    align-items: center;
}

/* ==========================================================================
   Zone de la Carte
   ========================================================================== */
.zone-map {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #ffffff;
    padding: 10px;
    align-items:flex-start;
    justify-content: top;
    box-sizing: border-box;
}

/* ==========================================================================
   Zone des Données et Graphiques
   ========================================================================== */
.zone-data {
    display: flex;
    padding: 10px;
    flex-direction: column;
    gap: 15px; /* Espacement vertical constant entre les blocs de données */
    justify-content: top;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

.bloc-entete-graphiques{
    display: flex;
    gap: 20px;
    width: 100%;
    margin:0;
    padding: 0;
    justify-content: space-between;
}
/* FILTRES------------------------------------------------------------------*/

/* conteneur filtres */
.filtres {
    flex-grow: 4;
    display: flex;
    align-items: center;
    justify-content: space-around; 
    flex-wrap: wrap; 
    gap: 10px;  
    padding: 12px 10px;
    box-sizing: border-box;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.filtre-group-items{
    display: flex;
    align-items: flex-end;
    justify-content: center; 
    flex-wrap: wrap;
    gap: 10px;
    flex-direction: column;
}

.filtre-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filtre-label {
    font-weight: bold;
    margin: 0; 
}


.liste-deroulante {
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

/* FILTRES STADe et PIEGES*/

.conteneur-stade-et-type-piege {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 20px;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;

}


/* CARTE STADE------------------------------------------------------------------*/
/* --- Conteneur global des cartes de stades */
.carte-stade-container {
    display: flex;
    height: 100%;;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background-color: #ffffff;
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

/* --- Objet carré individuel (Le cep / le module)  */
.carte-stade {
    display: flex;
    flex-direction: column; /* Empile le label en haut et l'icône en bas */
    align-items: center;    /* Centre horizontalement les éléments */
    width: 70px;            /* Largeur fixe pour faire un carré */
    height: 70px;           /* Hauteur fixe égale à la largeur */
    background-color: var(--color-light, #f4f4f4);
    border-radius: 8px;
    padding: 6px;
    box-sizing: border-box;
    transition: transform 0.2s ease, background-color 0.2s ease;
    cursor: pointer;
}

/* --- Label (adulte/larve))  */
.carte-stade-label {
    font-size: 0.75rem;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    font-weight: bold;
}

/* --- Icône SVG  */
.carte-stade-ico {
    width: 45px;
    height: 45px;
    object-fit: contain;
    display: block;
}

/* --- Effet au survol  */
.carte-stade:hover {
    transform: scale(1.05); /* Léger zoom harmonieux au lieu de casser le carré */
    background-color: var(--color-light-dark, #e0e0e0);
}


/* CARTE TYPE PIEGE------------------------------------------------------------------*/
/* --- Conteneur global des boutons type piege */   
.filtre-type-piege-container {
    display: inline-flex !important;
    width: 180px;
    height: 100%;;
    flex-direction: column;
    align-items:  center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    box-sizing: border-box;
}

/* Bouton de piege inactve*/
.filtre-type-piege-container .bouton-type3 {
   width: 80%;
}

/*Bouton de piege active*/
.bouton-type-piege-actif {
    width: 80%;
    background-color:var(--color-alfa-dark);
    border: 1px solid #ccc;
    color: #fff;
    padding: 5px 10px;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: inline-block;
}




/* Zone Graphiques------------------------------------------------------------------*/

/*Graphique phenologie historique courbes*/
/* --- Conteneur global pour mettre les graphiques côte à côte --- */
.bloc-graphiques {
    display: flex;
    gap: 20px;          /* Espace de 20px entre les deux graphiques */
    width: 100%;
    margin: 0;
    box-sizing: border-box;
    align-items: center;
}

.graphique-principal{
    flex:2;
    margin:0;
    padding:10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    box-sizing: border-box;
    position:relative;
}



/* --- Vos styles de conteneurs de graphiques nettoyés --- */
.conteneur-graphique {
    position: relative;        /* Indispensable pour que Chart.js calcule la zone disponible */
    display: block;            
    height: 380px;             /* C'est ici qu'on fixe la hauteur voulue */
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: #ffffff; 
}


.conteneur-graphique canvas {
    display: block;            
    width: 100% !important;    
    height: 100% !important;   
    margin: 0 !important;      
    padding: 0 !important;
    box-sizing: border-box;
}

.legende-graphique{
display: flex;
width: max-content;
align-items: center;
justify-content: center;
padding: 8px !important;
gap: 20px;
margin: 0 auto 10px auto;
border-bottom: 1px solid #eee;
box-sizing: border-box;
background-color: #ffffff; 
}


.icon-info-graphique {
    display: inline-block;
    text-decoration: none;
    position: absolute;
    bottom: 1px;  /* Ajusté selon le padding de .graphique-gauche */
    left: 3px; /* Ajusté selon le padding de .graphique-gauche */
    z-index: 600;
    margin: 0;
    cursor: pointer;
    color: #d3d3d3;
    font-size: 0.9rem;
}

/*---ADAPTATION TABLETTE -----------------------------------------------------------*/
@media (max-width: 1280px) {
    /* Sur les écrans moyens, la carte passe en bas */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
.zone-map {
        height: auto;
    }

    .conteneur-map {
        height: 300px; /* Sur mobile/tablette, la carte passe sous les données avec une hauteur fixe adaptée */
        min-height: initial;
    }

    .bouton-position{
        max-width: 60px;
        height: auto;
        text-wrap: wrap;
        padding: 2px;
    }


}

/*---ADAPTATION MOBILE -----------------------------------------------------------*/
@media (max-width: 800px) {

    .bloc-graphiques, .bloc-entete-graphiques {
        flex-direction: column;
        width: 100%;   
    }

    .bloc-graphiques .graphique-gauche, .graphique-droite {
        flex: 1;    /* les grapphiques prennent toute la largeur de la page en mobile*/
    }

    .conteneur-graphique, .legende-graphique,.zone-data, .graphique-gauche, .graphique-droite{
            width: 100%;
    }

    .conteneur-graphique{
        height: 300px;
    }


}

/* Zone Tableaux ------------------------------------------------------------------*/




.table-responsive {
    width: 100%;
    overflow-x: auto;
    height: stretch;
}

.tableau-cfd {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.tableau-cfd th, 
.tableau-cfd td {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    text-align: left;
}

.tableau-cfd th {
    background-color: #f4f4f4;
    position: sticky;
    top: 0;
    z-index: 2;
    font-weight: 600;
}

.text-center { text-align: center; }
.font-bold { font-weight: bold; }

/* Couleurs sous condition */
.bg-jaune-pale { background-color: #f7ed96 !important; } /* total > 0 et <= 3 */
.bg-orange-pale { background-color: #f8cb87 !important; } /* total > 3 et dans_zto = 0 */
.bg-rouge-pale { background-color: #fd8793 !important; }  /* total > 3 et dans_zto = 1 */