* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    overflow: hidden;
    height: 100vh;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
    flex-direction: column;
    gap: 15px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Navbar styling */
.navbar {
    background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 0.8rem 1.5rem;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: #ffd700 !important;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

@media (min-width: 480px) {
    .navbar-brand {
        position: relative;
        left: 0;
        transform: none;
        font-size: 1.5rem;
    }      
    .navbar-brand img {
        width: 36px;
        height: 36px;
    }
}

.search-form {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1001;
}

.search-form .input-group {
    height: 38px;
    flex-wrap: nowrap;
}

.search-input {
    border-radius: 0 !important;
    border: none;
    padding: 0 0.8rem;
    font-size: 0.88rem;
    height: 100%;
    flex: 1 1 auto;
    min-width: 0;
    line-height: 1;
}

.search-input:focus {
    box-shadow: none;
    outline: none;
    border: none;
}

.search-icon {
    background: #fff;
    border: none;
    border-radius: 50px 0 0 50px !important;
    padding: 0 0.2rem 0 1rem;
    font-size: 1rem;
    color: #1a472a;
    height: 100%;
}

.search-btn {
    border-radius: 0 50px 50px 0 !important;
    background: #ffd700;
    color: #1a472a;
    border: none;
    padding: 0 1.1rem;
    font-weight: 700;
    font-size: 1.5rem;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.search-btn:hover {
    background: #ffed4a;
    color: #1a472a;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
    z-index: 9999;
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
    display: none;
    border: 1px solid #e0e0e0;
}

.autocomplete-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 0.4rem 0.9rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.dropdown-item-custom {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.dropdown-item-custom:last-child {
    border-bottom: none;
}

.dropdown-item-custom:hover,
.dropdown-item-custom.active {
    background: #f0f9f3;
}

.item-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1a2e1c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-name mark {
    background: #fff3b0;
    border-radius: 3px;
    padding: 0 1px;
    font-weight: 700;
    color: inherit;
}

.item-meta {
    font-size: 0.7rem;
    color: #777;
    margin-top: 1px;
}

.item-badge {
    font-size: 0.6rem;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    background: #1a472a;
    color: #fff;
    flex-shrink: 0;
}

.dropdown-empty {
    padding: 1rem;
    text-align: center;
    font-size: 0.8rem;
    color: #9e9e9e;
}

.main-container {
    display: flex;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.sidebar {
    width: 360px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
    z-index: 10;
}

@media (max-width: 768px) {
    .navbar {
        display: block;
        position: fixed;
        inset: 0 0 auto;
        padding: 0.75rem;
        background: transparent;
        box-shadow: none;
        pointer-events: none;
    }

    .navbar .container-fluid {
        display: block;
        padding: 0;
    }

    .navbar-brand {
        display: none;
    }

    .navbar .search-form {
        width: 100%;
        max-width: none;
        margin: 0 !important;
        pointer-events: auto;
    }

    .search-form .input-group {
        height: 52px;
        padding: 0 0.4rem;
        border: 1px solid rgba(255, 255, 255, 0.48);
        border-radius: 50px;
        background: rgba(255, 255, 255, 0.22);
        box-shadow: 0 10px 28px rgba(12, 35, 24, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
        backdrop-filter: blur(16px) saturate(150%);
        -webkit-backdrop-filter: blur(16px) saturate(150%);
    }

    .search-icon,
    .search-input {
        background: transparent !important;
        color: #123522;
    }

    .search-icon {
        border-radius: 0 !important;
        padding: 0 0.65rem;
        color: #0d4525;
    }

    .search-input {
        padding: 0 0.3rem;
        font-size: 0.95rem;
    }

    .search-input::placeholder {
        color: rgba(18, 53, 34, 0.72);
    }

    .search-btn {
        display: none;
    }
    
    .main-container {
        height: 100vh;
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        width: 100% !important;
        max-width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1.1);
        border-radius: 0;
        box-shadow: none;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-toggle-mobile {
        display: flex;
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 1100;
        background: #1a472a;
        color: white;
        border: none;
        border-radius: 50%;
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 16px rgba(0,0,0,0.3);
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .sidebar-toggle-mobile:active {
        transform: scale(0.95);
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    .sidebar-header {
        border-radius: 0;
    }
    
    .poi-list-container {
        flex: 1;
        min-height: -400px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .map-container > .search-form {
        position: absolute;
        top: 25px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
        margin: 0 !important;
        width: 90%;
        max-width: none;
    }

    .leaflet-top.leaflet-right {
        top: 75px;
        right: 20px;
    }
}

@media (min-width: 769px) {
    .sidebar-toggle-mobile {
        display: none;
    }
}

.sidebar-header {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-bottom: 2px solid #ffd700;
}

.sidebar-header h5 {
    font-weight: 700;
    color: #1a472a;
    margin: 0;
}

.sidebar-header p {
    font-size: 0.75rem;
    color: #6c757d;
    margin: 0;
}

.stats-row {
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.stat-card {
    text-align: center;
    background: white;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.stat-card.status-online .stat-number {
    color: #1f8f4d;
}

.stat-card.status-offline .stat-number {
    color: #c0392b;
}

.stat-number {
    font-size: 1.3rem;
    font-weight: 800;
    color: #1a472a;
}

.stat-label {
    font-size: 0.7rem;
    color: #6c757d;
}

.controls-panel {
    padding: 0.8rem 1rem;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.filter-group, .sort-group {
    margin-bottom: 0.8rem;
}

.filter-group label, .sort-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.3rem;
}

.form-select-sm, .form-control-sm {
    font-size: 0.8rem;
    border-radius: 20px;
}

.btn-reset {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
    font-size: 0.7rem;
    width: 100%;
}

.poi-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem;
    background: #f8f9fa;
}

.poi-card {
    background: white;
    border-radius: 12px;
    padding: 0.8rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid #ffd700;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.poi-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    background: #fffef5;
}

.poi-card.highlight {
    background: #fff8e1;
    border-left-color: #ff6f00;
}

.poi-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.poi-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-badge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border-radius: 999px;
    padding: 0.18rem 0.5rem;
    font-size: 0.62rem;
    font-weight: 700;
}

.status-badge i {
    font-size: 0.82rem;
    line-height: 1;
}

.status-badge.online {
    background: #e9f7ef;
    color: #1f8f4d;
}

.status-badge.offline {
    background: #fdecea;
    color: #c0392b;
}

.status-badge.unknown {
    background: #eef1f4;
    color: #6c757d;
}

.poi-category-badge {
    font-size: 0.6rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: #1a472a;
    color: white;
}

.poi-detail {
    font-size: 0.7rem;
    color: #6c757d;
}

.poi-detail i {
    width: 16px;
    margin-right: 0px;
}

.map-container {
    flex: 1;
    position: relative;
}

#map {
    height: 100%;
    width: 100%;
}

.modal-header-custom {
    background: linear-gradient(135deg, #1a472a 0%, #0d2818 100%);
    color: white;
}

#detailModal .modal-dialog {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

#detailModal .modal-content {
    width: 100%;
    margin: auto;
}

.modal-coords {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
}

.cctv-video-wrap {
    background: #101418;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 0.375rem 0.375rem;
    overflow: hidden;
}

#cctv-feed {
    width: 100%;
    height: 100%;
    background: #000;
    border: 0;
    object-fit: contain;
    display: none;
}

#loading-text {
    color: #fff;
    font-weight: 600;
    padding: 2rem;
    text-align: center;
}

.feature-properties-table {
    margin: 0;
    border: 1px solid #e8eee9;
    border-radius: 14px;
    overflow: hidden;
}

.feature-properties-table th,
.feature-properties-table td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
    border-color: #e8eee9;
}

.feature-properties-table th {
    width: 38%;
    min-width: 130px;
    color: #285237;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: capitalize;
    background: #f4f8f5;
}

.feature-properties-table td {
    color: #1b2d21;
    font-size: 0.88rem;
    overflow-wrap: anywhere;
}

.feature-properties-table tr:last-child > * {
    border-bottom: 0;
}

@media (max-width: 576px) {
    .feature-properties-table th,
    .feature-properties-table td {
        padding: 0.65rem 0.75rem;
    }

    .feature-properties-table th {
        min-width: 112px;
    }
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(26, 71, 42, 0.8);
}

.leaflet-popup-content-wrapper {
    border-radius: 12px;
}

/* Daftar layer tetap mudah dipakai saat banyak overlay tersedia. */
.leaflet-control-layers-expanded .leaflet-control-layers-list {
    max-height: min(58vh, 340px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.35rem;
}

.leaflet-control-layers-list::-webkit-scrollbar {
    width: 6px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb {
    background: rgba(26, 71, 42, 0.45);
    border-radius: 999px;
}

.custom-marker {
    background: #0f3d5e;
    border: 3px solid white;
    border-radius: 50% 50% 50% 0;
    width: 24px;
    height: 24px;
    transform: rotate(-45deg);
    box-shadow: 0 6px 14px rgba(0,20,40,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}
.custom-marker i {
    transform: rotate(45deg);
    color: white;
    font-size: 12px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.leaflet-popup-content {
    font-size: 0.95rem;
    font-weight: 500;
    color: #133043;
}
.leaflet-popup-content strong {
    color: #004b75;
}

.footer-text {
    padding: 0.5rem;
    text-align: center;
    font-size: 0.65rem;
    background: #e9ecef;
    border-top: 1px solid #dee2e6;
}

.news-toggle-mobile,
.news-panel {
    display: none;
}

@media (max-width: 768px) {
    .news-toggle-mobile {
        display: flex;
        position: fixed;
        right: 20px;
        bottom: 88px;
        z-index: 1101;
        width: 56px;
        height: 56px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 50%;
        background: #ffd700;
        color: #1a472a;
        font-size: 1.2rem;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
    }

    .news-panel {
        display: flex;
        position: fixed;
        inset: auto 0 0;
        z-index: 1120;
        height: min(78vh, 650px);
        flex-direction: column;
        padding: 0.7rem 1rem calc(1rem + env(safe-area-inset-bottom));
        background: #fff;
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.24);
        transform: translateY(105%);
        transition: transform 0.3s ease;
    }

    .news-panel.show {
        transform: translateY(0);
    }

    .news-panel-handle {
        width: 42px;
        height: 4px;
        margin: 0 auto 0.85rem;
        border-radius: 99px;
        background: #d0d7d2;
    }

    .news-panel-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
    }

    .news-panel-header h5 {
        margin: 0;
        color: #1a472a;
        font-size: 1rem;
        font-weight: 800;
    }

    .news-panel-header p {
        margin: 0.2rem 0 0;
        color: #6c757d;
        font-size: 0.75rem;
    }

    .news-close {
        width: 34px;
        height: 34px;
        border: 0;
        border-radius: 50%;
        background: #f1f4f2;
        color: #1a472a;
    }

    .news-search {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        margin: 1rem 0 0.65rem;
        padding: 0.65rem 0.8rem;
        border: 1px solid #dce5de;
        border-radius: 12px;
        color: #477151;
        background: #f8fbf8;
    }

    .news-search input {
        width: 100%;
        border: 0;
        outline: 0;
        color: #1b2d21;
        background: transparent;
        font-size: 0.9rem;
    }

    .news-list {
        min-height: 0;
        flex: 1;
        overflow-y: auto;
        overscroll-behavior: contain;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-content: start;
        gap: 0.7rem;
        padding: 0.2rem 0.1rem 0.5rem;
    }

    .news-card {
        display: flex;
        min-width: 0;
        flex-direction: column;
        overflow: hidden;
        border: 1px solid #e4ece6;
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 3px 10px rgba(22, 58, 32, 0.07);
        color: inherit;
        text-decoration: none;
    }

    .news-card-image {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        background: #e9f1eb;
    }

    .news-card-placeholder {
        display: grid;
        place-items: center;
        color: #39734a;
        font-size: 1.5rem;
    }

    .news-card-content {
        display: flex;
        min-height: 86px;
        flex: 1;
        flex-direction: column;
        padding: 0.65rem;
    }

    .news-card-title {
        display: -webkit-box;
        overflow: hidden;
        color: #193d26;
        font-size: 0.78rem;
        font-weight: 700;
        line-height: 1.4;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
    }

    .news-card-date {
        display: block;
        margin-top: auto;
        padding-top: 0.45rem;
        color: #718276;
        font-size: 0.64rem;
    }

    .news-message {
        padding: 2rem 0.5rem;
        color: #6c757d;
        text-align: center;
        font-size: 0.85rem;
    }

    .news-pagination {
        display: flex;
        justify-content: center;
        gap: 0.35rem;
        padding-top: 0.8rem;
    }

    .news-load-more {
        border: 0;
        border-radius: 999px;
        padding: 0.6rem 1rem;
        background: #1a472a;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 700;
    }

    .news-end,
    .news-loading {
        color: #718276;
        font-size: 0.75rem;
    }

    .geography-content {
        min-height: 0;
        flex: 1;
        overflow-y: auto;
        padding: 0.3rem 0.15rem 1rem;
        color: #536258;
        font-size: 0.84rem;
        line-height: 1.65;
    }

    .geography-intro {
        margin: 0.25rem 0 1rem;
        color: #526057;
    }

    .geography-stats {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: hidden;
        margin-bottom: 1.1rem;
        border: 1px solid #dfe9e1;
        border-radius: 14px;
        background: #dfe9e1;
        gap: 1px;
    }

    .geography-stats div {
        padding: 0.7rem;
        background: #fff;
    }

    .geography-stats span,
    .geography-kicker {
        display: block;
        color: #79907f;
        font-size: 0.62rem;
        font-weight: 800;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }

    .geography-stats strong {
        display: block;
        margin-top: 0.15rem;
        color: #183d26;
        font-size: 0.83rem;
    }

    .geography-section {
        margin-top: 1rem;
        padding: 0.9rem;
        border: 1px solid #e3ece5;
        border-radius: 14px;
        background: #fff;
    }

    .geography-section h6 {
        margin: 0.25rem 0 0.4rem;
        color: #193d26;
        font-size: 0.95rem;
        font-weight: 800;
    }

    .geography-section p {
        margin: 0;
    }

    .geography-table {
        width: 100%;
        margin-top: 0.55rem;
        font-size: 0.76rem;
    }

    .geography-table th,
    .geography-table td {
        padding: 0.5rem 0;
        vertical-align: top;
        border-bottom: 1px solid #edf2ee;
    }

    .geography-table tr:last-child > * {
        border-bottom: 0;
    }

    .geography-table th {
        width: 25%;
        color: #245237;
        font-weight: 800;
    }

    .geography-source {
        display: block;
        margin: 1rem 0 0.2rem;
        color: #1a6a36;
        font-size: 0.76rem;
        font-weight: 700;
        text-align: center;
        text-decoration: none;
    }
}
