/* Base Tables - Grundbedienung */

.table {
    width: 100%;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--spacing-sm) var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table thead th {
    font-weight: 600;
    background-color: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.table tbody tr:hover {
    background-color: var(--bg-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Table Sizes */
.table-sm th,
.table-sm td {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.table-lg th,
.table-lg td {
    padding: var(--spacing-md);
    font-size: var(--font-size-lg);
}

/* Table Striped */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bg-secondary);
}

/* Table Bordered */
.table-bordered {
    border: 1px solid var(--border-color);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color);
}

.table-bordered thead th,
.table-bordered thead td {
    border-bottom-width: 2px;
}

/* Table Hover */
.table-hover tbody tr {
    transition: background-color var(--transition-fast);
}

/* Table Responsive */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive > .table {
    margin-bottom: 0;
}

/* Table Variants */
.table-primary {
    --bs-table-bg: var(--primary-light);
}

.table-secondary {
    --bs-table-bg: #e2e3e5;
}

.table-success {
    --bs-table-bg: #d4edda;
}

.table-danger {
    --bs-table-bg: #f8d7da;
}

.table-warning {
    --bs-table-bg: #fff3cd;
}

.table-info {
    --bs-table-bg: #d1ecf1;
}

.table-dark {
    --bs-table-bg: #343a40;
    color: var(--text-light);
}

/* Table Clickable Row */
.table-clickable tbody tr {
    cursor: pointer;
}

.table-clickable tbody tr:hover {
    background-color: var(--primary-light);
}

/* Table Sortable */
.table-sortable th {
    cursor: pointer;
    user-select: none;
}

.table-sortable th:hover {
    background-color: var(--border-light);
}

.table-sortable th::after {
    content: '';
    display: inline-block;
    margin-left: var(--spacing-xs);
    opacity: 0.3;
}

.table-sortable th.sort-asc::after {
    content: '↑';
    opacity: 1;
}

.table-sortable th.sort-desc::after {
    content: '↓';
    opacity: 1;
}

/* Table Pagination */
.table-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
}

.table-pagination-info {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.table-pagination-controls {
    display: flex;
    gap: var(--spacing-xs);
}

/* Table Empty State */
.table-empty {
    text-align: center;
    padding: var(--spacing-xl) !important;
    color: var(--text-muted);
}

.table-empty-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* Table Loading State */
.table-loading {
    position: relative;
    pointer-events: none;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}