/* --- THEMES --- */
:root {
    --bg-color: #21242b;
    --panel-bg: rgba(33, 36, 43, 0.95);
    --text-main: #bbc2cf;
    --text-muted: #5b6268;
    --border: rgba(255, 255, 255, 0.15);
    --accent: #51afef;
    --glass-blur: 10px;
    --item-bg: rgba(255, 255, 255, 0.08);
    --btn-bg: #2c313a;
    --btn-hover: #3e4451;
}

body.light-mode {
    --bg-color: #f7fafc;
    --panel-bg: rgba(255, 255, 255, 0.95);
    --text-main: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --accent: #3182ce;
    --item-bg: #ffffff;
    --btn-bg: #edf2f7;
    --btn-hover: #e2e8f0;
}

body, html {
    height: 100%; margin: 0; overflow: hidden;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', system-ui, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- RESET --- */
button { appearance: none; -webkit-appearance: none; font-family: inherit; border: none; outline: none; }

/* --- Layout --- */
#vis-container { position: relative; width: 100%; height: 100vh; }
#visualization { width: 100%; height: 100%; z-index: 1; }
#connection-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* --- CONTROLS --- */
.top-controls { position: absolute; top: 20px; right: 20px; z-index: 2000; display: flex; gap: 10px; }
#menu-btn {
    position: absolute; top: 20px; left: 20px; z-index: 1000;
    background: var(--panel-bg); color: var(--text-main);
    border: 1px solid var(--border); padding: 10px 16px; border-radius: 8px;
    cursor: pointer; backdrop-filter: blur(var(--glass-blur));
}
.icon-btn {
    background: var(--panel-bg); color: var(--text-main);
    border: 1px solid var(--border); width: 40px; height: 40px;
    border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(var(--glass-blur));
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.active { background: var(--accent); color: white; border-color: var(--accent); }

/* --- SIDEBAR BUTTONS --- */
#sidebar .bulk-buttons button, #sidebar .refresh-btn {
    background-color: var(--btn-bg) !important; color: var(--text-main) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important; padding: 8px 12px; border-radius: 6px; cursor: pointer; transition: 0.2s;
}
#sidebar .bulk-buttons button:hover, #sidebar .refresh-btn:hover {
    background-color: var(--btn-hover) !important; border-color: var(--accent) !important; color: #fff !important;
}
#preview-panel #open-emacs-btn {
    width: 100%; margin-top: 10px; background: linear-gradient(135deg, #a24eab, #6c3483) !important;
    color: white !important; border: none !important; font-weight: 600; padding: 12px; border-radius: 8px; cursor: pointer;
}
body.light-mode #sidebar .bulk-buttons button, body.light-mode #sidebar .refresh-btn {
    background-color: #edf2f7 !important; color: #2d3748 !important; border-color: #e2e8f0 !important;
}

/* --- TIMELINE --- */
.vis-item { background: var(--item-bg); border: 1px solid var(--border); color: #eee; border-radius: 6px; z-index: 10; transition: background-color 0.3s, border-color 0.3s; }
.vis-item.vis-selected { border-color: var(--accent); box-shadow: 0 0 15px var(--accent); background-color: rgba(81, 175, 239, 0.2); z-index: 100; }
.vis-label { color: var(--text-muted); }
body.focus-mode .vis-item { opacity: 0.15; filter: grayscale(100%); }
body.focus-mode .vis-item.highlighted { opacity: 1; filter: grayscale(0%); z-index: 500; border-color: var(--text-main); }

/* --- SIDEBAR LAYOUT --- */
#sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 320px;
    background: var(--panel-bg); border-right: 1px solid var(--border);
    z-index: 3000; transform: translateX(-100%); transition: transform 0.3s;
    display: flex; flex-direction: column; backdrop-filter: blur(var(--glass-blur));
}
#sidebar.open { transform: translateX(0); }
.sidebar-header { padding: 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.sidebar-controls { padding: 15px; border-bottom: 1px solid var(--border); }
.sidebar-footer { padding: 15px; border-top: 1px solid var(--border); }
#filter-list { flex-grow: 1; overflow-y: auto; padding: 10px; }
input[type="text"] { width: 100%; background: rgba(0,0,0,0.1); border: 1px solid var(--border); color: var(--text-main); padding: 8px; border-radius: 6px; margin-bottom: 10px; box-sizing: border-box; }
.close-btn { background: transparent; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }

/* --- FILTER ITEM LAYOUT --- */
.filter-item {
    display: flex;
    justify-content: space-between; /* Space between Label and Eye */
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}
.filter-item:hover { background: rgba(255,255,255,0.05); }

/* Left Side: Checkbox + Dot + Name */
.filter-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1; /* Takes up all available space */
}

/* Checkbox (Hidden, using custom UI or just standard) */
.filter-left input { cursor: pointer; margin: 0; }

/* The Dot */
.filter-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}

/* Right Side: Eye Icon */
.filter-eye {
    color: var(--text-muted);
    opacity: 0.4;
    transition: all 0.2s;
    padding: 4px;
    cursor: pointer;
}
.filter-eye:hover { opacity: 1; color: var(--text-main); }

/* State: Blocked (Red Eye Slashed) */
.filter-eye.blocked {
    opacity: 1;
    color: #e06c75; /* Red */
}

/* --- PREVIEW PANEL --- */
#preview-panel {
    position: fixed; top: 80px; right: 20px; bottom: 20px; width: 450px;
    background: var(--panel-bg); border: 1px solid var(--border);
    border-radius: 12px; z-index: 2500; transform: translateX(150%);
    transition: transform 0.3s; display: flex; flex-direction: column;
    backdrop-filter: blur(var(--glass-blur)); box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}
#preview-panel.open { transform: translateX(0); }
.preview-header { padding: 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
#preview-content { flex-grow: 1; padding: 25px; overflow-y: auto; line-height: 1.6; }
#preview-content h1, h2, h3 { color: var(--text-main); margin-top: 1.5em; }
#preview-content a { color: var(--accent) !important; text-decoration: none; border-bottom: 1px dotted var(--accent); font-weight: 500; }
#preview-content a:hover { background: rgba(81, 175, 239, 0.1); border-bottom-style: solid; }
#preview-content h1.node-title { display: none; }

/* --- MODAL --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); z-index: 5000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content { background: var(--bg-color); border: 1px solid var(--border); padding: 25px; border-radius: 12px; width: 350px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); text-align: center; }
#modal-title { margin-top: 0; color: var(--text-main); }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* --- TOOLTIPS --- */
div.vis-tooltip {
    background-color: var(--panel-bg) !important; border: 1px solid var(--border) !important;
    color: var(--text-main) !important; border-radius: 8px !important; padding: 12px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important; backdrop-filter: blur(12px) !important; z-index: 99999 !important;
}
.tooltip-tag {
    display: inline-block; border: 1px solid transparent; padding: 2px 8px; border-radius: 12px;
    font-size: 11px; font-weight: 600; margin-right: 4px; margin-top: 4px;
}
