/* =============================================================================
   TABLES - Tabelas de Dados
   ============================================================================= */

/* Base Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    vertical-align: middle;
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.03em;
}

.data-table td {
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-900);
}

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

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Variants */
.data-table-compact th,
.data-table-compact td {
    padding: 0.5rem 0.75rem;
}

.data-table-bordered {
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    overflow: hidden;
}

.data-table-bordered th,
.data-table-bordered td {
    border: 1px solid var(--gray-200);
}

.data-table-striped tbody tr:nth-child(even) {
    background: var(--gray-50);
}

.data-table-striped tbody tr:nth-child(even):hover {
    background: var(--gray-100);
}

/* Column Types */
.col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.col-checkbox {
    width: 1%;
    text-align: center;
}

.col-id {
    width: 1%;
    white-space: nowrap;
    color: var(--gray-500);
    font-family: monospace;
    font-size: 0.8125rem;
}

.col-status {
    width: 1%;
    white-space: nowrap;
}

.col-date {
    width: 1%;
    white-space: nowrap;
    color: var(--gray-600);
}

.col-value {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    font-family: monospace;
}

.col-center {
    text-align: center;
}

.col-right {
    text-align: right;
}

/* Cell Content */
.cell-with-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cell-with-icon svg {
    width: 1rem;
    height: 1rem;
    color: var(--gray-400);
    flex-shrink: 0;
}

.cell-with-avatar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cell-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
}

.cell-truncate {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cell-link {
    color: var(--primary);
    text-decoration: none;
}

.cell-link:hover {
    text-decoration: underline;
}

.cell-muted {
    color: var(--gray-500);
}

.cell-small {
    font-size: 0.75rem;
}

/* Sortable Columns */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease;
}

.sortable:hover {
    background: var(--gray-100);
}

.sort-icon {
    display: inline-flex;
    margin-left: 0.375rem;
    opacity: 0.3;
    transition: opacity 0.15s ease;
}

.sortable:hover .sort-icon {
    opacity: 0.6;
}

.sortable.sorted .sort-icon {
    opacity: 1;
    color: var(--primary);
}

.sortable.sorted-desc .sort-icon {
    transform: rotate(180deg);
}

/* Row Selection */
.row-checkbox {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
}

.data-table tbody tr.selected {
    background: var(--primary-light);
}

.data-table tbody tr.selected:hover {
    background: #dbeafe;
}

/* Row States */
.data-table tbody tr.row-muted {
    opacity: 0.6;
}

.data-table tbody tr.row-highlight {
    background: #fef3c7;
}

.data-table tbody tr.row-success {
    background: #dcfce7;
}

.data-table tbody tr.row-danger {
    background: #fee2e2;
}

/* Empty State */
.table-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.table-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    background: var(--gray-100);
    border-radius: 50%;
    color: var(--gray-400);
}

.table-empty-icon svg {
    width: 2rem;
    height: 2rem;
}

.table-empty-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.table-empty-message {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Loading Skeleton */
.table-skeleton td {
    padding: 1rem;
}

.skeleton {
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 0.25rem;
    height: 1rem;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 0.75rem;
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

/* Table Header */
.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.table-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* Table Footer */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* Responsive */
@media (max-width: 768px) {
    .data-table-responsive {
        display: block;
    }

    .data-table-responsive thead {
        display: none;
    }

    .data-table-responsive tbody,
    .data-table-responsive tr,
    .data-table-responsive td {
        display: block;
    }

    .data-table-responsive tr {
        padding: 1rem;
        border-bottom: 1px solid var(--gray-200);
    }

    .data-table-responsive td {
        padding: 0.25rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
    }

    .data-table-responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-700);
    }

    .data-table-responsive td.col-actions {
        justify-content: flex-end;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        border-top: 1px solid var(--gray-100);
    }

    .data-table-responsive td.col-actions::before {
        display: none;
    }

    /* Table Cards Mobile */
    .table-cards-mobile tr {
        background: white;
        border-radius: 0.5rem;
        border: 1px solid var(--gray-200);
        margin-bottom: 0.75rem;
    }
}
