/* ═══════════════════════════════════════════════════════════════
   Tabelas Premium (Global)
   Reuso: classes tp-* em qualquer listagem
   Compatibilidade: mantém classes ma-* da listagem de alunos
   ═══════════════════════════════════════════════════════════════ */

:root {
    --tp-primary: #0B1F33;
    --tp-surface: #ffffff;
    --tp-text: #0F172A;
    --tp-muted: #526173;
    --tp-border: #E6EDF5;
    --tp-teal: #0EA5A4;
}

.tp-table-theme,
.ma-page {
    --tp-primary: var(--ma-primary, #0B1F33);
    --tp-surface: var(--ma-surface, #ffffff);
    --tp-text: var(--ma-text, #0F172A);
    --tp-muted: var(--ma-muted, #526173);
    --tp-border: var(--ma-border, #E6EDF5);
    --tp-teal: var(--ma-teal, #0EA5A4);
}

/* ── Overwrite Tabler: tabelas padrão (card-table) ── */
.table-responsive > .table.table-vcenter.card-table {
    margin-bottom: 0;
}

.table-responsive > .table.table-vcenter.card-table thead th {
    padding: 12px 16px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tp-muted);
    background: rgba(11, 31, 51, 0.03);
    border-bottom: 1px solid var(--tp-border);
    font-weight: 700;
    white-space: nowrap;
}

.table-responsive > .table.table-vcenter.card-table tbody td {
    padding: 13px 16px;
    color: var(--tp-text);
    border-bottom: 1px solid var(--tp-border);
    vertical-align: middle;
}

.table-responsive > .table.table-vcenter.card-table tbody td.text-secondary {
    color: var(--tp-text) !important;
}

.table-responsive > .table.table-vcenter.card-table tbody tr:hover > * {
    background: rgba(14, 165, 164, 0.05);
}

.table-responsive > .table.table-vcenter.card-table tbody tr:last-child > * {
    border-bottom-color: transparent;
}

@media (max-width: 767.98px) {
    .table-responsive > .table.table-mobile-md.card-table tbody td::before {
        color: var(--tp-muted);
        letter-spacing: 0.04em;
        text-transform: uppercase;
        font-size: 0.72rem;
        font-weight: 700;
    }

    [data-bs-theme=dark] .table-responsive > .table.table-mobile-md.card-table tbody td::before {
        color: rgba(214, 177, 94, 0.7);
    }
}

.table-responsive > .table.tp-table-users thead th,
.table-responsive > .table.tp-table-users tbody td {
    text-align: center;
}

.table-responsive > .table.tp-table-users td[data-label="ID"],
.table-responsive > .table.tp-table-users td[data-label="CPF"],
.table-responsive > .table.tp-table-users td[data-label="Telefone"],
.table-responsive > .table.tp-table-users td[data-label="Ativo"],
.table-responsive > .table.tp-table-users td[data-label="Ações"] {
    white-space: nowrap;
}

.table-responsive > .table.tp-table-users td[data-label="ID"],
.table-responsive > .table.tp-table-users td[data-label="CPF"],
.table-responsive > .table.tp-table-users td[data-label="Telefone"] {
    font-variant-numeric: tabular-nums;
}

.table-responsive > .table.tp-table-users td[data-label="Nome Completo"] {
    min-width: 240px;
}

.table-responsive > .table.tp-table-users td[data-label="E-mail"] {
    min-width: 250px;
    word-break: break-word;
}

.table-responsive > .table.tp-table-users td[data-label="Ações"] {
    min-width: 176px;
}

.table-responsive > .table.tp-table-users .tp-table-actions {
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.tp-card-head,
.ma-card-head {
    padding: 16px;
    border-bottom: 1px solid var(--tp-border);
}

.tp-search-wrap,
.ma-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    border: 1px solid var(--tp-border);
    border-radius: 12px;
    padding: 9px 12px;
    background: #fff;
    color: var(--tp-muted);
}

.tp-search-wrap:focus-within,
.ma-search-wrap:focus-within {
    border-color: rgba(14, 165, 164, 0.45);
    box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.12);
}

.tp-search-input,
.ma-search-input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--tp-text);
    font-size: 0.92rem;
}

.tp-search-input::placeholder,
.ma-search-input::placeholder {
    color: #98a7b8;
}

.tp-table-wrap,
.ma-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.tp-table,
.ma-table {
    width: 100%;
    min-width: 1040px;
    border-collapse: collapse;
}

.tp-table thead th,
.ma-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tp-muted);
    background: rgba(11, 31, 51, 0.03);
    border-bottom: 1px solid var(--tp-border);
    white-space: nowrap;
}

