/* Table Styles */

.table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
}

.table-actions {
    display: flex;
    gap: 10px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table thead {
    background: var(--bg-light);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table th.sortable {
    cursor: pointer;
    user-select: none;
}

.table th.sortable:hover {
    background: #e8e8e8;
}

.table th.sortable::after {
    content: ' ⇅';
    opacity: 0.3;
}

.table th.sorted-asc::after {
    content: ' ↑';
    opacity: 1;
}

.table th.sorted-desc::after {
    content: ' ↓';
    opacity: 1;
}

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

.table tbody tr:hover {
    background: rgba(128, 0, 0, 0.02);
}

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

.table td {
    padding: 14px 16px;
    color: var(--text-dark);
}

.table td.text-right {
    text-align: right;
}

.table td.text-center {
    text-align: center;
}

/* Striped Table */
.table-striped tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* Bordered Table */
.table-bordered {
    border: 1px solid var(--border-color);
}

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

/* Compact Table */
.table-compact th,
.table-compact td {
    padding: 10px 12px;
}

/* Table Footer */
.table-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-info {
    font-size: 13px;
    color: var(--text-light);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-dark);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
}

.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);
}

/* Table Filters */
.table-filters {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.filter-item select,
.filter-item input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
}

/* Status Indicators in Tables */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active .status-dot {
    background: var(--success);
}

.status-inactive .status-dot {
    background: var(--text-muted);
}

.status-pending .status-dot {
    background: var(--warning);
}

.status-overdue .status-dot {
    background: var(--danger);
}

/* Table Actions Column */
.table-actions-cell {
    white-space: nowrap;
}

/* Empty Table State */
.table-empty {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.table-empty i {
    font-size: 48px;
    opacity: 0.3;
    margin-bottom: 15px;
}

.table-empty p {
    margin: 0;
    font-size: 14px;
}

/* Loading State */
.table-loading {
    padding: 40px 20px;
    text-align: center;
}

.table-loading .spinner {
    margin: 0 auto 15px;
}

/* Responsive Table */
@media (max-width: 768px) {
    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .table-actions {
        width: 100%;
    }
    
    .table-actions .btn {
        flex: 1;
    }
    
    .table-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-item {
        width: 100%;
    }
    
    .table-footer {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination {
        width: 100%;
        justify-content: center;
    }
    
    /* Make table scrollable on mobile */
    .table {
        min-width: 600px;
    }
}

/* Card Table (Mobile Alternative) */
@media (max-width: 576px) {
    .table-card-mobile .table-wrapper {
        display: none;
    }
    
    .table-cards {
        display: block;
        padding: 15px;
    }
    
    .table-card {
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .table-card-row {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border-bottom: 1px solid var(--bg-light);
    }
    
    .table-card-row:last-child {
        border-bottom: none;
    }
    
    .table-card-label {
        font-weight: 600;
        color: var(--text-light);
        font-size: 12px;
    }
    
    .table-card-value {
        color: var(--text-dark);
        font-size: 14px;
        text-align: right;
    }
}