/* ================================================================================
 * COLONNES FIGÉES (STICKY) RÉUTILISABLES POUR TABLEAUX
 * Classes : .sticky_premier_col (première colonne) et .sticky_dernier_col (dernière colonne)
 * Appliquer ces classes sur les cellules <th> et <td> concernées.
 * Le conteneur parent du tableau doit autoriser le défilement horizontal (overflow-x: auto).
 * Compatible avec DataTables (scrollX/scrollY) et les tableaux HTML standards.
 * ================================================================================ */

/* Première colonne figée à gauche */
.sticky_premier_col {
    position: sticky !important;
    left: 0;
    z-index: 2;
    background-color: var(--custom-white, #ffffff);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

/* Dernière colonne figée à droite */
.sticky_dernier_col {
    position: sticky !important;
    right: 0;
    z-index: 2;
    background-color: var(--custom-white, #ffffff);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.05);
}

/* En-têtes figées : z-index supérieur pour rester au-dessus des cellules du corps */
thead th.sticky_premier_col,
thead th.sticky_dernier_col {
    z-index: 3;
}

/* Fond des en-têtes avec table-primary-custom : équivalent opaque de la teinte
 * primaire translucide (primary 20 % sur le fond), pour masquer le contenu défilant */
.table-primary-custom th.sticky_premier_col,
.table-primary-custom th.sticky_dernier_col {
    background-color: color-mix(in srgb, rgb(var(--primary-rgb)) 20%, var(--custom-white, #ffffff)) !important;
}

/* Lignes paires (table-striped-danger) : équivalent opaque de rgba(var(--warning-rgb), 0.15)
 * sur le fond du tableau, calculé via color-mix pour s'adapter au mode clair/sombre */
.table.table-striped-danger > tbody > tr:nth-of-type(even) > .sticky_premier_col,
.table.table-striped-danger > tbody > tr:nth-of-type(even) > .sticky_dernier_col {
    background-color: color-mix(in srgb, rgb(var(--warning-rgb)) 15%, var(--custom-white, #ffffff));
}

/* Lignes impaires : fond blanc */
.table.table-striped-danger > tbody > tr:nth-of-type(odd) > .sticky_premier_col,
.table.table-striped-danger > tbody > tr:nth-of-type(odd) > .sticky_dernier_col {
    background-color: var(--custom-white, #ffffff);
}

/* DataTables : en-tête dans dataTables_scrollHead (header séparé du body) */
.dataTables_scrollHead th.sticky_premier_col,
.dataTables_scrollHead th.sticky_dernier_col {
    z-index: 3;
}

/* ================================================================================
 * EN-TÊTE DE TABLEAU table-primary-custom — teinte primaire translucide
 * ================================================================================ */
.table thead.table-primary-custom {
    background-color: rgba(var(--primary-rgb), 0.2) !important;
    color: var(--default-text-color) !important;
    --bs-table-color: #000 !important;
    --bs-table-bg: rgba(var(--primary-rgb), 0.1) !important;
    --bs-table-border-color: rgba(var(--primary-rgb), 0.1);
    --bs-table-striped-bg: rgba(var(--primary-rgb), 0.5);
    --bs-table-striped-color: #000;
    --bs-table-active-bg: rgba(var(--primary-rgb), 0.5);
    --bs-table-hover-bg: rgba(var(--primary-rgb), 0.5);
    color: var(--bs-table-color);
    border-color: var(--bs-table-border-color);
}
