/* ══════════════════════════════════════════════════════════════
   PUBLIC GIS DASHBOARD — MAIN STYLESHEET (DESKTOP & RESPONSIVE)
   ══════════════════════════════════════════════════════════════ */

/* ══ RESET & BASE ══ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
    background: #eef2f7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* ══ CSS VARIABLES ══ */
:root {
    --primary: #0F5FDC;
    --primary-light: #3b82f6;
    --primary-dark: #0a4ab5;
    --primary-glow: rgba(15, 95, 220, 0.35);
    --surface: #ffffff;
    --nav-glass: rgba(10, 63, 158, 0.92);
    --nav-glass-2: rgba(15, 95, 220, 0.88);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --plate-blue: #0F5FDC;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 8px 20px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.20), 0 8px 16px -8px rgba(15, 23, 42, 0.10);
    --shadow-glow: 0 8px 24px -4px rgba(15, 95, 220, 0.35);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-pill: 9999px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-cinematic: cubic-bezier(0.25, 1, 0.5, 1);

    --nav-height: 65px;
    --safe-top: env(safe-area-inset-top, 0px);
}

/* ══ SCROLLBAR ══ */
* {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

*::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: var(--radius-pill);
}

*::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ══ FOCUS-VISIBLE ══ */
a:focus-visible,
button:focus-visible,
input:focus-visible,
.list-group-item:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ══ ENTRANCE ANIMATIONS ══ */
@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideRightFade {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ══ TOP NAVIGATION ══ */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: linear-gradient(120deg, var(--nav-glass) 0%, var(--nav-glass-2) 100%);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    height: calc(var(--nav-height) + var(--safe-top));
    padding: calc(10px + var(--safe-top)) 24px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: var(--shadow-md);
    animation: slideDownFade 0.7s var(--ease-cinematic) forwards;
}

