/* ============================================================
   theme.css — Dark/Light mode variables + Hybrid Redesign
   GIS Pengelolaan Sampah DLH Kabupaten Garut
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=DM+Sans:ital,wght@0,300;0,400;0,500;1,400&display=swap');

/* ── DARK MODE (default) ──────────────────────────────────── */
:root,
:root[data-theme="dark"] {
    --bg-primary: #0d1f0f;
    --bg-secondary: #0a1a0c;
    --bg-surface: rgba(6, 18, 8, 0.88);
    --bg-surface-hover: rgba(34, 139, 34, 0.08);
    --bg-overlay: rgba(6, 18, 8, 0.85);

    --border-primary: rgba(34, 139, 34, 0.25);
    --border-secondary: rgba(34, 139, 34, 0.15);
    --border-accent: rgba(230, 100, 20, 0.35);

    --text-primary: #e8f5e8;
    --text-secondary: #8aba8a;
    --text-muted: #5a7a5a;
    --text-hint: #3d7a3d;
    --text-dim: #2d5a2d;

    --accent-green: #7dca7d;
    --accent-green-mid: #2d8a2d;
    --accent-green-dark: #1a6b1a;
    --accent-orange: #e87a30;
    --accent-orange-bg: rgba(230, 100, 20, 0.15);
    --accent-orange-border: rgba(230, 100, 20, 0.3);

    --map-grid: rgba(34, 85, 34, 0.15);
    --map-bg-from: #0a2e0c;
    --map-bg-to: #061208;
    --map-glow: rgba(34, 139, 34, 0.12);

    --scrollbar-track: rgba(6, 18, 8, 0.5);
    --scrollbar-thumb: rgba(34, 139, 34, 0.3);

    --tile-layer: dark;

    /* ── New Design Tokens ── */
    --panel-radius: 12px;
    --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    --panel-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.25);
    --animation-fast: 0.2s ease;
    --animation-med: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --animation-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --font-display: 'Rajdhani', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 50px;
    --header-height: 52px;
    --footer-height: 36px;
    --accent-blue: #54edfe;
    --accent-red: #ef4444;
    --accent-yellow: #fbbf24;
    --accent-purple: #a78bfa;
    --gradient-green: linear-gradient(135deg, #1a6b1a, #2d8a2d);
    --gradient-orange: linear-gradient(135deg, #c85a10, #e87a30);
    --gradient-card: linear-gradient(135deg, rgba(34, 139, 34, 0.08), rgba(6, 18, 8, 0.5));
}

/* ── LIGHT MODE ───────────────────────────────────────────── */
:root[data-theme="light"] {
    --bg-primary: #f0f7f0;
    --bg-secondary: #e8f3e8;
    --bg-surface: rgba(240, 247, 240, 0.92);
    --bg-surface-hover: rgba(26, 107, 26, 0.06);
    --bg-overlay: rgba(240, 247, 240, 0.90);

    --border-primary: rgba(26, 107, 26, 0.25);
    --border-secondary: rgba(26, 107, 26, 0.15);
    --border-accent: rgba(200, 80, 10, 0.35);

    --text-primary: #0d2e0d;
    --text-secondary: #1a4d1a;
    --text-muted: #2d6b2d;
    --text-hint: #3d7a3d;
    --text-dim: #5a8a5a;

    --accent-green: #1a6b1a;
    --accent-green-mid: #2d8a2d;
    --accent-green-dark: #0d4d0d;
    --accent-orange: #c85a10;
    --accent-orange-bg: rgba(200, 90, 16, 0.10);
    --accent-orange-border: rgba(200, 90, 16, 0.25);

    --map-grid: rgba(26, 107, 26, 0.08);
    --map-bg-from: #d8eed8;
    --map-bg-to: #c8e4c8;
    --map-glow: rgba(26, 107, 26, 0.08);

    --scrollbar-track: rgba(240, 247, 240, 0.5);
    --scrollbar-thumb: rgba(26, 107, 26, 0.25);

    --tile-layer: light;

    /* ── New Design Tokens ── */
    --panel-radius: 12px;
    --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.10);
    --panel-shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.08);
    --animation-fast: 0.2s ease;
    --animation-med: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    --animation-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --font-display: 'Rajdhani', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 50px;
    --header-height: 52px;
    --footer-height: 36px;
    --accent-blue: #0891b2;
    --accent-red: #dc2626;
    --accent-yellow: #d97706;
    --accent-purple: #7c3aed;
    --gradient-green: linear-gradient(135deg, #0d4d0d, #2d8a2d);
    --gradient-orange: linear-gradient(135deg, #a04010, #c85a10);
    --gradient-card: linear-gradient(135deg, rgba(26, 107, 26, 0.06), rgba(240, 247, 240, 0.5));
}

/* ── BASE ─────────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    transition: background var(--animation-med), color var(--animation-med);
}

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-green-mid);
}

/* ── LAYOUT UTAMA ─────────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: relative;
}

/* ── HEADER ───────────────────────────────────────────────── */
#header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px 0 8px;
    background: var(--bg-overlay);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(12px);
    z-index: 1000;
    flex-shrink: 0;
    transition: background var(--animation-med), border-color var(--animation-med);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-center {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    max-width: 420px;
    margin: 0 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Search bar in header */
.search-bar {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    padding: 0 10px;
    height: 32px;
    width: 100%;
    transition: all var(--animation-fast);
}

.search-bar:focus-within {
    border-color: var(--accent-green-mid);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(34, 139, 34, 0.1);
}

.search-bar i {
    font-size: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-body);
    width: 100%;
    padding: 0 8px;
}

.search-bar input::placeholder {
    color: var(--text-dim);
}

.search-bar .search-shortcut {
    font-size: 9px;
    color: var(--text-dim);
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Search results dropdown */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(12px);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 2000;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background var(--animation-fast);
    border-bottom: 1px solid var(--border-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-surface-hover);
}

.search-result-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.search-result-icon.jalur {
    background: rgba(45, 138, 45, 0.15);
    color: var(--accent-green);
}

.search-result-icon.titik {
    background: rgba(232, 122, 48, 0.15);
    color: var(--accent-orange);
}

.search-result-icon.kecamatan {
    background: rgba(84, 237, 254, 0.15);
    color: var(--accent-blue);
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-desc {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-box {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #fff;
    border: 1.5px solid var(--border-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    padding: 3px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}

.logo-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    line-height: 1.1;
}

.app-subtitle {
    font-size: 9px;
    color: var(--text-hint);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.btn-theme {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    background: transparent;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--animation-fast);
}

.btn-theme:hover {
    background: var(--bg-surface-hover);
    color: var(--accent-green);
    border-color: var(--accent-green-mid);
}

.btn-login {
    padding: 6px 14px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--border-primary);
    color: var(--accent-green);
    background: transparent;
    cursor: pointer;
    letter-spacing: 0.3px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--animation-fast);
}

.btn-login:hover {
    background: var(--bg-surface-hover);
    border-color: var(--accent-green);
}

/* ── MAP CONTAINER ────────────────────────────────────────── */
#map-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin-left: 0;
    transition: margin-left var(--animation-med);
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
#sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    z-index: 900;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-secondary);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--animation-med);
    box-shadow: none;
}

