/* 🎨 Variables CSS pour une gestion centralisée des couleurs et espacements */
:root {
    --primary-color: #2980b9;
    /* Bleu profond et professionnel */
    --secondary-color: #e67e22;
    /* Orange terreux pour l'accentuation */
    --accent-color: #27ae60;
    /* Vert pour les actions positives/succès */
    --background-light: #f8f9fa;
    /* Gris très clair, presque blanc */
    --background-medium: #e9ecef;
    /* Gris clair pour les dégradés */
    --text-dark: #343a40;
    /* Noir charbon pour le texte principal */
    --text-light: #ffffff;
    /* Blanc pur pour le contraste */
    --border-color-subtle: #dee2e6;
    /* Bordure très légère */
    --border-color-medium: #adb5bd;
    /* Bordure moyenne */
    --shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
    /* Ombre subtile */
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.1);
    /* Ombre moyenne pour les cartes */
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
    /* Ombre prononcée */
    --border-radius-sm: 6px;
    --border-radius-md: 10px;
    --border-radius-lg: 16px;
    --transition-fast: 0.2s ease-out;
    --transition-normal: 0.4s ease-in-out;
    --font-family-primary: 'Poppins', sans-serif;
    --font-family-secondary: 'Segoe UI', 'Roboto', Arial, sans-serif;

    /* NOUVELLES VARIABLES POUR LE DESIGN SPÉCIFIQUE */
    --table-header-bg-start: #66b3ff;
    /* Bleu plus clair pour l'en-tête du tableau */
    --table-header-bg-end: #3399ff;
    /* Bleu plus foncé pour l'en-tête du tableau */
    --filter-button-bg-start: #007bff;
    /* Bleu Bootstrap pour le bouton Valider */
    --filter-button-bg-end: #0069d9;
    /* Bleu plus foncé pour le bouton Valider */
    --table-row-even-bg: #f8f9fa;
    /* Couleur de fond pour les lignes paires du tableau */
    --table-row-hover-bg: #e9f5ff;
    /* Couleur de fond au survol des lignes du tableau */
}

/* 🏗️ Réinitialisation des styles et styles globaux */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-family-primary);
    /* Utilisation de la variable */
    color: var(--text-dark);
    /* Couleur de texte par défaut */
}

body {
    background: linear-gradient(135deg, var(--background-light) 0%, var(--background-medium) 100%);
    min-height: 100vh;
    /* S'assure que le dégradé couvre toute la hauteur */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Aligne le contenu en haut, le footer sera poussé par margin-top */
    font-family: var(--font-family-secondary);
    color: var(--text-dark);
    line-height: 1.6;
    /* Améliore la lisibilité du texte */
    padding: 0px;
    /* Padding global pour éviter que le contenu ne colle aux bords */
}

/* Conteneur principal du contenu (le cadre blanc) */
.container {
    max-width: 1800px;
    /* Limite la largeur du contenu */
    width: 100%;
    margin: 0 10px 10px 0px;
    /* Marge auto pour centrer, pousse le footer */
    padding: 30px;
    /* Padding généreux */
    background: var(--text-light);

    /* Coins plus arrondis */
    box-shadow: var(--shadow-lg);
    /* Ombre plus prononcée */
    display: flex;
    flex-direction: column;
    gap: 25px;
    /* Espacement entre les sections */
}

/* En-tête de la page (peut être utilisé pour un titre global de l'app) */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.title {
    font-size: 3.2em;
    /* Taille légèrement augmentée */
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.3em;
    animation: fadeIn 1s var(--transition-normal);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
    /* Léger effet de texte */
}

.subtitle {
    font-size: 1.3em;
    /* Taille légèrement augmentée */
    color: #6c757d;
    /* Gris plus doux */
    margin-bottom: 1.2em;
}

/* Animation Fade In pour les titres */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section des filtres (Niveau, Filière, Semestre, Valider) */
.filters {
    display: flex;
    flex-wrap: wrap;
    /* Permet aux éléments de passer à la ligne */
    gap: 20px 30px;
    /* Espacement horizontal et vertical */
    align-items: flex-end;
    /* Aligne les éléments en bas (pour les labels au-dessus) */
    justify-content: center;
    background-color: transparent;
    /* Fond très clair */
    border-radius: var(--border-radius-md);
    padding: 10px 20px;

    /* Bordure très subtile */
}

.filter-group {
    display: flex;
    flex-direction: column;
    /* Empile label et select */
    align-items: flex-start;
    gap: 5px;
    /* Espacement entre label et select */
}

