/* klic_viewer.css - extracted from klic_viewer.html
 * Do NOT add styles directly to klic_viewer.html.
 * This file is served with long-lived cache headers.
 */

:root {
    /* Gelijk met dashboard: custom chevron + inset */
    --select-chic-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23a1a1aa' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='M1.2 1.2L5 4.4l3.8-3.2'/%3E%3C/svg%3E");
    --select-chic-chevron-lm: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%234a5565' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round' d='M1.2 1.2L5 4.4l3.8-3.2'/%3E%3C/svg%3E");
    --select-native-pad-r: 2.75rem;
    --brand-primary: #FFFFFF;
    --brand-accent: #FFFFFF;
    --surface-dark: #1e1e1e;
    --bg-deep: #121212;
    --border-white: rgba(255, 255, 255, 0.07);
    --color-text-main: #E5E7EB;
    --color-text-dim: #9CA3AF;
    --color-text-muted: #8B92A0;
    /* Viewer sidebar: layered gradient (neon whisper + cool depth) */
    --viewer-sidebar-bg: linear-gradient(
        165deg,
        #18181c 0%,
        #141418 38%,
        #101014 100%
    );
    --viewer-sidebar-glow-tl: radial-gradient(
        ellipse 130% 90% at 0% 0%,
        rgba(204, 255, 0, 0.07) 0%,
        transparent 58%
    );
    --viewer-sidebar-glow-br: radial-gradient(
        ellipse 100% 70% at 100% 100%,
        rgba(59, 130, 246, 0.06) 0%,
        transparent 55%
    );
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-deep);
    color: var(--color-text-main);
    letter-spacing: -0.01em;
}

.glass {
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.map-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    background: rgba(18, 18, 18, 0.92);
    border: 1px solid rgba(255,255,255,0.1);
    touch-action: manipulation;
}

.map-btn i {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.75) !important;
}

@media (min-width: 1024px) {
    .map-btn {
        width: 38px;
        height: 38px;
        border-radius: 14px;
    }
    .map-btn i {
        font-size: 14px;
    }
}

.map-btn:hover {
    background: rgba(42, 42, 42, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

.map-btn:hover i {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Legend Search Bar */
.legend-search-wrapper {
    margin-bottom: 17px; /* φ-based: 28/φ ≈ 17 */
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border-white);
    height: 44px;
    border-radius: 16px;
    padding: 0 12px;
    transition: all 0.2s;
}

.legend-search-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.legend-search-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 13px;
    margin-left: 8px;
    font-weight: 500;
}

.legend-search-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Logo visibility during search - removed as search is moved */

/* Satellite Button Toggle State */
.map-btn.sat-active {
    background: #fff;
    color: #000;
}
.map-btn.sat-active i {
    color: #000 !important;
}

/* Sat/Tech Toggle (LEGACY REMOVED) */

/* Pipe Glow & Precision */
.klic-line {
    transition: stroke-width 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: pointer !important;
    pointer-events: auto !important;
}

/* SVG Path Animation - Only for preview maps (ANIMATION REMOVED) */
#preview-map .animating-line {
    stroke-dashoffset: 0;
}

.klic-line:hover {
    stroke-width: 14px !important;
}

.selected-line {
    stroke-width: 16px !important;
}

/* Point selection highlight */
.point-selection-ring {
    border-radius: 50%;
    border: 3px solid #CCFF00;
    box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.25), 0 0 16px rgba(204, 255, 0, 0.4);
    animation: pointSelectPulse 1.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pointSelectPulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.25), 0 0 16px rgba(204, 255, 0, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(204, 255, 0, 0.1), 0 0 24px rgba(204, 255, 0, 0.3); }
}

/* Marker-pane staat boven leidingen; zonder dit vangen transparante vlakken alle touches af. */
.leaflet-klicMarkers-pane .leaflet-marker-icon,
.leaflet-klicMarkers-pane .leaflet-div-icon,
.leaflet-klicMarkers-pane .marker-cluster {
    pointer-events: auto !important;
}

.klic-hulpmiddel-icon {
    background: transparent !important;
    border: none !important;
}
.klic-hulpmiddel-icon.selected > div {
    box-shadow: 0 0 0 4px rgba(204, 255, 0, 0.5), 0 0 20px rgba(204, 255, 0, 0.4) !important;
    border-color: #CCFF00 !important;
}

.map-btn.active {
    background: #CCFF00;
    color: #000;
    border-color: #CCFF00;
}

.map-btn.active i {
    color: #000 !important;
}

/* Safety Mode Pulse */
.map-btn.safety-active {
    background: #FF4400 !important;
    border-color: #FF4400 !important;
    box-shadow: 0 0 15px rgba(255, 68, 0, 0.4);
    animation: safety-pulse 2s infinite;
}
.map-btn.safety-active i {
    color: white !important;
}

@keyframes safety-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 68, 0, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(255, 68, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 68, 0, 0); }
}