#sidebar.open {
    transform: translateX(0);
    box-shadow: var(--panel-shadow);
}

/* Toggle button — positioned independently on the map edge */
#sidebar-toggle {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 901;
    width: 28px;
    height: 52px;
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    border-left: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-green);
    font-size: 15px;
    transition: all var(--animation-med);
    box-shadow: 3px 0 16px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
}

/* Green accent strip on the left edge */
#sidebar-toggle::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent-green-mid);
    border-radius: 0 3px 3px 0;
    opacity: 0.7;
    transition: all var(--animation-fast);
}

#sidebar-toggle:hover {
    border-color: var(--accent-green-mid);
    background: linear-gradient(135deg, rgba(34, 139, 34, 0.2), var(--bg-surface));
    box-shadow: 3px 0 20px rgba(34, 139, 34, 0.3);
    width: 32px;
}

#sidebar-toggle:hover::before {
    height: 32px;
    opacity: 1;
}

#sidebar-toggle:active {
    transform: translateY(-50%) scale(0.92);
}

#sidebar-toggle #toggle-icon {
    transition: all var(--animation-med);
}

/* Move toggle to the right edge of the sidebar when open */
#sidebar.open~#sidebar-toggle {
    left: var(--sidebar-width);
    border-radius: 10px 0 0 10px;
    border-right: none;
    border-left: 1px solid var(--border-secondary);
    box-shadow: -3px 0 16px rgba(0, 0, 0, 0.25);
}

