/* =========================================================================
   1. PENGATURAN DASAR & STRUKTUR UTAMA KANVAS GRID (DESKTOP)
========================================================================= */
html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
}

.main-layout-container {
    width: 100%;
    height: calc(100vh - 70px);
    /* Memotong tinggi navbar agar tidak ke bawah scroll */
    margin-top: 70px;
    /* Memberi ruang pas bagi navbar agar peta kelihatan penuh */
    display: grid;
    grid-template-columns: 320px 1fr;
    /* Kolom Kiri: 320px (Legenda), Kolom Kanan: Sisa Ruang (Peta) */
    padding: 0 !important;
    max-width: none !important;
    overflow: hidden;
    position: relative;
    background-color: #121212;
}

/* Container untuk memastikan label rapi */
.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    /* Mendorong titik warna ke kanan */
}

/* Style titik warna */
.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-left: auto;
    /* Memastikan titik berada di paling kanan */
    border: 1px solid rgba(255, 255, 255, 0.2);
}

h3 {
    margin-bottom: -12px !important;
}

/* Definisi Warna per Kategori */
.color-budaya {
    background-color: #ff9f43;
}

/* Oranye terang */
.color-sejarah {
    background-color: #5f27cd;
}

/* Ungu */
.color-kuliner {
    background-color: #ee5253;
}

/* Merah */
.color-alam {
    background-color: #10ac84;
}

/* Hijau */
.color-transportasi {
    background-color: #54a0ff;
}

/* Biru */
.color-akomodasi {
    background-color: #feca57;
}

/* Kuning */
.color-fasilitas {
    background-color: #c8d6e5;
}

/* Abu-abu muda */

/* Efek redup saat checkbox tidak dicentang */
.sync-chk:not(:checked)+.legend-label+.color-dot {
    opacity: 0.3;
    filter: grayscale(1);
}

/* =========================================================================
   2. PANEL LEGENDA & FILTER (DESKTOP KIRI)
========================================================================= */
.map-legend-control {
    grid-column: 1;
    height: 100%;
    width: 100%;
    background: rgba(30, 20, 12, 0.98);
    /* Cokelat Gelap khas Mataram */
    border-right: 2px solid #d4af37;
    /* Border Emas asli/var(--gold) */
    padding: 30px 24px;
    color: #f5f0e6;
    /* Warna Cream asli/var(--cream) */
    box-shadow: 6px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 2;
    overflow-y: auto;
    box-sizing: border-box;
}

.legend-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #d4af37;
    border-bottom: 2px solid rgba(212, 175, 55, 0.25);
    padding-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 4px 0;

}

.legend-item:hover {
    transform: translateX(6px);
}

.btn-check-all,
.btn-uncheck-all {
    padding: 8px 16px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-check-all:hover,
.btn-uncheck-all:hover {
    transform: translateY(-4px);
}

.legend-item input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: #d4af37;
    cursor: pointer;
}

.legend-icon {
    width: 24px;
    text-align: center;
}

.legend-label {
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* =========================================================================
   3. TOMBOL NAVIGASI & KONTROL ZOOM CUSTOM DESKTOP
========================================================================= */
.btn-custom-zoom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(212, 175, 55, 0.4);
    color: #f5f0e6;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 13px;
    transition: all 0.2s ease-in-out;
}

.btn-custom-zoom:hover {
    background: #d4af37;
    color: #1a0f05;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
    transform: translateY(-2px);
}

/* Modifikasi elemen bawaan Leaflet di kanan bawah agar senada */
.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
    background-color: #2b1808 !important;
    color: #d4af37 !important;
    border-color: rgba(212, 175, 55, 0.3) !important;
}

.leaflet-control-zoom a:hover {
    background-color: #d4af37 !important;
    color: #000 !important;
}

/* =========================================================================
   4. WRAPPER MAP LEAFLET (DESKTOP KANAN)
========================================================================= */
.map-content-wrapper {
    grid-column: 2;
    width: 100%;
    height: 100%;
    position: relative;
    margin: 0;
    padding: 0;
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* =========================================================================
   5. POPUP BALON INFORMASI (INFOWINDOW) LEAFLET
========================================================================= */
.popup-box {
    min-width: 220px;
    padding: 4px;
    color: #333;
}

.popup-category {
    display: inline-block;
    background: #2b1808;
    color: #d4af37;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: bold;
}

.popup-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #111;
}

.popup-desc {
    font-size: 12px;
    line-height: 1.5;
    color: #555;
}

