/* Mobile UI Enhancements */

/* Mobile Table to Card Transformation */
@media screen and (max-width: 767.98px) {
    .table-responsive.mobile-cards table,
    .table-responsive.mobile-cards thead,
    .table-responsive.mobile-cards tbody,
    .table-responsive.mobile-cards th,
    .table-responsive.mobile-cards td,
    .table-responsive.mobile-cards tr {
        display: block;
    }

    /* Hide table headers (but not display: none, for accessibility if needed) */
    .table-responsive.mobile-cards thead tr {
        display: none;
    }

    /* Add Card styling to each row */
    .table-responsive.mobile-cards tr {
        margin-bottom: 15px;
        background-color: var(--bs-card-bg, #fff);
        border: 1px solid var(--bs-card-border-color, #eff2f7);
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        padding: 10px;
    }
    
    body[data-layout-mode="dark"] .table-responsive.mobile-cards tr {
        background-color: #2b3e58;
        border-color: #324765;
    }

    /* Add padding to tds and create label from data-label */
    .table-responsive.mobile-cards td {
        border: none !important;
        position: relative;
        padding-left: 45% !important;
        text-align: right;
        min-height: 35px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--bs-border-color, #eff2f7) !important;
    }
    
    body[data-layout-mode="dark"] .table-responsive.mobile-cards td {
        border-bottom-color: #324765 !important;
    }

    .table-responsive.mobile-cards td:last-child {
        border-bottom: 0 !important;
    }

    /* Creating the labels */
    .table-responsive.mobile-cards td:before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: 40%;
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: var(--bs-body-color, #495057);
    }
    
    body[data-layout-mode="dark"] .table-responsive.mobile-cards td:before {
        color: #8c9fb9;
    }

    .btn-fab-mobile {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1000;
        box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
    }
    .btn-fab-mobile span {
        display: none;
    }
    .btn-fab-mobile i {
        margin: 0 !important;
        font-size: 24px;
    }
}

/* Ensure touch targets are at least 44px */
.btn, .form-control, .form-select {
    min-height: 44px;
}