#sidebar.open~#sidebar-toggle::before {
    left: auto;
    right: 0;
    border-radius: 3px 0 0 3px;
}

#sidebar.open~#sidebar-toggle:hover {
    box-shadow: -3px 0 20px rgba(34, 139, 34, 0.3);
}

/* Pulse animation on the toggle icon when sidebar is closed — eye catching */
#sidebar:not(.open)~#sidebar-toggle #toggle-icon {
    animation: toggle-bounce 2.5s ease-in-out infinite;
}

@keyframes toggle-bounce {

    0%,
    100% {
        opacity: 0.7;
        transform: translateX(0);
    }

    30% {
        opacity: 1;
        transform: translateX(3px);
    }

    60% {
        opacity: 0.8;
        transform: translateX(1px);
    }
}

.sidebar-header {
    padding: 14px 14px 10px;
    border-bottom: 1px solid var(--border-secondary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.sidebar-header-actions {
    display: flex;
    gap: 4px;
}

.sidebar-header-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    background: transparent;
    border: 1px solid var(--border-secondary);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--animation-fast);
}

.sidebar-header-btn:hover {
    border-color: var(--border-primary);
    color: var(--text-secondary);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

.sidebar-body::-webkit-scrollbar {
    width: 3px;
}

.sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px;
}

/* Accordion-style filter sections */
.filter-section {
    margin-bottom: 4px;
    border-radius: 8px;
    overflow: hidden;
    transition: all var(--animation-fast);
}

.filter-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background var(--animation-fast);
    user-select: none;
}

.filter-section-header:hover {
    background: var(--bg-surface-hover);
}

.filter-section-header .filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-section-header .filter-label i {
    font-size: 12px;
}

.filter-section-header .collapse-icon {
    font-size: 12px;
    color: var(--text-dim);
    transition: transform var(--animation-fast);
}

.filter-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.filter-section-body {
    padding: 0 6px 8px;
    transition: all var(--animation-fast);
    overflow: hidden;
}

.filter-section.collapsed .filter-section-body {
    display: none;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 6px;
    border-radius: 6px;
    cursor: pointer;
    transition: background var(--animation-fast);
}

.filter-item:hover {
    background: var(--bg-surface-hover);
}

.filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-dot.square {
    border-radius: 2px;
}

.filter-text {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

/* Toggle switch */
.toggle {
    width: 28px;
    height: 16px;
    border-radius: 8px;
    background: var(--accent-green-dark);
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    transition: background var(--animation-fast);
    border: 1px solid var(--border-primary);
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-green);
    transition: all var(--animation-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle.off {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--border-secondary);
}

.toggle.off::after {
    right: auto;
    left: 2px;
    background: var(--text-dim);
}

/* Select / Select2 overrides */
.filter-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    cursor: pointer;
    transition: border-color var(--animation-fast);
    font-family: var(--font-body);
}

.filter-select:focus {
    outline: none;
    border-color: var(--border-primary);
}

/* Select2 custom styling */
.select2-container--default .select2-selection--single {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--border-secondary) !important;
    border-radius: 6px !important;
    height: 30px !important;
    font-family: var(--font-body) !important;
    font-size: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-secondary) !important;
    line-height: 28px !important;
    padding-left: 8px !important;
    font-size: 12px !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--text-dim) !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 28px !important;
}

.select2-dropdown {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-primary) !important;
    border-radius: 8px !important;
    box-shadow: var(--panel-shadow) !important;
    backdrop-filter: blur(12px) !important;
}