.tp-table tbody td,
.ma-table tbody td {
    padding: 13px 16px;
    color: var(--tp-text);
    border-bottom: 1px solid var(--tp-border);
    font-size: 0.9rem;
    vertical-align: middle;
}

.tp-table tbody tr:hover,
.ma-table tbody tr:hover {
    background: rgba(14, 165, 164, 0.05);
}

.tp-table tbody tr:last-child td,
.ma-table tbody tr:last-child td {
    border-bottom: none;
}

.tp-user,
.ma-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tp-avatar,
.ma-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(14, 165, 164, 0.22);
    flex-shrink: 0;
}

.tp-avatar--initials,
.ma-avatar--initials {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tp-primary) 0%, #1a3a5c 100%);
    color: #fff;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.tp-user-meta,
.ma-user-meta {
    min-width: 0;
}

.tp-user-name,
.tp-user-role,
.ma-user-name,
.ma-user-role {
    margin: 0;
    line-height: 1.2;
}

.tp-user-name,
.ma-user-name {
    font-weight: 600;
}

.tp-user-role,
.ma-user-role {
    margin-top: 2px;
    font-size: 0.77rem;
    color: var(--tp-muted);
}

.tp-badge,
.ma-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.tp-badge--active,
.ma-badge--active {
    background: rgba(25, 135, 84, 0.12);
    color: #198754;
    border: 1px solid rgba(25, 135, 84, 0.22);
}

.tp-badge--inactive,
.ma-badge--inactive {
    background: rgba(220, 53, 69, 0.12);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.22);
}

.tp-empty,
.tp-empty-search,
.ma-empty,
.ma-empty-search {
    padding: 28px 20px;
    text-align: center;
    color: var(--tp-muted);
}

.tp-empty h2,
.ma-empty h2 {
    margin: 0 0 6px;
    color: var(--tp-text);
    font-family: 'Manrope', sans-serif;
    font-size: 1.15rem;
}

.tp-empty p,
.ma-empty p {
    margin: 0;
    font-size: 0.92rem;
}

.tp-empty code,
.ma-empty code {
    background: rgba(11, 31, 51, 0.06);
    color: var(--tp-primary);
    border-radius: 6px;
    padding: 2px 6px;
}

/* Herda layout global de .btn-actions + .btn-icon (botoes-premium.css) */
.tp-actions,
.ma-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}

.tp-actions .btn,
.ma-actions .btn {
    white-space: nowrap;
    padding: 5px 10px;
    font-size: 0.76rem;
}

.tp-actions .btn.btn-icon,
.ma-actions .btn.btn-icon {
    padding: 0;
}

.tp-table td[data-label="Ações"],
.ma-table td[data-label="Ações"] {
    min-width: 150px;
    text-align: center;
}

.tp-actions--table,
.ma-actions--table {
    width: 100%;
    justify-content: center;
}

