/* ===== TABLE COMPONENT STYLES ===== */

/* Base Table Styles */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-primary);
    background: var(--bg-card);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-weight: var(--weight-semibold);
    text-align: start;
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--border-primary);
}

.table td {
    padding: var(--spacing-3) var(--spacing-4);
    border-bottom: 1px solid var(--border-primary);
    color: var(--text-secondary);
}

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

.table tbody tr {
    transition: all var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* Table Variants */
.table-striped tbody tr:nth-child(odd) {
    background: var(--bg-tertiary);
}

.table-striped tbody tr:hover {
    background: var(--bg-secondary);
}

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

.table-borderless th,
.table-borderless td {
    border: none;
}

/* Table Sizes */
.table-sm th,
.table-sm td {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--text-xs);
}

.table-lg th,
.table-lg td {
    padding: var(--spacing-4) var(--spacing-6);
    font-size: var(--text-base);
}

/* Table with Fixed Header */
.table-fixed-header {
    max-height: 400px;
    overflow-y: auto;
}

.table-fixed-header table {
    position: relative;
}

.table-fixed-header thead {
    position: sticky;
    top: 0;
    z-index: var(--z-10);
}

/* Table Row States */
.table-row-active {
    background: var(--accent-blue-10) !important;
}

.table-row-success {
    background: var(--accent-green-10) !important;
}

.table-row-warning {
    background: var(--accent-yellow-10) !important;
}

.table-row-danger {
    background: var(--accent-red-10) !important;
}

/* Table with Checkboxes */
.table-selectable th:first-child,
.table-selectable td:first-child {
    width: 40px;
    text-align: center;
}

/* Table with Actions */
.table-actions {
    display: flex;
    gap: var(--spacing-2);
    justify-content: flex-end;
}

.table-action-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--spacing-1);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent-blue);
}

.table-action-btn.edit:hover {
    color: var(--accent-blue);
}

.table-action-btn.delete:hover {
    color: var(--accent-red);
}

.table-action-btn.view:hover {
    color: var(--accent-green);
}

/* Table Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-3) var(--spacing-4);
    border-top: 1px solid var(--border-primary);
    background: var(--bg-secondary);
}

.table-pagination-info {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

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

.table-pagination-btn {
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--text-primary);
    cursor: pointer;
    padding: var(--spacing-1) var(--spacing-2);
    border-radius: var(--radius-md);
    font-size: var(--text-xs);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
}

.table-pagination-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-focus);
}

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

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

/* Table Empty State */
.table-empty {
    padding: var(--spacing-8);
    text-align: center;
    color: var(--text-tertiary);
}

.table-empty-icon {
    font-size: var(--text-3xl);
    margin-bottom: var(--spacing-3);
    opacity: 0.5;
}

.table-empty-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    margin-bottom: var(--spacing-2);
    color: var(--text-primary);
}

.table-empty-message {
    font-size: var(--text-sm);
    max-width: 300px;
    margin: 0 auto var(--spacing-4);
}

/* Table Loading State */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary-50);
    backdrop-filter: var(--backdrop-blur-sm);
    -webkit-backdrop-filter: var(--backdrop-blur-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-10);
}

.table-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-20);
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-primary);
    border-top-color: var(--accent-blue);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
    }
    
    .table-responsive thead {
        display: none;
    }
    
    .table-responsive tbody, 
    .table-responsive tr, 
    .table-responsive td {
        display: block;
        width: 100%;
    }
    
    .table-responsive tr {
        margin-bottom: var(--spacing-4);
        border: 1px solid var(--border-primary);
        border-radius: var(--radius-md);
        overflow: hidden;
    }
    
    .table-responsive td {
        display: flex;
        justify-content: space-between;
        text-align: right;
        padding: var(--spacing-3) var(--spacing-4);
    }
    
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: var(--weight-semibold);
        color: var(--text-primary);
        text-align: left;
    }
    
    .table-pagination {
        flex-direction: column;
        gap: var(--spacing-3);
    }
}

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