/* Measurement tool styling */
.measurement-badge {
    position: fixed;
    top: auto;
    bottom: 100px; /* Positioned above the legend/bottom nav on mobile */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2001;
    padding: 10px 20px;
    border-radius: 18px;
    background: rgba(22, 22, 22, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(204, 255, 0, 0.3);
    color: var(--color-text-main);
    font-size: 15px;
    font-weight: 700;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    pointer-events: auto;
    white-space: nowrap;
    min-width: 180px;
    justify-content: space-between;
}

@media (min-width: 1024px) {
    .measurement-badge {
        top: 80px;
        bottom: auto;
        left: calc(50% + 190px);
        font-size: 13px;
        padding: 8px 16px;
        border-radius: 14px;
    }
}

.measurement-badge i {
    font-size: 14px;
    color: #CCFF00;
}

.measurement-badge .close-measure {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    cursor: pointer;
    margin-left: 4px;
    transition: all 0.2s;
}

.measurement-badge .close-measure:hover {
    background: rgba(255,255,255,0.1);
}

.measure-marker {
    width: 44px;
    height: 44px;
    background: transparent;
    position: relative;
}

.measure-target {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.measure-target-circle {
    width: 18px;
    height: 18px;
    border: 2px solid #CCFF00;
    border-radius: 50%;
    background: transparent; /* Fully transparent to see the line meeting the center */
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    z-index: 2;
}

.measure-target-line-v {
    position: absolute;
    width: 1.5px;
    height: 26px;
    background: #CCFF00;
    z-index: 3;
}

.measure-target-line-h {
    position: absolute;
    width: 26px;
    height: 1.5px;
    background: #CCFF00;
    z-index: 3;
}

.measure-target-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #CCFF00;
    border-radius: 50%;
    z-index: 4;
    box-shadow: 0 0 4px #000;
}

/* Precision mode: hide marker visuals during drag since magnifier has its own crosshair */
.marker-dragging .measure-target {
    opacity: 0;
}

/* Magnifier Styling */
.map-magnifier {
    position: fixed;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px solid #CCFF00;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6), inset 0 0 20px rgba(0,0,0,0.2);
    z-index: 3000;
    display: none;
    overflow: hidden;
    pointer-events: none;
    background: #111111;
    transform: translate(-50%, -100%);
    margin-top: -40px; /* Offset above finger */
}

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

.magnifier-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
    width: 24px;
    height: 24px;
    pointer-events: none;
}

.magnifier-crosshair::before,
.magnifier-crosshair::after {
    content: '';
    position: absolute;
    background: #CCFF00;
    opacity: 0.6;
}

.magnifier-crosshair::before {
    top: 50%; left: 0; right: 0; height: 2px; transform: translateY(-50%);
}

.magnifier-crosshair::after {
    left: 50%; top: 0; bottom: 0; width: 2px; transform: translateX(-50%);
}

/* Proximity Alert Styling */
.proximity-alert {
    position: fixed;
    top: auto;
    bottom: 160px; /* Above measurement badge on mobile */
    left: 50%;
    transform: translateX(-50%);
    z-index: 2002;
    padding: 10px 20px;
    border-radius: 18px;
    background: rgba(0, 210, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 210, 255, 0.4);
    color: #00D1FF;
    font-size: 13px;
    font-weight: 800;
    display: none;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    pointer-events: none;
    text-transform: none;
    letter-spacing: 0.05em;
}

@media (min-width: 1024px) {
    .proximity-alert {
        top: 80px;
        bottom: auto;
        left: calc(50% + 190px);
        font-size: 11px;
        padding: 8px 16px;
        border-radius: 14px;
    }
}

.proximity-alert i {
    font-size: 14px;
    animation: proximity-pulse 1.5s infinite;
}

@keyframes proximity-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.filter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 17px; /* φ-based */
    padding: 3px;
    background: rgba(255,255,255,0.025);
    border-radius: 10px;
    border: 1px solid var(--border-white);
}

.filter-tab {
    flex: 1;
    padding: 7px 6px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0.03em;
    color: var(--color-text-dim);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

@media (min-width: 1024px) {
    .filter-tab {
        padding: 7px 6px;
        font-size: 12px;
    }
}

.filter-tab.active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

/* Toggle switch (Kadaster-style) */
.klic-toggle {
    width: 40px; height: 22px;
    background: rgba(255,255,255,0.1);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
    cursor: pointer;
}
.klic-toggle.active {
    background: #CCFF00;
}
.klic-toggle-thumb {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #fff;
    position: absolute;
    top: 2px; left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.klic-toggle.active .klic-toggle-thumb {
    transform: translateX(18px);
    background: #111111;
}

.legend-group-header {
    font-size: 11px;
    font-weight: 900;
    color: var(--color-text-dim);
    text-transform: none;
    letter-spacing: 0.15em;
    margin: 16px 0 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (min-width: 1024px) {
    .legend-group-header {
        font-size: 10px;
        margin: 14px 0 4px 10px;
    }
}

.legend-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-white);
}

.user-location-marker {
    width: 20px;
    height: 20px;
    background: #3B82F6;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.8);
    transition: border-radius 0.2s, width 0.2s, height 0.2s;
}

.user-location-marker.compass-arrow {
    width: 0;
    height: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    /* Arrow pointing up - after counter-rotation in RAF, always faces heading direction */
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 22px solid #3B82F6;
    filter: drop-shadow(0 0 8px rgba(59,130,246,0.9));
    will-change: transform;
}

/* Compass mode indicator - bottom-right of map */
#compassIndicator {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 16px;
    z-index: 9100;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(12, 12, 12, 0.88);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
#compassIndicator.active { display: flex; }

#compassNeedleWrapper {
    width: 28px;
    height: 28px;
    position: relative;
    will-change: transform;
}
#compassNeedleSvg {
    width: 100%;
    height: 100%;
    will-change: transform;
}
#compassHeadingText {
    font-size: 9px;
    font-weight: 800;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.5px;
    line-height: 1;
}