.select2-results__option {
    font-size: 12px !important;
    color: var(--text-secondary) !important;
    padding: 6px 10px !important;
}

.select2-results__option--highlighted {
    background: var(--bg-surface-hover) !important;
    color: var(--accent-green) !important;
}

.select2-search__field {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--border-secondary) !important;
    border-radius: 4px !important;
    color: var(--text-primary) !important;
    font-size: 11px !important;
}

/* ── FLOATING PANELS (glassmorphism) ──────────────────────── */
.floating-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--panel-radius);
    box-shadow: var(--panel-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all var(--animation-med);
}

.floating-panel:hover {
    border-color: rgba(34, 139, 34, 0.35);
}

/* ── STATS PANEL (redesain) ───────────────────────────────── */
#stats-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 500;
    width: 260px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--panel-radius);
    padding: 12px 14px 10px;
    backdrop-filter: blur(16px);
    box-shadow: var(--panel-shadow);
    transition: all var(--animation-med);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-green);
    opacity: 0.5;
}

.stat-card:hover {
    border-color: rgba(34, 139, 34, 0.35);
}

.stat-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.stat-item {
    background: var(--gradient-card);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    padding: 10px 12px;
    transition: all var(--animation-fast);
}

.stat-item:hover {
    border-color: var(--border-primary);
    transform: translateY(-1px);
}

.stat-item .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 2px;
}

.stat-item .stat-value-wrap {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.stat-item .stat-value {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-green);
    line-height: 1;
}

.stat-item .stat-unit {
    font-size: 11px;
    color: var(--text-hint);
}

/* Warna berbeda per stat */
.stat-item:nth-child(1) .stat-value {
    color: var(--accent-green);
}

.stat-item:nth-child(2) .stat-value {
    color: var(--accent-orange);
}

.stat-item:nth-child(3) .stat-value {
    color: var(--accent-blue);
}

.stat-item:nth-child(4) .stat-value {
    color: var(--accent-purple);
}

/* Stat progress bar */
.stat-progress {
    height: 2px;
    background: var(--border-secondary);
    border-radius: 1px;
    margin-top: 4px;
    overflow: hidden;
}

.stat-progress-bar {
    height: 100%;
    border-radius: 1px;
    background: var(--gradient-green);
    width: 0%;
    transition: width 1s ease;
}

/* ── POPUP JALUR (bottom sheet style) ─────────────────────── */
#popup-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 600;
    display: none;
    padding: 0 12px 12px;
    pointer-events: none;
}

#popup-panel.show {
    display: block;
}

.popup-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-accent);
    border-radius: var(--panel-radius);
    padding: 14px 16px;
    backdrop-filter: blur(16px);
    box-shadow: var(--panel-shadow);
    pointer-events: auto;
    max-width: 380px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.popup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-orange);
    opacity: 0.6;
}

.popup-handle {
    width: 32px;
    height: 3px;
    background: var(--text-dim);
    border-radius: 2px;
    margin: 0 auto 8px;
}

.popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all var(--animation-fast);
}

.popup-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.popup-tag {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 600;
    background: var(--accent-orange-bg);
    border: 1px solid var(--accent-orange-border);
    color: var(--accent-orange);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.popup-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
    padding-right: 30px;
}

.popup-km {
    font-size: 10px;
    color: var(--text-hint);
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-secondary);
    display: flex;
    align-items: center;
    gap: 3px;
}

.popup-jadwal-title {
    font-size: 8px;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.popup-jadwal-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 160px;
    overflow-y: auto;
}

.popup-jadwal-item {
    background: var(--bg-surface-hover);
    border-radius: 6px;
    padding: 6px 8px;
    border-left: 2px solid var(--accent-green-mid);
    transition: background var(--animation-fast);
}

.popup-jadwal-item:hover {
    background: rgba(34, 139, 34, 0.12);
}

.popup-jadwal-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 1px;
}

.popup-jadwal-shift {
    font-size: 9px;
    font-weight: 600;
    color: var(--accent-orange);
    letter-spacing: 0.5px;
}

