/* Habillage commun des tableaux DataTables du module web.
   Chargé par ModuleWeb/partage/dataTables_bootstrap4 ; tout est préfixé « body.module-web »
   (layouts/appN) pour ne jamais toucher au back-office. Design de la page Habilitations.
   Style uniquement : aucun contenu ni comportement modifié. */
body.module-web {
    --mw-text: #1f2d3d;
    --mw-muted: #66768a;
    --mw-border: #e3e8ef;
    --mw-bg: #f5f7fa;
    --mw-accent: #1e6fbf;
    --mw-accent-soft: #e8f1fb;
}

/* ---------- Carte qui contient un tableau : bandeau bleu → en-tête clair ---------- */
body.module-web .card:has(table.dataTable) {
    background: #fff;
    border: 1px solid var(--mw-border) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    overflow: hidden;
}
body.module-web .card:has(table.dataTable) > .card-header[class*="bgc-primary"],
body.module-web .card-header[class*="bgc-primary"]:has(.dt-buttons) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    padding: .9rem 1.25rem !important;
    color: var(--mw-text) !important;
    background: #fff !important;
    border: 0 !important;
    border-bottom: 1px solid var(--mw-border) !important;
}
body.module-web .card:has(table.dataTable) > .card-header[class*="bgc-primary"] :is(h3, h4, h5, .card-title),
body.module-web .card-header[class*="bgc-primary"]:has(.dt-buttons) :is(h3, h4, h5, .card-title) {
    margin: 0;
    font-size: 1.05rem !important;
    font-weight: 600;
    color: var(--mw-text) !important;
}
body.module-web .card:has(table.dataTable) > .card-header[class*="bgc-primary"] .text-white,
body.module-web .card-header[class*="bgc-primary"]:has(.dt-buttons) .text-white {
    color: var(--mw-text) !important;
}

/* ---------- Zone autour du tableau : Afficher / Rechercher / pagination ---------- */
body.module-web .dataTables_wrapper > .row {
    margin-left: 0;
    margin-right: 0;
    background: transparent !important;
}
body.module-web .dataTables_wrapper > .row:first-child {
    padding: .85rem .75rem .6rem;
}
body.module-web .dataTables_wrapper > .row:last-child {
    padding: .7rem .75rem .9rem;
}
body.module-web .dataTables_wrapper .dataTables_length,
body.module-web .dataTables_wrapper .dataTables_filter,
body.module-web .dataTables_wrapper .dataTables_info {
    color: var(--mw-muted);
    font-size: .88rem;
}
body.module-web .dataTables_wrapper .dataTables_filter input,
body.module-web .dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--mw-border);
    border-radius: 8px;
    padding: .3rem .6rem;
    height: auto;
    color: var(--mw-text);
    background-color: #fff;
}
body.module-web .dataTables_wrapper .dataTables_filter input:focus,
body.module-web .dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--mw-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--mw-accent-soft);
}

/* Pagination */
body.module-web .dataTables_wrapper .pagination {
    gap: .25rem;
    margin: 0;
}
body.module-web .dataTables_wrapper .pagination .page-link {
    border: 1px solid var(--mw-border) !important;
    border-radius: 8px !important;
    color: var(--mw-text);
    background: #fff;
    padding: .35rem .7rem;
    font-size: .85rem;
    margin: 0 !important;
    box-shadow: none !important;
}
body.module-web .dataTables_wrapper .pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background: var(--mw-bg);
    color: var(--mw-text);
}
body.module-web .dataTables_wrapper .pagination .page-item.active .page-link {
    background: var(--mw-accent) !important;
    border-color: var(--mw-accent) !important;
    color: #fff !important;
}
body.module-web .dataTables_wrapper .pagination .page-item.disabled .page-link {
    color: #b3bdc9;
    background: #fff;
}

/* Indicateur de chargement */
body.module-web .dataTables_wrapper .dataTables_processing {
    border: 1px solid var(--mw-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .1) !important;
    background: #fff !important;
    color: var(--mw-muted);
    font-size: .88rem;
}