.legend-card {
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .legend-card {
        position: fixed !important;
        bottom: 20px !important;
        left: 20px !important;
        right: auto !important;
        width: auto !important;
        max-width: calc(100vw - 40px) !important;
        border-radius: 16px !important;
        padding: 0 !important;
        overflow: hidden auto !important;
    }

    .legend-card.collapsed {
        width: 44px !important;
        height: 44px !important;
        border-radius: 12px !important;
        transform: none !important;
    }
    
    .legend-card.collapsed .legend-content-area,
    .legend-card.collapsed .legend-toggle-handle {
        display: none !important;
    }

    .legend-card.collapsed::before {
        content: '\f0ca';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        color: #CCFF00; /* Dennis the Dev: Active color for visibility */
        cursor: pointer;
        font-size: 18px;
    }

    /* Legenda icoon fallback voor als FA niet laadt of ::before niet werkt */
    .legend-card.collapsed {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath fill='%23CCFF00' d='M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
        background-size: 20px !important;
    }
    .legend-card.collapsed::before {
        display: none !important;
    }

    .legend-card:not(.collapsed) {
        padding: 20px !important;
        width: calc(100vw - 40px) !important;
        max-height: 78vh !important;
        left: 20px !important;
        right: 20px !important;
        bottom: 20px !important;
        z-index: 2005 !important;
        background: var(--viewer-sidebar-glow-tl), var(--viewer-sidebar-glow-br), var(--viewer-sidebar-bg) !important;
        background-color: #121214 !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 12px 40px rgba(0, 0, 0, 0.45) !important;
        /* Single scroll container on mobile */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Remove nested scroll containers on mobile */
    .legend-card:not(.collapsed) .legend-content-area {
        overflow: visible !important;
        flex: none !important;
    }

    .legend-card:not(.collapsed) #legendGrid {
        overflow: visible !important;
        flex: none !important;
        min-height: auto !important;
        height: auto !important;
    }

    /* Allow all category items to fully expand without clipping */
    .legend-category-group.expanded .legend-category-items {
        max-height: 2000px !important;
    }

    /* Dunne scrollbar op mobile card */
    .legend-card::-webkit-scrollbar { width: 4px; }
    .legend-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
    .legend-card::-webkit-scrollbar-track { background: transparent; }

    /* Verberg de zij-knoppen als de legenda open is op mobiel */
    body.legend-open #sideButtons {
        display: none !important;
        transform: translateX(150%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }

    .legend-toggle-handle {
        display: flex !important;
        padding-bottom: 15px;
    }
}

.legend-toggle-handle {
    display: none;
    width: 100%;
    height: 40px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-bottom: -10px;
    margin-top: -10px;
}

.handle-bar {
    width: 32px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Transparency Slider Styling */
.opacity-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    transition: all 0.2s;
}

.opacity-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.opacity-slider::-moz-range-thumb {
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.legend-card:not(.collapsed) .handle-bar {
    background: rgba(255,255,255,0.1);
}

.legend-content-area {
    transition: opacity 0.3s ease;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Tailwind preflight compatibility with Leaflet */
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}
.leaflet-tile-pane img {
    display: inline !important;
}
.leaflet-control a {
    text-decoration: none;
}

#map {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1;
    background: #111111;
}

/* Labels hidden by default - shown only when labels-visible class active */
.klic-label-high, .klic-label-medium, .klic-label-low, .klic-maatvoering-label {
    display: none !important;
}
#map.labels-visible .klic-label-high,
#map.labels-visible .klic-label-medium,
#map.labels-visible .klic-label-low,
#map.labels-visible .klic-maatvoering-label {
    display: block !important;
}

/* KLIC-tekstlabels op donkere kaart: donkere halootje i.p.v. witte glow (leesbaar, strak) */
#map.labels-visible .klic-map-label-text {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    /* Strakke contour (donker) - geen brede witte bloom */
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.95),
        0 0 2px rgba(0, 0, 0, 0.7),
        0 1px 1px rgba(0, 0, 0, 0.88),
        0 -1px 1px rgba(0, 0, 0, 0.35),
        1px 0 1px rgba(0, 0, 0, 0.5),
        -1px 0 1px rgba(0, 0, 0, 0.5);
}
#map.labels-visible .klic-map-label-text--maat {
    color: #a8b0bf;
    text-shadow:
        0 0 1px rgba(0, 0, 0, 0.9),
        0 1px 2px rgba(0, 0, 0, 0.55);
}
#map.labels-visible .klic-map-label-text--maat .klic-map-label-maat-ico {
    font-size: 7px;
    opacity: 0.55;
}