.nav-brand {
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.nav-title {
    font-family: 'Kalimati', serif;
    font-size: clamp(16px, 3.5vw, 20px);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.5px;
    margin: 0;
}

.nav-subtitle {
    font-size: 11px;
    color: #cbd5e1;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.3px;
}

.nav-logo {
    height: 42px;
    width: auto;
    object-fit: contain;
    transition: transform 0.3s var(--ease);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.nav-logo:hover {
    transform: scale(1.08);
}

.nav-buttons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-nav-action {
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s var(--ease-spring), background 0.2s var(--ease), box-shadow 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-back {
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(4px);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.20);
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-login {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: white;
    border: none;
    box-shadow: var(--shadow-glow);
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transform: translateY(-2px);
    box-shadow: 0 12px 28px -6px rgba(15, 95, 220, 0.45);
}

.btn-nav-action:active {
    transform: translateY(0) scale(0.97);
}

/* ══════════════════════════════════════════════════════════════
   🚀 ULTRA-MODERN 1-CLICK TOGGLE SEARCH PILL
   ══════════════════════════════════════════════════════════════ */
.nav-search-wrapper {
    position: relative;
    width: 340px;
    margin-left: 12px;
}

.search-pill {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 9999px;
    height: 40px;
    padding: 3px 6px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.search-pill:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}

.search-pill:focus-within {
    background: #ffffff;
    border-color: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

/* ⚡️ 1-Click Toggle Button (घर नं ⇄ सडक कोड) */
.btn-type-toggle {
    background: rgba(255, 255, 255, 0.25) !important;
    border: none !important;
    outline: none !important;
    border-radius: 9999px !important;
    color: #ffffff !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    padding: 5px 11px !important;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-type-toggle:hover {
    background: rgba(255, 255, 255, 0.38) !important;
    transform: scale(1.05);
}

.btn-type-toggle:active {
    transform: scale(0.95);
}

.search-pill:focus-within .btn-type-toggle {
    background: #e2e8f0 !important;
    color: #0F5FDC !important;
}

/* सडक कोड मोडमा स्विच हुँदा चम्किने ब्याच */
.btn-type-toggle.mode-road {
    background: #f59e0b !important;
    color: #000000 !important;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.search-pill:focus-within .btn-type-toggle.mode-road {
    background: #fef3c7 !important;
    color: #b45309 !important;
}

/* Search Input Inside Pill */
.search-input {
    border: none !important;
    background: transparent !important;
    color: #ffffff !important;
    padding: 0 10px !important;
    font-size: 13.5px !important;
    width: 100% !important;
    outline: none !important;
    box-shadow: none !important;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.75);
}

.search-pill:focus-within .search-input {
    color: #0f172a !important;
}

.search-pill:focus-within .search-input::placeholder {
    color: #64748b;
}

.search-submit-icon {
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    margin-right: 8px;
}

.search-pill:focus-within .search-submit-icon {
    color: #0F5FDC;
}

/* Search Dropdown Stack & Results */
.search-dropdown-stack {
    position: absolute;
    top: 115%;
    left: 0;
    right: 0;
    z-index: 2500;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.search-dropdown-stack .dropdown-msg,
.search-dropdown-stack .nav-search-results {
    position: static !important;
    top: auto !important;
    animation: dropdown-in 0.2s var(--ease);
}

.nav-search-results {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    max-height: 320px;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    display: none;
    color: #333;
    z-index: 2500;
    border: 1px solid var(--border);
}

.nav-search-results.has-results {
    display: block;
}

@keyframes dropdown-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-msg {
    background: white;
    padding: 10px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 2500;
    color: #333;
}

.result-item {
    transition: all 0.2s var(--ease);
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background: #f1f5f9;
    transform: translateX(4px);
}

.result-icon {
    width: 38px;
    height: 38px;
    background: rgba(15, 95, 220, 0.10);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    color: var(--primary);
}

.result-title {
    font-family: 'Kalimati', serif;
    letter-spacing: 0.5px;
}

/* ══ MAIN WORKSPACE LAYOUT ══ */
.app-workspace {
    margin-top: calc(var(--nav-height) + var(--safe-top));
    height: calc(100vh - var(--nav-height) - var(--safe-top));
    width: 100vw;
    overflow: hidden;
}

.gis-sidebar {
    width: 300px;
    min-width: 300px;
    height: 100%;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
    background: #ffffff;
    border-right: none !important;
    transition: width 0.35s var(--ease), min-width 0.35s var(--ease);
    opacity: 0;
    animation: slideRightFade 0.8s var(--ease-cinematic) forwards;
    animation-delay: 0.2s;
}

.gis-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-right: none !important;
}

.map-wrapper {
    height: 100%;
    position: relative;
    background: #e2e8f0;
}

#portal-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ══ HOUSE PLATE POPUP (LEAFLET) ══ */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-lg) !important;
    padding: 0 !important;
    overflow: hidden;
    box-shadow: var(--shadow-lg) !important;
    border: none !important;
    background: transparent !important;
    animation: popup-in 0.15s var(--ease) !important;
    width: 310px !important;
    box-sizing: border-box;
}

@keyframes popup-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.leaflet-popup-tip-container {
    display: none;
}

.leaflet-container a.leaflet-popup-close-button {
    color: #ffffff !important;
    right: 8px !important;
    top: 8px !important;
    font-size: 16px !important;
    width: 26px !important;
    height: 26px !important;
    line-height: 26px !important;
    background: rgba(0, 0, 0, 0.45) !important;
    backdrop-filter: blur(4px);
    border-radius: 50% !important;
    text-align: center !important;
    padding: 0 !important;
    z-index: 999;
    text-decoration: none;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.leaflet-container a.leaflet-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.75) !important;
    color: #ffffff !important;
    transform: rotate(90deg);
}

.leaflet-popup-content {
    margin: 0 !important;
    width: 310px !important;
    max-width: 90vw !important;
    box-sizing: border-box;
}

.house-plate-popup {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--plate-blue) 60%, var(--primary-dark) 100%);
    color: white;
    padding: 18px 20px;
    font-family: 'Kalimati', serif;
    display: block;
    text-align: left;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: relative;
}

.house-plate-popup > div > div:first-child {
    min-width: 0 !important;
    flex: 1 1 auto !important;
}

