/* Estilos para tabelas */
.table-container {
    margin: var(--spacing-xl) 0;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-medium);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--bg-primary);
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
}

.data-table thead th {
    padding: var(--spacing-lg);
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.data-table thead th:hover {
    background: rgba(255, 255, 255, 0.1);
}

.data-table thead th.sortable::after {
    content: '↕️';
    position: absolute;
    right: var(--spacing-sm);
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
    font-size: 0.8rem;
}

.data-table thead th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.data-table thead th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.data-table tbody td {
    padding: var(--spacing-md) var(--spacing-lg);
    vertical-align: top;
    line-height: 1.5;
}

.data-table tbody td:first-child {
    font-weight: 500;
    color: var(--primary-color);
}

/* Colunas específicas */
.traditional-col {
    background: rgba(30, 58, 138, 0.05);
    position: relative;
}

.traditional-col::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
}

.academic-col {
    background: rgba(245, 158, 11, 0.05);
    position: relative;
}

.academic-col::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--secondary-color);
}

/* Filtros de tabela */
.table-filters {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-select,
.filter-input {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.filter-button {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
}

.filter-button:hover {
    background: var(--accent-color);
    transform: translateY(-1px);
}

.filter-button.active {
    background: var(--secondary-color);
}

/* Toggle de visualização */
.view-toggle {
    display: flex;
    gap: var(--spacing-xs);
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: var(--spacing-xs);
}

.view-toggle-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
}

.view-toggle-btn.active {
    background: var(--bg-primary);
    color: var(--primary-color);
    font-weight: 500;
    box-shadow: var(--shadow-light);
}

/* Indicadores de diferenças */
.difference-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: var(--spacing-xs);
    vertical-align: middle;
}

.difference-major {
    background: #ef4444;
}

.difference-minor {
    background: var(--secondary-color);
}

.difference-none {
    background: #10b981;
}

/* Tooltips para células */
.cell-tooltip {
    position: relative;
    cursor: help;
}

.cell-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 1000;
    pointer-events: none;
}

.cell-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* Destacar linha ativa */
.data-table tbody tr.highlighted {
    background: rgba(30, 58, 138, 0.1);
    border-left: 4px solid var(--primary-color);
}

/* Paginação */
.table-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    gap: var(--spacing-xs);
}

.pagination-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Exportação */
.table-export {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.export-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.export-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
}

/* Notas da tabela */
.table-source,
.table-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--secondary-color);
    line-height: 1.5;
}

/* Estados de carregamento */
.table-loading {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-secondary);
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
    margin-right: var(--spacing-sm);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Busca na tabela */
.table-search {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.table-search-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg) var(--spacing-md) 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    background: var(--bg-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.table-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.table-search-icon {
    position: absolute;
    left: var(--spacing-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Destacar resultados de busca */
.search-highlight {
    background: yellow;
    padding: 1px 2px;
    border-radius: 2px;
    font-weight: 500;
}

/* Linha vazia quando não há resultados */
.no-results {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-secondary);
    font-style: italic;
}

.no-results::before {
    content: '🔍';
    display: block;
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

