/* Mobile Optimization & Modern UI */

:root {
    --primary-color: #0d6efd;
    --bg-light: #f8f9fa;
    --card-border-radius: 12px;
    --input-radius: 4px;
}

/* General Improvements */
body {
    background-color: var(--bg-light);
    -webkit-tap-highlight-color: transparent;
}

/* Layui Card Overrides for Mobile */
@media (max-width: 768px) {
    .layui-card {
        margin-bottom: 15px;
        border-radius: var(--card-border-radius);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .layui-card-header {
        border-bottom: 1px solid #f6f6f6;
        padding: 0 15px;
    }

    .layui-card-body {
        padding: 15px;
    }
}

/* Layui Form Optimization for Mobile */
@media (max-width: 768px) {
    .layui-form-item {
        margin-bottom: 15px;
        clear: both;
    }

    .layui-form-label {
        float: none;
        display: block;
        padding: 9px 0;
        width: 100%;
        text-align: left;
    }

    .layui-input-block {
        margin-left: 0;
    }

    .layui-inline {
        display: block;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .layui-input-inline {
        display: block;
        width: 100% !important;
        margin-right: 0;
    }

    /* Adjust button groups to wrap if needed */
    .layui-btn-group {
        display: flex;
        flex-wrap: wrap;
    }

    .layui-btn-group .layui-btn {
        flex: 1;
        margin-bottom: 0;
    }
}

/* Layui Table Optimization (Card View) */
@media (max-width: 768px) {
    .layui-table {
        display: block;
        width: 100%;
        background-color: transparent;
        border: none;
    }

    .layui-table thead {
        display: none;
    }

    .layui-table tbody {
        display: block;
        width: 100%;
    }

    .layui-table tr {
        display: block;
        background-color: #fff;
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        padding: 10px;
        border: 1px solid #eee;
    }

    .layui-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        border-bottom: 1px dashed #f0f0f0;
        padding: 8px 0;
        min-height: 40px;
        text-align: right;
    }

    .layui-table td:last-child {
        border-bottom: none;
        justify-content: flex-end;
        padding-top: 12px;
    }

    .layui-table td:before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: #666;
        margin-right: 10px;
        text-align: left;
    }

    /* Hide empty cells or specific columns if needed */
    .layui-table td:empty {
        display: none;
    }

    /* Fix for button groups in table */
    .layui-table td .layui-btn-group {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Sidebar & Header Adjustments */
@media (max-width: 991.98px) {
    .top-header {
        padding: 0 15px;
    }

    .main-content {
        padding: 15px;
    }
}

/* Bottom Navigation for User Portal (if used) */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        height: 60px;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #6c757d;
        font-size: 0.75rem;
        flex: 1;
        height: 100%;
    }

    .bottom-nav-item i {
        font-size: 1.4rem;
        margin-bottom: 2px;
    }

    .bottom-nav-item.active {
        color: var(--primary-color);
    }
}