/* ── LAYER SWITCHER ───────────────────────────────────────── */
#layer-switcher {
    position: absolute;
    bottom: 44px;
    left: 16px;
    z-index: 500;
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    padding: 3px;
    display: flex;
    gap: 2px;
    backdrop-filter: blur(12px);
    box-shadow: var(--panel-shadow-sm);
}

.layer-btn {
    padding: 5px 14px;
    border-radius: 7px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--animation-fast);
    letter-spacing: 0.3px;
    font-family: var(--font-body);
}

.layer-btn:hover {
    color: var(--text-secondary);
}

.layer-btn.active {
    background: var(--gradient-green);
    border-color: var(--accent-green-mid);
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.25);
}

/* ── MAP CONTROLS ─────────────────────────────────────────── */
#map-controls {
    position: absolute;
    bottom: 48px;
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
    pointer-events: auto;
}

.map-ctrl-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: all var(--animation-fast);
    backdrop-filter: blur(12px);
    box-shadow: var(--panel-shadow-sm);
}

.map-ctrl-btn:hover {
    border-color: var(--border-primary);
    color: var(--accent-green);
    background: var(--bg-surface-hover);
    transform: scale(1.05);
}

.map-ctrl-btn:active {
    transform: scale(0.95);
}

.map-ctrl-sep {
    height: 8px;
}

/* ── TOOLTIP ──────────────────────────────────────────────── */
.tooltip-btn {
    position: relative;
}

.tooltip-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    right: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid var(--border-secondary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all var(--animation-fast);
    font-family: var(--font-body);
}

.tooltip-btn:hover::after {
    opacity: 1;
}

/* ── FOOTER ───────────────────────────────────────────────── */
#footer {
    height: var(--footer-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    background: var(--bg-overlay);
    border-top: 1px solid var(--border-secondary);
    backdrop-filter: blur(12px);
    z-index: 1000;
    flex-shrink: 0;
    transition: background var(--animation-med);
}

.footer-left,
.footer-right {
    font-size: 11px;
    color: var(--text-dim);
}

.footer-coord {
    font-family: var(--font-display);
    font-size: 12px;
    color: var(--text-hint);
    letter-spacing: 0.3px;
}

/* ── LEAFLET OVERRIDES ────────────────────────────────────── */
.leaflet-control-zoom {
    display: none;
}

.leaflet-control-attribution {
    background: var(--bg-surface) !important;
    color: var(--text-dim) !important;
    font-size: 9px !important;
    border-radius: 6px 0 0 0 !important;
    padding: 2px 8px !important;
}

.leaflet-control-attribution a {
    color: var(--text-hint) !important;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-primary) !important;
    box-shadow: var(--panel-shadow) !important;
    font-family: var(--font-body) !important;
}

.leaflet-popup-tip {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-primary) !important;
}

.leaflet-popup-close-button {
    color: var(--text-muted) !important;
}

/* Loading overlay */
#map-loading {
    position: absolute;
    inset: 0;
    background: var(--bg-primary);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    transition: opacity 0.6s ease;
}

#map-loading.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid var(--border-secondary);
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-family: var(--font-display);
    font-size: 13px;
    color: var(--text-hint);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ── MOBILE RESPONSIVE ────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --sidebar-collapsed-width: 0px;
        --header-height: 48px;
        --footer-height: 28px;
    }

    #header {
        padding: 0 8px;
    }

    .header-center {
        display: none;
    }

    .app-title {
        font-size: 13px;
    }

    .app-subtitle {
        display: none;
    }

    .badge-live {
        font-size: 8px;
        padding: 2px 6px;
    }

    .badge-live::before {
        width: 4px;
        height: 4px;
    }

    .btn-login span {
        display: none;
    }

    #sidebar {
        width: 100% !important;
        transform: translateX(-100%);
        z-index: 1000;
    }

    #sidebar.open {
        transform: translateX(0);
    }

    #sidebar-toggle {
        display: none;
    }

    #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
    }

    #sidebar-overlay.show {
        display: block;
    }

    #map-wrap.sidebar-open {
        margin-left: 0;
    }

    #stats-panel {
        top: 8px;
        right: 8px;
        width: 160px;
    }

    .stat-card {
        padding: 8px 10px;
    }

    .stat-grid {
        gap: 4px;
    }

    .stat-item {
        padding: 6px 8px;
    }

    .stat-item .stat-value {
        font-size: 14px;
    }

    .stat-card-title {
        font-size: 7px;
        margin-bottom: 6px;
    }

    #popup-panel {
        padding: 0 8px 8px;
    }

    .popup-card {
        max-width: 100%;
        padding: 12px 14px;
    }

    #layer-switcher {
        bottom: 12px;
        left: 12px;
    }

    .layer-btn {
        padding: 4px 10px;
        font-size: 9px;
    }

    #map-controls {
        bottom: 12px;
        right: 8px;
    }

    .map-ctrl-btn {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .footer-left,
    .footer-right {
        font-size: 8px;
    }

    .footer-coord {
        font-size: 9px;
    }

    /* Mobile search toggle */
    .mobile-search-toggle {
        display: flex !important;
    }
}

