/* =========================================
   0. MENCEGAH HALAMAN MELUBER KE KANAN
   ========================================= */
html, body {
    max-width: 100% !important;
    overflow-x: hidden !important; /* Mematikan scroll horizontal */
}

/* Paksa semua elemen pembungkus utama OJS agar tidak melebar */
.pkp_site_head, 
.pkp_structure_head,
.pkp_structure_page {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* =========================================
   1. HEADER BANNER (DIPERBAIKI)
   ========================================= */
.header-banner {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
    background-color: #f5f5f5;
}

.header-banner img {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important; /* Memaksa gambar tidak melebihi layar */
    height: auto !important;
    max-height: 500px;
    object-fit: cover !important;
    object-position: center;
}

/* Teks di atas banner */
.header-text-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 2;
}

.header-title {
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    font-family: Arial, sans-serif;
    font-size: clamp(16px, 3vw, 36px);
    font-weight: bold;
    line-height: 1.2;
    padding: 10px 20px;
    border-radius: 5px;
    margin: 0;
    overflow-wrap: anywhere;
}

.header-subtitle {
    color: #fff;
    background: rgba(0, 0, 0, 0.65);
    font-family: Arial, sans-serif;
    font-size: clamp(11px, 1.5vw, 18px);
    line-height: 1.4;
    padding: 5px 15px;
    border-radius: 5px;
    margin: 0;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

/* =========================================
   2. MENU NAVIGASI PORTAL
   ========================================= */
.navigation-menu {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 20px auto;
    padding: 0 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.navigation-menu a {
    display: inline-block;
    box-sizing: border-box;
    padding: 10px 20px;
    text-align: center;
    text-decoration: none;
    color: #0073aa;
    font-family: Arial, sans-serif;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid #0073aa;
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.navigation-menu a:hover,
.navigation-menu a:focus {
    background-color: #0073aa;
    color: #fff;
}

/* =========================================
   3. PERBAIKAN TOTAL LAYOUT OJS (MOBILE & DESKTOP MODE)
   ========================================= */
@media screen and (max-width: 1024px) {

    /* 1. Paksa container utama menjadi satu kolom ke bawah */
    .pkp_structure_content {
        display: block !important;
        flex-direction: column !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        padding: 0 10px !important;
        box-sizing: border-box !important;
    }

    /* 2. Paksa Konten Utama (Kiri) menjadi 100% */
    .pkp_structure_main {
        display: block !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 0 20px 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* 3. Paksa Sidebar (Kanan) turun ke bawah */
    .pkp_structure_sidebar {
        display: block !important;
        float: none !important;
        clear: both !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 20px 0 0 0 !important;
        padding: 20px 0 0 0 !important;
        border-top: 2px dashed #ccc;
        box-sizing: border-box !important;
    }

    /* 4. Matikan efek Grid Bootstrap jika ada */
    .pkp_structure_content .row {
        display: block !important;
        margin: 0 !important;
    }
    
    .pkp_structure_content [class*="col-"] {
        display: block !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* 5. Perbaiki Kotak-kotak Sidebar */
    .pkp_structure_sidebar .pkp_block {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 20px !important;
        box-sizing: border-box !important;
    }

    /* 6. Gambar & Tabel tidak boleh bocor keluar layar */
    .pkp_structure_main img,
    .pkp_structure_sidebar img {
        max-width: 100% !important;
        height: auto !important;
    }

    .pkp_structure_main table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
    }

    /* 7. Penyesuaian Banner di HP/Desktop Mode */
    .header-banner img {
        max-height: 300px;
    }
}

/* =========================================
   4. PENYESUAIAN KHUSUS HP LAYAR KECIL
   ========================================= */
@media screen and (max-width: 480px) {
    .header-banner img {
        max-height: 200px;
    }

    .header-text-wrapper {
        width: 96%;
        gap: 5px;
    }

    .header-title {
        font-size: 16px;
        padding: 6px 10px;
        line-height: 1.25;
    }

    .header-subtitle {
        font-size: 11px;
        padding: 4px 8px;
    }

    .navigation-menu {
        gap: 8px;
    }

    .navigation-menu a {
        flex: 1 1 100%;
        padding: 10px;
        font-size: 13px;
    }
}