.house-plate-popup > div > div:last-child {
    flex: 0 0 auto !important;
    min-width: 80px;
}

.plate-separator {
    border-top: 1px dashed rgba(255, 255, 255, 0.4);
    margin: 14px 0;
    width: 100%;
}

.popup-body {
    padding: 16px 20px;
    background: #fff;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hp-label {
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 2px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.hp-number {
    font-size: clamp(22px, 5vw, 32px) !important;
    font-weight: 700;
    line-height: 1.2 !important;
    letter-spacing: 1px;
    word-break: break-all !important;
    overflow-wrap: anywhere !important;
    white-space: normal !important;
    max-width: 100%;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.hp-road {
    font-size: 15px;
    font-weight: 500;
    line-height: 1.35;
    margin-right: 15px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.hp-ward {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    margin-top: 5px;
    font-family: 'Kalimati', serif;
}

.hp-photo {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid white;
    box-shadow: var(--shadow-sm);
    background: rgba(255, 255, 255, 0.2);
    display: block;
}

.hp-photo-empty {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.2);
    border: 1px dashed white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.hp-qr {
    width: 56px;
    height: 56px;
    display: block;
    border-radius: 6px;
    background: #fff;
    padding: 3px;
}

.btn-navigate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #ffffff !important;
    text-decoration: none;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease);
    border: none;
    cursor: pointer;
    flex: 1;
}

.btn-navigate:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: #ffffff !important;
}

.btn-navigate:active {
    transform: translateY(0) scale(0.97);
}

/* ══ LOCATION POPUP & RED RIPPLE MARKER ══ */
.location-popup .leaflet-popup-content {
    width: max-content !important;
    max-width: 220px !important;
}

.location-popup .leaflet-popup-content-wrapper {
    box-shadow: none !important;
    border-radius: var(--radius-md) !important;
    width: auto !important;
}

.selected-marker-icon {
    background: none;
    border: none;
}

.marker-pin-red {
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    background: linear-gradient(135deg, #f87171, var(--danger));
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -24px 0 0 -16px;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.marker-pin-red::after {
    content: '';
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    position: absolute;
}

.marker-ripple {
    width: 20px;
    height: 20px;
    background: var(--danger);
    border-radius: 50%;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -10px 0 0 -10px;
    opacity: 0;
    animation: ripple-glow 2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
    z-index: 5;
}

@keyframes ripple-glow {
    0% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
    }
    50% {
        opacity: 0.4;
    }
    100% {
        transform: scale(4);
        opacity: 0;
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
}

/* ══ PUBLIC LIGHTBOX ══ */
#public-photo-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(8, 12, 22, 0.94);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    animation: dropdown-in 0.2s var(--ease);
}

#public-photo-lightbox.active {
    display: flex;
}

#public-photo-lightbox img {
    max-width: 88vw;
    max-height: 75vh;
    border-radius: var(--radius-md);
    object-fit: contain;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
}

#public-photo-lightbox .lb-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

#public-photo-lightbox .lb-close:hover {
    background: rgba(255, 255, 255, 0.30);
    transform: rotate(90deg);
}

#public-photo-lightbox .lb-info {
    margin-top: 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    min-width: 260px;
    max-width: 88vw;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#public-photo-lightbox .lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.88);
}

#public-photo-lightbox .lb-row i {
    width: 16px;
    text-align: center;
    color: #2ecc71;
}

#public-photo-lightbox .lb-val {
    font-weight: 700;
    color: #fff;
    font-family: 'Kalimati', serif;
}

/* ══ NATIVE LEAFLET CONTROLS ══ */
.leaflet-control-layers {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 13px !important;
    padding: 6px !important;
    margin-top: 20px !important;
}

.leaflet-control-layers-toggle {
    width: 36px !important;
    height: 36px !important;
    border-radius: var(--radius-sm) !important;
}

/* ══ NOTIFICATIONS & PREMIUM FULLSCREEN LOADER ══ */
.map-loader {
    position: fixed;
    inset: 0;
    background-color: #ffffff;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease-cinematic), visibility 0.6s;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.8s ease-out;
}

