/* ==========================================================================
   Tableaux "v2" : alternance blanc / gris clair, sans filets, survol gris,
   en-tete gris, carte arrondie. S'applique a TOUS les tableaux .table de
   l'application (admin et portail client). Charge apres style.css.

   Hors perimetre (volontaire) : PDF, emails (pas de .table) et grille
   .planning-grid.
   ========================================================================== */

:root {
    --gfc-t-stripe: #f6f7f9;
    --gfc-t-hover: #eceef2;
    --gfc-t-head-bg: #f1f2f4;
    --gfc-t-head-fg: #6b7280;
    --gfc-t-muted: #6b7280;
    --gfc-t-card-border: #e5e7eb;
}

[data-theme="dark"] {
    --gfc-t-stripe: rgba(255, 255, 255, 0.04);
    --gfc-t-hover: rgba(255, 255, 255, 0.09);
    --gfc-t-head-bg: rgba(255, 255, 255, 0.07);
    --gfc-t-head-fg: #a3a3a3;
    --gfc-t-muted: #a3a3a3;
    --gfc-t-card-border: #525252;
}

/* --- Carte : les bandes vont d'un bord a l'autre ------------------------- */
.table-responsive {
    border: 1px solid var(--gfc-t-card-border);
    border-radius: 12px;
    overflow: auto;
}

.card > .table,
.card-body.p-0 > .table {
    margin-bottom: 0;
}

/* --- Base : pas de filets, fond neutre ----------------------------------- */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: transparent;
    --bs-table-border-color: transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    border-color: transparent;
}

.table > :not(caption) > * > * {
    border-width: 0;
    border-bottom: 0;
    background-color: transparent;
    box-shadow: none;
    vertical-align: middle;
}

/* --- En-tete gris -------------------------------------------------------- */
.table thead th,
.table > thead > tr > * {
    background-color: var(--gfc-t-head-bg) !important;
    color: var(--gfc-t-head-fg);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 0;
    box-shadow: none;
}

/* --- Alternance (annule le zebrage impair de .table-striped) ------------- */
.table > tbody > tr:nth-child(even) > * {
    background-color: var(--gfc-t-stripe) !important;
    box-shadow: none !important;
}

.table > tbody > tr:nth-child(odd) > * {
    background-color: transparent !important;
    box-shadow: none !important;
}

/* --- Survol -------------------------------------------------------------- */
.table > tbody > tr:hover > * {
    background-color: var(--gfc-t-hover) !important;
    color: inherit;
}

/* --- Lignes contextuelles Bootstrap (table-danger, -warning...) en gris --- */
.table > tbody > tr[class*="table-"] > *,
.table > tbody > tr > [class*="table-"] {
    --bs-table-bg: transparent;
    --bs-table-color: inherit;
    color: inherit;
}

/* --- Tableaux cle / valeur : pas d'alternance, libelles en gris ---------- */
.table.table-borderless > tbody > tr > * {
    background-color: transparent !important;
}

.table.table-borderless > tbody > tr:hover > * {
    background-color: transparent !important;
}

.table.table-borderless:not(:has(> thead)) > tbody > tr > th,
.table.table-borderless:not(:has(> thead)) > tbody > tr > td:first-child {
    color: var(--gfc-t-muted);
    font-weight: 500;
}

/* --- Pas de couleur dans les tableaux ------------------------------------ */
.table .badge {
    background: none !important;
    color: inherit !important;
    border: 0;
    padding: 0;
    font-size: inherit;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.table .badge > .bi:not(:only-child) {
    display: none;
}

.table .text-muted,
.table .text-secondary,
.table small.text-muted {
    color: var(--gfc-t-muted) !important;
}

.table a:not(.btn):not(.dropdown-item) {
    color: inherit;
    text-decoration: none;
}

.table a:not(.btn):not(.dropdown-item):hover {
    text-decoration: underline;
}

.table .btn-outline-primary,
.table .btn-outline-secondary,
.table .btn-outline-success,
.table .btn-outline-danger,
.table .btn-outline-warning,
.table .btn-outline-info,
.table .btn-outline-dark,
.table .btn-light,
.table .btn-link {
    --bs-btn-color: var(--gfc-t-muted);
    --bs-btn-border-color: var(--gfc-t-card-border);
    --bs-btn-hover-color: #111827;
    --bs-btn-hover-bg: var(--gfc-t-hover);
    --bs-btn-hover-border-color: var(--gfc-t-card-border);
    --bs-btn-active-color: #111827;
    --bs-btn-active-bg: var(--gfc-t-hover);
    --bs-btn-active-border-color: var(--gfc-t-card-border);
    --bs-btn-bg: transparent;
}
