/* ==========================================================================
   KYA SPOTLIGHT - PURE APPLICATION SCAFFOLD (ENVIRONMENT UPDATE)
   ========================================================================== */

@import url('https://unpkg.com/leaflet@1.9.4/dist/leaflet.css');

/* --- DEBUG CACHE BUSTER ---
   Current UUID: CSS-VER-ENV-2
*/
/*
body::after {
    content: 'CSS UUID: CSS-VER-ENV-2';
    position: fixed; bottom: 10px; left: 10px;
    background: #e11d48; color: white; padding: 6px 12px;
    z-index: 999999; font-weight: bold; font-family: monospace; border-radius: 4px;
}
*/

.kya-app-row { display: flex; flex-direction: row; width: 100%; height: 55vh; min-height: 500px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; box-sizing: border-box; overflow: hidden; margin: 20px 0; }
.kya-app-sidebar { flex: 0 0 320px; width: 320px; overflow-y: auto; overflow-x: hidden; padding: 15px; box-sizing: border-box; transition: flex 0.3s ease, width 0.3s ease, padding 0.3s ease; z-index: 1000; background: #f8fafc; }
#kya-tool-sliver { flex: 0 0 48px; width: 48px; background: #ffffff; border-left: 1px solid #cbd5e1; border-right: 1px solid #cbd5e1; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 15px 0; box-sizing: border-box; z-index: 1010; box-shadow: 2px 0 10px rgba(0,0,0,0.05); }
.kya-app-canvas { flex: 1 1 0%; position: relative; background: #e2e8f0; z-index: 1; overflow: hidden; }
#kya-spotlight-map { position: absolute !important; top: 0 !important; bottom: 0 !important; left: 0 !important; right: 0 !important; width: 100% !important; height: 100% !important; z-index: 1; }
.kya-app-row.is-collapsed .kya-app-sidebar { flex: 0 0 0px; width: 0px; padding-left: 0; padding-right: 0; }

.kya-tool-btn { width: 32px; height: 32px; min-height: 32px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #475569; font-size: 24px; font-weight: bold; flex-shrink: 0; user-select: none; padding: 0; transition: all 0.2s ease; }
.kya-tool-btn:hover { background: #e2e8f0; }
.kya-tool-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.kya-tool-btn.is-hidden { opacity: 0.6; background: #e2e8f0; color: #94a3b8; }
#kya-global-toggle:not(.is-hidden) { color: #2563eb; background: #eff6ff; border-color: #bfdbfe; box-shadow: inset 0 0 4px rgba(37, 99, 235, 0.2); }
.kya-tool-btn.is-hidden .icon-eye-open { display: none; }
.kya-tool-btn.is-hidden .icon-eye-closed { display: block !important; }

.kya-slider-container { position: relative; width: 48px; flex-grow: 1; display: flex; align-items: center; justify-content: center; }
.kya-vertical-range { position: absolute; width: max(calc(55vh - 160px), 340px) !important; max-width: none !important; height: 4px; transform: rotate(-90deg); cursor: ns-resize; z-index: 5; margin: 0; }
@media (max-width: 1024px) {
    .kya-app-row { flex-direction: column; height: auto; min-height: auto; }
    .kya-app-sidebar { flex: 0 0 auto !important; width: 100% !important; height: auto; padding: 15px !important; border-bottom: 1px solid #cbd5e1; }
    #kya-tool-sliver { display: none; }
    .kya-app-canvas { height: 70vh; flex: 0 0 70vh; }
    .kya-app-row.is-collapsed .kya-app-sidebar { display: block !important; }
}
.leaflet-container img { max-width: none !important; }

/* FILTER UI COMPONENTS */
.kya-filter-wrap { margin-bottom: 5px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; transition: opacity 0.2s ease; }
.kya-filter-wrap:last-child { margin-bottom: 0px; }
.kya-filter-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.kya-filter-title-wrap { display: flex; align-items: center; gap: 6px; }
.kya-filter-toggle { margin: 0; cursor: pointer; width: 12px; height: 12px; }
.kya-filter-title { font-size: 13px; font-weight: 600; color: #1e293b; margin: 0; word-wrap: break-word; overflow-wrap: break-word; word-break: normal; }
.kya-filter-values { font-size: 11px; color: #475569; }
.kya-filter-wrap.is-disabled .kya-dual-slider { opacity: 0.4; pointer-events: none; }
.kya-filter-wrap.is-disabled .kya-filter-values { opacity: 0.4; }
.kya-dual-slider { position: relative; width: 100%; height: 20px; display: flex; align-items: center; }
.kya-slider-track { position: absolute; width: 100%; height: 4px; background: #cbd5e1; border-radius: 2px; z-index: 1; }
.kya-slider-highlight { position: absolute; height: 4px; background: #2563eb; border-radius: 2px; z-index: 2; }
.kya-dual-slider input[type="range"] { position: absolute; width: 100%; -webkit-appearance: none; appearance: none; background: transparent; pointer-events: none; z-index: 3; margin: 0; padding: 0; }
.kya-dual-slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: #2563eb; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.3); border: 2px solid #ffffff; }
.kya-dual-slider input[type="range"]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 14px; border-radius: 50%; background: #2563eb; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,0.3); border: 2px solid #ffffff; }
.kya-dual-slider input[id$="-min-input"]::-webkit-slider-thumb { background: #ef4444; } 
.kya-dual-slider input[id$="-min-input"]::-moz-range-thumb { background: #ef4444; }
.kya-dual-slider input[id$="-max-input"]::-webkit-slider-thumb { background: #10b981; } 
.kya-dual-slider input[id$="-max-input"]::-moz-range-thumb { background: #10b981; }

/* ACCORDION UI COMPONENTS */
.kya-accordion { border: 1px solid #bae6fd; border-radius: 6px; margin-bottom: 10px; background: #ffffff; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.kya-accordion-header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: #e0f2fe; border-bottom: 1px solid transparent; transition: background 0.2s; }
.kya-accordion-header:hover { background: #bae6fd; }
.kya-accordion-title-wrap { display: flex; align-items: center; gap: 8px; }
.kya-accordion-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; color: #0369a1; margin: 0; cursor: pointer; user-select: none; }
.kya-accordion-caret { cursor: pointer; color: #0284c7; font-size: 16px; transition: transform 0.3s ease; user-select: none; }
.kya-accordion-content { max-height: 0; overflow: hidden; padding: 0 12px; transition: max-height 0.3s ease-out, padding 0.3s ease; background: #ffffff; }
.kya-accordion.is-open .kya-accordion-header { border-bottom-color: #bae6fd; }
.kya-accordion.is-open .kya-accordion-caret { transform: rotate(180deg); }
.kya-accordion.is-open .kya-accordion-content { max-height: 2500px; padding: 10px 12px; }

/* SUB-ACCORDION UI COMPONENTS */
.kya-sub-accordion { margin-bottom: 10px; padding-left: 8px; border-left: 2px solid #e2e8f0; }
.kya-sub-accordion:last-child { margin-bottom: 0; }
.kya-sub-accordion-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; margin-bottom: 6px; user-select: none; }
.kya-sub-accordion-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; margin: 0; }
.kya-sub-accordion-caret { color: #94a3b8; font-size: 12px; transition: transform 0.3s ease; }
.kya-sub-accordion-content { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out; }
.kya-sub-accordion.is-open .kya-sub-accordion-caret { transform: rotate(180deg); }
.kya-sub-accordion.is-open .kya-sub-accordion-content { max-height: 1500px; padding-bottom: 5px; }

/* 14. DETAILS OVERLAY PANE */
.kya-details-pane { position: absolute; top: 15px; right: 55px; width: 320px; background: rgba(255, 255, 255, 0.95); border: 1px solid #cbd5e1; border-radius: 8px; padding: 15px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06); z-index: 1000; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; pointer-events: none; transition: opacity 0.2s ease; backdrop-filter: blur(4px); }
.kya-details-pane.is-hidden { opacity: 0; }
.kya-details-title { font-size: 16px; font-weight: 700; color: #0f172a; margin: 0 0 10px 0; border-bottom: 2px solid #e2e8f0; padding-bottom: 6px; }
.kya-details-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.kya-details-label { color: #475569; font-weight: 600; }
.kya-details-val-wrap { display: flex; align-items: center; gap: 10px; }
.kya-details-value { color: #0f172a; font-weight: bold; background: #e2e8f0; padding: 2px 6px; border-radius: 4px; }
.kya-details-empty { font-size: 13px; color: #64748b; font-style: italic; margin: 0; }

/* Pass/Fail SVG Icons - Scaled down to the Goldilocks Zone */
.kya-icon-match { width: 18px; height: 18px; fill: none; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.kya-icon-pass { stroke: #10b981; } 
.kya-icon-fail { stroke: #ef4444; } 

/* ==========================================================================
   15. BUTTON GROUP (Categorical Filters)
   ========================================================================== */
.kya-btn-group { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.kya-btn-pill { padding: 4px 10px; font-size: 11px; font-weight: 600; color: #475569; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 12px; cursor: pointer; transition: all 0.2s; user-select: none; }
.kya-btn-pill:hover { background: #e2e8f0; }
.kya-btn-pill.is-active { background: #2563eb; color: #ffffff; border-color: #1d4ed8; }
.kya-filter-wrap.is-disabled .kya-btn-group { opacity: 0.4; pointer-events: none; }

/* Enlarge checkboxes for touch targets */
input[type="checkbox"].kya-filter-toggle {
    width: 20px !important;
    height: 20px !important;
    margin: 0 8px 0 0 !important;
    cursor: pointer;
    vertical-align: middle;
    flex-shrink: 0 !important;
}

/* Modern Mobile Horizontal 'Pill' Control Bar (Eye on Left, Slider Horizontal) */
@media (max-width: 768px) {
    .kya-app-row { 
        position: relative; 
    }
    
    #kya-tool-sliver {
        display: flex !important;
        flex-direction: row !important; 
        align-items: center;
        justify-content: center;
        position: absolute !important; 
        top: auto !important;
        bottom: 25px !important; 
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important; 
        z-index: 1000 !important;
        background: rgba(255, 255, 255, 0.95);
        padding: 8px 16px !important; 
        border-radius: 30px; 
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        width: auto !important; 
        height: auto !important;
        touch-action: none; 
    }
    
    #kya-sliver-toggle { 
        display: none !important; 
    }

    /* 1. Put the Eye on the Left */
    #kya-global-toggle {
        order: 1 !important; /* Force to first position */
        width: 36px !important;
        height: 36px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 15px 0 0 !important; /* 15px gap on the right */
        border-radius: 50%;
        background: #f1f5f9;
        flex-shrink: 0; 
    }
    
    /* 2. Put the Slider on the Right */
    .kya-slider-container {
        order: 2 !important; /* Force to second position */
        height: auto !important; 
        width: 130px !important; 
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 !important; 
    }

    /* 3. Brute-force the slider back to horizontal */
    input[type=range].kya-vertical-range {
        -webkit-appearance: slider-horizontal !important; 
        appearance: auto !important; 
        writing-mode: horizontal-tb !important; 
        transform: none !important; /* Kill any rogue rotations */
        width: 100% !important; 
        height: 24px !important; 
        margin: 0 !important;
        padding: 0 !important;
        direction: ltr !important;
    }
}