/* Sembunyikan laci sidebar mobile bawaan saat tampilan layar lebar */
.peta-sidebar,
.btn-toggle-peta {
    display: none;
}

/* Kunci Kontrol Zoom Melayang Khusus Mobile (Disembunyikan di Desktop) */
.mobile-floating-zoom {
    position: absolute;
    bottom: 24px;
    right: 20px;
    z-index: 7;
    /* Diaktifkan lewat media query mobile */
    flex-direction: column;
    gap: 10px;
}
.popup-link{
    text-align: right !important;
}
.btn-mobile-zoom {
    width: 46px;
    height: 46px;
    background-color: #2b1808;
    border: 2px solid rgba(212, 175, 55, 0.8);
    color: #d4af37;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-mobile-zoom:active {
    transform: scale(0.9);
    background-color: #d4af37;
    color: #2b1808;
}

    .t {
        display: none !important;
        position: absolute !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
/* =========================================================================
   6. PEMBARUAN: INTERFACES RESPONSIF & GRID KHUSUS MOBILE (Layar <= 768px)
========================================================================= */
@media (max-width: 768px) {
    .popup-box{
        width: 100px !important;
        padding: auto;
    }
    .popup-link{

    }
    .p {
        display: none !important;
        position: absolute !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }


    /* Memaksa body tidak bisa di-scroll secara global agar layout mengunci */
    body {
        overflow: hidden !important;
    }

    /* Mengubah susunan grid desktop menjadi tumpuk & pas dengan tinggi sisa layar */
    .main-layout-container {
        grid-template-columns: 1fr;
        /* Menjadi satu kolom penuh */
        grid-template-rows: auto 1fr;
        /* Baris atas untuk filter, sisanya kebawah full untuk peta */
        height: calc(100vh - 70px);
        /* Tinggi pas dari batas bawah navbar sampai ujung layar HP */
        margin-top: 70px;
        overflow: hidden;
        /* Mencegah main-layout tembus kebawah */
    }

    /* Modifikasi panel filter di mobile (Menempati Baris Pertama) */
    .map-legend-control {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-height: 180px;
        /* Membatasi tinggi filter agar area peta tetap dominan */
        border-right: none;
        border-bottom: 2px solid #d4af37;
        /* Mengalihkan garis pembatas ke area bawah */
        padding: 14px 16px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .legend-title {
        margin-bottom: 10px;
        font-size: 13px;
        letter-spacing: 1px;
    }

    /* Menyusun item-item filter secara horizontal agar hemat ruang vertikal HP */
    .map-legend-control>div:first-child {
        display: flex;
        flex-wrap: wrap;
        /* Membuat filter otomatis turun ke baris baru jika penuh */
        gap: 6px 14px;
    }

    .legend-item {
        margin-bottom: 0;
        /* Menghapus margin bawah bawaan desktop */
        padding: 2px 0;
        color: #d4af37;
    }

    .legend-label {
        font-size: 12px;
        color: #d4af37;
        /* Sedikit mengecilkan teks agar muat di layar HP kecil */
    }



    .btn-check-all,
    .btn-uncheck-all {
        padding: 8px 16px;
        /* Padding standar untuk desktop */
        font-size: 14px;
    }

    /* Modifikasi wrapper peta di mobile (Menempati Baris Kedua - Menghabiskan Sisa Layar) */
    .map-content-wrapper {
        grid-column: 1;
        grid-row: 2;
        width: 100%;
        height: 100%;
        /* Otomatis mengisi 1fr dari sisa row grid */
    }

    /* Menampilkan tombol navigasi zoom bulat melayang di atas peta */
    .mobile-floating-zoom {
        display: flex;
        bottom: 16px;
        /* Disesuaikan posisinya agar pas di ujung layar HP */
        right: 16px;
    }

    /* HILANGKAN FOOTER TOTAL DAN BEBASKAN MATRIKS RUANGNYA */
    footer {
        display: none !important;
        position: absolute !important;
        visibility: hidden !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* =========================================================================
   TOMBOL PENGARAH / DIREKSI RUTE DI DALAM POPUP PETA
========================================================================= */
.btn-peta-direksi {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding: 8px 12px;
    background-color: #2b1808;
    /* Cokelat gelap Mataram */
    border: 1px solid #d4af37;
    /* Emas */
    color: #d4af37;
    border-radius: 6px;
    font-family: 'Josefin Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-peta-direksi:hover {
    background-color: #d4af37;
    color: #2b1808;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
}

/* Modifikasi popup bawaan Leaflet agar tombol terlihat rapi */
.leaflet-popup-content {
    margin: 13px 19px 13px 14px !important;
}