/* ============================================================
   SIGSPA-SINDPESCA — TABLES
   Tabelas modernas + responsividade (scroll horizontal nunca quebra layout).
   ============================================================ */

.table {
    margin-bottom: 0;
}

.table th {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--surface-alt);
    border-bottom: 1.5px solid var(--surface-border);
    padding: 12px 14px;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    font-size: 13.5px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--surface-border);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--dur-fast) var(--ease-out);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Variante moderna */
.table-modern {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-modern thead th {
    background: var(--surface-alt);
    color: var(--gray-500);
    border-bottom: 1.5px solid var(--surface-border);
}

/* ---------- Responsividade ---------- */
/* Wrapper padrão: rolagem horizontal com bordas arredondadas */
.table-responsive {
    border-radius: var(--radius-md);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-pill);
}

/* Qualquer tabela fora de wrapper não pode estourar o layout */
.table,
table {
    max-width: 100%;
}

/* Tabelas conhecidas do sistema ganham scroll garantido */
.gl-tabela,
.gm-tabela,
.gdi-tabela,
.gpr-tabela,
.gfn-tabela,
.pag-tabela,
.ath-tabela,
.atd-tabela,
.mdm-lista,
.mdoc-lista,
.ent-tabela,
.sai-tabela,
.usr-tabela,
.prod-tabela {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
}

/* Ajustes em telas pequenas */
@media (max-width: 767.98px) {
    .table th,
    .table td {
        padding: 9px 10px;
    }

    .table td {
        font-size: 12.5px;
    }

    .table thead th {
        position: static;
    }

    /* Reduz largura mínima quando há muitas ações */
    .table .btn-sm {
        padding: 5px 8px;
        font-size: 11px;
    }
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] .table th {
    background: var(--gray-100);
    color: var(--gray-400);
    border-bottom-color: var(--surface-border);
}

[data-theme="dark"] .table td {
    color: var(--gray-600);
    border-bottom-color: var(--surface-border);
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--gray-100);
}
