/* --- MOBILE RESPONSIVE FIX --- */
@media screen and (max-width: 768px) {

    /* 1. Reset Body & Layout Utama agar tidak melebar keluar layar */
    body {
        height: auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        /* Mencegah layar bisa digeser ke kanan/kiri */
        width: 100% !important;
    }

    .dashboard-layout {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    .main-content {
        width: 100% !important;
        height: auto !important;
        overflow-x: hidden !important;
    }

    /* 2. Perbaiki Header Atas (Top Bar) */
    .top-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 15px !important;
        height: auto !important;
        gap: 15px;
    }

    /* Agar tombol E-Modul dan Profil sejajar di mobile */
    .top-bar>div:nth-child(2) {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 3. Perbaiki Grid & Padding Container */
    .dashboard-container {
        padding: 15px !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
        /* Ubah kotak stat menjadi 1 baris ke bawah */
        gap: 15px !important;
    }

    .content-section {
        padding: 15px !important;
    }

    /* 4. PERBAIKAN TABEL AGAR BISA DI-SCROLL KE SAMPING (Kunci dari masalah terpotong) */
    .table-responsive {
        width: 100% !important;
        overflow-x: auto !important;
        /* Izinkan scroll horizontal hanya di area tabel */
        -webkit-overflow-scrolling: touch;
    }

    /* 5. Styling Floating Button (Tombol Pemicu Sidebar) */
    .mobile-nav-toggle {
        display: flex !important;
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
        width: 55px !important;
        height: 55px !important;
        background: #003366 !important;
        color: white !important;
        border-radius: 50% !important;
        z-index: 10001 !important;
        justify-content: center !important;
        align-items: center !important;
        border: none !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
        font-size: 22px !important;
        cursor: pointer;
    }

    /* 6. Styling Sidebar Mobile (Popup Menu) */
    .sidebar {
        position: fixed !important;
        bottom: 85px !important;
        /* Tepat di atas tombol pemicu */
        right: 20px !important;
        left: auto !important;
        top: auto !important;
        width: 260px !important;
        min-width: 260px !important;
        max-height: 60vh !important;
        background: white !important;
        border-radius: 12px !important;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2) !important;
        z-index: 10000 !important;

        display: none !important;
        /* Tersembunyi sampai tombol diklik */
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    .sidebar.show-nav {
        display: flex !important;
    }

    .sidebar-header {
        padding: 15px !important;
    }

    .sidebar-header h2 {
        font-size: 1.2rem !important;
    }

    .sidebar-nav {
        padding: 0 !important;
    }

    .nav-item {
        padding: 12px 20px !important;
        font-size: 0.95rem !important;
    }

    /* 7. Perbaiki Kolom Pencarian dan Filter */
    .filter-group {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .filter-input {
        width: 100%;
        box-sizing: border-box;
    }
}