.filters label {
    font-weight: 600;
    /* Plus de poids */
    color: var(--text-dark);
    white-space: nowrap;
    margin-right: 0;
    /* Supprime la marge droite qui était pour le style inline */
}

.filters select {
    font-size: 1.05rem;
    /* Taille légèrement augmentée */
    padding: 10px 15px;
    /* Padding généreux */
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-medium);
    background: var(--text-light);
    /* Fond blanc */
    color: var(--text-dark);
    transition: all var(--transition-fast);
    outline: none;
    cursor: pointer;
    min-width: 150px;
    /* Largeur minimale pour les selects */
}

.filters select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.3);
    /* Effet de focus plus moderne */
}

.filters button {
    font-size: 1.05rem;
    /* Taille légèrement augmentée */
    padding: 12px 20px;
    /* Padding généreux */
    border-radius: var(--border-radius-sm);
    border: none;
    background-color: var(--filter-button-bg-start);
    /* Dégradé bleu Bootstrap */
    color: var(--text-light);
    font-weight: 600;

    /* Ombre pour les boutons */
    transition: all var(--transition-fast);
    cursor: pointer;
    margin-top: 25px;
    /* Aligne le bouton avec le bas des selects */
}

.filters button:hover {
    /* Inversion du dégradé au survol */
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4);


    /* Léger effet de soulèvement */
}

.filters button:active {
    background: rgba(0, 10, 255, 0.6);
    transform: translateY(2px);
    /* Retour à la position normale au clic */
    box-shadow: 0 0px 10px rgba(0, 0, 0, 0.3);
}

/* Conteneur du tableau */
.table-container {
    width: 100%;
    margin: 25px auto;
    border-radius: var(--border-radius-md);
    box-shadow: var(--shadow-md);
    /* Ombre plus prononcée */
    background: var(--text-light);
    /* Fond blanc */
    overflow-x: auto;
    /* Permet le défilement horizontal sur petits écrans */
    animation: fadeIn 0.8s var(--transition-normal);
    min-height: 0;
    transition: min-height var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
    border: 1px solid var(--border-color-subtle);
    /* Bordure subtile */
}

/* Masquer le conteneur si vide */
.table-container:empty,
.table-container table:empty,
.table-container table:not(:has(tbody.model)) {
    /* Garde cette règle si tbody.model est une classe spécifique */
    min-height: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    display: none !important;
}

/* Style général du tableau */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    font-weight: 700;
    border: none;
    background: var(--text-light);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    /* Important pour les coins arrondis */
}



/* En-tête du tableau */
table thead th,
table tbody td {
    padding: 4px 10px;
    /* Padding généreux */
    text-align: center;
    border-bottom: 1px solid var(--border-color-subtle);
    /* Bordures horizontales légères */
    border-right: 1px solid var(--border-color-subtle);
    /* Bordures verticales légères */
}

table thead th:last-child,
table tbody td:last-child {
    border-right: none;
}

table thead tr {
    background: var(--table-header-bg-start);
    /* Dégradé bleu clair pour l'en-tête */
    color: var(--text-light);
    text-transform: capitalize;
    position: -webkit-sticky !important;
    top: 0;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    /* Ombre sous l'en-tête */
}

table thead th {
    font-weight: 600;
    font-size: 0.8rem;
    /* Taille légèrement augmentée */
}

/* Corps du tableau */
table tbody tr {
    background: var(--text-light);

}

table tbody tr:nth-child(even) {
    /* Bandes zébrées */
    background: var(--table-row-even-bg);
    /* Couleur plus claire pour les lignes paires */
}

table tbody tr:hover {
    background: var(--table-row-hover-bg);
    /* Bleu très clair au survol des lignes */
}

/* Styles pour les cellules spécifiques du tableau (si applicable) */
/* Les inputs dans le tableau ne sont pas montrés dans le nouveau design,
   mais les styles sont conservés pour la flexibilité */
table .model .model-row input {
    width: 130px;
    /* Largeur ajustée */
    height: 45px;
    /* Hauteur ajustée */
    padding: 10px 15px;
    font-size: 1.05rem;
    border-radius: var(--border-radius-sm);
    background: var(--background-light);
    color: var(--text-dark);
    transition: all var(--transition-fast);
    text-align: center;
    border: 1px solid var(--border-color-medium);
}

table .model .model-row input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.3);
    background: var(--text-light);
}

table .model .model-row input:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

