* {
    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 i {
    font-size: 1.5rem;
    color: #ffd700;
}

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

.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;
}

.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;
}