/* ==========================================================================
   TABLES & RESPONSIVE CARDS (المرحلة 4 & table-cards.js)
   ========================================================================== */

.table-wrapper, .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    margin-bottom: var(--space-4);
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: start;
}

.table-custom th {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table-custom td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.92rem;
    vertical-align: middle;
}

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

.table-custom tr:hover td {
    background-color: var(--bg-subtle);
}

/* التوافق مع جداول الأدمن الحالية */
@media (max-width: 768px) {
    .table-responsive-cards table,
    .table-responsive-cards thead,
    .table-responsive-cards tbody,
    .table-responsive-cards th,
    .table-responsive-cards td,
    .table-responsive-cards tr {
        display: block;
    }

    .table-responsive-cards thead tr {
        position: absolute;
        top: -9999px;
        right: -9999px;
    }

    .table-responsive-cards tr {
        background-color: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: var(--space-3);
        padding: var(--space-3);
        box-shadow: var(--shadow-xs);
    }

    .table-responsive-cards td {
        border: none;
        border-bottom: 1px solid var(--border-subtle);
        position: relative;
        padding: var(--space-2) 0;
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: var(--space-2);
        text-align: start;
    }

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

    .table-responsive-cards td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.8rem;
        color: var(--text-muted);
        flex: 0 0 auto;
    }
}