/* Inputs désactivés */
table .model .model-row input:disabled {
    background: var(--background-medium);
    /* Gris plus prononcé */
    color: #888;
    cursor: not-allowed;
    opacity: 0.8;
}

/* Animation au clic (input) */
table .model .model-row input:active {
    transform: scale(0.97);
    /* Effet plus prononcé */
}

/* Amélioration du hover/focus sur tout le module (tbody.model) */
/* Ces styles sont spécifiques à une structure tbody.model et peuvent être ajustés
   ou supprimés si votre tableau est une structure tbody standard */
tbody.model {
    transition: background var(--transition-fast), box-shadow var(--transition-fast), outline var(--transition-fast);
    display: table-row-group;
}

tbody.model:hover,
tbody.model:focus-within {
    background: var(--table-row-hover-bg) !important;
    /* Utilise la couleur de survol des lignes */
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.2);
    /* Ombre de focus */
    outline: none;
}

/* Pour renforcer la visibilité de la sélection clavier */
tbody.model:focus-within {
    outline: 3px solid var(--primary-color);
    /* Bordure de focus plus épaisse */
    outline-offset: -3px;
}

/* Supprimer le fond sur les tr internes pour éviter les conflits */
tbody.model tr {
    background: transparent !important;
}

/* Styles pour les cellules spécifiques du tableau */
td.module {
    font-weight: 600;
    color: var(--primary-color);
    background: #f0f8ff;
    /* Fond légèrement différent pour la colonne module */
    border-right: 1px solid var(--border-color-medium);
}

td.moyenne_ele, td.Dec_el, td.moyenne_model, td.Dec_model {
    font-weight: 600;
    font-size: 1.05rem;
}

td.Dec_el, td.Dec_model {
    letter-spacing: 0.8px;
}

input[type="number"] {
    width: 70px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color-medium);
    background: var(--background-light);
    font-size: 1.05rem;
    text-align: center;
    transition: all var(--transition-fast);
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.3);
    background: var(--text-light);
}

/* Conteneur de la moyenne (non visible dans le design fourni) */
.average-container {
    margin: 0px auto;
    text-align: center;
    background: var(--background-light);
    border-radius: var(--border-radius-md);
    padding: 25px;
    max-width: 400px;
}

.average-title {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.6em;
}

.average-value {
    font-size: 3em;
    font-weight: 800;
    color: #2c3e50;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.08);
}

/* Conteneur du graphique (non visible dans le design fourni) */
.chart-container {
    width: 80%;
    max-width: 800px;
    margin: 35px auto;
    padding: 30px;
    border-radius: var(--border-radius-md);
    background: var(--text-light);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color-subtle);
}

/* Pied de page moderne et responsive */
.main-footer {
    width: 100%;
    background: var(--background-light);
    color: var(--text-dark);
    text-align: center;
    padding: 20px;
    /* Padding ajusté */
    font-size: 0.9em;
    border-top: 1px solid var(--border-color-subtle);
    margin-top: auto;
    margin-bottom: 5px;
    /* Pousse le footer vers le bas */
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    /* Espace les éléments */
    align-items: center;
    gap: 10px;
    /* Espacement ajusté */
}

.main-footer strong {
    position: absolute;
    left: 110px;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--text-dark);
    order: 1;
    /* Pour flexbox */
}

.main-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-fast);
}

.main-footer a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.main-footer .float-right {
    position: absolute;
    right: 90px;
    font-size: 1.0em;
    color: #6c757d;
    font-weight: 500;
    order: 2;
    /* Pour flexbox */
}

/* title lien linkdin */
.tooltip {
    position: absolute;
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    margin-top: -30px;
    margin-left: 10px;
    white-space: nowrap;
}