@media (min-width: 701px) {
    .tp-table--alunos thead th:nth-child(1),
    .tp-table--alunos td[data-label="ID"],
    .ma-table thead th:nth-child(1),
    .ma-table td[data-label="ID"] {
        width: 52px;
        white-space: nowrap;
    }

    .tp-table--alunos thead th:nth-child(3),
    .tp-table--alunos td[data-label="CPF"],
    .ma-table thead th:nth-child(3),
    .ma-table td[data-label="CPF"] {
        width: 148px;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .tp-table--alunos thead th:nth-child(4),
    .tp-table--alunos td[data-label="Telefone"],
    .ma-table thead th:nth-child(4),
    .ma-table td[data-label="Telefone"] {
        width: 154px;
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .tp-table--alunos thead th:nth-child(6),
    .tp-table--alunos td[data-label="Status"],
    .ma-table thead th:nth-child(6),
    .ma-table td[data-label="Status"] {
        width: 106px;
        white-space: nowrap;
    }

    .tp-table--alunos thead th:nth-child(7),
    .tp-table--alunos td[data-label="Ações"],
    .ma-table thead th:nth-child(7),
    .ma-table td[data-label="Ações"] {
        width: 150px;
        white-space: nowrap;
    }
}

@media (max-width: 700px) {
    .tp-card,
    .ma-card {
        border-radius: 14px;
    }

    .tp-table,
    .ma-table {
        min-width: 0;
    }

    .tp-table thead,
    .ma-table thead {
        display: none;
    }

    .tp-table tbody tr,
    .ma-table tbody tr {
        display: block;
        margin: 10px;
        border: 1px solid var(--tp-border);
        border-radius: 12px;
        background: #fff;
        overflow: hidden;
    }

    .tp-table tbody td,
    .ma-table tbody td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        align-items: center;
        padding: 11px 12px;
    }

    .tp-table tbody td::before,
    .ma-table tbody td::before {
        content: attr(data-label);
        font-size: 0.74rem;
        color: var(--tp-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
    }

    .tp-table tbody td[data-label="Aluno"],
    .ma-table tbody td[data-label="Aluno"] {
        align-items: flex-start;
        flex-direction: column;
    }

    .tp-table tbody td[data-label="Aluno"]::before,
    .ma-table tbody td[data-label="Aluno"]::before {
        margin-bottom: 2px;
    }

    .tp-user,
    .ma-user {
        width: 100%;
    }

    .tp-table tbody td[data-label="E-mail"],
    .ma-table tbody td[data-label="E-mail"] {
        flex-direction: column;
        align-items: flex-start;
    }

    .tp-table tbody td[data-label="Ações"],
    .ma-table tbody td[data-label="Ações"] {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .tp-actions--table,
    .ma-actions--table {
        width: auto;
    }

    .tp-actions--table .btn,
    .tp-actions--table .tp-badge,
    .ma-actions--table .btn,
    .ma-actions--table .ma-badge {
        width: auto;
        text-align: center;
    }
}

[data-bs-theme=dark] .tp-table-theme {
    --tp-surface: #0b1f33;
    --tp-text: #D6B15E;
    --tp-muted: rgba(214, 177, 94, 0.7);
    --tp-border: rgba(214, 177, 94, 0.18);
}

[data-bs-theme=dark] .table-responsive > .table.table-vcenter.card-table thead th {
    background: rgba(214, 177, 94, 0.06);
    border-bottom-color: rgba(214, 177, 94, 0.18);
    color: rgba(214, 177, 94, 0.7);
}

[data-bs-theme=dark] .table-responsive > .table.table-vcenter.card-table tbody td {
    border-bottom-color: rgba(214, 177, 94, 0.18);
    color: #D6B15E;
}

[data-bs-theme=dark] .table-responsive > .table.table-vcenter.card-table tbody td.text-secondary {
    color: #D6B15E !important;
}

[data-bs-theme=dark] .table-responsive > .table.table-vcenter.card-table tbody tr:hover > * {
    background: rgba(214, 177, 94, 0.08);
}

[data-bs-theme=dark] .tp-search-wrap,
[data-bs-theme=dark] .ma-search-wrap {
    background: rgba(9, 25, 43, 0.75);
    border-color: var(--tp-border);
    color: var(--tp-muted);
}

[data-bs-theme=dark] .tp-search-input,
[data-bs-theme=dark] .ma-search-input {
    color: #D6B15E;
}

[data-bs-theme=dark] .tp-search-input::placeholder,
[data-bs-theme=dark] .ma-search-input::placeholder {
    color: rgba(214, 177, 94, 0.45);
}

[data-bs-theme=dark] .tp-table thead th,
[data-bs-theme=dark] .ma-table thead th {
    background: rgba(214, 177, 94, 0.06);
    border-bottom-color: var(--tp-border);
    color: var(--tp-muted);
}

[data-bs-theme=dark] .tp-table tbody td,
[data-bs-theme=dark] .ma-table tbody td {
    border-bottom-color: var(--tp-border);
    color: #D6B15E;
}

[data-bs-theme=dark] .tp-table tbody tr:hover,
[data-bs-theme=dark] .ma-table tbody tr:hover {
    background: rgba(214, 177, 94, 0.08);
}

[data-bs-theme=dark] .tp-avatar,
[data-bs-theme=dark] .ma-avatar {
    border-color: rgba(214, 177, 94, 0.35);
}

[data-bs-theme=dark] .tp-avatar--initials,
[data-bs-theme=dark] .ma-avatar--initials {
    background: linear-gradient(135deg, #0F2845 0%, #1a3a5c 100%);
    color: #D6B15E;
}

[data-bs-theme=dark] .tp-user-role,
[data-bs-theme=dark] .ma-user-role,
[data-bs-theme=dark] .tp-empty,
[data-bs-theme=dark] .tp-empty-search,
[data-bs-theme=dark] .ma-empty,
[data-bs-theme=dark] .ma-empty-search {
    color: rgba(214, 177, 94, 0.68);
}

[data-bs-theme=dark] .tp-empty code,
[data-bs-theme=dark] .ma-empty code {
    background: rgba(214, 177, 94, 0.12);
    color: #D6B15E;
}

/* Dark mode para .btn-actions agora é global (botoes-premium.css) */

@media (max-width: 700px) {
    [data-bs-theme=dark] .tp-table tbody tr,
    [data-bs-theme=dark] .ma-table tbody tr {
        background: rgba(9, 25, 43, 0.95);
        border-color: var(--tp-border);
    }
}
