:root {
    --blue-navy: #1a2a4a;
    --border: #e2e8f0;
    --em-bg-color: ;
    --cie-bg-color: ;
    --genie-bg-color: ;
    --batt-bg-color: ;
    --res-bg-color: ;
}

body {
    font-family: 'JetBrains Mono', 'Roboto', 'Segoe UI', sans-serif;
}

a {
    text-decoration: none;
    color: black;
}

.table-container {
    max-width: 2000px;
    padding: 20px;
    margin: auto;
    border-radius: 12px;
}

#tableManoeuvres {
    background: white;
}

.dataTable-dropdown label {
    color: black !important;
    font-weight: 400 !important;
}

.dataTable-top {
    padding: 15px 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    align-items: center;
    justify-content: space-between;
}

.dataTable-top::after {
    position: absolute !important;
}

/* Style général du tableau sur Ordinateur */
th {
    background-color: var(--blue-navy) !important;
    color: white !important;
}

td {
    vertical-align: middle;
}

td[data-label='Effectifs'] {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 5px;
    min-width: 180px;
}

tr:nth-child(even) {
    background: #d8dce1;
}

/* Espacement et subtilité des lignes */
th,
td {
    padding: 12px 16px;
    vertical-align: middle;
}

.badge-unite {
    display: inline-block;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
    margin-right: 4px;
    margin-bottom: 4px;
    text-transform: uppercase;
    color: #ffffff;
    /* Texte blanc par défaut */
}

.badge-em {
    background-color: #f9a825;
    color: #1a2a4a;
}

.badge-cie {
    background-color: #3d61b3;
    color: white;
}

.badge-batterie {
    background-color: #c62828;
    color: white;
}

.badge-genie {
    background-color: #2e7d32;
}

.badge-reservistes {
    background-color: #ad4eb9;
    color: white;
}

/* Couleur par défaut si l'unité n'est pas dans la liste PHP */
.badge-default {
    background-color: #78909c;
    color: black;
}

.effectifs-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
    /* Espace entre les lignes d'effectifs */
}

/* Alignement parfait de la ligne */
.effectif-ligne {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    line-height: 1.2;
}

/* Le chiffre : mis en valeur dans un petit rectangle aligné */
.effectif-chiffre {
    display: inline-block;
    width: 32px;
    /* Largeur fixe pour que les labels soient alignés verticalement */
    text-align: right;
    padding-right: 8px;
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    /* Style archive */
}

/* Couleurs subtiles pour différencier le commandement de la troupe */
.effectif-chiffre.officier {
    color: #c53030;
}

/* Rouge discret */
.effectif-chiffre.troupe {
    color: #2b6cb0;
}

/* Bleu discret */
.effectif-chiffre.chevaux {
    color: #4a5568;
}

/* Gris */
/* Le texte à côté du chiffre */
.effectif-label {
    color: #4a5568;
    font-size: 0.8rem;
}

/* Séparateur pour les chevaux (optionnel, pour détacher les animaux des hommes) */
.effectif-ligne.equi {
    margin-top: 2px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 2px;
}

/* Style si aucun effectif */
.effectif-vide {
    color: #a0aec0;
    display: block;
    text-align: center;
}

/* ==========================================================================
LA MAGIE MOBILE (Media Query)
========================================================================== */
@media screen and (max-width: 600px) {

    /* On force le tableau, le Bachelor (tbody, tr, td) à se comporter comme des blocs verticaux */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    /* On cache l'en-tête du tableau d'origine (les titres des colonnes) */
    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    /* Chaque ligne devient une "carte" indépendante */
    tr {
        background: #ffffff;
        border: 1px solid var(--border);
        border-radius: 8px;
        margin-bottom: 15px;
        padding: 10px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    /* Chaque cellule s'organise en ligne interne */
    td {
        border: none !important;
        border-bottom: 1px solid #f0f4f8 !important;
        position: relative;
        padding-left: 50% !important;
        /* On pousse le texte vers la droite */
        text-align: right;
        min-height: 24px;
    }

    td:last-child {
        border-bottom: none !important;
    }

    /* On injecte le titre de la colonne à gauche via le CSS pseudo-élément */
    td::before {
        position: absolute;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: bold;
        color: var(--blue-navy);
        /* Récupère l'attribut "data-label" qu'on va ajouter dans le HTML */
        content: attr(data-label);
    }

    /* Petit ajustement cosmétique pour l'année sur mobile */
    td[data-label="Année"] {
        background-color: #f0f4f8;
        border-radius: 4px;
        font-weight: bold;
    }
}