/* style/components.css */

/* --- Styles pour la section "Vos données" --- */

/* Conteneur pour les tuiles DANS CETTE SECTION */
/* Défaut: 1 colonne (Mobile) */
/* Nouveau: Conteneur spécifique pour les tuiles d'importation (CSV et XML/ZIP) */
.import-tiles-container { /* <--- CHANGEMENT DE SELECTEUR */
    display: grid;
    gap: 20px; /* Conservé */
    /* margin-top: 20px; */ /* SUPPRIMÉ */
    grid-template-columns: 1fr 1fr; /* <--- CHANGEMENT : 2 colonnes */
}

/* Style de base pour une tuile (s'applique à Bienvenue, Imports, Sélecteur) */
.tile {
    background-color: #ffffff; /* Fond blanc pour les tuiles */
    border: 1px solid var(--color-border); /* Bordure grise claire */
    border-radius: 8px; /* Coins arrondis */
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); /* Ombre légère */
    display: flex;
    flex-direction: column; /* Organise le contenu en colonne */
}

/* Ajustement pour la tuile Bienvenue sortie de la grille */
#welcome-tile {
   margin-bottom: 20px; /* Espace avant la grille des autres tuiles */
   /* Autres styles si besoin (ex: background, box-shadow moins prononcée ?) */
   /* box-shadow: none; */
   /* background-color: var(--color-background); */
}


.tile h3 {
    color: var(--color-primary-dark);
    margin-top: 0;
    margin-bottom: 15px;
    display: flex; /* Pour aligner l'icône et le texte */
    align-items: center;
}

.tile h3 i {
    margin-right: 8px; /* Espace entre icône et titre de tuile */
    color: var(--color-primary-light); /* Icône en bleu clair */
}

.tile p {
    line-height: 1.6; /* Améliore la lisibilité du texte */
    margin-bottom: 10px;
    flex-grow: 1; /* Permet au paragraphe de prendre l'espace dispo si besoin */
}

.tile strong {
    color: var(--color-primary-dark);
}

.tile code { /* Style pour l'élément 'code' (ex: nom de fichier) */
    background-color: var(--color-grey-note);
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
}


/* Style pour le conteneur du titre et des actions */
.section-title-container {
    display: flex; /* Met le titre et les boutons sur la même ligne */
    justify-content: space-between; /* Espace entre le titre et les boutons */
    align-items: center; /* Aligne verticalement au centre */
    margin-bottom: 25px; /* Conserve la marge sous le titre */
    padding-bottom: 10px; /* Conserve le padding sous le titre */
    border-bottom: 2px solid var(--color-border); /* Conserve la bordure */
    gap: 15px; /* Espace si les éléments passent à la ligne sur petit écran */
    flex-wrap: wrap; /* Permet aux boutons de passer à la ligne si pas assez de place */
}

/* Ajustement pour le H2 pour qu'il ne prenne pas toute la largeur */
.section-title-container h2 {
    margin: 0; /* Retire les marges par défaut du H2 */
    padding: 0;
    border: none; /* La bordure est maintenant sur le conteneur */
    display: inline-flex; /* Pour aligner icône et span */
    align-items: center;
    flex-grow: 1; /* Permet au titre de prendre l'espace dispo */
}


/* Conteneur pour les boutons à côté du titre */
.section-title-actions {
    display: flex;
    gap: 10px; /* Espace entre les boutons */
    flex-shrink: 0; /* Empêche les boutons de rétrécir */
}

/* Style générique pour les boutons d'action près du titre */
.btn-action {
    padding: 5px 10px;
    font-size: 0.85em;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px; /* Espace entre icône et texte du bouton */
}
.btn-action i {
    font-size: 0.9em; /* Icône légèrement plus petite */
}

/* Style spécifique bouton Démo */
.btn-demo {
    background-color: var(--color-grey-note);
    border-color: #ced4da;
    color: var(--color-text-muted);
}
.btn-demo:hover {
    background-color: #e2e6ea;
    border-color: #dae0e5;
    color: var(--color-text);
}
body[data-theme="dark"] .btn-demo {
     background-color: #444;
     border-color: #555;
     color: #ccc;
}
 body[data-theme="dark"] .btn-demo:hover {
     background-color: #555;
     border-color: #666;
     color: #fff;
}

/* Style spécifique bouton Reset */
.btn-reset {
    background-color: var(--color-danger-bg);
    border-color: rgba(var(--color-danger-rgb), 0.3);
    color: var(--color-danger);
}
.btn-reset:hover {
    background-color: rgba(var(--color-danger-rgb), 0.2);
    border-color: rgba(var(--color-danger-rgb), 0.5);
    color: var(--color-danger);
}
 body[data-theme="dark"] .btn-reset {
     background-color: #3e1c1f;
     border-color: rgba(var(--color-danger-rgb), 0.5);
     color: var(--color-danger);
 }
  body[data-theme="dark"] .btn-reset:hover {
     background-color: #5a2a2e;
     border-color: rgba(var(--color-danger-rgb), 0.7);
     color: #f17c89;
 }

