/* Table Styles */

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

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gray-50);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

th:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* Sort Icons */
th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.4;
    font-size: 10px;
}

th.sort-asc .sort-icon,
th.sort-desc .sort-icon {
    opacity: 1;
    color: var(--primary);
}

th.sort-asc .sort-icon::after { content: '▲'; }
th.sort-desc .sort-icon::after { content: '▼'; }
th:not(.sort-asc):not(.sort-desc) .sort-icon::after { content: '⇅'; }

/* Table Rows */
tr:hover td {
    background: var(--gray-50);
}

tbody tr {
    cursor: pointer;
    transition: background 0.1s ease;
}

/* Users Table specific */
#usersTableBody tr {
    transition: background 0.15s ease;
}

#usersTableBody tr:hover {
    background: rgba(79, 70, 229, 0.08) !important;
}

/* User Cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--white);
    flex-shrink: 0;
}

/* Progress Bar in Table */
.progress-bar {
    width: 80px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Daily Stats Table */
.daily-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.daily-stats-table th,
.daily-stats-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--gray-200);
}

.daily-stats-table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    position: sticky;
    top: 0;
    font-size: 12px;
}

.daily-stats-table td:first-child,
.daily-stats-table th:first-child {
    text-align: left;
    font-weight: 500;
}

.daily-stats-table tr:hover {
    background: var(--gray-50);
}

.daily-stats-table-container {
    max-height: 400px;
    overflow-y: auto;
}

.daily-stat-in {
    color: #10B981;
    font-weight: 500;
}

.daily-stat-out {
    color: #3B82F6;
    font-weight: 500;
}

/* Table Search */
.table-search {
    margin-bottom: 16px;
}

.table-search input {
    width: 100%;
    max-width: 300px;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
}

.table-search input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Mobile Table Improvements */
@media (max-width: 768px) {
    .table-container {
        position: relative;
    }

    /* Scroll shadow indicators */
    .table-container::before,
    .table-container::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 20px;
        pointer-events: none;
        z-index: 2;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .table-container::after {
        right: 0;
        background: linear-gradient(to left, rgba(0,0,0,0.08), transparent);
    }

    .table-container.scrollable::after {
        opacity: 1;
    }

    /* Table search full width */
    .table-search input {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    th, td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 10px;
    }

    .progress-bar {
        width: 60px;
    }

    .daily-stats-table th,
    .daily-stats-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
}
