/**
 * Fix définitif pour les fonds blancs des tableaux
 * Ce fichier doit être chargé EN DERNIER pour surcharger tous les autres styles
 */

/* ========================================= */
/* FORCE BRUTALE : AUCUN FOND BLANC AUTORISÉ */
/* ========================================= */

/* Tous les tableaux possibles */
table,
.table,
table.table,
table.dataTable,
.dataTables_wrapper table,
.table-responsive table,
div[class*="table"] table {
    background-color: transparent !important;
    background-image: none !important;
    background: transparent !important;
}

/* Tous les tbody */
table tbody,
.table tbody,
table.dataTable tbody,
.dataTables_wrapper table tbody {
    background-color: transparent !important;
    background-image: none !important;
    background: transparent !important;
}

/* Toutes les lignes */
table tr,
.table tr,
table tbody tr,
.table tbody tr,
table.dataTable tbody tr,
table.dataTable tbody tr.odd,
table.dataTable tbody tr.even,
table.dataTable.stripe tbody tr.odd,
table.dataTable.stripe tbody tr.even,
table.dataTable.display tbody tr,
table.dataTable.display tbody tr.odd,
table.dataTable.display tbody tr.even,
.dataTables_wrapper table tbody tr {
    background-color: transparent !important;
    background-image: none !important;
}

/* Toutes les cellules */
table td,
.table td,
table tbody td,
.table tbody td,
table.dataTable td,
table.dataTable tbody td,
table.dataTable tbody tr td,
table.dataTable tbody tr.odd td,
table.dataTable tbody tr.even td,
.dataTables_wrapper table tbody tr td {
    background-color: transparent !important;
    background-image: none !important;
    background: transparent !important;
    color: var(--text-primary, #f0f0f0) !important;
}

/* Toutes les cellules d'en-tête */
table th,
.table th,
table thead th,
.table thead th,
table.dataTable thead th,
.dataTables_wrapper table thead th {
    background-color: rgba(0, 0, 70, 0.6) !important;
    background-image: none !important;
    color: var(--text-primary, #f0f0f0) !important;
}

/* Colonne de tri DataTables */
table.dataTable tbody tr > .sorting_1,
table.dataTable.stripe tbody tr.odd > .sorting_1,
table.dataTable.stripe tbody tr.even > .sorting_1,
table.dataTable.display tbody tr.odd > .sorting_1,
table.dataTable.display tbody tr.even > .sorting_1 {
    background-color: transparent !important;
    background-image: none !important;
}

/* Lignes alternées (striped) - SOMBRE */
.table-striped tbody tr:nth-of-type(odd),
table.table-striped tbody tr:nth-of-type(odd),
table.dataTable.stripe tbody tr.odd,
table.dataTable.display tbody tr.odd {
    background-color: rgba(0, 0, 50, 0.3) !important;
    background-image: none !important;
}

.table-striped tbody tr:nth-of-type(odd) td,
table.table-striped tbody tr:nth-of-type(odd) td,
table.dataTable.stripe tbody tr.odd td,
table.dataTable.display tbody tr.odd td {
    background-color: transparent !important;
    background-image: none !important;
}

.table-striped tbody tr:nth-of-type(even),
table.table-striped tbody tr:nth-of-type(even),
table.dataTable.stripe tbody tr.even,
table.dataTable.display tbody tr.even {
    background-color: transparent !important;
    background-image: none !important;
}

.table-striped tbody tr:nth-of-type(even) td,
table.table-striped tbody tr:nth-of-type(even) td,
table.dataTable.stripe tbody tr.even td,
table.dataTable.display tbody tr.even td {
    background-color: transparent !important;
    background-image: none !important;
}

/* Hover - SOMBRE */
.table tbody tr:hover,
table.table tbody tr:hover,
.table-hover tbody tr:hover,
table.table-hover tbody tr:hover,
table.dataTable tbody tr:hover,
table.dataTable.hover tbody tr:hover,
table.dataTable.display tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.15) !important;
    background-image: none !important;
}

.table tbody tr:hover td,
table.table tbody tr:hover td,
table.dataTable tbody tr:hover td,
table.dataTable.hover tbody tr:hover td {
    background-color: transparent !important;
    background-image: none !important;
}

