/* --- THEME VARIABLES --- */
:root {
    --bg-main: #f4f7f9;
    --bg-nav: #ffffff;
    --bg-panel: #ffffff;
    --text-main: #333333;
    --text-bold: #111111;
    --text-muted: #6b7280;
    --border-main: #d1d5db;
    --border-panel: #e5e7eb;
    --shadow-panel: rgba(0,0,0,0.08);
    --bg-hover: #f8f9fa;
}

body.dark-theme {
    --bg-main: #0b1120;
    --bg-nav: #111827;
    --bg-panel: #1f2937;
    --text-main: #e5e7eb;
    --text-bold: #f9fafb;
    --text-muted: #9ca3af;
    --border-main: #374151;
    --border-panel: #374151;
    --shadow-panel: rgba(0,0,0,0.5);
    --bg-hover: #374151;
}

/* --- PREMIUM SCROLLBARS --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: var(--border-main); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- PURE CSS FLEXBOX LAYOUT --- */
body, html { 
    margin: 0; padding: 0; height: 100vh; 
    background: var(--bg-main); color: var(--text-main); 
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 
    overflow: hidden; transition: background 0.3s, color 0.3s;
    display: flex; flex-direction: column;
}

/* --- NAVIGATION & UPLOAD BAR --- */
#top-nav { 
    position: relative; width: 100%; 
    background: var(--bg-nav); border-bottom: 1px solid var(--border-main); 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 10px 20px; z-index: 3000; box-shadow: 0 4px 6px var(--shadow-panel); 
    box-sizing: border-box; flex-wrap: wrap; gap: 15px; flex-shrink: 0; 
}
#sidebar-toggle:hover { color: #0056b3 !important; }
.nav-logo { flex: 0 0 auto; font-weight: 800; color: var(--text-bold); font-size: 14px; }
.nav-btn { background: var(--bg-hover); color: var(--text-main); border: 1px solid var(--border-main); padding: 8px 12px; font-size: 11px; cursor: pointer; font-weight: 700; transition: 0.2s; border-radius: 4px; letter-spacing: 0.5px; white-space: nowrap;}
.nav-btn:hover:not(:disabled) { background: var(--border-main); color: var(--text-bold); }
.nav-btn:disabled { opacity: 0.5; cursor: not-allowed; border-style: dashed;}