/* Lichte kaartlagen: subtielere stroke zodat kleur niet “vies” oogt */
#map.labels-visible.map-base-light .klic-map-label-text:not(.klic-map-label-text--maat) {
    text-shadow:
        0 0 1px rgba(255, 255, 255, 0.35),
        0 0 2px rgba(0, 0, 0, 0.55),
        0 1px 1px rgba(0, 0, 0, 0.45);
}

/* --- Loading Overlay --- */
@keyframes skeletonFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}
#skeletonOverlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    pointer-events: none;
    background: var(--bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}
#skeletonOverlay.fade-out {
    animation: skeletonFadeOut 0.4s ease forwards;
}
.skeleton-progress-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.skeleton-logo-mark svg {
    width: 160px;
    height: auto;
    opacity: 0.85;
}
.skeleton-status {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: none;
    color: rgba(255,255,255,0.3);
    transition: all 0.3s;
}
.skeleton-progress-track {
    width: 160px;
    height: 2px;
    background: rgba(255,255,255,0.06);
    border-radius: 2px;
    overflow: hidden;
}
.skeleton-progress-fill {
    height: 100%;
    background: #CCFF00;
    border-radius: 2px;
    width: 0%;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

@media (min-width: 1024px) {
    .legend-item {
        gap: 8px;
        padding: 7px 10px;
    }
}

.legend-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-white);
}

.legend-item.hidden-layer {
    opacity: 0.3;
    filter: grayscale(1);
}

.legend-category-group {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2px;
}

.legend-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

@media (min-width: 1024px) {
    .legend-category-header {
        padding: 7px 10px;
    }
}

.legend-category-header:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-white);
}

.legend-category-header.hidden-layer {
    opacity: 0.3;
    filter: grayscale(1);
}

.legend-category-chevron {
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

.legend-category-group.expanded .legend-category-chevron {
    transform: rotate(90deg);
}

.legend-category-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.legend-category-group.expanded .legend-category-items {
    max-height: 500px;
}

/* Fullscreen Tool Menu (mobile) */
.tool-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.tool-menu-overlay.open {
    display: flex;
}

.tool-menu-panel {
    width: 100%;
    max-height: 88vh;
    background: var(--surface-dark);
    border-top-left-radius: 28px;
    border-top-right-radius: 28px;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: toolMenuSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.tool-menu-panel::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 auto 16px;
}

@keyframes toolMenuSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.tool-menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 380px) {
    .tool-menu-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.tool-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 6px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    transition: all 0.15s;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    min-height: 88px;
}

.tool-menu-item:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.96);
}

.tool-menu-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
}