@media (max-width: 480px) {
    #stats-panel {
        width: 140px;
        top: 4px;
        right: 4px;
    }

    .stat-item .stat-label {
        font-size: 8px;
    }

    .stat-item .stat-value {
        font-size: 13px;
    }

    .stat-item .stat-unit {
        font-size: 8px;
    }

    #map-controls {
        gap: 3px;
    }

    .map-ctrl-btn {
        width: 26px;
        height: 26px;
        font-size: 12px;
    }

    #layer-switcher {
        padding: 2px;
    }

    .layer-btn {
        padding: 3px 8px;
        font-size: 8px;
    }
}

/* ── MOBILE SEARCH (di atas map) ──────────────────────────── */
.mobile-search-toggle {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-secondary);
    color: var(--text-muted);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--animation-fast);
    box-shadow: var(--panel-shadow-sm);
}

.mobile-search-toggle:hover {
    border-color: var(--border-primary);
    color: var(--accent-green);
}

/* Mobile search bar (full width overlay) */
#mobile-search {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 950;
    padding: 8px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-primary);
    backdrop-filter: blur(12px);
}

#mobile-search.show {
    display: block;
}

#mobile-search .search-bar {
    max-width: 100%;
}

/* ── DARK MODE MAP FILTER ─────────────────────────────────── */
:root[data-theme="dark"] #map {
    filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9);
}

:root[data-theme="dark"] #map .leaflet-marker-icon,
:root[data-theme="dark"] #map .leaflet-marker-shadow {
    filter: invert(1) hue-rotate(180deg);
}

/* ── LEGENDA ──────────────────────────────────────────────── */
.legend-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 4px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.legend-dot {
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── CONNECTION STATUS ────────────────────────────────────── */
.connection-status {
    display: flex;
    align-items: center;
    padding: 2px;
}

.connection-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 6px var(--accent-green);
    animation: pulse-dot 2s ease-in-out infinite;
}

.connection-dot.error {
    background: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
}

/* ── ANIMATED COUNTER ─────────────────────────────────────── */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-value.animated {
    animation: countUp 0.4s ease forwards;
}

.stat-value.animated:nth-child(1) {
    animation-delay: 0s;
}

.stat-value.animated:nth-child(2) {
    animation-delay: 0.05s;
}

.stat-value.animated:nth-child(3) {
    animation-delay: 0.1s;
}

.stat-value.animated:nth-child(4) {
    animation-delay: 0.15s;
}

/* ── JALAN OSM POPUP ─────────────────────────────────────── */
.gis-jalan-popup .leaflet-popup-content-wrapper {
    background: var(--bg-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 10px !important;
    padding: 0 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4) !important;
}

.gis-jalan-popup .leaflet-popup-content {
    margin: 12px 14px !important;
    min-width: 180px;
}

.gis-jalan-popup .leaflet-popup-tip-container {
    display: none;
}