/* ================================================ */
/* === NOUVEAU : Style pour rendre la tuile inactive === */
/* ================================================ */
/* Appliquer la classe .inactive à #level-selector-tile via JS */
.tile.inactive {
    opacity: 0.6;
    background-color: var(--color-background); /* Optionnel: fond légèrement grisé */
    cursor: not-allowed; /* Indique visuellement l'inactivité */
}
/* Désactive les clics sur le contenu de la tuile inactive */
.tile.inactive > * { /* Cible les enfants directs */
     pointer-events: none;
     user-select: none; /* Empêche sélection texte */
}
/* ================================================ */
/* === FIN Style Inactif === */
/* ================================================ */
/* --- Styles pour les Tableaux (base pour .results-table et autres) --- */
.table-container {
    /* overflow-x: auto; Permet le défilement horizontal sur petits écrans */
    border: 1px solid var(--color-border);
    border-radius: 8px; /* Coins arrondis pour le conteneur du tableau */
    margin-bottom: 20px; /* Espace après le tableau */
    background-color: var(--color-tile-background, #ffffff); /* Fond du conteneur */
}

/* Zone de Glisser-Déposer et Bouton d'Import */
.file-drop-zone {
    border: 1px dotted var(--color-border); border-radius: 8px; padding: 15px 20px;
    text-align: center; background-color: #ffffff; margin-top: 10px; margin-bottom: 10px;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
    display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 150px;
}
.file-drop-zone.dragover { border: 1px solid var(--color-primary-light); background-color: var(--color-info-bg); }
.drop-zone-text-primary { font-size: 1.1em; color: var(--color-text-muted); margin-bottom: 8px; }
.drop-zone-text-secondary { font-size: 0.9em; color: var(--color-text-muted); margin-bottom: 15px; margin-top: 0; }
.file-drop-zone > *:last-child { margin-bottom: 0; }


/* Style de base pour les boutons */
.btn-import {
    background-color: var(--color-primary-light); color: white; border: none; padding: 10px 20px;
    border-radius: 5px; cursor: pointer; font-family: var(--font-main); font-size: 1em;
    transition: background-color 0.3s ease; display: inline-flex; align-items: center; justify-content: center;
}
.btn-import:hover { background-color: var(--color-primary-dark); }
.btn-import i { margin-right: 8px; }

/* Timestamp de l'import */
.import-timestamp { font-size: 0.85em; color: var(--color-text-muted); margin-top: 10px; text-align: right; }


/* Style pour la zone affichant la liste des fichiers importés */
.file-list-area {
    font-size: 0.9em; margin-top: 15px; margin-bottom: 15px; padding: 10px 15px;
    background-color: var(--color-background); border: 1px solid var(--color-border); border-radius: 5px;
    height: 150px; /* Fixe la hauteur pour éviter le "blanc" et le décalage */
    overflow-y: auto; /* Permet le défilement si le contenu dépasse */
}
.file-list-area p { margin: 0 0 5px 0; }
.file-list-area p:last-of-type { margin-bottom: 0; }
.file-list-area ul { list-style: none; padding-left: 0; margin: 5px 0; max-height: 100px; overflow-y: auto; background-color: #fff; border: 1px solid var(--color-border); border-radius: 3px; }
.file-list-area ul li { margin-bottom: 0; padding: 5px 10px; border-bottom: 1px dashed var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.file-list-area ul li:last-child { border-bottom: none; }
.file-list-name { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 15px; }
.file-list-name i { margin-right: 6px; color: var(--color-text-muted); font-size: 0.9em; }
.file-list-count { flex-shrink: 0; font-size: 0.9em; color: var(--color-primary-dark); font-weight: bold; white-space: nowrap; }
.file-list-area em { color: var(--color-text-muted); font-size: 0.9em; display: block; margin-top: 8px; }


/* Note d'information */
.info-note { background-color: var(--color-grey-note); border-radius: 5px; padding: 10px 15px; margin-top: 15px; font-size: 0.9em; border-left: 4px solid var(--color-primary-light); }
.info-note p { margin: 0; color: var(--color-text-muted); line-height: 1.5; }
.info-note i { margin-right: 5px; color: var(--color-primary-light); }

/* Style pour les messages d'erreur */
.error-message { color: var(--color-danger, #dc3545); background-color: var(--color-danger-bg, #f8d7da); border: 1px solid var(--color-danger, #f5c6cb); border-radius: 5px; padding: 10px 15px; margin-top: 10px; font-size: 0.9em; }

/* *** MODIFIÉ : Style pour les éléments du sélecteur de niveau (Vos données) *** */
/* Empêche le dernier paragraphe AVANT le sélecteur de niveau de s'étirer */
/* Ceci force le conteneur de niveaux à rester collé en haut */
#level-selector-tile > p:last-of-type {
    flex-grow: 0; /* Annule l'étirement */
}

/* Le reste de vos styles pour le sélecteur (gardez-les) */
#level-selector-container {
    flex-grow: 0; /* Empêche ce conteneur de s'étirer (sécurité) */
}
#level-selector-container .level-checkbox-item {
    display: block;
    margin-bottom: 8px;
}
#level-selector-container .level-checkbox-item label {
    margin-left: 5px; cursor: pointer; user-select: none; vertical-align: middle;
}
#level-selector-container .level-checkbox-item input[type="checkbox"] {
    cursor: pointer; vertical-align: middle; accent-color: var(--color-primary-light); margin: 0;
}

/* *** FIN MODIFICATION *** */

/* --- Fin des styles pour "Vos données" --- */


/* --- Styles pour l'en-tête commun des sections --- */
.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px solid var(--color-border); }
.section-header h2 { margin: 0; flex-grow: 1; }