.tool-menu-label {
    font-size: 11px;
    font-weight: 800;
    color: white;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

.tool-menu-desc {
    display: none;
}

.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pulsating-poly {
    fill-opacity: 0.1;
    stroke-opacity: 0.6;
}

.selection-glow {
    stroke-dasharray: 10, 20;
    filter: drop-shadow(0 0 8px #CCFF00);
    stroke-linecap: round;
    pointer-events: none !important;
    cursor: default !important;
}

.leaflet-pane.leaflet-selectionHighlight-pane {
    pointer-events: none !important;
}

/* ANIMATIONS REMOVED */

/* Custom Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Fix weird attribution pill and any other default leaflet controls in the corners */
.leaflet-bottom.leaflet-right,
.leaflet-bottom.leaflet-left,
.leaflet-top.leaflet-right,
.leaflet-top.leaflet-left {
    pointer-events: none !important;
}

.leaflet-control-attribution, 
.leaflet-control-container .leaflet-bottom.leaflet-right > div:not(.leaflet-control-scale) {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Specifically target the attribution link/text container which often gets auto-styled */
.leaflet-control-attribution a,
.leaflet-control-attribution span {
    display: none !important;
}

/* Ensure the scale control itself stays visible but clean */
.leaflet-control-scale {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    background: rgba(0,0,0,0.3) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-top: none !important;
    color: #fff !important;
    padding: 2px 5px !important;
    text-shadow: 0 1px 2px #000 !important;
    font-weight: 600 !important;
    font-size: 10px !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
.leaflet-control-scale-line {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* Desktop Power Tools Toolbar */
.desktop-tools-bar {
    position: fixed;
    top: 80px; /* Lower on mobile */
    left: 50%;
    transform: translateX(-50%);
    z-index: 1005;
    display: none; /* Hidden by default, toggled by JS */
    gap: 8px;
    padding: 6px;
    background: rgba(30, 30, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-white);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (min-width: 1024px) {
    .desktop-tools-bar {
        top: 24px;
        left: calc(50% + 160px);
    }
}

.desktop-tools-bar.visible {
    display: flex;
}

/* Annotation Button (Top Left) */
.annotation-btn-wrapper {
    position: fixed;
    top: 24px;
    left: 348px; /* 320px sidebar + 28px gap */
    z-index: 1005;
    transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

body.sidebar-collapsed .annotation-btn-wrapper {
    left: 88px; /* 60px sidebar + 28px gap */
}

.annotation-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    font-weight: 800;
    color: white;
    background: rgba(30, 30, 30, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-white);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 0.05em;
}

.annotation-btn:hover {
    background: rgba(50, 50, 50, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.annotation-btn.active {
    background: #CCFF00;
    color: black;
    border-color: #CCFF00;
    box-shadow: 0 0 15px rgba(204, 255, 0, 0.4);
}

.annotation-btn i {
    font-size: 14px;
}

@media (max-width: 1024px) {
    .annotation-btn-wrapper {
        left: 24px;
        top: 80px; /* Below header on mobile if needed, or hidden */
        display: none; /* Keep hidden on mobile for now as requested for desktop layout */
    }
}

.tool-btn {
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.5);
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
    text-transform: none;
    letter-spacing: 0.05em;
}

.tool-btn:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.tool-btn.active {
    background: rgba(204, 255, 0, 0.1);
    color: #CCFF00;
    border-color: rgba(204, 255, 0, 0.2);
}

.tool-btn i {
    font-size: 12px;
}

/* Annotation Marker Styling */
.annotation-marker {
    background: transparent;
    border: none;
}

.annotation-bubble {
    background: #CCFF00;
    color: #000;
    padding: 6px 12px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 800;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    white-space: nowrap;
    position: relative;
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.annotation-bubble::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #CCFF00;
}

.annotation-input-wrapper {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2005;
    background: rgba(20, 20, 20, 0.96);
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border-white);
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    display: none;
    width: 300px;
}

/* Desktop Sidebar Optimization - Golden Ratio layout
   Sidebar : Map ≈ 1 : φ (1 : 1.618)
   At 1440px → sidebar ~320px, map ~1120px (ratio 1:3.5 ≈ visual φ)
   Padding rhythm: 28px (base) → 17px → 11px (÷ φ each step) */
@media (min-width: 1024px) {
    .legend-card {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 320px !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        border: none !important;
        border-right: 1px solid var(--border-white) !important;
        margin: 0 !important;
        padding: 28px 24px !important;
        z-index: 1002 !important;
        transform: none !important;
        display: flex !important;
        flex-direction: column !important;
        background: var(--viewer-sidebar-glow-tl), var(--viewer-sidebar-glow-br), var(--viewer-sidebar-bg) !important;
        background-color: #121214 !important;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 4px 0 24px rgba(0, 0, 0, 0.35) !important;
        transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1), padding 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    body.sidebar-collapsed .legend-card {
        width: 60px !important;
        padding: 28px 10px !important;
    }

    body.sidebar-collapsed .legend-card .legend-content-area,
    body.sidebar-collapsed .legend-card #desktop-logo,
    body.sidebar-collapsed .legend-card .breadcrumb-nav {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s;
    }

    #sidebar-toggle {
        position: absolute;
        right: -12px;
        top: 50%;
        transform: translateY(-50%);
        width: 24px;
        height: 48px;
        background: linear-gradient(180deg, #1c1c20 0%, #16161a 100%);
        border: 1px solid var(--border-white);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 1003;
        color: white;
        transition: all 0.2s;
    }

    #sidebar-toggle:hover {
        background: #2a2a2a;
        color: #CCFF00;
    }

    body.sidebar-collapsed #sidebar-toggle i {
        transform: rotate(180deg);
    }

    #map {
        left: 320px !important;
        width: calc(100% - 320px) !important;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1), width 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    body.sidebar-collapsed #map {
        left: 60px !important;
        width: calc(100% - 60px) !important;
    }

    /* Breadcrumb Styling */
    .breadcrumb-nav {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 20px;
        font-size: 10px;
        font-weight: 800;
        text-transform: none;
        letter-spacing: 0.1em;
        color: var(--color-text-dim);
        transition: opacity 0.4s;
    }

    .breadcrumb-item {
        cursor: pointer;
        transition: color 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .breadcrumb-item:hover {
        color: #CCFF00;
    }

    .breadcrumb-sep {
        opacity: 0.2;
    }

    #selectionSheet {
        left: 348px !important; /* sidebar 320px + 28px gap */
        right: 28px !important;
        bottom: 28px !important;
        width: auto !important;
        max-width: 400px !important;
        transform: translateY(calc(100% + 40px)) !important;
        transition: left 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    body.sidebar-collapsed #selectionSheet {
        left: 88px !important; /* 60px collapsed + 28px gap */
    }
    
    #selectionSheet.open {
        transform: translateY(0) !important;
    }

#sideButtons {
    position: fixed !important;
    right: 16px !important;
    top: 24px !important; /* Back to top, but we'll ensure logo doesn't overlap */
    z-index: 1005 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important; /* More space for touch */
}

@media (min-width: 1024px) {
    #sideButtons {
        right: 28px !important;
        top: 28px !important;
        gap: 8px !important;
    }
}

    #legendGrid {
        flex: 1;
        height: auto !important;
        max-height: none !important;
        overflow-y: auto !important;
        min-height: 0;
        padding-right: 0 !important;
    }

    /* Dunne scrollbar styling */
    .legend-card, #legendGrid {
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,0.15) transparent;
    }
    .legend-card::-webkit-scrollbar, #legendGrid::-webkit-scrollbar {
        width: 4px;
    }
    .legend-card::-webkit-scrollbar-thumb, #legendGrid::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.15);
        border-radius: 4px;
    }
    .legend-card::-webkit-scrollbar-track, #legendGrid::-webkit-scrollbar-track {
        background: transparent;
    }