/* ---------- Tableau ---------- */
body.module-web .dataTables_wrapper table.dataTable {
    border-collapse: collapse !important;
    border: 0 !important;
    margin-top: .25rem !important;
    margin-bottom: .25rem !important;
}
body.module-web .dataTables_wrapper table.dataTable thead th,
body.module-web .dataTables_wrapper table.dataTable thead td {
    padding: .65rem 1.5rem .65rem .75rem !important; /* place de l'icône de tri */
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.3;
    vertical-align: middle;
    color: var(--mw-muted);
    background: var(--mw-bg) !important;
    border: 0 !important;
    border-bottom: 1px solid var(--mw-border) !important;
}
body.module-web .dataTables_wrapper table.dataTable tbody td {
    padding: .7rem .75rem !important;
    vertical-align: middle;
    font-size: .92rem;
    color: var(--mw-text);
    background: #fff;
    border: 0 !important;
    border-bottom: 1px solid var(--mw-border) !important;
}
body.module-web .dataTables_wrapper table.dataTable.table-striped tbody tr:nth-of-type(odd) td,
body.module-web .dataTables_wrapper table.dataTable.table-striped tbody tr:nth-of-type(odd) {
    background: #fff;
}
body.module-web .dataTables_wrapper table.dataTable tbody tr:hover td {
    background: #fafbfd !important;
}
body.module-web .dataTables_wrapper table.dataTable tbody tr.selected td {
    background: var(--mw-accent-soft) !important;
}
body.module-web .dataTables_wrapper table.dataTable tbody tr.selected td:first-child {
    box-shadow: inset 3px 0 0 var(--mw-accent);
}
body.module-web .dataTables_wrapper table.dataTable tbody td:first-child a {
    font-weight: 600;
    color: var(--mw-accent);
}
body.module-web .dataTables_wrapper table.dataTable td.dataTables_empty {
    padding: 2rem 1rem !important;
    text-align: center;
    color: var(--mw-muted);
    background: #fff !important;
}

/* Filtres par colonne : 2e ligne d'en-tête ou pied de tableau */
body.module-web .dataTables_wrapper table.dataTable thead tr + tr th,
body.module-web .dataTables_wrapper table.dataTable thead tr.filters th {
    padding: .45rem .4rem !important;
    background: #fff !important;
}
body.module-web .dataTables_wrapper table.dataTable tfoot th,
body.module-web .dataTables_wrapper table.dataTable tfoot td {
    padding: .5rem .4rem !important;
    background: #fff;
    border: 0 !important;
    border-top: 1px solid var(--mw-border) !important;
    font-weight: 400;
}
body.module-web .dataTables_wrapper table.dataTable tfoot th:not(:has(input, select)) {
    font-size: 0;
}
body.module-web .dataTables_wrapper table.dataTable thead input,
body.module-web .dataTables_wrapper table.dataTable tfoot input {
    width: 100% !important;
    min-width: 3rem;
    padding: .28rem .55rem;
    font-size: .8rem;
    font-weight: 400;
    color: var(--mw-text);
    background: #fff;
    border: 1px solid var(--mw-border);
    border-radius: 6px;
}
body.module-web .dataTables_wrapper table.dataTable thead input:focus,
body.module-web .dataTables_wrapper table.dataTable tfoot input:focus {
    border-color: var(--mw-accent);
    outline: 0;
    box-shadow: 0 0 0 3px var(--mw-accent-soft);
}
body.module-web .dataTables_wrapper table.dataTable thead input::placeholder,
body.module-web .dataTables_wrapper table.dataTable tfoot input::placeholder {
    color: #a3afbd;
}

/* ---------- Boutons d'export (colonnes, copie, CSV, Excel, PDF, impression) : discrets ---------- */
body.module-web .dt-buttons {
    display: inline-flex;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: none !important;
}
body.module-web .dt-buttons .btn,
body.module-web .dt-buttons .dt-button {
    background: #fff !important;
    border: 1px solid var(--mw-border) !important;
    color: var(--mw-muted) !important;
    box-shadow: none !important;
    padding: .32rem .6rem !important;
    margin: 0 0 0 -1px !important;
    border-radius: 0 !important;
}
body.module-web .dt-buttons .btn:first-child,
body.module-web .dt-buttons .dt-button:first-child {
    margin-left: 0 !important;
    border-radius: 8px 0 0 8px !important;
}
body.module-web .dt-buttons .btn:last-child,
body.module-web .dt-buttons .dt-button:last-child {
    border-radius: 0 8px 8px 0 !important;
}
body.module-web .dt-buttons .btn i,
body.module-web .dt-buttons .dt-button i {
    color: inherit !important;
}
body.module-web .dt-buttons .btn:hover,
body.module-web .dt-buttons .dt-button:hover {
    background: var(--mw-bg) !important;
    color: var(--mw-text) !important;
}

/* Menu « Masquer des colonnes » */
body.module-web .dt-button-collection {
    border: 1px solid var(--mw-border) !important;
    border-radius: 10px !important;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .14) !important;
    padding: .35rem !important;
}
body.module-web .dt-button-collection .dt-button,
body.module-web .dt-button-collection .dropdown-item {
    border-radius: 6px !important;
    font-size: .88rem;
}
body.module-web .dt-button-collection .dt-button.active,
body.module-web .dt-button-collection .dropdown-item.active {
    background: var(--mw-accent-soft) !important;
    color: var(--mw-accent) !important;
}
