#map {
    height: 70vh;
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Page title */
.page-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    font-weight: 600;
}

/* Filter sidebar containers */
.filter-container {
    background-color: #fff;
    padding: 12px; /* Diperkecil dari 16px untuk menghemat space */
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

/* Filter sections spacing */
.filter-section {
    margin-bottom: 10px; /* Diperkecil dari 15px untuk menghemat space */
}

/* Gaya untuk filter compact */
.compact-filter {
    padding: 8px;
    margin-bottom: 0;
}

/* Search box at bottom of filters */
.search-box {
    margin-bottom: 10px;
    margin-top: 10px;
}

/* Facility filter checkboxes */
.facility-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Diperkecil dari 15px */
    margin-top: 8px; /* Diperkecil dari 10px */
}

.facility-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}

/* Tab filter styling - BARU */
.nav-tabs .nav-link {
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
}

.tab-content {
    padding-top: 10px;
}

/* Legend styling - Positioned at right bottom, aligned with layer control */
.map-legend {
    position: absolute;
    bottom: 30px;
    right: 10px; /* Aligned with right edge */
    background-color: white;
    padding: 8px; /* Reduced padding */
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 220px; /* Reduced width */
    font-size: 0.8rem; /* Smaller font */
    /* Remove margin-right to align with layer control */
}

.legend-section {
    margin-bottom: 8px; /* Reduced margin */
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-title {
    font-weight: 600;
    margin-bottom: 5px; /* Reduced margin */
    font-size: 0.85rem; /* Smaller font */
    padding-bottom: 2px; /* Reduced padding */
    border-bottom: 2px solid #e0e0e0;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px; /* Reduced margin */
}

.legend-item:last-child {
    margin-bottom: 0;
}

.legend-color {
    width: 14px; /* Slightly smaller */
    height: 14px;
    margin-right: 6px; /* Reduced margin */
    border: 1px solid #ccc;
    border-radius: 2px;
}

.legend-icon {
    width: 18px; /* Slightly smaller */
    height: 18px;
    margin-right: 6px; /* Reduced margin */
}

/* Collapsible kelurahan legend */
.legend-collapse .legend-clickable {
    user-select: none;
    transition: background-color 0.2s;
}

.legend-kelurahan-list {
    transition: all 0.3s ease;
    max-height: 180px; /* Reduced height */
}

/* Kelurahan legend subcategory styling */
.legend-subcategory {
    margin-bottom: 6px; /* Reduced margin */
}

.legend-subcategory:last-child {
    margin-bottom: 0;
}

/* Custom scrollbar for kelurahan list */
.legend-kelurahan-list::-webkit-scrollbar {
    width: 4px;
}

.legend-kelurahan-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.legend-kelurahan-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.legend-kelurahan-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Facility marker styling */
.facility-marker {
    background: none !important;
    border: none !important;
}

/* User location marker styling */
.user-location-marker {
    background: none !important;
    border: none !important;
}

/* Button styling */
.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.btn-secondary {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
}

.btn-secondary:hover {
    background-color: #95a5a6;
    border-color: #95a5a6;
}

/* Button with icon styling */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Notification styling */
.nearby-notification .alert {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 2000;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Tombol filter mobile yang lebih kecil dan responsif */
#mobile-filter-toggle {
    position: relative;
    z-index: 1050;
    padding: 6px 12px;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border-radius: 20px;
    margin-bottom: 10px;
    background-color: white;
    border: 1px solid #3498db;
    color: #3498db;
}

#mobile-filter-toggle:hover {
    background-color: #f8f9fa;
}

#mobile-filter-toggle i {
    font-size: 0.8rem;
}

/* Memperbaiki style untuk accordion pada filter mobile */
.accordion-button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.accordion-button:not(.collapsed) {
    background-color: #e7f2fa;
    color: #3498db;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: #e7f2fa;
}

.accordion-body {
    padding: 0.75rem;
    background-color: #f8f9fa;
}

