:root {
    --bg-dark: #1e1e1e;
    --bg-panel: #252526;
    --border: #3e3e42;
    --accent: #0e639c;
    --accent-hover: #1177bb;
    --text: #cccccc;
    --text-muted: #888888;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.header {
    background: #333333;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.brand { font-weight: 600; color: #fff; font-size: 16px; margin-right: 20px; }
.controls { display: flex; align-items: center; gap: 8px; }
.divider { width: 1px; height: 24px; background: #555; margin: 0 4px; }

.btn {
    background: #3c3c3c;
    color: var(--text);
    border: 1px solid transparent;
    padding: 5px 12px;
    font-size: 13px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn:hover:not(:disabled) { background: #4a4a4a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-run { background: var(--accent); color: white; }
.btn-run:hover:not(:disabled) { background: var(--accent-hover); }
.btn-stop { background: #a1260d; color: white; }
.btn-stop:hover:not(:disabled) { background: #c5221f; }

/* Hide File Inputs */
#csvFile, #pyFile { display: none; }

/* Layout */
.main-container { display: flex; flex: 1; height: 100%; overflow: hidden; }
.pane { display: flex; flex-direction: column; position: relative; min-width: 200px; min-height: 100px; }

#left-pane { width: 50%; border-right: 1px solid var(--border); }
#right-pane { flex: 1; display: flex; flex-direction: column; }

/* --- UPDATED RESIZERS --- */

/* Vertical Resizer (Code vs Visualizer) */
.resizer-v { 
    position: absolute; 
    right: -6px;        /* Center the 12px hit box over the edge */
    top: 0; 
    bottom: 0; 
    width: 12px;        /* Large hit area */
    cursor: col-resize; 
    z-index: 100;
    display: flex;
    justify-content: center;
}

/* Horizontal Resizer (Visualizer vs Console) */
.resizer-h { 
    position: relative;
    height: 12px;       /* Large hit area */
    margin-top: -6px;   /* Pull up to overlap boundary */
    margin-bottom: -6px;
    cursor: row-resize; 
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Visual Lines on Hover (The actual blue line is thinner than the hit area) */
.resizer-v::after, .resizer-h::after {
    content: "";
    background: transparent;
    transition: background 0.2s;
}

.resizer-v::after { width: 4px; height: 100%; }
.resizer-h::after { height: 4px; width: 100%; }

.resizer-v:hover::after, .resizer-h:hover::after {
    background: var(--accent);
}

/* Components */
.panel-header {
    background: var(--bg-panel);
    padding: 6px 15px;
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    user-select: none;
}

#monaco-container { flex: 1; width: 100%; }

#vis-container {
    flex: 1;
    background: #111;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
canvas { width: 100%; height: 100%; cursor: grab; display: block; }
canvas:active { cursor: grabbing; }

.vis-hint {
    position: absolute; top: 10px; left: 10px;
    font-size: 11px; color: rgba(255,255,255,0.3); pointer-events: none;
}

#console-container {
    height: 180px;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
}
#console-output {
    flex: 1;
    overflow-y: auto;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    padding: 10px;
    line-height: 1.4;
}

.log-info { color: #d4d4d4; }
.log-err { color: #f48771; }
.log-sys { color: #569cd6; font-style: italic; }
.log-success { color: #89d185; }

#loader {
    position: fixed; inset: 0;
    background: rgba(30,30,30,0.95);
    z-index: 9999;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
}
.spinner {
    width: 40px; height: 40px;
    border: 3px solid #333; border-top: 3px solid var(--accent);
    border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px;
}
#loader-text { color: var(--text-muted); font-size: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Documentation Modal --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
}

.modal-content {
    background-color: var(--bg-panel);
    margin: 5% auto;
    border: 1px solid var(--border);
    width: 600px;
    max-width: 90%;
    max-height: 85vh;
    border-radius: 6px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px 20px;
    background: #333;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { font-size: 18px; color: white; margin: 0; }

.close {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}
.close:hover { color: white; }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    color: var(--text);
    line-height: 1.6;
}

.modal-body h3 {
    margin-top: 20px; margin-bottom: 10px;
    color: var(--accent-hover);
    border-bottom: 1px solid #444;
    padding-bottom: 5px;
}
.modal-body h3:first-child { margin-top: 0; }

.modal-body pre {
    background: #111;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Consolas', monospace;
    font-size: 13px;
    color: #9cdcfe;
    overflow-x: auto;
}

.modal-body ul { margin-left: 20px; }
.modal-body li { margin-bottom: 8px; }
.modal-body code {
    background: #333;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    color: #dcdcaa;
}

.modal-body a {
    color: #4fc1ff; /* Bright blue for dark mode visibility */
    text-decoration: none;
    font-weight: 600;
}

.modal-body a:hover {
    text-decoration: underline;
    color: #9cdcfe;
}