.upload-controls { display: flex; align-items: center; gap: 8px; background: var(--bg-hover); border: 1px solid var(--border-main); padding: 6px 8px; border-radius: 6px; flex-wrap: nowrap; justify-content: flex-end; box-sizing: border-box; flex: 0 0 auto;}
.btn-upload { background: #0056b3; color: white; padding: 6px 12px; font-size: 11px; font-weight: bold; border-radius: 4px; cursor: pointer; text-transform: uppercase; margin: 0; white-space: nowrap; transition: background 0.2s;}
.btn-upload:hover { background: #004494; }
.file-name { font-size: 10px; color: var(--text-muted); font-family: monospace; min-width: 80px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.btn-init { background: #059669; color: #fff; border: none; padding: 6px 12px; font-size: 11px; font-weight: bold; border-radius: 4px; cursor: pointer; white-space: nowrap; transition: background 0.2s; margin: 0;}
.btn-init:hover { background: #047857; }
.btn-export { background: #0056b3; color: #fff; border: none; padding: 6px 12px; font-size: 11px; font-weight: bold; border-radius: 4px; cursor: pointer; display: none; transition: 0.2s; white-space: nowrap; margin-right: 4px;}
.btn-export:hover { background: #004494; }

/* --- LEFT-HAND ENTERPRISE SIDEBAR --- */
.sidebar {
    width: 250px;
    background: var(--bg-nav);
    border-right: 1px solid var(--border-main);
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    z-index: 2000;
}
.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}
.sidebar-group {
    padding: 15px 0 5px 0;
    border-bottom: 1px solid var(--border-panel);
}
.sidebar-group:last-child {
    border-bottom: none;
}
.sidebar-header {
    font-size: 10px;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 8px;
    white-space: nowrap;
}
.sidebar-btn {
    width: 100%;
    text-align: left;
    padding: 10px 20px;
    border: none !important;
    border-radius: 0 !important;
    background: transparent;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: block;
    border-left: 4px solid transparent !important;
    transition: all 0.2s ease;
}
.sidebar-btn:hover:not(:disabled) {
    background: var(--bg-hover) !important;
    color: var(--text-bold) !important;
}
.sidebar-btn.active {
    background: rgba(0, 86, 179, 0.08) !important;
    color: #0056b3 !important;
    border-left: 4px solid #0056b3 !important;
    box-shadow: none !important;
}
body.dark-theme .sidebar-btn.active {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
    border-left-color: #3b82f6 !important;
}

/* --- FILTER BAR --- */
#filter-bar { position: relative; width: 100%; background: var(--bg-hover); border-bottom: 1px solid var(--border-main); display: none; align-items: center; padding: 8px 20px; z-index: 1500; box-sizing: border-box; gap: 10px; flex-wrap: wrap; box-shadow: 0 2px 4px var(--shadow-panel); flex-shrink: 0;}
#custom-filters-container { position: relative; width: 100%; display: none; flex-wrap: wrap; gap: 10px; padding: 10px 20px; background: var(--bg-hover); border-bottom: 1px solid var(--border-main); z-index: 1490; box-sizing: border-box; flex-shrink: 0;}
.custom-filter-chip { display: flex; align-items: center; background: #e6f2ff; border: 1px solid #0056b3; border-radius: 4px; padding: 4px 8px; font-size: 11px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
body.dark-theme .custom-filter-chip { background: #002244; }
.custom-filter-select { background: transparent; border: none; font-weight: bold; color: #0056b3; outline: none; font-size: 11px; font-family: monospace; cursor: pointer; max-width: 150px; text-transform: uppercase; }
.custom-filter-input { background: var(--bg-panel); border: 1px solid #b3d7ff; padding: 4px 6px; margin: 0 6px; border-radius: 3px; color: var(--text-main); font-size: 11px; outline: none; width: 130px; }
.custom-filter-remove { background: transparent; color: #dc3545; border: none; font-size: 16px; cursor: pointer; font-weight: bold; margin-left: 4px; line-height: 1; padding: 0 4px; transition: 0.2s;}
.custom-filter-remove:hover { color: #fff; background: #dc3545; border-radius: 3px; }
.metric-toggle { font-size: 10px; padding: 5px 8px; font-weight: bold; border-radius: 4px; border: 1px solid #dc3545; color: #dc3545; background: #fff5f5; cursor: pointer; outline: none; white-space: nowrap;}
.metric-toggle:focus { border-color: #dc3545;}

/* --- MULTI-SELECT DROPDOWNS --- */
.dd-wrapper { position: relative; display: none; margin: 4px 0; }
.dd-control-group { display: flex; border: 1px solid #0056b3; border-radius: 4px; overflow: hidden; background: #e6f2ff; transition: 0.2s; }
.dd-control-group.group-or { border-color: #d97706; background: #fffbeb; }
.dd-control-group.group-not { border-color: #dc3545; background: #fff5f5; }
.logic-btn { font-size: 10px; padding: 6px 8px; font-weight: bold; background: #0056b3; color: #fff; border: none; cursor: pointer; outline: none; transition: 0.2s; border-right: 1px solid rgba(255,255,255,0.3);}
.logic-btn:hover { filter: brightness(1.1); }
.logic-btn.logic-or { background: #d97706; }
.logic-btn.logic-not { background: #dc3545; }
.dd-btn { font-size: 10px; padding: 6px 10px; font-weight: bold; border: none; color: #0056b3; background: transparent; cursor: pointer; min-width: 110px; max-width: 150px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; text-transform: uppercase; text-align:left; transition: 0.2s;}
.group-or .dd-btn { color: #d97706; }
.group-not .dd-btn { color: #dc3545; }
.dd-btn:hover { background: rgba(0,0,0,0.05); }
.dd-content { display: none; position: absolute; top: calc(100% + 4px); left: 0; background-color: var(--bg-panel); min-width: 220px; box-shadow: 0px 12px 24px 0px rgba(0,0,0,0.3); z-index: 9999; border: 1px solid var(--border-panel); border-radius: 6px; max-height: 350px; overflow-y: auto;}
.dd-content label { display: flex; align-items: center; padding: 8px 12px; font-size: 11px; color: var(--text-main); cursor: pointer; text-transform: uppercase; font-weight: 600; border-bottom: 1px solid var(--bg-hover);}
.dd-content label:hover { background-color: var(--bg-hover); }
.dd-content input { margin-right: 8px; cursor: pointer; }
.show { display: block; }

/* --- WORKSPACE --- */
.workspace { position: relative; flex: 1; width: 100%; display: flex; overflow: hidden; }
.tab-content { position: relative; width: 100%; height: 100%; display: none; background: var(--bg-main); box-sizing: border-box; flex-direction: column; overflow-y: auto; transition: background 0.3s;}
.tab-content.active { display: flex; }
.tab-content.with-panel { width: calc(100% - 340px); }
.scrollable-content { padding: 30px; flex-grow: 1; overflow-y: auto;}
.ui-layer { max-width: 1400px; margin: 0 auto; width: 100%;}
.tactical-panel { background: var(--bg-panel); border: 1px solid var(--border-panel); padding: 25px; box-shadow: 0 4px 12px var(--shadow-panel); margin-bottom: 20px; border-radius: 8px; position: relative; transition: 0.3s;}
.header-panel { display: flex; justify-content: space-between; align-items: center; }
.gps-strip { font-size: 11px; font-weight: bold; padding: 6px 12px; border-radius: 4px; text-transform: uppercase;}
.section-title { font-size: 15px; color: var(--text-bold); border-bottom: 2px solid var(--border-panel); padding-bottom: 10px; margin-bottom: 20px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }

/* --- MAPS & PANELS --- */
.full-frame-container { flex-grow: 1; position: relative; min-height: 500px; background: var(--bg-main);}
/* Safari/Webkit specific Fullscreen fixes */
.full-frame-container:fullscreen { margin: 0 !important; border: none !important; border-radius: 0 !important; width: 100vw !important; height: 100vh !important; background: var(--bg-main); display: block !important;}
.full-frame-container:-webkit-full-screen { margin: 0 !important; border: none !important; border-radius: 0 !important; width: 100vw !important; height: 100vh !important; background: var(--bg-main); display: block !important;}

#hexmap-container, #epicenter-map, #mynetwork, #mule-network { position: absolute; top: 0; left: 0; width: 100%; height: 100%; outline: none; }

/* --- REDESIGNED PREMIUM MAP CONTROLS --- */
.map-controls-panel {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid var(--border-panel);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s;
}
body.dark-theme .map-controls-panel { background: rgba(31, 41, 55, 0.9); border-color: #4b5563; }

.spatial-mode-panel {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 1px solid var(--border-panel);
    display: flex;
    align-items: center;
    gap: 4px;
    transition: opacity 0.2s;
}
body.dark-theme .spatial-mode-panel { background: rgba(31, 41, 55, 0.9); border-color: #4b5563; }

.floating-inspector {
    position: absolute;
    top: 15px;
    left: 60px;
    width: 350px;
    max-height: calc(100% - 90px);
    overflow-y: auto;
    z-index: 9999;
    margin: 0 !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    scrollbar-width: thin;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: max-height 0.3s ease-in-out, opacity 0.2s;
}
body.dark-theme .floating-inspector { background: rgba(31, 41, 55, 0.95); }

.floating-inspector.right-panel {
    left: auto;
    right: 15px;
    top: 65px;
    max-height: calc(100% - 100px);
}

.playback-panel {
    position: absolute; 
    bottom: 20px; 
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; 
    padding: 15px; 
    display: flex; 
    gap: 15px; 
    align-items: center; 
    width: 400px; 
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    transition: opacity 0.2s;
}
body.dark-theme .playback-panel { background: rgba(31, 41, 55, 0.95); }

.play-btn { background: #059669; color: #fff; border: none; padding: 8px 15px; font-size: 12px; font-weight: bold; border-radius: 4px; cursor: pointer; width: 80px; text-align: center;}
.play-btn:hover { background: #047857; }
.play-btn.playing { background: #d97706; }

/* --- MAP BUTTON UTILITIES --- */
.map-action-btn {
    background: transparent;
    color: var(--text-main);
    border: none;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.2s;
    text-transform: uppercase;
}
.map-action-btn:hover {
    background: var(--bg-hover);
    color: #0056b3;
}
.map-action-btn.snapshot-btn:hover { color: #059669; }

/* Active states for Hex/Heatmap toggles */
.map-action-btn.active-mode-hex { background: #dc3545; color: #fff; }
.map-action-btn.active-mode-heat { background: #d97706; color: #fff; }

/* Hide UI class used dynamically during html2canvas captures */
.hide-on-screenshot {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* --- DETAILS PANE --- */
.details-pane { position: absolute; right: 0; top: 0; height: 100%; width: 340px; background: var(--bg-panel); border-left: 1px solid var(--border-main); z-index: 500; display: none; flex-direction: column; box-shadow: -4px 0 15px var(--shadow-panel);}
.details-header { padding: 15px 20px; border-bottom: 1px solid var(--border-main); background: var(--bg-hover); display: flex; justify-content: space-between; align-items: center; }
.details-header span { font-weight: 800; font-size: 13px; color: var(--text-bold); letter-spacing: 1px; }
.details-body { padding: 20px; overflow-y: auto; flex: 1; font-size: 13px; color: var(--text-main); }
.details-body h4 { margin-top: 0; font-size: 16px; color: var(--text-bold); word-break: break-all; margin-bottom: 10px;}
.details-body h5 { margin: 20px 0 10px 0; font-size: 11px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-panel); padding-bottom: 4px; display: flex; justify-content: space-between; align-items: center;}
.details-body ul { padding-left: 20px; margin: 0; }
.details-body li { margin-bottom: 6px; }

/* --- KPIs & GRIDS --- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 20px; }
.kpi-box { background: var(--bg-panel); border: 1px solid var(--border-panel); padding: 20px; text-align: center; border-radius: 6px; box-shadow: 0 2px 8px var(--shadow-panel); border-top: 4px solid #6c757d;}
.kpi-val { font-size: 26px; font-weight: bold; margin-bottom: 5px; color: var(--text-bold);}
.kpi-lbl { font-size: 11px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; }

.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 40px;}
.chart-container { background: var(--bg-panel); border: 1px solid var(--border-panel); padding: 15px; position: relative; height: 380px; border-radius: 8px; transition: 0.3s; box-shadow: 0 2px 8px var(--shadow-panel);}
.chart-title { font-size: 12px; color: var(--text-bold); margin-bottom: 10px; text-align: center; font-weight: 700;}
.chart-svg-wrapper { width: 100%; height: 320px; }

.tooltip { position: absolute; opacity: 0; background: var(--bg-panel); color: var(--text-main); padding: 12px; border-radius: 6px; border: 1px solid var(--border-main); font-size: 0.85rem; pointer-events: none; z-index: 10000; box-shadow: 0 8px 16px var(--shadow-panel);}

/* --- OVERLAY & COMPONENTS --- */
#init-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(244,247,249,0.95); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; backdrop-filter: blur(5px);}
body.dark-theme #init-overlay { background: rgba(11,17,32,0.95); }
.progress-container { width: 300px; height: 8px; background: var(--border-main); border-radius: 4px; margin-top: 15px; overflow: hidden; display: none; }
.progress-bar { height: 100%; width: 0%; background: #059669; transition: width 0.1s linear; }
#init-status-text { color: var(--text-muted); font-size: 11px; margin-top: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.5px; display: none; }

.hygiene-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-panel); font-size: 12px;}
.hygiene-row:nth-child(even) { background-color: var(--bg-hover); }
.badge-good { background: #d1fae5; color: #059669; padding: 2px 6px; border-radius: 10px; font-weight: bold; font-size: 10px;}
.badge-warn { background: #fffbeb; color: #d97706; padding: 2px 6px; border-radius: 10px; font-weight: bold; font-size: 10px;}
.badge-fail { background: #fee2e2; color: #dc3545; padding: 2px 6px; border-radius: 10px; font-weight: bold; font-size: 10px;}
.badge-opt { background: var(--border-panel); color: var(--text-muted); padding: 2px 6px; border-radius: 10px; font-weight: bold; font-size: 10px;}

.legend-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.legend-item { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--text-main); font-weight: 600; }
.l-icon { width: 16px; height: 16px; border: 2px solid var(--bg-panel); flex-shrink: 0; box-shadow: 0 1px 3px var(--shadow-panel); }
.stat-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; border-bottom: 1px solid var(--border-panel); padding-bottom: 6px; }
.total-row { border: none; margin-top: 12px; padding-top: 12px; border-top: 2px solid var(--border-main); }
.hex-title { font-size: 18px; font-weight: 800; margin-bottom: 4px; text-transform: uppercase; color: var(--text-bold);}
.hex-id { color: var(--text-muted); font-size: 11px; font-family: monospace; margin-bottom: 16px; }

.toggle-group { display: flex; border: 1px solid #dc3545; border-radius: 4px; overflow: hidden; }
.toggle-btn { flex: 1; padding: 8px 10px; font-size: 11px; font-weight: bold; border: none; background: var(--bg-panel); color: #dc3545; cursor: pointer; transition: 0.2s; }
.toggle-btn.active { background: #dc3545; color: #fff !important; }
#btn-con-network.active { background: #3b82f6; }
#btn-con-flow.active { background: #3b82f6; }
#btn-con-network:not(.active) { color: #3b82f6; }
#btn-con-flow:not(.active) { color: #3b82f6; }

/* --- D3 SANKEY HOVER EFFECTS --- */
.sankey-node rect { cursor: pointer; transition: fill-opacity 0.2s; }
.sankey-node rect:hover { fill-opacity: 0.8; }
.sankey-link { transition: stroke-opacity 0.2s; }
.sankey-link:hover { stroke-opacity: 0.6; }

/* --- LEAFLET MARKER CLUSTER ANIMATIONS & EFFECTS --- */
.custom-cluster {
    transition: transform 0.2s ease-in-out;
    z-index: 400 !important;
}
.custom-cluster:hover {
    transform: scale(1.15);
    z-index: 1000 !important;
}

/* --- DASHBOARD EXPAND/COLLAPSE FULLSCREEN CLASSES --- */
.dashboard-toggle-btn {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: #0056b3;
    color: white;
    border: none;
    padding: 6px 20px;
    border-radius: 0 0 8px 8px;
    font-size: 11px;
    font-weight: 900;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: none;
    letter-spacing: 1px;
    transition: background 0.2s;
}
.dashboard-toggle-btn:hover { background: #004494; }

/* --- FLOATING INSPECTOR EXPAND/COLLAPSE CLASSES --- */
.floating-inspector.collapsed {
    max-height: 48px !important; /* Collapse to only show the header */
    overflow: hidden !important;
    padding-bottom: 0 !important;
}
.floating-inspector.collapsed .inspector-content {
    display: none !important;
}
.inspector-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-panel); 
}
.floating-inspector.collapsed .inspector-header {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.inspector-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-main);
    color: var(--text-main);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.inspector-toggle-btn:hover {
    background: var(--bg-hover);
    color: #0056b3;
    border-color: #0056b3;
}

/* --- TOOLTIP ICON STYLING FIX --- */
.help-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--border-main);
    color: var(--text-main);
    font-size: 10px;
    font-weight: 900;
    cursor: help;
    margin-left: 8px;
    vertical-align: middle;
    font-family: monospace;
    line-height: 1;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px var(--shadow-panel);
}

.help-icon-btn:hover {
    background: #0056b3;
    color: #fff;
    transform: scale(1.15);
}

/* --- ACCORDION FILTER GROUPS (CRITICAL FIX) --- */
.filter-group {
    background: var(--bg-panel);
    border: 1px solid var(--border-panel);
    border-radius: 6px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

/* Base colors for the different panel types */
.filter-group.group-red { border-left: 4px solid #dc3545; }
.filter-group.group-purple { border-left: 4px solid #6f42c1; }
.filter-group.group-pink { border-left: 4px solid #e83e8c; }

.filter-header {
    padding: 10px 15px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-main);
    background: var(--bg-hover);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-panel);
    user-select: none;
    transition: background 0.2s;
}

.filter-header:hover {
    filter: brightness(0.95);
}

.accordion-indicator {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.filter-body {
    padding: 15px;
    display: block;
}

/* --- THE MAGIC COLLAPSE RULES --- */
.filter-group.collapsed .filter-body {
    display: none !important;
}

.filter-group.collapsed .filter-header {
    border-bottom: none;
}

.filter-group.collapsed .accordion-indicator {
    transform: rotate(-90deg); /* Points the arrow to the right when closed */
}