/* --- Styles pour la section "Résultats et suivi" --- */
.table-controls { flex-grow: 1; display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 15px; }
.search-area { display: flex; align-items: center; flex-grow: 1; min-width: 250px; gap: 10px; }
#search-input { padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 0.95em; box-sizing: border-box; flex-grow: 1; max-width: 310px; }
#search-input:focus { border-color: var(--color-primary-light); outline: none; box-shadow: 0 0 3px var(--color-primary-light); }
.count-indicator { font-size: 0.9em; color: var(--color-text-muted); white-space: nowrap; flex-shrink: 0; }
.control-buttons { display: flex; gap: 10px; flex-shrink: 0; }
.btn-export { background-color: #6c757d; color: white; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-family: var(--font-main); font-size: 0.9em; transition: background-color 0.3s ease, opacity 0.3s ease; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
.btn-export:hover { background-color: #5a6268; opacity: 0.9; }
.btn-export:disabled { background-color: #adb5bd; cursor: not-allowed; opacity: 0.7;}
.btn-export i { margin-right: 6px; }
#results-toggle-column-filters-btn { /* Hérite de .btn-toggle-filters */ }
#results-toggle-column-filters-btn:disabled { /* Hérite de .btn-export:disabled */ }

/* Tableau des résultats */
.results-table { width: 100%; border-collapse: collapse; margin-top: 0; font-size: 0.9em; table-layout: fixed; word-wrap: break-word; overflow-wrap: break-word; }
.results-table th, .results-table td { border: 1px solid var(--color-border); padding: 8px 12px; text-align: left; vertical-align: middle; }
.results-table th { background-color: var(--color-grey-note); font-weight: bold; white-space: normal; /* Allow text wrapping */ overflow-wrap: break-word; /* Break long words if necessary */ }
/* --- Styles pour les Badges de Statut (Basé sur le style de l'Aide) --- */

/* Style commun (anciennement #aide .status-cell) */
.status-badge {
    display: inline-block;
    padding: 2px 5px;      /* Padding du style Aide */
    border-radius: 4px;    /* Coins arrondis du style Aide */
    font-size: 0.85em;     /* Taille police du style Aide */
    font-weight: 500;      /* Poids police du style Aide */
    text-align: center;
    min-width: 90px;       /* Largeur min du style Aide */
    vertical-align: middle;
    line-height: 1.4;
    border: 1px solid transparent; /* Bordure par défaut */
}

/* Styles spécifiques (anciennement #aide .status-...) */
.status-validee {
    background-color: var(--color-success-bg); /* Fond pâle */
    color: var(--color-success);              /* Texte vif */
    border-color: rgba(var(--color-success-rgb), 0.3); /* Bordure légère */
}
.status-rejetee {
    background-color: var(--color-danger-bg);  /* Fond pâle */
    color: var(--color-danger);               /* Texte vif */
    border-color: rgba(var(--color-danger-rgb), 0.3);  /* Bordure légère */
}
.status-non-presentee {
    background-color: var(--color-info-bg);     /* Fond pâle */
    color: var(--color-info);                 /* Texte vif */
    border-color: rgba(var(--color-info-rgb), 0.3);   /* Bordure légère */
}
/* Style pour N/A */
.status-na {
    background-color: var(--color-grey-note);
    color: var(--color-text-muted);
    border-color: var(--color-border);
    font-weight: normal;
}

/* Styles spécifiques pour le mode sombre (si activé) */
body[data-theme="dark"] .status-badge {
    /* Le style de base devrait s'adapter via les variables */
}
/* Ajuster fonds/couleurs/bordures sombres pour correspondre au style "Aide" */
body[data-theme="dark"] .status-validee {
    background-color: #1c3a27; /* Fond vert très sombre */
    color: var(--color-success);      /* Texte vert vif */
    border-color: rgba(var(--color-success-rgb), 0.5);
}
body[data-theme="dark"] .status-rejetee {
    background-color: #3e1c1f; /* Fond rouge très sombre */
    color: var(--color-danger);       /* Texte rouge vif */
    border-color: rgba(var(--color-danger-rgb), 0.5);
}
body[data-theme="dark"] .status-non-presentee {
    background-color: #1a3a4a; /* Fond bleu très sombre */
    color: var(--color-info);         /* Texte bleu vif */
    border-color: rgba(var(--color-info-rgb), 0.5);
}
body[data-theme="dark"] .status-na {
    background-color: #333;
    color: #999;
    border-color: #555;
}

.results-table td:nth-child(4), .results-table td:nth-child(5), .results-table td:nth-child(6), .results-table td:nth-child(7), .results-table td:nth-child(8),
.results-table th:nth-child(4), .results-table th:nth-child(5), .results-table th:nth-child(6), .results-table th:nth-child(7), .results-table th:nth-child(8) { text-align: center; }
/* --- Styles AJOUTÉS pour les Badges de Statut dans le Tableau Résultats --- */


@media (max-width: 600px) { .results-table th, .results-table td { padding: 6px 8px; } .results-table { font-size: 0.85em; } }

/* Tri du tableau */
.results-table th[data-sort-key] { cursor: pointer; position: relative; padding-right: 20px; user-select: none; }
.results-table th[data-sort-key]:hover { background-color: #e0e0e0; }
.sort-indicator { display: none; /* Hide by default */ width: 1em; height: 1em; margin-left: 6px; text-align: center; line-height: 1; vertical-align: middle; color: var(--color-text-muted); font-size: 0.8em; }
.sort-indicator.asc, .sort-indicator.desc { display: inline-block; /* Show when active */ }
.sort-indicator.asc::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f0de"; color: var(--color-primary-dark); }
.sort-indicator.desc::before { font-family: "Font Awesome 6 Free"; font-weight: 900; content: "\f0dd"; color: var(--color-primary-dark); }

/* --- Styles pour la section Statistiques --- */

/* Tuiles Stats */
.stats-tiles-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-tile { background-color: #ffffff; border: 1px solid var(--color-border); border-radius: 8px; padding: 15px 20px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); display: flex; align-items: flex-start; gap: 15px; overflow: hidden; }
.tile-icon { padding: 10px; border-radius: 50%; color: #fff; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-sizing: border-box; }
.icon-total { background-color: var(--color-primary, #007bff); } .icon-success { background-color: var(--color-success, #28a745); } .icon-danger { background-color: var(--color-danger, #dc3545); } .icon-info { background-color: var(--color-info, #17a2b8); }
.stat-content { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.stat-value { font-size: 2em; font-weight: bold; color: var(--color-text-strong, var(--color-text)); line-height: 1.1; margin: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label { font-size: 0.9em; color: var(--color-text-muted); margin: 0; text-align: left; margin-top: 2px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Conteneurs Graphiques / Compétences */
.chart-container, .competency-tiles-container { background-color: #ffffff; padding: 20px; border: 1px solid var(--color-border); border-radius: 8px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); margin-bottom: 20px; min-height: 100px; display: flex; flex-direction: column; color: var(--color-text-muted); }
 .chart-container h3, .competency-tiles-container h3 { margin-top: 0; margin-bottom: 15px; text-align: center; color: var(--color-text); }
 .chart-context-info { font-size: 0.8em; color: var(--color-text-muted); text-align: center; margin-top: 10px; }
 .competency-scale-info { font-size: 0.7em; font-weight: normal; color: var(--color-text-muted); }

/* Tuiles Compétences */
.competency-tiles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; }
.competency-tile { border: 1px solid var(--color-border); border-radius: 5px; padding: 12px 15px; display: flex; flex-direction: column; justify-content: space-between; min-height: 80px; color: white; position: relative; overflow: hidden; }
.competency-tile.domain-1 { background-color: #F17642; border-left: 5px solid #d9683a; } .competency-tile.domain-2 { background-color: #32AD88; border-left: 5px solid #2b9374; } .competency-tile.domain-3 { background-color: #2985FF; border-left: 5px solid #2474e0; } .competency-tile.domain-4 { background-color: #D62091; border-left: 5px solid #b81c7e; } .competency-tile.domain-5 { background-color: #5A3A87; border-left: 5px solid #4d3173; }
.competency-name { font-size: 0.85em; font-weight: bold; line-height: 1.3; margin-bottom: 8px; }
.competency-average { font-size: 1.4em; align-self: flex-end; white-space: nowrap; }
.avg-score-value { font-weight: bold; }
.avg-score-suffix { font-size: 0.48em; font-weight: normal; color: inherit; margin-left: 1px; }
.competency-tile-placeholder { display: none; }
@media (min-width: 992px) { .competency-tiles-grid { grid-template-columns: repeat(4, 1fr); } .competency-tile-placeholder { display: block; visibility: hidden; } }
@media (min-width: 768px) and (max-width: 991px) { .competency-tiles-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 767px) { .competency-tiles-grid { grid-template-columns: 1fr; } }

/* =============================================================== */
/* === STYLES POUR LES FILTRES (STATS & RESULTATS)             === */
/* =============================================================== */

/* --- Styles pour le Titre/Sous-titre Dynamique (Stats & Résultats) --- */
.stats-population-info,
.results-population-info { /* Commun aux deux sections */
    padding: 5px 0 15px 0; margin-bottom: 20px; text-align: center;
    border-bottom: 1px dashed var(--color-border);
}
.population-title { /* Cible le H3 */
    font-size: 1.15em; color: var(--color-text); margin: 0 0 3px 0; font-weight: 600;
}
.population-subtitle { /* Cible le P */
    font-size: 0.9em; color: var(--color-text-muted); margin: 0; min-height: 1.2em;
}
/* --- Fin Titre/Sous-titre --- */

/* --- Styles Zone Rétractable et Filtres Internes (Stats & Résultats) --- */

/* En-tête Stats (actions à droite) */
.stats-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* Bouton Toggle Filtres (commun Stats & Résultats) */
.btn-toggle-filters {
    background-color: var(--color-background); color: var(--color-primary-dark);
    border: 1px solid var(--color-border); padding: 8px 12px; font-size: 0.9em;
    border-radius: 5px; cursor: pointer; transition: all 0.3s ease;
    display: inline-flex; align-items: center;
}
.btn-toggle-filters:not(:disabled):hover { background-color: var(--color-grey-note); border-color: #ccc; }
/* Style désactivé (hérite de :disabled de .btn-export via sélecteur ID) */
#results-toggle-column-filters-btn:disabled { /* styles déjà dans .btn-export:disabled */ }
.btn-toggle-filters i { margin-right: 6px; }
.btn-toggle-filters .toggle-icon { display: inline-block; margin-left: 8px; transition: transform 0.3s ease-out; font-size: 0.8em; }
.btn-toggle-filters.expanded .toggle-icon { transform: rotate(180deg); }


/* Conteneur Rétractable (commun Stats & Résultats) */
/* ID: #stats-filters-collapsible-content / #results-filters-collapsible-content */
.collapsible-content {
    transition: max-height 0.4s ease-out, opacity 0.3s 0.1s ease-out, margin-bottom 0.4s ease-out, padding-top 0.4s ease-out, padding-bottom 0.4s ease-out, border-width 0.4s ease-out;
    overflow: hidden;
    /* Styles quand VISIBLE */
    background-color: var(--color-background); padding: 15px 20px; border: 1px solid var(--color-border);
    border-radius: 8px; margin-bottom: 30px; max-height: 1000px; opacity: 1;
}
/* Styles quand MASQUÉ (classe .collapsed) */
.collapsible-content.collapsed {
    max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0;
    border-top-width: 0; border-bottom-width: 0;
    transition: max-height 0.3s ease-in, opacity 0.2s ease-in, margin-bottom 0.3s ease-in, padding-top 0.3s ease-in, padding-bottom 0.3s ease-in, border-width 0.3s ease-in;
}

/* Styles pour les groupes de filtres internes (Niveau, Classe, Statut, CRCN) */
.filter-group { margin-bottom: 15px; }
.filter-group:last-child { margin-bottom: 0; }
.filter-group-label { display: block; font-weight: bold; color: var(--color-text); margin-bottom: 10px; }

/* Boutons Tous/Aucun */
.filter-buttons { display: flex; gap: 10px; margin-bottom: 10px; }
.filter-buttons-inline { margin-bottom: 5px; margin-left: 5px; }
.btn-filter-all, .btn-filter-none { padding: 3px 8px; font-size: 0.8em; border: 1px solid var(--color-border); border-radius: 4px; cursor: pointer; background-color: #ffffff; color: var(--color-text-muted); transition: all 0.2s ease; }
.btn-filter-all:hover { background-color: var(--color-success-bg); border-color: var(--color-success); color: var(--color-success); }
.btn-filter-none:hover { background-color: var(--color-danger-bg); border-color: var(--color-danger); color: var(--color-danger); }

/* Conteneurs et items Checkbox DANS LES FILTRES */
.filter-checkboxes-container {
    display: flex; flex-wrap: wrap; /* Affichage en ligne avec retour */
    gap: 5px 15px; /* Espace vertical et horizontal */
    padding-left: 5px;
}
/* Style item checkbox DANS LES FILTRES */
.collapsible-content .filter-checkbox-item {
    /* display: inline-flex; /* Assuré par le style de base .level-checkbox-item maintenant */
    width: auto; /* Ne force pas la largeur */
    margin-bottom: 0; /* Géré par gap */
}
.filter-checkbox-item label { margin-left: 5px; cursor: pointer; user-select: none; color: var(--color-text); font-size: 0.95em; vertical-align: middle; }
.filter-checkbox-item input[type="checkbox"] { cursor: pointer; vertical-align: middle; accent-color: var(--color-primary-light); }

/* Fieldsets pour les classes */
.class-filter-fieldset { border: 1px solid var(--color-border); border-radius: 5px; padding: 10px 15px 15px 15px; margin-top: 10px; }
.class-filter-fieldset legend { font-weight: bold; color: var(--color-primary-dark); padding: 0 8px; font-size: 0.9em; margin-left: 5px; }

/* Colonnes CSS pour les classes - Désactivé */
/* .class-filter-fieldset .filter-checkboxes-container { column-width: 180px; column-gap: 20px; } */
/* .class-filter-fieldset .filter-checkbox-item { break-inside: avoid-column; display: inline-block; width: 100%; margin-bottom: 5px; } */
/* @media (max-width: 480px) { .class-filter-fieldset .filter-checkboxes-container { column-width: auto; column-count: 1; } } */

/* Placeholder */
.filter-placeholder { font-style: italic; color: var(--color-text-muted); font-size: 0.9em; }

/* --- Fin des styles spécifiques aux Filtres --- */

/* --- Styles pour la Section Ressources --- */

.ressources-tiles-container {
    display: grid;
    /* Crée des colonnes flexibles (min 250px, max 1fr) */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px; /* Espace entre les tuiles */
    margin-top: 20px; /* Espace après le paragraphe introductif */
}

.resource-tile {
    display: flex; /* Utiliser flex pour la structure interne */
    flex-direction: column; /* Image au-dessus, contenu en dessous */
    background-color: #ffffff; /* Fond blanc (sera surchargé en mode sombre) */
    border: 1px solid var(--color-border);
    border-radius: 8px;
    text-decoration: none; /* Enlever soulignement du lien */
    color: var(--color-text); /* Couleur texte par défaut */
    overflow: hidden; /* Empêche contenu de déborder (si image trop grande) */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out; /* Pour l'effet au survol */
}

.resource-tile:hover {
    transform: translateY(-4px); /* Léger déplacement vers le haut */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); /* Ombre plus prononcée */
}

.resource-tile-image {
    height: 140px; /* Hauteur fixe pour la zone image */
    background-color: var(--color-grey-note); /* Couleur de fond placeholder */
    display: flex; /* Pour centrer l'icône placeholder */
    align-items: center;
    justify-content: center;
    /* Style pour l'icône placeholder (si vous la gardez temporairement) */
    font-size: 3em;
    color: var(--color-text-muted);
    opacity: 0.5;
    /* Styles si vous utilisez une image de fond CSS au lieu de <img> */
    /* background-size: cover; */
    /* background-position: center; */
}

/* Style si vous utilisez une balise <img> */
.resource-tile-image img {
    display: block; /* Assure bon comportement */
    width: 100%;   /* Prend toute la largeur du conteneur */
    height: 100%;  /* Prend toute la hauteur du conteneur */
    object-fit: cover; /* Recadre l'image pour remplir sans déformer */
}


.resource-tile-content {
    padding: 15px;
    flex-grow: 1; /* Permet à cette partie de s'étendre si tuiles de hauteurs différentes */
    display: flex;
    flex-direction: column;
}

.resource-tile h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--color-primary-dark);
    font-size: 1.1em;
}

.resource-tile p {
    margin-top: 0;
    margin-bottom: 0; /* Pas de marge basse sur le dernier paragraphe */
    font-size: 0.9em;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex-grow: 1; /* Pousse le paragraphe à prendre l'espace restant */
}

/* --- Styles Ressources Mode Sombre --- */
body[data-theme="dark"] .resource-tile {
     background-color: var(--color-tile-background, #1e1e1e);
     border-color: var(--color-border, #424242);
     color: var(--color-text, #e0e0e0);
}
 body[data-theme="dark"] .resource-tile h4 {
      color: var(--color-primary-light); /* Titre plus clair */
 }
 body[data-theme="dark"] .resource-tile p {
      color: var(--color-text-muted, #bdbdbd);
 }
 body[data-theme="dark"] .resource-tile-image {
     background-color: #2a2a2a; /* Fond placeholder plus sombre */
     color: var(--color-text-muted);
 }
body[data-theme="dark"] .resource-tile:hover {
     background-color: #252525; /* Légèrement plus clair au survol */
}

/* =============================================================== */
/* === STYLES TABLEAU RÉPARTITION COMPÉTENCES (Stats)          === */
/* =============================================================== */

/* == Conteneur Principal (Style "Tuile") == */
.competency-distribution-container {
    /* Apparence générale type "carte" */
    background-color: #ffffff;
    padding: 20px;
    border: 1px solid var(--color-border);
    border-radius: 8px; /* Coins arrondis de la tuile globale */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    /* Espacement */
    margin-top: 30px;
    margin-bottom: 20px;
}
body[data-theme="dark"] .competency-distribution-container {
    background-color: var(--color-tile-background, #1e1e1e);
    border-color: var(--color-border, #424242);
}

/* == Titre du Tableau == */
#competency-distribution-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.2em;
    color: var(--color-text);
}
body[data-theme="dark"] #competency-distribution-title {
    color: var(--color-text);
}

/* == Zone des Contrôles (Légende et Boutons) == */
.competency-distribution-controls {
    display: flex;              /* Alignement horizontal */
    justify-content: space-between; /* Espace entre légende et boutons */
    align-items: center;        /* Alignement vertical */
    margin-bottom: 15px;
    gap: 20px;                  /* Espace minimum entre les groupes */
}

/* Légende Heatmap (Groupe Gauche) */
#heatmap-legend {
    display: flex;
    align-items: center;        /* Aligne icône et barre/labels verticalement */
    flex-basis: 18%;           /* Largeur de base (ajustable, ex: 30%) */
    flex-shrink: 0;            /* Empêche de rétrécir */
    min-width: 180px;          /* Largeur minimale */
    gap: 8px;                   /* Espace entre icône et barre/labels */
    box-sizing: border-box;
}

/* Icône d'info dans la légende */
.heatmap-info-icon {
    color: var(--color-text-muted);
    font-size: 1.1em;
    cursor: help;
    flex-shrink: 0;
    /* Pas besoin de marge si 'gap' sur #heatmap-legend est suffisant */
}
body[data-theme="dark"] .heatmap-info-icon {
     color: var(--color-text-muted);
}

/* Wrapper pour Barre + Labels (dans la légende) */
.heatmap-bar-labels-wrapper {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-grow: 1; /* Occupe l'espace restant dans la légende */
}

/* Barre de dégradé */
.heatmap-gradient-bar {
    height: 18px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: linear-gradient(to right,
        rgba(40, 167, 69, 0.0) 0%, rgba(40, 167, 69, 0.15) 10%,
        rgba(40, 167, 69, 0.35) 30%, rgba(40, 167, 69, 0.60) 60%,
        rgba(40, 167, 69, 0.85) 85%, rgba(40, 167, 69, 1) 100%
    );
}
body[data-theme="dark"] .heatmap-gradient-bar {
     border-color: var(--color-border);
     background: linear-gradient(to right,
         rgba(102, 187, 106, 0.0) 0%, rgba(102, 187, 106, 0.15) 10%,
         rgba(102, 187, 106, 0.35) 30%, rgba(102, 187, 106, 0.60) 60%,
         rgba(102, 187, 106, 0.85) 85%, rgba(102, 187, 106, 1) 100%
     );
}

/* Labels sous la barre (0%, 50%, 100%) */
.heatmap-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75em; /* Taille réduite */
    color: var(--color-text-muted);
    padding: 2px 2px 0 2px;
    position: relative;
    height: 1.1em;
}
.heatmap-labels span.label-50 { /* Positionnement label central */
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
body[data-theme="dark"] .heatmap-labels {
     color: var(--color-text-muted);
}

/* Groupe des boutons (à droite) */
.control-button-group {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

/* Style boutons Export et Toggle */
#competency-distribution-toggle-view,
#export-competency-distrib-csv-btn {
   font-size: 0.85em;
   padding: 5px 10px;
   /* Hérite du style .btn-toggle-filters ou .btn-export selon la classe utilisée en HTML */
}
#competency-distribution-toggle-view i,
#export-competency-distrib-csv-btn i {
    margin-right: 5px;
}


/* == Conteneur du Tableau (Pour l'arrondi) == */
.competency-distribution-table-wrapper {
    border-radius: 6px; /* Arrondi des coins du tableau */
    overflow: hidden;   /* Masque les coins carrés des cellules */
    margin-top: 10px;   /* Espace après les contrôles/légende */
    /* border: 1px solid var(--color-border); */ /* Option: bordure sur le wrapper */
}

/* == Styles du Tableau lui-même == */
.competency-distribution-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.8em;
    /* margin-top: 0; */ /* Retiré car mis sur le wrapper */
    border: none;       /* Pas de bordure sur la table si le wrapper en a une ou si on arrondit juste */
}

/* Cellules (th et td) */
.competency-distribution-table th,
.competency-distribution-table td {
    border: 1px solid var(--color-border); /* Garde les bordures internes */
    padding: 5px 3px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
body[data-theme="dark"] .competency-distribution-table th,
body[data-theme="dark"] .competency-distribution-table td {
    border-color: var(--color-border);
}

/* --- Styles des En-têtes (Thead) --- */
.competency-distribution-table thead th {
    font-weight: bold;
}

/* En-tête "Niveau" */
.competency-distribution-table thead th[rowspan="2"] {
     background-color: #e9ecef;
     width: 75px;
     text-align: center; /* Centré */
     color: var(--color-text);
     border-left: none; /* Retire bordure si wrapper a une bordure */
     border-top: none;
}
body[data-theme="dark"] .competency-distribution-table thead th[rowspan="2"] {
     background-color: #333;
     color: var(--color-text);
}

/* En-têtes Ligne 1 (Noms Domaines) */
.competency-distribution-table thead tr:first-child th {
    font-size: 0.9em;
    padding: 6px 3px;
    white-space: normal;
    border-top: none; /* Retire bordure si wrapper a une bordure */
}
/* Retire bordure droite du dernier en-tête de domaine */
.competency-distribution-table thead tr:first-child th:last-child {
     border-right: none;
}


/* En-têtes Ligne 2 (Numéros Compétences) */
.competency-distribution-table thead tr:last-child th {
    font-size: 0.95em;
    width: calc((100% - 75px) / 16); /* Largeur calculée */
    /* border-top: none; */ /* La bordure interne est ok ici */
}
/* Retire bordure droite du tout dernier en-tête de compétence */
.competency-distribution-table thead tr:last-child th:last-child {
     border-right: none;
}


/* Application Couleurs Domaine (Ligne 1 et Ligne 2 via JS) */
.competency-distribution-table thead th.domain-header-1 { background-color: #F17642 !important; color: white !important; }
.competency-distribution-table thead th.domain-header-2 { background-color: #32AD88 !important; color: white !important; }
.competency-distribution-table thead th.domain-header-3 { background-color: #2985FF !important; color: white !important; }
.competency-distribution-table thead th.domain-header-4 { background-color: #D62091 !important; color: white !important; }
.competency-distribution-table thead th.domain-header-5 { background-color: #5A3A87 !important; color: white !important; }


/* --- Styles du Corps (Tbody) --- */

/* Première colonne (Labels Niveaux) */
.competency-distribution-table tbody td:first-child {
    width: 75px;
    text-align: center; /* Centré */
    font-weight: bold;
    background-color: var(--color-background);
    font-size: 0.9em; /* Taille police labels niveaux (un peu réduite) */
    border-left: none; /* Retire bordure si wrapper a une bordure */
}
body[data-theme="dark"] .competency-distribution-table tbody td:first-child {
     background-color: #1e1e1e;
}
/* Retire bordure basse pour la dernière ligne, 1ere cellule */
.competency-distribution-table tbody tr:last-child td:first-child {
     border-bottom: none;
}

/* Cellules de données (heatmap) */
.competency-distribution-table tbody td {
    font-size: 0.9em; /* Taille police données (un peu réduite) */
    position: relative;
}
/* Retire bordure basse pour la dernière ligne, cellules de données */
.competency-distribution-table tbody tr:last-child td {
     border-bottom: none;
}
/* Retire bordure droite pour la dernière cellule de chaque ligne */
.competency-distribution-table tbody td:last-child {
    border-right: none;
}


/* Styles Heatmap */
.competency-distribution-table tbody td.heatmap-cell { background-color: transparent; transition: background-color 0.2s ease-in-out; }
.competency-distribution-table tbody td.heatmap-10 { background-color: rgba(40, 167, 69, 0.15); }
.competency-distribution-table tbody td.heatmap-30 { background-color: rgba(40, 167, 69, 0.35); }
.competency-distribution-table tbody td.heatmap-60 { background-color: rgba(40, 167, 69, 0.6); }
.competency-distribution-table tbody td.heatmap-85 { background-color: rgba(40, 167, 69, 0.85); }
.competency-distribution-table tbody td.heatmap-100 { background-color: rgba(40, 167, 69, 1); color: white; }
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-10 { background-color: rgba(102, 187, 106, 0.15); }
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-30 { background-color: rgba(102, 187, 106, 0.35); }
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-60 { background-color: rgba(102, 187, 106, 0.6); }
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-85 { background-color: rgba(102, 187, 106, 0.85); }
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-100 { background-color: rgba(102, 187, 106, 1); color: #121212; }

/* Style Highlight Max */
.competency-distribution-table tbody td.highlight-max { font-weight: bold; }

/* Mise en évidence de la CELLULE au survol */
.competency-distribution-table tbody td.heatmap-cell:hover {
    outline: 2px solid var(--color-accent, orange);
    outline-offset: -2px;
    cursor: default;
}
body[data-theme="dark"] .competency-distribution-table tbody td.heatmap-cell:hover {
    outline-color: yellow;
}

/* =============================================================== */
/* === FIN STYLES TABLEAU RÉPARTITION COMPÉTENCES            === */
/* =============================================================== */

/* --- Styles pour le bouton de suppression de fichier --- */
.delete-file-btn {
    background: none;
    border: none;
    color: var(--color-danger);
    cursor: pointer;
    padding: 0 5px;
    font-size: 0.9em;
    margin-left: auto; /* Pousse le bouton à droite */
}

.delete-file-btn:hover {
    color: var(--color-danger-dark); /* Une version plus foncée de la couleur danger au survol */
}

.delete-file-btn i {
    pointer-events: none; /* Assure que le clic est bien sur le bouton */
}

@media print {
    /* --- Styles d'impression généraux --- */
    body.print-stats .sidebar,
    body.print-stats .main-nav,
    body.print-stats .sidebar-footer,
    body.print-stats .main-content > section:not(#statistiques), /* Masque les autres sections */
    body.print-stats #statistiques .stats-filters, /* Masque la zone de filtres */
    body.print-stats footer.privacy-notice {
        display: none !important;
    }

    body.print-stats .main-content {
        margin-left: 0 !important;
        padding: 10px !important; /* Réduit pour maximiser l'espace */
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    
    body.print-stats #statistiques {
        padding-top: 0 !important;
        box-sizing: border-box;
    }

    /* Conserver l'en-tête de la section Statistiques et ses boutons */
    body.print-stats #statistiques .section-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-bottom: 1px solid #666 !important;
        padding-bottom: 10px !important;
        margin-bottom: 15px !important;
        page-break-after: avoid !important; /* Éviter une coupure juste après l'en-tête */
    }
    body.print-stats #statistiques .section-header h2 {
        font-size: 1.5em !important; /* Taille ajustée */
        color: #000 !important;
        margin: 0 !important;
    }
    body.print-stats #statistiques .section-header .stats-actions {
        display: flex !important; /* S'assurer que les actions sont visibles */
        gap: 8px !important;
    }
    /* --- Styles pour les boutons d'action dans l'en-tête de la section Statistiques à l'impression --- */
    body.print-stats #statistiques .section-header .stats-actions button {
        display: inline-flex !important;
        font-size: 0.85em !important; /* Légèrement plus grand pour lisibilité */
        padding: 5px 10px !important; /* Padding un peu plus généreux */
        border-radius: 5px !important; /* Conserver l'arrondi */
        border-width: 1px !important; /* S'assurer que la bordure est de 1px */
        border-style: solid !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        /* Les couleurs spécifiques seront héritées ou surchargées ci-dessous si nécessaire */
    }

    /* Conserver le style spécifique de .btn-export */
    body.print-stats #statistiques .section-header .stats-actions button.btn-export {
        background-color: #6c757d !important; /* Couleur originale */
        color: white !important; /* Couleur originale */
        border-color: #6c757d !important; /* Ou transparent si pas de bordure à l'origine */
    }
     body.print-stats #statistiques .section-header .stats-actions button.btn-export i {
        color: white !important;
     }

    /* Conserver le style spécifique de .btn-toggle-filters */
    body.print-stats #statistiques .section-header .stats-actions button.btn-toggle-filters {
        background-color: var(--color-background) !important; /* Couleur originale */
        color: var(--color-primary-dark) !important; /* Couleur originale */
        border-color: var(--color-border) !important; /* Couleur originale */
    }
    body.print-stats #statistiques .section-header .stats-actions button.btn-toggle-filters i,
    body.print-stats #statistiques .section-header .stats-actions button.btn-toggle-filters .toggle-icon {
        color: var(--color-primary-dark) !important; /* Couleur originale */
    }
    
    /* Style général pour les icônes dans les boutons d'action à l'impression */
     body.print-stats #statistiques .section-header .stats-actions button i {
        margin-right: 5px !important; /* Espace cohérent */
     }
    
    body.print-stats #statistiques .stats-population-info {
        text-align: center;
        padding-bottom: 8px;
        margin-bottom: 15px;
        border-bottom: 1px dashed #ccc !important;
        page-break-after: avoid !important;
    }
    body.print-stats #statistiques .population-title {
        font-size: 1.2em !important;
        color: #000 !important;
    }
    body.print-stats #statistiques .population-subtitle {
        font-size: 0.9em !important;
        color: #333 !important;
    }

    /* Styles pour les 4 tuiles de statistiques */
    body.print-stats .stats-tiles-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Crucial pour empêcher le retour à la ligne */
        justify-content: space-between !important;
        align-items: stretch !important; 
        gap: 6px !important; /* Espace minimaliste */
        padding: 0 !important;
        margin-bottom: 20px !important;
        page-break-inside: avoid !important;
        width: 100% !important; 
        box-sizing: border-box;
    }

    body.print-stats .stat-tile {
        flex: 1 1 auto !important; /* Permet de grandir et rétrécir, base automatique */
        min-width: 0 !important; /* Important pour que flex-shrink fonctionne bien avec flex-basis: auto */
        padding: 6px !important; /* Padding réduit */
        box-shadow: none !important;
        border: 1px solid #666 !important; /* Bordure un peu plus visible */
        font-size: 0.75em !important; /* Taille de police globale de la tuile encore réduite */
        page-break-inside: avoid !important;
        display: flex !important; 
        align-items: center !important; 
        gap: 5px !important; 
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: #ffffff !important; /* Fond explicitement blanc */
    }

    body.print-stats .stat-tile .tile-icon {
        display: flex !important; 
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important; /* Pas de padding interne à l'icône elle-même */
        width: 28px !important;  /* Taille fixe */
        height: 28px !important; /* Taille fixe */
        border-radius: 50% !important;
        font-size: 14px !important; /* Taille de l'icône FA (en px pour consistance) */
        line-height: 28px !important; /* Pour centrer verticalement l'icône FA si besoin */
        text-align: center !important; /* Pour centrer horizontalement l'icône FA */
        color: #ffffff !important; /* Couleur de l'icône FA elle-même */
        flex-shrink: 0 !important; 
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    /* Forcer les couleurs de fond des icônes */
    body.print-stats .stat-tile i.icon-total { background-color: var(--color-primary, #007bff) !important; }
    body.print-stats .stat-tile i.icon-success { background-color: var(--color-success, #28a745) !important; }
    body.print-stats .stat-tile i.icon-danger { background-color: var(--color-danger, #dc3545) !important; }
    body.print-stats .stat-tile i.icon-info { background-color: var(--color-info, #17a2b8) !important; }

    body.print-stats .stat-tile .stat-content {
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        flex-grow: 1 !important;
        min-width: 0; 
        text-align: left !important; /* Assurer l'alignement à gauche du texte */
    }
    body.print-stats .stat-tile .stat-value {
        font-size: 1.4em !important; /* Taille ajustée */
        font-weight: bold !important;
        margin-bottom: 0px !important; /* Pas de marge en bas */
        color: #000000 !important;
        line-height: 1.1 !important;
    }
    body.print-stats .stat-tile .stat-label {
        font-size: 0.9em !important; /* Un peu plus grand pour la lisibilité du label */
        line-height: 1.1 !important;
        color: #111111 !important; /* Un peu plus foncé */
        white-space: normal !important; 
    }


    /* Styles pour tous les conteneurs de graphiques et compétences */
    body.print-stats #statistiques .chart-container,
    body.print-stats #statistiques .competency-tiles-container,
    body.print-stats #statistiques .competency-distribution-container {
        display: block !important;
        padding: 15px !important;
        border: 1px solid #bbb !important;
        box-shadow: none !important;
        page-break-inside: avoid !important; /* Tenter d'éviter les coupures */
        margin-bottom: 20px !important;
        -webkit-print-color-adjust: exact !important; /* Pour les couleurs des graphiques/tuiles compétences */
        print-color-adjust: exact !important;
    }
    body.print-stats #statistiques .chart-container h3,
    body.print-stats #statistiques .competency-tiles-container h3,
    body.print-stats #statistiques .competency-distribution-container h3 {
        font-size: 1.2em !important;
        margin-bottom: 10px !important;
        color: #000 !important;
    }
    body.print-stats #statistiques .chart-context-info {
        font-size: 0.75em !important;
        margin-top: 8px !important;
        color: #555 !important;
    }
    
    /* Spécifique pour les tuiles compétences pour forcer les couleurs */
    body.print-stats .competency-tile {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color: white !important; /* Assurer que le texte est blanc sur fond coloré */
    }
    body.print-stats .competency-tile.domain-1 { background-color: #F17642 !important; border-left-color: #d9683a !important; }
    body.print-stats .competency-tile.domain-2 { background-color: #32AD88 !important; border-left-color: #2b9374 !important; }
    body.print-stats .competency-tile.domain-3 { background-color: #2985FF !important; border-left-color: #2474e0 !important; }
    body.print-stats .competency-tile.domain-4 { background-color: #D62091 !important; border-left-color: #b81c7e !important; }
    body.print-stats .competency-tile.domain-5 { background-color: #5A3A87 !important; border-left-color: #4d3173 !important; }
    body.print-stats .competency-average { color: white !important; }


    /* Styles pour le tableau de répartition des compétences */
    body.print-stats .competency-distribution-table th,
    body.print-stats .competency-distribution-table td {
        font-size: 0.75em !important; /* Réduire un peu pour l'impression */
        padding: 4px 2px !important;
        border-color: #999 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    body.print-stats .competency-distribution-table thead th {
        color: white !important; /* Pour les en-têtes de domaine colorés */
    }
    body.print-stats .competency-distribution-table thead th[rowspan="2"] { /* En-tête "Niveau" */
        background-color: #e0e0e0 !important;
        color: #000 !important;
    }
    body.print-stats .competency-distribution-table tbody td:first-child { /* Colonne "Niveau X" */
        background-color: #f0f0f0 !important;
        color: #000 !important;
    }
    /* Forcer les couleurs de la heatmap */
    body.print-stats .competency-distribution-table tbody td.heatmap-10 { background-color: rgba(40, 167, 69, 0.15) !important; }
    body.print-stats .competency-distribution-table tbody td.heatmap-30 { background-color: rgba(40, 167, 69, 0.35) !important; }
    body.print-stats .competency-distribution-table tbody td.heatmap-60 { background-color: rgba(40, 167, 69, 0.6) !important; }
    body.print-stats .competency-distribution-table tbody td.heatmap-85 { background-color: rgba(40, 167, 69, 0.85) !important; }
    body.print-stats .competency-distribution-table tbody td.heatmap-100 { background-color: rgba(40, 167, 69, 1) !important; color: white !important; }
    body.print-stats .heatmap-gradient-bar {
        background: linear-gradient(to right,
            rgba(40, 167, 69, 0.0) 0%, rgba(40, 167, 69, 0.15) 10%,
            rgba(40, 167, 69, 0.35) 30%, rgba(40, 167, 69, 0.60) 60%,
            rgba(40, 167, 69, 0.85) 85%, rgba(40, 167, 69, 1) 100%
        ) !important;
        border: 1px solid #666 !important;
    }


    /* Configuration de la page pour l'impression */
    @page {
        size: A4 portrait; /* Forcer le mode portrait */
        margin: 1cm; /* Marges standard */
    }

    /* Éviter les veuves et orphelines si possible */
    h2, h3, h4, p {
        orphans: 3;
        widows: 3;
    }
}


/* Dans components.css ou main.css */

.competency-heatmap-table th { /* En-têtes de la heatmap */
    /* background-color: var(--color-grey-note); Déjà fait en inline style pour le sticky */
    /* Laisser l'inline style pour le background du sticky header pour qu'il prime sur les th de .results-table */
}

body[data-theme="dark"] .competency-heatmap-table th {
    /* background-color: #2a2a2a; Idem */
    /* color: var(--color-text); */ /* Le texte des th est déjà géré */
}

/* Pour la coloration de la heatmap en mode sombre,
   il faudrait définir des couleurs alternatives si celles par défaut ne conviennent pas.
   Exemple pour une cellule : */
body[data-theme="dark"] .competency-heatmap-table td[style*="background-color: #2a9d8f"] { /* Vert foncé */
    background-color: #2a9d8f !important; /* Garder la même ou ajuster */
    color: white !important;
}
body[data-theme="dark"] .competency-heatmap-table td[style*="background-color: #c7f9cc"] { /* Vert très clair */
    background-color: #3a5a40 !important; /* Alternative sombre pour le vert clair */
    color: #e0e0e0 !important;
}

/* Optionnel: Ajouts dans components.css ou main.css */

.comparison-topflop-tile h5 { /* Pour le titre de la classe dans la tuile */
    /* Style déjà géré par l'inline style, mais tu peux ajouter plus ici */
    border-bottom: 1px solid var(--color-border-light, #dee2e6); /* Ligne de séparation plus légère */
    padding-bottom: 8px;
}

/* Ajustement pour le mode sombre si les couleurs des icônes par défaut ne conviennent pas */
body[data-theme="dark"] .comparison-topflop-tile .fa-check-circle {
    color: var(--color-success); /* S'assure qu'il utilise la variable thème sombre */
}
body[data-theme="dark"] .comparison-topflop-tile .fa-exclamation-triangle {
    color: var(--color-danger); /* S'assure qu'il utilise la variable thème sombre */
}

/* --- Styles pour le Segmented Toggle (nouveau) --- */
.segmented-toggle {
    display: flex;
    border: 1px solid var(--color-border);
    border-radius: 5px;
    overflow: hidden; /* Pour que les coins arrondis s'appliquent aux boutons */
    background-color: var(--color-background); /* Fond par défaut */
}

/* Add margin-bottom to custom-groups-selection-area when it's not collapsed */
#custom-groups-selection-area:not(.collapsed) {
    margin-bottom: 25px;
}

.segmented-toggle .toggle-button {
    padding: 8px 15px;
    border: none;
    background-color: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
    flex-grow: 1; /* Pour que les boutons prennent la même largeur */
    text-align: center;
    white-space: nowrap; /* Empêche le texte de passer à la ligne */
}

.segmented-toggle .toggle-button:hover {
    background-color: var(--color-grey-note);
    color: var(--color-text);
}

.segmented-toggle .toggle-button.active {
    background-color: var(--color-primary-light);
    color: white;
    font-weight: bold;
}

/* Styles pour le mode sombre */
body[data-theme="dark"] .segmented-toggle {
    border-color: var(--color-border);
    background-color: var(--color-background);
}

body[data-theme="dark"] .segmented-toggle .toggle-button {
    color: var(--color-text-muted);
}

body[data-theme="dark"] .segmented-toggle .toggle-button:hover {
    background-color: #333;
    color: var(--color-text);
}

body[data-theme="dark"] .segmented-toggle .toggle-button.active {
    background-color: var(--color-primary-dark); /* Plus foncé en mode sombre */
    color: white;
}

/* Styles pour les contrôles de graphiques dans l'onglet Comparaison */
.chart-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 10px; /* Espace avant le canvas */
    gap: 15px; /* Espace entre le bouton et la case à cocher */
}

.chart-controls .btn-action,
.chart-controls .btn-toggle-filters { /* S'assurer que les boutons de bascule héritent bien */
    padding: 6px 12px; /* Ajuster le padding si besoin */
    font-size: 0.85em; /* Ajuster la taille de police si besoin */
}

.chart-controls .filter-checkbox-item {
    margin-left: 0; /* Annuler la marge par défaut si elle vient de .filter-checkbox-item */
    display: flex;
    align-items: center;
}

.chart-controls .filter-checkbox-item input[type="checkbox"] {
    margin-right: 5px;
}

.chart-controls .filter-checkbox-item label {
    font-size: 0.9em; /* Taille de police pour le label "Afficher moyenne" */
    color: var(--color-text-muted);
}

body[data-theme="dark"] .chart-controls .filter-checkbox-item label {
    color: var(--color-text-muted);
}

/* Styles for Competency Heatmap Table Cell Wrapping */
.competency-heatmap-table td,
.competency-heatmap-table th {
    white-space: normal; /* Allow text to wrap */
    word-wrap: break-word; /* Break long words if necessary */
    overflow-wrap: break-word; /* Ensure wrapping for very long unbreakable strings */
    vertical-align: middle; /* Align content vertically in the middle */
}

/* Ensure first column (competency names) has enough space and wraps */
.competency-heatmap-table th:first-child,
.competency-heatmap-table td:first-child {
    /* width is set by JS, but ensure wrapping properties */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: left; /* Competency names are usually left-aligned */
}

/* Data cells (class/group names in header, and average scores in body) */
.competency-heatmap-table th:not(:first-child),
.competency-heatmap-table td:not(:first-child) {
    text-align: center; /* Center align the average scores and class/group names */
    /* width is set by JS, but ensure wrapping properties */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