/* 📲 Responsive Design */
@media (max-width: 1024px) {
    .container {
        margin: 20px auto;
        padding: 20px;
    }

    .title {
        font-size: 2.5em;
    }

    .subtitle {
        font-size: 1.2em;
    }

    .filters {
        gap: 15px 20px;
        padding: 15px 20px;
    }

    .table-container {
        margin: 20px auto;
    }

    table thead th,
    table tbody td {
        padding: 15px;
    }

    table .model .model-row input {
        width: 110px;
        height: 40px;
        font-size: 0.95rem;
    }

    .chart-container {
        width: 90%;
        padding: 25px;
    }

    .average-title {
        font-size: 1.3rem;
    }

    .average-value {
        font-size: 2.8em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        /* Moins de padding sur mobile */
    }



    .container {
        margin: 10px auto;
        padding: 15px;
        box-shadow: none;
        border-radius: 0;
        gap: 15px;
    }

    .header {
        margin-bottom: 10px;
    }

    .title {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
    }

    .filters {
        flex-direction: column;
        /* Empile les filtres verticalement */
        align-items: stretch;
        /* Les éléments s'étirent sur toute la largeur */
        gap: 10px;
        padding: 15px;
        box-shadow: none;
        border-radius: 0;
        border: none;
    }

    .filter-group {
        width: 100%;
        /* Chaque groupe de filtre prend toute la largeur */
        align-items: flex-start;
    }

    .filters label {
        text-align: left;
        width: 100%;
        margin-bottom: 5px;
    }

    .filters select,
    .filters button {
        width: 100%;
        /* Les selects et boutons prennent toute la largeur */
        padding: 10px;
        font-size: 1rem;
        margin-top: 0;
        /* Supprime la marge supérieure du bouton Valider */
    }

    .filters button {
        margin-top: 10px;
        /* Ajoute une marge supérieure pour le bouton Valider */
    }

    .table-container {
        margin: 10px 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    table {
        font-size: 0.9rem;
    }

    table thead th,
    table tbody td {
        padding: 12px 8px;
    }

    table .model .model-row input {
        width: 90px;
        height: 35px;
        font-size: 0.85rem;
    }

    .average-container {
        margin: 15px auto;
        padding: 20px;
        border-radius: var(--border-radius-sm);
        box-shadow: none;
        border: none;
    }

    .average-title {
        font-size: 1.1rem;
    }

    .average-value {
        font-size: 2.2em;
    }

    .chart-container {
        width: 100%;
        padding: 20px;
        border-radius: var(--border-radius-sm);
        box-shadow: none;
        border: none;
    }

    .main-footer {
        padding: 20px 15px;
        margin-top: 15px;
        font-size: 0.86em;
        flex-direction: row;
        margin-bottom: 0px;
        box-shadow: none;
        border-radius: 0;
        border-top: 1px solid var(--border-color-subtle);
        justify-content: center;
        /* Centre les éléments du footer */
    }

    .main-footer strong {
        position: absolute;
        left: -160px;
        width: 100%;
        margin: 0;
    }

    .main-footer .float-right {
        position: absolute;
        right: 60px;
        font-size: 0.93em;
    }
}

@media (max-width: 570px) {

    .main-footer {
        padding: 20px 6px;
        margin-top: 15px;
        font-size: 0.85em;
        border-radius: 0;
        border-top: 1px solid var(--border-color-subtle);
    }

    .main-footer strong {
        position: absolute;
        left: -100px;
        font-size: 0.8em;
    }

    .main-footer .float-right {
        position: absolute;
        right: 32px;
        font-size: 0.89em;
        font-weight: bold;
    }

    .main-footer .float-right {
        font-weight: normal;
    }

    .title {
        font-size: 1.6em;
        /* Ajuste la taille de police du titre */
    }

    .subtitle {
        font-size: 0.85em;
        /* Ajuste la taille de police du sous-titre */
    }

    .filters select,
    .filters button {
        font-size: 0.9rem;
        /* Ajuste la taille de police des filtres et boutons */
        padding: 8px;
        /* Ajuste le padding */
    }

    table {
        font-size: 0.75rem;
        /* Ajuste la taille de police du tableau */
    }

    table thead th,
    table tbody td {
        padding: 8px 5px;
        /* Ajuste le padding des cellules du tableau */
    }

    table .model .model-row input {
        width: 70px;
        /* Ajuste la largeur des inputs dans le tableau */
        height: 30px;
        /* Ajuste la hauteur des inputs dans le tableau */
        font-size: 0.7rem;
        /* Ajuste la taille de police des inputs */
    }

    .average-value {
        font-size: 1.6em;
        /* Ajuste la taille de police de la valeur moyenne */
    }
}

/* Scrollbar personnalisée pour un look moderne */
::-webkit-scrollbar {
    width: 12px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-medium);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
    border: 3px solid var(--background-medium);
}

::-webkit-scrollbar-thumb:hover {
    background: #2c3e50;
}

/* Styles pour les éléments spécifiques qui n'étaient pas dans le CSS initial */
.content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
}

.sous_title {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
    margin: 30px auto;
    padding: 12px 25px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 2px solid var(--border-color-medium);
    width: fit-content;
    transition: transform var(--transition-normal);
}

.sous_title:hover {
    transform: scale(1.02);
}

.title span {
    color: var(--secondary-color);
}