#logo-wrapper {
    position: fixed !important;
    top: 24px !important;
    left: 24px !important;
    z-index: 1003;
    display: block !important;
    pointer-events: auto !important;
    background: rgba(11, 11, 11, 0.88);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
}

#logo-wrapper svg {
    height: 18px !important;
    width: auto !important;
}

@media (min-width: 1024px) {
    #logo-wrapper {
        position: relative !important;
        top: 0 !important;
        left: 0 !important;
        margin-bottom: 24px !important;
        background: transparent !important;
        backdrop-filter: none !important;
        padding: 0 !important;
        border: none !important;
    }

    #logo-wrapper svg {
        height: 24px !important;
    }
}
}

#selectionSheet.open {
    transform: translateY(0);
}

/* LOGO ANIMATION */
@keyframes logoBubbleReveal {
    0% { transform: translateX(-82%); opacity: 0; }
    15% { opacity: 1; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes logoTextReveal {
    0% { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); opacity: 0; }
    15% { opacity: 1; }
    100% { -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); opacity: 1; }
}
.logo-animated-svg { overflow: visible; }
.logo-animated-svg .logo-bubble {
    animation: logoBubbleReveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    transform-origin: center;
}
.logo-animated-svg .logo-text {
    animation: logoTextReveal 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.logo-animated-svg:hover .logo-bubble {
    animation: logoBubbleReveal 0.96s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.logo-animated-svg:hover .logo-text {
    animation: logoTextReveal 0.96s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@media (hover: none) {
    @keyframes logoBubbleRevealTouch {
        0% { transform: translate3d(-70%, 0, 0); opacity: 0.8; }
        15% { opacity: 1; }
        100% { transform: translate3d(0, 0, 0); opacity: 1; }
    }
    .logo-animated-svg .logo-bubble {
        animation: logoBubbleRevealTouch 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
    }
}

.beta-badge {
    font-size: 8px;
    font-weight: 900;
    background: #CCFF00;
    color: #000;
    padding: 1px 4px;
    border-radius: 3px;
    letter-spacing: 0.05em;
    line-height: 1;
    margin-left: 4px;
    text-transform: none;
}

/* Toast Notifications */
.klic-toast {
    padding: 10px 20px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
    pointer-events: auto;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    width: max-content;
    max-width: 100%;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    box-sizing: border-box;
    scrollbar-width: thin;
}
.klic-toast span {
    white-space: nowrap;
}
.klic-toast.toast-success {
    background: rgba(22, 22, 22, 0.94);
    border: 1px solid rgba(204, 255, 0, 0.3);
    color: #CCFF00;
}
.klic-toast.toast-error {
    background: rgba(22, 22, 22, 0.94);
    border: 1px solid rgba(255, 68, 0, 0.3);
    color: #FF4400;
}
.klic-toast.toast-info {
    background: rgba(22, 22, 22, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
}
.klic-toast.toast-out {
    animation: toastOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(16px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(16px) scale(0.95); }
}

/* Coordinate badge responsive */
.coord-badge-inner {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#coordBadge {
    bottom: 24px !important;
    left: 80px !important; /* Right of the legend button (which is 44px + 20px margin) */
    z-index: 400 !important; /* Below Leaflet popups (700) */
}

@media (min-width: 1024px) {
    #coordBadge {
        bottom: 8px !important;
        right: auto !important;
        left: 340px !important;
    }
    body.sidebar-collapsed #coordBadge {
        left: 80px !important;
    }
    .coord-badge-inner {
        font-size: 11px;
        font-weight: 500;
    }
}

/* Safe area insets for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #legendContainer { padding-bottom: env(safe-area-inset-bottom); }
    #selectionSheet > div { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
    #toastContainer { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Mobile: selection sheet loskomt van schermrand */
@media (max-width: 1023px) {
    #selectionSheet {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
        /* Extra offset when closed so shadow doesn't bleed in */
        transform: translateY(calc(100% + 30px));
    }
    #selectionSheet.open {
        transform: translateY(0) !important;
    }
    #selectionSheet > div {
        border-radius: 24px !important;
        /* Constrain height so close button stays reachable */
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tools Panel */
.tools-panel {
    position: fixed;
    inset: 0;
    z-index: 5000;
    pointer-events: none;
    visibility: hidden;
}
.tools-panel.open {
    pointer-events: auto;
    visibility: visible;
}
.tools-panel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}
.tools-panel.open .tools-panel-backdrop {
    opacity: 1;
}
.tools-panel-drawer {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: #1a1a1a;
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
    padding-bottom: env(safe-area-inset-bottom);
    -webkit-overflow-scrolling: touch;
}
.tools-panel.open .tools-panel-drawer {
    transform: translateX(0);
}
.tools-cat-label {
    font-size: 9px;
    font-weight: 900;
    color: rgba(255,255,255,0.3);
    text-transform: none;
    letter-spacing: 0.14em;
    padding: 0 6px 6px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.tools-cat-label i {
    font-size: 9px;
    width: 12px;
    text-align: center;
}
.tools-item-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.tools-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 8px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: rgba(255,255,255,0.65);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: left;
}
.tools-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.tools-item:active {
    background: rgba(255,255,255,0.1);
}
.tools-item.active {
    background: rgba(204, 255, 0, 0.08);
    color: #CCFF00;
}
.tools-item.active i {
    color: #CCFF00 !important;
    opacity: 1 !important;
}
.tools-item i {
    font-size: 12px;
    width: 16px;
    text-align: center;
    color: rgba(255,255,255,0.3);
    flex-shrink: 0;
}
.tools-item:hover i { color: inherit; }
.tools-item i[style] { opacity: 0.65; }
.tools-item:hover i[style] { opacity: 1; }
.tools-item span { flex: 1; }
.tools-item kbd {
    font-size: 8px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', monospace;
    color: rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
    flex-shrink: 0;
}
@media (max-width: 1023px) {
    .tools-item kbd { display: none; }
    .tools-item { padding: 11px 10px; font-size: 13px; }
}
#desktopToolsBtn.tools-open {
    background: rgba(204,255,0,0.12) !important;
    border-color: rgba(204,255,0,0.25) !important;
}
#desktopToolsBtn.tools-open i {
    color: #CCFF00 !important;
}