/* Mobile filter modal styling - UPDATE untuk accordion */
@media (max-width: 768px) {
    .modal-body .filter-section {
        margin-bottom: 15px; /* Diperkecil dari 20px */
    }
    
    .modal-body .facility-filter {
        flex-direction: column;
        gap: 8px; /* Diperkecil dari 10px */
    }
    
    /* Accordion styling */
    .accordion-button {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .accordion-body {
        padding: 0.5rem;
    }
    
    /* Fix for mobile kelurahan checkboxes */
    .mobile-kelurahan-checkbox {
        margin-right: 5px;
    }
    
    /* Ensure the scrollable containers on mobile have proper size */
    .scrollable-mobile-container {
        max-height: 180px !important;
        overflow-y: auto;
        border: 1px solid #eee;
        border-radius: 6px;
        background-color: white;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    /* Improve checkbox styling on mobile */
    .filter-checkbox {
        margin-bottom: 8px;
    }
    
    .filter-checkbox label {
        margin-bottom: 0;
        font-size: 0.9rem;
    }
}

/* Perbaikan untuk mobile kelurahan info */
.mobile-kelurahan-info {
    font-size: 0.8rem !important;
    padding: 6px 10px !important;
    margin-bottom: 10px;
    border-radius: 4px;
    background-color: #e7f5ff;
    border: 1px solid #c6e4f8;
    color: #3498db;
}

/* Perbaikan untuk layout fasilitas di mobile */
.facility-filter-mobile {
    margin-top: 5px;
}

.facility-filter-mobile .row {
    margin-right: -5px;
    margin-left: -5px;
}

.facility-filter-mobile .col-6 {
    padding-right: 5px;
    padding-left: 5px;
    margin-bottom: 10px;
}

/* Perbaikan untuk checkbox pada mobile */
.mobile-kecamatan-checkbox,
.mobile-kelurahan-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Label checkbox yang lebih jelas di mobile */
.filter-checkbox label {
    font-size: 0.85rem;
    margin-left: 5px;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
    font-weight: 400;
    color: #333;
}

/* Perbaikan untuk teks pada 'Select All' option */
.select-all-option {
    font-weight: 600;
    color: #2c3e50;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

/* Perbaikan untuk modal footer */
.modal-footer {
    padding: 0.75rem;
    border-top: 1px solid #e9ecef;
    background-color: #f8f9fa;
}

.modal-footer .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Perbaikan untuk modal header */
.modal-header {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* Perbaikan untuk search box pada mobile */
.search-box .input-group {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.search-box .input-group-text {
    border: none;
    background-color: #f8f9fa;
}

.search-box .form-control {
    border: none;
    height: 38px;
    padding-left: 0;
}

.search-box .form-control:focus {
    box-shadow: none;
    border-color: #3498db;
}

/* Responsive design */
@media (max-width: 768px) {
    .filter-sidebar {
        margin-bottom: 1rem;
    }
    
    #map {
        height: 70vh;
        order: 1; /* Ensure map comes after title */
    }
    
    .container {
        display: flex;
        flex-direction: column;
    }
    
    .page-title {
        order: 0; /* Title stays at top */
    }
    
    .row {
        order: 1; /* Row with map comes next */
    }
    
    .map-legend {
        max-width: 180px; /* Smaller on mobile */
        font-size: 0.7rem; /* Smaller font on mobile */
        bottom: 80px; /* Higher on mobile to avoid controls */
        right: 5px; /* Aligned with right edge on mobile */
        padding: 6px; /* Smaller padding */
        /* Remove margin-right for mobile too */
    }
    
    .legend-title {
        font-size: 0.75rem;
    }
    
    .legend-item span {
        font-size: 0.65rem;
    }
    
    .legend-subcategory div {
        font-size: 0.6rem;
    }
    
    .legend-kelurahan-list {
        max-height: 120px; /* Reduced height on mobile */
    }
    
    /* Smaller user location elements on mobile */
    .user-location-container {
        width: 25px;
        height: 25px;
    }
    
    .user-location-pulse {
        width: 25px;
        height: 25px;
    }
    
    .user-location-marker {
        font-size: 16px;
    }
    
    .legend-user-location {
        width: 16px;
        height: 16px;
    }
    
    .legend-user-pulse {
        width: 16px;
        height: 16px;
    }
    
    .legend-user-marker {
        font-size: 10px;
    }
}

@media (max-width: 576px) {
    .map-legend {
        bottom: 90px; /* Even higher on small screens */
        right: 5px; /* Keep on right edge */
        max-width: 160px; /* Smaller width */
        padding: 5px; /* Smaller padding */
        /* Remove margin-right for small screens too */
    }
    
    .legend-title {
        font-size: 0.7rem;
    }
    
    .legend-item span {
        font-size: 0.6rem;
    }
    
    .legend-subcategory div {
        font-size: 0.55rem;
    }
    
    .legend-kelurahan-list {
        max-height: 100px; /* Further reduced on small screens */
    }
    
    /* Modal dialog improvements for very small screens */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .accordion-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .accordion-body {
        padding: 0.5rem;
    }
    
    .scrollable-mobile-container {
        max-height: 150px !important;
    }
    
    .filter-checkbox label {
        font-size: 0.8rem;
    }
    
    .mobile-kelurahan-info {
        font-size: 0.75rem !important;
        padding: 5px 8px !important;
    }
    
    .modal-footer .btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.85rem;
    }
}

/* Ensure map is visible on mobile */
@media (max-width: 767.98px) {
    .col-md-9 {
        padding-right: 15px;
        padding-left: 15px;
    }
    
    #map {
        width: 100%;
        height: 70vh;
        margin-top: 10px;
    }
}

/* Circle styling for 3km radius */
.leaflet-control-scale-line {
    border: 2px solid #FF1744;
    border-radius: 2px;
}

/* Enhanced user location circle */
.leaflet-interactive {
    animation: pulse 2s infinite;
}

/* Accuracy circle styling */
.accuracy-circle {
    stroke-dasharray: 5, 5;
    stroke: #707070;
    fill: #707070;
    fill-opacity: 0.1;
}

/* Loading spinner for location button */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* GPS Location Button in Map */
.leaflet-control-gps {
    margin-top: 10px;
}

.leaflet-control-gps a {
    width: 30px;
    height: 30px;
    line-height: 28px;
    text-align: center;
    font-size: 18px;
    background: white;
    color: #333;
    border: 2px solid rgba(0,0,0,0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaflet-control-gps a:hover {
    background: #f4f4f4;
    color: #111;
}

.leaflet-control-gps.locating a {
    color: #FF1744;
    animation: pulse-gps 1.5s infinite;
}

@keyframes pulse-gps {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* City Boundary Marker Styling */
.city-boundary-marker {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

.city-boundary-marker div {
    font-family: 'Arial', sans-serif;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    animation: pulse-city-marker 2s infinite;
}

@keyframes pulse-city-marker {
    0% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

/* City Boundary Polygon Styling */
.leaflet-interactive[stroke="#FF6B35"] {
    animation: dash-city-boundary 3s linear infinite;
}

@keyframes dash-city-boundary {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 15; }
}

/* Legend clickable effect */
.legend-clickable {
    cursor: pointer;
}

.legend-clickable:hover {
    background-color: #f5f5f5;
    padding: 2px;
    border-radius: 3px;
}

/* Styling untuk Grid Koordinat */
.label-koordinat {
    background-color: rgba(255, 255, 255, 0.8);
    border: 1px solid #666;
    border-radius: 3px;
    padding: 2px 5px;
    font-size: 10px;
    font-weight: bold;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    pointer-events: none;
    z-index: 999;
    white-space: nowrap;
}

.garis-koordinat {
    stroke: #ff6b35;
    stroke-width: 1;
    stroke-dasharray: 5, 5;
    stroke-opacity: 0.7;
}

/* Tombol kontrol untuk grid koordinat */
.leaflet-control-koordinat {
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    cursor: pointer;
}

.leaflet-control-koordinat a {
    display: block;
    width: 30px;
    height: 30px;
    line-height: 30px;
    text-align: center;
    font-size: 18px;
    color: #333;
    text-decoration: none;
}

.leaflet-control-koordinat.aktif a {
    background-color: #f4f4f4;
    color: #FF6B35;
}

.leaflet-control-koordinat:hover {
    background-color: #f4f4f4;
}

/* Optimasi untuk perangkat mobile */
@media (max-width: 768px) {
    .label-koordinat {
        font-size: 8px;
        padding: 1px 3px;
    }
    
    /* PERBAIKAN: Meningkatkan tampilan checkbox pada mobile */
    input[type="checkbox"] {
        width: 16px;
        height: 16px;
        margin-right: 5px;
    }
    
    /* PERBAIKAN: Membuat container filter mobile lebih responsif */
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .accordion-body {
        padding: 0.75rem;
    }
}

/* Styling untuk kontainer multi-select */
.multi-select-container {
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    margin-top: 5px;
}

/* Styling untuk kontainer checkbox */
.checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Diperkecil dari 8px */
    margin-top: 6px; /* Diperkecil dari 8px */
    max-height: 150px;
    overflow-y: auto;
}

/* Styling untuk scrollable container - BARU */
.scrollable-container {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 8px;
    border-radius: 4px;
}

/* Styling untuk item checkbox individual */
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 4px;
}

/* PERBAIKAN: Memastikan label checkbox lebih jelas */
.filter-checkbox label {
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

/* Styling opsi "Pilih Semua" */
.select-all-option {
    padding-bottom: 6px; /* Diperkecil dari 8px */
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 6px; /* Diperkecil dari 8px */
    font-weight: 600;
}

/* Custom scrollbar untuk kontainer checkbox */
.checkbox-container::-webkit-scrollbar,
.scrollable-container::-webkit-scrollbar,
.scrollable-mobile-container::-webkit-scrollbar {
    width: 4px;
}

.checkbox-container::-webkit-scrollbar-track,
.scrollable-container::-webkit-scrollbar-track,
.scrollable-mobile-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.checkbox-container::-webkit-scrollbar-thumb,
.scrollable-container::-webkit-scrollbar-thumb,
.scrollable-mobile-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 2px;
}

.checkbox-container::-webkit-scrollbar-thumb:hover,
.scrollable-container::-webkit-scrollbar-thumb:hover,
.scrollable-mobile-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* PERBAIKAN: Meningkatkan tampilan mobile */
@media (max-width: 768px) {
    .multi-select-container {
        max-height: 180px;
    }
    
    .checkbox-container,
    .scrollable-container {
        max-height: 120px;
    }
    
    .scrollable-mobile-container {
        max-height: 150px;
    }
    
    /* PERBAIKAN: Perbesar font dan ukuran checkbox pada mobile */
    .filter-checkbox label {
        font-size: 0.95rem;
    }
    
    .filter-checkbox input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }
    
    .select-all-option {
        padding-bottom: 8px;
        margin-bottom: 8px;
        font-size: 1rem;
    }
    
    /* PERBAIKAN: Tambahkan margin pada tombol filter di mobile */
    #mobile-filter-toggle {
        margin-bottom: 15px;
    }
    
    /* PERBAIKAN: Memastikan modal filter memiliki tinggi yang cukup */
    .modal-body {
        max-height: 70vh;
        overflow-y: auto;
    }
    
    /* PERBAIKAN: Tombol pada footer modal */
    .modal-footer .btn {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* PERBAIKAN: Ukuran yang lebih spesifik untuk perangkat kecil */
@media (max-width: 576px) {
    .multi-select-container {
        max-height: 150px;
    }
    
    .checkbox-container,
    .scrollable-container {
        max-height: 120px;
    }
    
    .scrollable-mobile-container {
        max-height: 130px;
        padding: 6px;
    }
    
    /* PERBAIKAN: Buat filter modal menjadi lebih user-friendly pada perangkat sangat kecil */
    .modal-body {
        padding: 0.75rem;
    }
    
    .accordion-button {
        padding: 0.5rem 0.75rem;
    }
    
    .accordion-body {
        padding: 0.5rem;
    }
}

/* Animation for pulse effect */
@keyframes pulse {
    0% {
        opacity: 0.7;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.7;
    }
}