table.dataTable.hover tbody tr:hover > .sorting_1,
table.dataTable.display tbody tr:hover > .sorting_1 {
    background-color: transparent !important;
    background-image: none !important;
}

/* Lignes sélectionnées dans DataTables */
table.dataTable tbody tr.selected,
table.dataTable tbody tr.selected td {
    background-color: rgba(0, 123, 255, 0.2) !important;
    background-image: none !important;
}

/* Wrapper DataTables */
.dataTables_wrapper,
div.dataTables_wrapper {
    background-color: transparent !important;
    background-image: none !important;
}

/* Container responsive */
.table-responsive,
div.table-responsive,
.dataTables_scroll,
.dataTables_scrollBody {
    background-color: transparent !important;
    background-image: none !important;
}

/* Pas de fond blanc sur les divs contenant des tableaux */
div[class*="dataTables"],
div[id*="dataTables"],
div[class*="table-"] {
    background-color: transparent !important;
    background-image: none !important;
}

/* Mode card mobile - garder le fond sombre */
@media (max-width: 768px) {
    .table-responsive-cards tbody tr {
        background: rgba(0, 0, 80, 0.4) !important;
        background-image: none !important;
    }

    .table-responsive-cards tbody tr:hover {
        background: rgba(0, 0, 90, 0.5) !important;
        background-image: none !important;
    }

    .table-responsive-cards tbody tr td {
        background-color: transparent !important;
        background-image: none !important;
    }
}

/* Bordures - toujours sombres */
.table,
table.table,
table.dataTable,
.table-bordered,
table.table-bordered,
table.dataTable.table-bordered {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.table th,
.table td,
table.table th,
table.table td,
table.dataTable th,
table.dataTable td {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Scrollbar sombre pour les tableaux */
.dataTables_scrollBody,
.table-responsive {
    scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 60, 0.3);
}

.dataTables_scrollBody::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.dataTables_scrollBody::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: rgba(0, 0, 60, 0.3);
}

.dataTables_scrollBody::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.dataTables_scrollBody::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Lignes colorées contextuelles - garder le fond transparent */
.table tbody tr.table-primary,
.table tbody tr.table-success,
.table tbody tr.table-danger,
.table tbody tr.table-warning,
.table tbody tr.table-info {
    background-image: none !important;
}

.table tbody tr.table-primary td,
.table tbody tr.table-success td,
.table tbody tr.table-danger td,
.table tbody tr.table-warning td,
.table tbody tr.table-info td {
    background-color: transparent !important;
    background-image: none !important;
}

/* Footer DataTables */
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    background-color: transparent !important;
    background-image: none !important;
}

/* Processing overlay */
.dataTables_processing {
    background: rgba(0, 0, 60, 0.9) !important;
    background-image: none !important;
}

/* Formulaires dans les tableaux */
table input,
table select,
table textarea,
.table input,
.table select,
.table textarea {
    background: rgba(0, 0, 60, 0.5) !important;
    color: var(--text-primary, #f0f0f0) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

table input:focus,
table select:focus,
table textarea:focus,
.table input:focus,
.table select:focus,
.table textarea:focus {
    background: rgba(0, 0, 60, 0.7) !important;
    border-color: rgba(93, 173, 226, 0.5) !important;
}

/* Checkboxes dans les tableaux */
table input[type="checkbox"],
.table input[type="checkbox"] {
    background-color: rgba(0, 0, 60, 0.5) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Boutons dans les tableaux */
table .btn,
.table .btn {
    /* Les styles de boutons sont déjà définis dans dark-theme.css */
}

/* IMPORTANT: Exclure le mode impression */
@media print {
    /* En impression, on peut garder le fond blanc pour économiser l'encre */
    table,
    .table,
    table tbody,
    table tr,
    table td {
        background: white !important;
        color: black !important;
    }
}

/* Désactiver tous les pseudo-éléments avec fond blanc */
table::before,
table::after,
.table::before,
.table::after,
table tbody::before,
table tbody::after,
table tr::before,
table tr::after,
table td::before,
table td::after {
    background-color: transparent !important;
    background-image: none !important;
}