.loader-logo {
    width: 120px;
    height: auto;
    object-fit: contain;
    margin-bottom: 20px;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.15));
}

.loader-spinner-wrapper {
    margin-bottom: 24px;
}

.spinner {
    width: 45px;
    height: 45px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loader-palika-name {
    font-family: 'Inter', sans-serif;
    color: var(--primary);
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.loader-system-name {
    font-family: 'Kalimati', serif;
    color: #475569;
    font-size: 20px;
    margin-bottom: 15px;
}

.loader-text {
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-msg {
    position: fixed;
    top: calc(var(--nav-height) + var(--safe-top) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 3000;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s var(--ease-spring);
    box-shadow: var(--shadow-lg);
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ══ SIDEBAR CONTROLS ══ */
.btn-expand-sidebar {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    z-index: 1050;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 20px 10px;
    background: white;
    border: 1px solid var(--border);
    border-left: none;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    color: var(--primary);
    transition: all 0.25s var(--ease);
    display: none;
}

.btn-expand-sidebar:hover {
    background: #f8fafc;
    padding-left: 15px;
}

.gis-sidebar.collapsed ~ .map-wrapper .btn-expand-sidebar {
    display: block;
}

.sidebar-header {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 18px 20px !important;
    margin-bottom: 16px !important;
    position: relative;
}

.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background: linear-gradient(to right, var(--primary), transparent);
    border-radius: 2px;
}

.sidebar-header h6 {
    font-size: 15px;
    font-weight: 700 !important;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.accordion-item {
    border: none !important;
    background: transparent !important;
    margin-bottom: 8px;
}

.accordion-button {
    background: transparent !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    padding: 16px 24px !important;
    border-radius: var(--radius-md) !important;
    transition: all 0.3s var(--ease);
    font-size: 14.5px !important;
}

.accordion-button:hover {
    background: rgba(15, 95, 220, 0.04) !important;
}

.accordion-button:not(.collapsed) {
    color: var(--primary) !important;
    background: rgba(15, 95, 220, 0.08) !important;
}

.accordion-body {
    padding: 10px 24px 20px !important;
}

.list-group-item {
    border: none !important;
    background: transparent !important;
    padding: 14px 18px !important;
    margin-bottom: 6px;
    border-radius: var(--radius-md) !important;
    transition: all 0.25s var(--ease);
    border: 1px solid transparent;
}

.list-group-item:hover {
    background: #f8fafc !important;
    border-color: var(--border);
    transform: translateX(3px);
    box-shadow: var(--shadow-xs);
}

.list-group-item .rounded.p-2 {
    border-radius: var(--radius-sm) !important;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Modern Toggle Switches */
.form-switch .form-check-input {
    width: 3em;
    height: 1.5em;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background-color: #e2e8f0;
    transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.form-switch .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15, 95, 220, 0.18);
}

.form-switch .form-check-input:focus {
    box-shadow: none !important;
}

/* Ward Filter Accordion */
.filter-accordion-body {
    background-color: #f8faff;
    padding: 1rem;
}

.filter-card {
    background-color: #ffffff;
    padding: 1.25rem;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.filter-card:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.custom-focus-ring:focus {
    border-color: #0F5FDC;
    box-shadow: 0 0 0 0.25rem rgba(15, 95, 220, 0.25);
}

.help-text {
    font-family: 'Kalimati', serif;
    font-size: 0.8rem;
}

/* ══ FLOATING MAP BUTTONS ══ */
#btn-fullscreen,
#btn-locate {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-md);
    transition: all 0.25s var(--ease-spring);
}

#btn-fullscreen:hover,
#btn-locate:hover {
    background: #ffffff;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

#btn-fullscreen:active,
#btn-locate:active {
    transform: translateY(-1px) scale(0.96);
}

/* ══ GEOMAN MEASURE TOOL ══ */
.leaflet-pm-toolbar {
    box-shadow: var(--shadow-md) !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    overflow: hidden;
    background: var(--surface) !important;
}

.leaflet-pm-toolbar .button-container {
    border-bottom: 1px solid var(--border) !important;
    transition: all 0.2s var(--ease);
}

.leaflet-pm-toolbar .button-container:last-child {
    border-bottom: none !important;
}

.leaflet-pm-toolbar .button-container:hover {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.leaflet-pm-toolbar .button-container a {
    background-color: transparent !important;
    color: var(--text-main) !important;
}

.leaflet-pm-toolbar .action-container {
    background: var(--surface) !important;
}

.pm-tooltip {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--primary);
    box-shadow: var(--shadow-sm);
    font-family: 'Kalimati', 'Inter', sans-serif;
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 600;
}

.measure-tooltip {
    background: rgba(15, 23, 42, 0.90) !important;
    backdrop-filter: blur(4px);
    color: #ffffff !important;
    border: 1px solid var(--primary) !important;
    border-radius: var(--radius-sm) !important;
    padding: 6px 10px !important;
    font-family: 'Kalimati', 'Inter', sans-serif !important;
    font-size: 13px !important;
    box-shadow: var(--shadow-md) !important;
}

.measure-tooltip b {
    color: #f59e0b !important;
}

/* ══ MAP CURSORS & WMS INTERACTION ══ */
.leaflet-container.leaflet-grab {
    cursor: default !important;
}

.leaflet-container.leaflet-grab:active {
    cursor: grabbing !important;
}

.leaflet-interactive {
    cursor: pointer !important;
}

.mtmp-popup .leaflet-popup-content-wrapper {
    background: var(--surface) !important;
}

.mtmp-popup .leaflet-popup-tip {
    background: var(--surface) !important;
}

/* ══════════════════════════════════════════════════════════════
   🚀 ROCK-SOLID CLUSTERING UI (NO MAP POSITION DRIFT)
   ══════════════════════════════════════════════════════════════ */
.leaflet-cluster-icon {
    background: transparent !important;
    border: none !important;
}

.marker-cluster {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    background-clip: padding-box;
}

/* भित्री मुख्य गोलो */
.marker-cluster div {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    text-align: center;
    font-family: 'Kalimati', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 12.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: transform 0.2s var(--ease-spring);
}

.marker-cluster:hover div {
    transform: scale(1.15);
}

/* ── Light Mode Gradients ── */
.marker-cluster-small {
    background-color: rgba(34, 197, 94, 0.25);
}
.marker-cluster-small div {
    background: linear-gradient(135deg, #4ade80, #16a34a);
    color: #ffffff;
}

.marker-cluster-medium {
    background-color: rgba(245, 158, 11, 0.25);
}
.marker-cluster-medium div {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #ffffff;
}

.marker-cluster-large {
    background-color: rgba(239, 68, 68, 0.25);
}
.marker-cluster-large div {
    background: linear-gradient(135deg, #f87171, #dc2626);
    color: #ffffff;
}

/* ══════════════════════════════════════════════════════════════
   🌙 DARK MODE THEME PRESETS & OVERRIDES
   ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
    --primary-light: #60a5fa;
    --surface: #0f172a;
    --nav-glass: rgba(15, 23, 42, 0.92);
    --nav-glass-2: rgba(2, 6, 23, 0.88);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --plate-blue: #1e293b;
    --shadow-md: 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] body,
[data-theme="dark"] .map-wrapper,
[data-theme="dark"] .app-workspace {
    background: #020617;
}

[data-theme="dark"] .gis-sidebar,
[data-theme="dark"] .sidebar-header,
[data-theme="dark"] .filter-card,
[data-theme="dark"] .filter-accordion-body {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] .list-group-item:hover,
[data-theme="dark"] .accordion-button:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .form-switch .form-check-input {
    background-color: #334155;
    border-color: #475569;
}

[data-theme="dark"] .list-group-item .fw-bold {
    color: #f59e0b !important;
}

[data-theme="dark"] .list-group-item .text-muted {
    color: #fbbf24 !important;
}

[data-theme="dark"] .measure-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border-color: #f59e0b !important;
}

[data-theme="dark"] .accordion-button::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23f59e0b'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") !important;
}

[data-theme="dark"] .leaflet-pm-toolbar .button-container a {
    filter: brightness(0) saturate(100%) invert(61%) sepia(74%) saturate(1637%) hue-rotate(354deg) brightness(98%) contrast(97%) !important;
}

[data-theme="dark"] .leaflet-pm-toolbar .button-container:hover {
    background-color: rgba(245, 158, 11, 0.15) !important;
}

[data-theme="dark"] .leaflet-pm-toolbar .action-container a {
    color: #f59e0b !important;
}

[data-theme="dark"] .map-loader {
    background-color: #0f172a;
}

[data-theme="dark"] .loader-palika-name {
    color: #f8fafc;
}

[data-theme="dark"] .loader-system-name {
    color: #94a3b8;
}

/* 🌙 Dark Mode Search Pill */
[data-theme="dark"] .search-pill:focus-within {
    background: #1e293b;
    border-color: #facc15;
}

[data-theme="dark"] .search-pill:focus-within .search-input {
    color: #f8fafc !important;
}

[data-theme="dark"] .search-pill:focus-within .btn-type-toggle {
    background: #334155 !important;
    color: #facc15 !important;
}

[data-theme="dark"] .btn-type-toggle.mode-road {
    background: #eab308 !important;
    color: #0f172a !important;
}

[data-theme="dark"] .nav-search-results,
[data-theme="dark"] .search-results-dropdown {
    background: #0f172a !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .dropdown-msg {
    background: #1e293b !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .result-item,
[data-theme="dark"] .s-item {
    border-bottom-color: #334155 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .result-item:hover,
[data-theme="dark"] .s-item:hover {
    background-color: #1e293b !important;
}

[data-theme="dark"] .result-icon,
[data-theme="dark"] .s-icon {
    background: rgba(250, 204, 21, 0.15) !important;
    color: #facc15 !important;
}

[data-theme="dark"] .result-title,
[data-theme="dark"] .s-item b {
    color: #f8fafc !important;
}

[data-theme="dark"] .result-subtitle,
[data-theme="dark"] .s-item small {
    color: #facc15 !important;
}

/* 🌙 Dark Mode Glow Gradients */
[data-theme="dark"] .marker-cluster div {
    border-color: rgba(15, 23, 42, 0.8);
}
[data-theme="dark"] .marker-cluster-small div {
    background: linear-gradient(135deg, #22c55e, #15803d);
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.5);
    color: #ffffff;
}

[data-theme="dark"] .marker-cluster-medium div {
    background: linear-gradient(135deg, #eab308, #b45309);
    box-shadow: 0 0 14px rgba(234, 179, 8, 0.5);
    color: #ffffff;
}

[data-theme="dark"] .marker-cluster-large div {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.6);
    color: #ffffff;
}

/* ══ RESPONSIVE & MOBILE FIXES ══ */
@media (max-width: 768px) {
    #active-dashboard-title,
    .nav-search-wrapper,
    .gis-sidebar,
    .leaflet-control-zoom {
        display: none !important;
    }

    .nav-logo {
        height: 36px;
    }

    .leaflet-popup-content-wrapper,
    .leaflet-popup-content:not(.location-popup .leaflet-popup-content) {
        width: 260px !important;
    }

    .house-plate-popup {
        padding: 14px 15px;
    }

    .popup-body {
        padding: 12px 15px;
    }

    .hp-road {
        font-size: 13px;
    }

    .hp-ward {
        font-size: 11px;
        margin-top: 3px;
    }

    .hp-photo,
    .hp-photo-empty {
        width: 50px;
        height: 50px;
        font-size: 16px;
    }

    .hp-qr {
        width: 44px;
        height: 44px;
    }

    .btn-navigate {
        padding: 10px;
        font-size: 12px;
        gap: 5px;
    }

    .plate-separator {
        margin: 10px 0;
    }
}

/* ══ REDUCED MOTION & EMPTY FIXES ══ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

.nav-search-results:empty,
.dropdown-msg:empty {
    display: none !important;
    padding: 0 !important;
}