@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* ── Boom / Tree ────────────────────────────────── */
/* Leaflet root: transparant; echte stijl op .bomen-marker-bubble */
/* Centraal anker: marker-midden = lat/lng = wortelcirkel-midden */
.bomen-divicon {
    background: none !important;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bomen-marker-bubble {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    line-height: 0;
    pointer-events: none;
}
.bomen-marker-bubble i {
    line-height: 1;
    display: block;
}
/* Bomen #009300 - brandgroen, donkere schil voor contrast op lichte kaart */
.bomen-marker-bubble--bgt {
    background: linear-gradient(165deg, #0a1f0a 0%, #040d04 100%);
    border: 2px solid #009300;
    color: #8fef8f;
    font-size: 12px;
}
.bomen-marker-bubble--monumentaal {
    background: linear-gradient(165deg, #0d2a0c 0%, #051505 100%);
    border: 2px solid #1fb300;
    color: #b8f5b0;
    font-size: 14px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 2px 12px rgba(0, 147, 0, 0.35);
}

.boom-popup .leaflet-popup-content-wrapper {
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg, #071407 0%, #020802 100%);
    border: 1px solid rgba(0, 147, 0, 0.55);
    border-radius: 12px;
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.55),
        0 14px 40px rgba(0, 0, 0, 0.72),
        0 0 24px rgba(0, 100, 0, 0.12);
    color: #f0faef;
    padding: 0;
}
.boom-popup .leaflet-popup-content {
    margin: 12px 14px;
}
.boom-popup-inner {
    font-family: system-ui, sans-serif;
    min-width: 200px;
    max-width: 260px;
}
.boom-popup-title {
    color: #e8f5ec;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 8px 0;
}
.boom-popup-badge-monument {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 3px 7px;
    border-radius: 4px;
    margin: 0 0 8px 0;
    background: rgba(0, 100, 0, 0.4);
    color: #d0f5cc;
    border: 1px solid rgba(0, 180, 0, 0.4);
}
.boom-popup-footnote {
    font-size: 10px;
    font-style: italic;
    margin: 8px 0 0 0;
    color: rgba(160, 220, 160, 0.9) !important;
}
.boom-popup table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.boom-popup .leaflet-popup-tip-container {
    display: none;
}
.boom-popup .leaflet-popup-close-button {
    color: rgba(255,255,255,0.75);
    top: 8px;
    right: 10px;
    font-size: 18px;
    font-weight: 600;
}
.boom-popup .leaflet-popup-close-button:hover {
    color: #fff;
}
.boom-popup table td {
    padding: 4px 6px 4px 0;
    color: rgba(255,255,255,0.95);
    vertical-align: top;
}
.boom-popup table td:first-child {
    color: rgba(255,255,255,0.55);
    font-size: 10px;
    white-space: nowrap;
    padding-right: 10px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.04em;
}
/* Wortelzone-rij - #009300-familie */
.boom-popup tr.wortelzone-row td {
    background: rgba(0, 80, 0, 0.35);
    padding-top: 7px;
    padding-bottom: 7px;
    border-top: 1px solid rgba(0, 147, 0, 0.4);
    color: #f0faf0;
    font-size: 12px;
}
.boom-popup tr.wortelzone-row td:first-child {
    color: #6edd6a;
    font-size: 10px;
    padding-left: 6px;
}
.boom-popup tr.wortelzone-row td:last-child b {
    color: #b8ffb4;
    font-weight: 700;
    font-size: 13px;
    padding-right: 6px;
}
/* Standaard popup in norotatePane eindigt onder siblings op mapPane
   (klicLines 450+). Boom-detail gebruikt .leaflet-topPopups-pane (JS 20000). */
.leaflet-popup-pane {
    z-index: 9999 !important;
    isolation: isolate;
}
.leaflet-topPopups-pane {
    z-index: 20000 !important;
    isolation: isolate;
}
.boom-popup {
    z-index: 9999 !important;
}

/* ═══════════════════════════════════════════════════════════════════
   DEVIATION MODAL - full-viewport overlay (viewer laadt geen modals.css)
   Zelfde motion-taal als dashboard .modal-backdrop
   ═══════════════════════════════════════════════════════════════════ */
#deviation-modal {
    --color-bg-card: #1a1a1a;
    --color-border: rgba(255,255,255,0.08);
    --color-text-main: rgba(255,255,255,0.92);
    --color-text-dim: rgba(255,255,255,0.45);
    --color-text-muted: rgba(255,255,255,0.3);
    --color-brand: #CCFF00;
    --color-bg-alpha-05: rgba(255,255,255,0.05);
    --color-bg-alpha-10: rgba(255,255,255,0.1);
    position: fixed !important;
    inset: 0 !important;
    z-index: 100000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    background: rgba(5, 8, 12, 0.56) !important;
    backdrop-filter: blur(0px) !important;
    -webkit-backdrop-filter: blur(0px) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition:
        opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.34s,
        backdrop-filter 0.45s ease,
        -webkit-backdrop-filter 0.45s ease !important;
}

#deviation-modal.open {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    backdrop-filter: blur(14px) saturate(1.12) !important;
    -webkit-backdrop-filter: blur(14px) saturate(1.12) !important;
    transition:
        opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s,
        backdrop-filter 0.48s ease,
        -webkit-backdrop-filter 0.48s ease !important;
}

