/* Responsive card layout for data tables on narrow screens.
   Add `table-mobile-cards` to any table that should stack on mobile.
   Optional cell classes:
     - `mobile-card-actions`: hides the label and right-aligns action buttons
     - `mobile-card-full`: stacks label above value (useful for long/multi-line cells)
     - `mobile-card-empty`: hides the label in empty-state rows
*/

@media (max-width: 767.98px) {
    .table-responsive:has(.table-mobile-cards) {
        overflow-x: visible;
    }

    .table-mobile-cards,
    .table-mobile-cards thead,
    .table-mobile-cards tbody,
    .table-mobile-cards th,
    .table-mobile-cards td,
    .table-mobile-cards tr {
        display: block;
        width: 100%;
    }

    .table-mobile-cards thead {
        display: none;
    }

    .table-mobile-cards tbody {
        border: none;
    }

    .table-mobile-cards tr {
        margin-bottom: 1rem;
        padding: 0.75rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
        background-color: var(--bs-body-bg);
    }

    .table-mobile-cards td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.375rem 0;
        border: none;
        text-align: right;
    }

    .table-mobile-cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        max-width: 50%;
        font-weight: 600;
        color: var(--bs-secondary);
        text-align: left;
    }

    .table-mobile-cards td.mobile-card-full {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }

    .table-mobile-cards td.mobile-card-full::before {
        margin-bottom: 0.25rem;
    }

    .table-mobile-cards td.mobile-card-actions {
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--bs-border-color-translucent);
    }

    .table-mobile-cards td.mobile-card-actions::before {
        content: none;
    }

    .table-mobile-cards td.mobile-card-empty {
        justify-content: center;
        text-align: center;
    }

    .table-mobile-cards td.mobile-card-empty::before {
        content: none;
    }
}