/* ── TITIK SAMPAH POPUP (Leaflet popup style) ────────────── */
.gis-titik-sampah-popup .leaflet-popup-content-wrapper {
    background: var(--bg-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    padding: 0 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
    overflow: hidden !important;
}

.gis-titik-sampah-popup .leaflet-popup-content {
    margin: 0 !important;
    min-width: 260px;
    max-width: 340px;
}

.gis-titik-sampah-popup .leaflet-popup-tip-container {
    display: none;
}

.gis-titik-sampah-popup .leaflet-popup-close-button {
    top: 8px !important;
    right: 8px !important;
    z-index: 100 !important;
    width: 22px !important;
    height: 22px !important;
    line-height: 22px !important;
    font-size: 14px !important;
    color: rgba(255,255,255,0.6) !important;
    background: rgba(0,0,0,0.3) !important;
    border-radius: 6px !important;
    border: none !important;
    padding: 0 !important;
    text-align: center !important;
    transition: all var(--animation-fast);
}

.gis-titik-sampah-popup .leaflet-popup-close-button:hover {
    background: rgba(239, 68, 68, 0.8) !important;
    color: #fff !important;
}

.titik-popup-content {
    font-family: var(--font-body);
    color: var(--text-primary);
}

/* Loading state */
.titik-popup-loading {
    padding: 32px 24px;
    text-align: center;
    min-width: 200px;
}

.titik-popup-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border-primary);
    border-top-color: var(--accent-orange);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 12px;
}

.titik-popup-loading-text {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* Photo slider */
.titik-popup-slider {
    position: relative;
    width: 100%;
    background: #000;
    overflow: hidden;
    min-height: 160px;
    display: flex;
    align-items: center;
}

.titik-popup-slides {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.titik-popup-slide {
    display: none;
    width: 100%;
    position: relative;
}

.titik-popup-slide.active {
    display: block;
}

.titik-popup-slide img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.3s ease;
}

.titik-popup-slide.error {
    background: var(--bg-secondary);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.titik-popup-slide.error::after {
    content: '📷 Foto tidak tersedia';
    font-size: 11px;
    color: var(--text-muted);
}

.titik-popup-slide.error img {
    display: none;
}

.titik-popup-slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    font-size: 10px;
    color: rgba(255,255,255,0.9);
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation arrows */
.titik-popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--animation-fast);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.25s ease, background 0.2s ease;
}

.titik-popup-slider:hover .titik-popup-nav {
    opacity: 1;
}

.titik-popup-nav:hover {
    background: rgba(0,0,0,0.7);
    border-color: rgba(255,255,255,0.3);
    transform: translateY(-50%) scale(1.1);
}

.titik-popup-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.titik-popup-prev {
    left: 6px;
}

.titik-popup-next {
    right: 6px;
}

/* Dots */
.titik-popup-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    z-index: 10;
}

.titik-popup-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: all var(--animation-fast);
    border: none;
    padding: 0;
}

.titik-popup-dot.active {
    background: #fff;
    box-shadow: 0 0 6px rgba(255,255,255,0.5);
    transform: scale(1.2);
}

.titik-popup-dot:hover {
    background: rgba(255,255,255,0.7);
}

/* Counter */
.titik-popup-counter {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    font-size: 9px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    background: rgba(0,0,0,0.4);
    padding: 2px 8px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    backdrop-filter: blur(4px);
}

/* Popup body */
.titik-popup-body {
    padding: 12px 14px 14px;
}

.titik-popup-header {
    margin-bottom: 8px;
}

.titik-popup-category {
    display: inline-block;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
    margin-bottom: 4px;
}

.titik-popup-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.25;
}

.titik-popup-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.titik-popup-info-row {
    display: flex;
    gap: 6px;
}

.titik-popup-info-item {
    flex: 1;
    background: var(--gradient-card);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    padding: 6px 8px;
    min-width: 0;
}

.titik-popup-info-label {
    display: block;
    font-size: 8px;
    font-weight: 600;
    color: var(--text-hint);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1px;
}

.titik-popup-info-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    word-break: break-word;
}

.titik-popup-catatan {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
    padding: 6px 8px;
    background: var(--bg-surface-hover);
    border-radius: 6px;
    border-left: 2px solid var(--accent-orange);
    line-height: 1.4;
}