#deviation-modal .modal-content {
    background: #1a1a1a !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 22px !important;
    width: 100% !important;
    max-width: 480px !important;
    max-height: 88vh !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.045) inset,
        0 28px 64px -18px rgba(0, 0, 0, 0.62),
        0 12px 28px -14px rgba(0, 0, 0, 0.35) !important;
    transform: translateY(14px) scale(0.982) !important;
    opacity: 0 !important;
    pointer-events: auto !important;
    transition:
        transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.32s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

#deviation-modal.open .modal-content {
    transform: translateY(0) scale(1) !important;
    opacity: 1 !important;
}

@media (prefers-reduced-motion: reduce) {
    #deviation-modal,
    #deviation-modal.open {
        transition-duration: 0.01ms !important;
        backdrop-filter: blur(12px) !important;
        -webkit-backdrop-filter: blur(12px) !important;
    }
    #deviation-modal .modal-content {
        transform: translateY(8px) !important;
        transition-duration: 0.01ms !important;
    }
    #deviation-modal.open .modal-content {
        transform: translateY(0) !important;
    }
}

#deviation-modal * {
    pointer-events: auto;
}

#deviation-modal select,
#deviation-modal input,
#deviation-modal textarea {
    color-scheme: dark;
}

/* Native <select>: zelfde chic skin als dashboard */
select:not([multiple]):not([size]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: var(--select-chic-chevron);
    background-repeat: no-repeat;
    background-position: right max(12px, 0.85rem) center;
    background-size: 0.625rem 0.375rem;
    padding-inline-end: var(--select-native-pad-r, 2.75rem) !important;
    -webkit-padding-end: var(--select-native-pad-r, 2.75rem) !important;
    cursor: pointer;
}

select:not([multiple]):not([size])::-ms-expand {
    display: none;
}

/* Block map interactions on mobile when legend panel is open */
@media (max-width: 768px) {
    body.legend-open #map,
    body.legend-open .leaflet-container {
        pointer-events: none !important;
        touch-action: none !important;
    }
}

/* ── Donkere basemap: Carto light_all + inversie → houtskoolgrijs (minder “OLED-zwart”) ── */
/* Iets zachter dan oud (0.87): lichtere bodem, minder extreem contrast */
img.klic-dark-base {
    filter: brightness(0.9) invert(1) hue-rotate(220deg) saturate(0.9) contrast(0.96) !important;
}
/* Mapbox dark-v11 (raster) - lift zwart naar donkergrijs */
img.klic-basemap-mb-tile {
    filter: brightness(1.14) contrast(0.9) saturate(0.9) !important;
}
/* Mapbox GL (dark-v11) -zelfde bedoeling op het canvas */
body:not(.light-mode) .klic-mapbox-dark-soft .mapboxgl-canvas {
    filter: brightness(1.1) contrast(0.9) saturate(0.9);
}

/* ── Cluster markers - KLICBOT neon geel met zwarte cijfers ── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(204, 255, 0, 0.18) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: #CCFF00 !important;
    color: #000000 !important;
    font-weight: 900 !important;
    font-size: 12px !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
}

/* Verbogen leidingen: geen pointer-events (opacity 0 alleen is onvoldoende voor Leaflet-hitboxes) */
.leaflet-pane path.klic-layer-hidden,
.leaflet-pane .klic-layer-hidden {
    pointer-events: none !important;
}

/* Eigen ontwerp-lagen - match dashboard card header (sentence case, muted icon) */
.overlays-legend-section .overlays-legend-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.overlays-legend-section .overlays-legend-heading > i {
    font-size: 11px;
    color: var(--color-text-muted);
    opacity: 0.9;
    flex-shrink: 0;
}
.overlays-legend-section .overlays-legend-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--color-text-main);
    text-transform: none;
    flex: 1;
    min-width: 0;
}
.overlays-legend-section .overlays-legend-count {
    font-size: 10px;
    color: var(--color-text-dim);
    opacity: 0.75;
    margin-left: auto;
    flex-shrink: 0;
}
