:root {
    --ui-bg-base: #000000;
    --ui-bg-panel: #050505;
    --ui-bg-surface: #0a0a0a;
    --ui-bg-hover: #111111;
    --ui-border-dark: #1a1a1a;
    --ui-border-light: #222222;
    --ui-text-dim: #444444;
    --ui-text-muted: #666666;
    --ui-text-main: #888888;
    --ui-text-bright: #cccccc;
    --ui-accent: #569cd6;
}

body {
    margin: 0;
    background: var(--ui-bg-base);
    color: var(--ui-text-muted);
    font-family: 'Segoe UI', sans-serif;
    display: grid;

    /* Dynamic Resizing Architecture Custom Variable Map */
    --sidebar-width: 280px;
    --editor-width: 1fr;
    --output-width: 1fr;
    --terminal-height: 350px;

    grid-template-areas:
    'sidebar editor output'
    'sidebar terminal terminal';
    grid-template-columns: var(--sidebar-width) var(--editor-width) var(--output-width);
    grid-template-rows: 1fr var(--terminal-height);
    height: 100vh;
    overflow: hidden;
    transition: grid-template-columns 0.1s ease-out, grid-template-rows 0.1s ease-out;
}

/* --- UPGRADED DRAG LOCK --- */
/* Completely paralyzes all iframes and editor internals from stealing the mouse while dragging */
body.dragging {
    transition: none;
    user-select: none !important;
}

body.dragging * {
    pointer-events: none !important;
    user-select: none !important;
}

.resizer-v {
    width: 2px;
    cursor: col-resize;
    background: var(--ui-bg-hover);
    z-index: 100;
    transition: background 0.2s;
    position: relative;
}

.resizer-v:hover, .resizer-v.active {
    background: var(--ui-accent) !important;
}

#resizer-sb {
    grid-column: 1;
    grid-row: 1 / span 2;
    justify-self: end;
    margin-right: -2px;
    position: relative;
}

#resizer-ed {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    margin-right: -2px;
    position: relative;
}

.resizer-h {
    height: 2px;
    cursor: row-resize;
    background: var(--ui-bg-hover);
    z-index: 100;
    grid-column: 2 / span 2;
    grid-row: 1;
    align-self: end;
    margin-bottom: -2px;
    transition: background 0.2s;
    position: relative;
}

.resizer-h:hover, .resizer-h.active {
    background: var(--ui-accent) !important;
}

/* --- THE ASYMMETRIC INVISIBLE HITBOXES --- */
#resizer-sb::after, #resizer-ed::after, .resizer-v::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    /* Pins directly to the visual line split */
    width: 14px;
    /* Generates the active grab zone rightward, clearing the left-side scrollbars */
    cursor: col-resize;
    z-index: 101;
    background: transparent;
}

#resizer-tm::after, .resizer-h::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    /* Pins directly to the visual line split */
    height: 14px;
    /* Generates the active grab zone downward into the terminal window top-dead space */
    cursor: row-resize;
    z-index: 101;
    background: transparent;
}

/* --- THE ASYMMETRIC INVISIBLE HITBOXES --- */
#resizer-sb::after, #resizer-ed::after, .resizer-v::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    /* Pins directly to the visual line split */
    width: 14px;
    /* Generates the active grab zone rightward, clearing the left-side scrollbars */
    cursor: col-resize;
    z-index: 101;
    background: transparent;
}

#resizer-tm::after, .resizer-h::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    /* Pins directly to the visual line split */
    height: 14px;
    /* Generates the active grab zone downward into the terminal window top-dead space */
    cursor: row-resize;
    z-index: 101;
    background: transparent;
}

.sidebar {
    grid-area: sidebar;
    background: var(--ui-bg-surface);
    border-right: 1px solid var(--ui-border-dark);
    padding: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar h3 {
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--ui-text-dim);
    margin: 0 0 15px 0;
    text-transform: uppercase;
}

/* Standardized layouts for all functional action bars across panels */
.toolbar, .controls, #viewportControls {
    display: flex;
    flex-wrap: wrap;
    /* Enforces multi-line flow when horizontal boundaries are breached */
    gap: 4px;
    align-items: center;
    background: var(--ui-bg-panel);
    padding: 4px 6px;
    border-bottom: 1px solid var(--ui-border-dark);
    box-sizing: border-box;
    min-height: 32px;
    margin-bottom: 0;
}

/* Explicit constraint overrides for workspace groupings */
.sidebar .toolbar {
    background: transparent;
    border-bottom: none;
    padding: 0;
    margin-bottom: 10px;
}

#pathUI {
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-bg-hover);
    margin-bottom: 10px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#breadcrumb {
    display: flex;
    gap: 5px;
    font-size: 10px;
    color: var(--ui-text-dim);
    flex-wrap: wrap;
    text-transform: uppercase;
    cursor: pointer;
    line-height: 1.4;
}

#breadcrumb span:hover {
    color: var(--ui-text-main);
}

#manualPath {
    background: var(--ui-bg-base);
    border: 1px solid var(--ui-border-dark);
    color: var(--ui-text-muted);
    font-size: 11px;
    padding: 4px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    >>>>>>> 4db95c6 (More updates)
}

#searchContainer {
    background: var(--ui-bg-panel);
    border: 1px solid var(--ui-border-dark);
    margin-bottom: 10px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#searchResults {
    max-height: 200px;
    overflow-y: auto;
    font-size: 11px;
    <<<<<<< HEAD
    border-top: 1px solid var(--ui-border-dark);
    =======
    border-top: 1px solid var(--ui-bg-hover);
    >>>>>>> 4db95c6 (More updates)
    display: none;
}

.search-item {
    padding: 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--ui-border-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-text-bright);
}

.search-meta {
    font-size: 9px;
    color: var(--ui-text-dim);
    margin-right: 5px;
}

#fileList {
    list-style: none;
    padding: 0;
    font-size: 12px;
    overflow-y: auto;
    flex-grow: 1;
    margin: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-border-dark) var(--ui-bg-base);
}

#fileList ul {
    list-style: none;
    padding-left: 14px;
    margin: 0;
    display: none;
    <<<<<<< HEAD
    border-left: 1px solid var(--ui-border-dark);
    =======
    border-left: 1px solid var(--ui-bg-hover);
    >>>>>>> 4db95c6 (More updates)
}

#fileList ul.expanded {
    display: block;
}

.fs-item {
    padding: 4px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
    color: var(--ui-text-main);
    border-radius: 2px;
}

.fs-item:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-text-bright);
}

.caret {
    width: 12px;
    text-align: center;
    font-size: 10px;
    color: var(--ui-text-dim);
    transition: transform 0.1s;
    display: inline-block;
}

.caret.open {
    transform: rotate(90deg);
    color: var(--ui-text-main);
}

.item-icon {
    opacity: 0.6;
    font-style: normal;
}

.editor-container {
    grid-area: editor;
    background: var(--ui-bg-base);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--ui-border-dark);
    min-width: 0;
    min-height: 0;
}

.output-container {
    grid-area: output;
    background: var(--ui-bg-panel);
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--ui-border-dark);
    min-width: 0;
    min-height: 0;
    <<<<<<< HEAD
    =======
}

.controls {
    background: var(--ui-bg-surface);
    padding: 10px;
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--ui-border-dark);
    align-items: center;
    flex-wrap: wrap;
    >>>>>>> 4db95c6 (More updates)
}

#tabBar {
    display: flex;
    background: var(--ui-bg-panel);
    border-bottom: 1px solid var(--ui-border-dark);
    overflow-x: auto;
    scrollbar-width: none;
}

#tabBar::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 8px 15px;
    font-size: 11px;
    color: var(--ui-text-dim);
    background: var(--ui-bg-surface);
    border-right: 1px solid var(--ui-border-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px 4px 0 0;
}

.tab.active {
    background: var(--ui-bg-base);
    color: var(--ui-text-bright);
    border-bottom: 1px solid var(--ui-accent);
}

.tab:hover {
    color: var(--ui-text-main);
}

.tab-close {
    font-size: 10px;
    opacity: 0.3;
    padding: 2px 5px;
}

.tab-close:hover {
    opacity: 1;
    color: #f44336;
}

#codeEditor, #outputEditor {
    flex-grow: 1;
    width: 100%;
}

#statusBar {
    flex-grow: 1;
    background: var(--ui-bg-base);
    <<<<<<< HEAD
    height: 24px;
    =======
    height: 26px;
    >>>>>>> 4db95c6 (More updates)
    border: 1px solid var(--ui-border-dark);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 10px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

#progressFill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--ui-bg-hover);
    width: 0%;
    transition: width 0.3s;
    z-index: 1;
    border-right: 1px solid var(--ui-border-light);
}

#statusText {
    position: relative;
    z-index: 2;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-container {
    grid-area: terminal;
    background: var(--ui-bg-base);
    border-top: 1px solid var(--ui-border-dark);
    position: relative;
    overflow: hidden;
    <<<<<<< HEAD
    <<<<<<< HEAD
    =======
    /* Removed padding: 5px; to prevent xterm math corruption */
    >>>>>>> 4db95c6 (More updates)
    =======
    >>>>>>> 758864b (Huge changes. Working on python integration.)
}

#terminalBox {
    position: absolute;
    top: 5px;
    bottom: 5px;
    left: 5px;
    right: 5px;
    <<<<<<< HEAD
    <<<<<<< HEAD
    overflow: hidden;
    =======
    /* Restores the 5px gap safely */
    =======
    >>>>>>> 758864b (Huge changes. Working on python integration.)
    overflow: hidden;
}

#terminalBox > .xterm {
    position: absolute !important;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

#terminalBox .xterm-viewport {
    overflow-y: auto !important;
    >>>>>>> 4db95c6 (More updates)
}

#terminalBox > .xterm {
    position: absolute !important;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

#terminalBox .xterm-viewport {
    overflow-y: auto !important;
}

/* Unified Text Inputs Grid Configuration */
input[type="text"], #manualPath, .git-controls input {
    background: var(--ui-bg-base);
    border: 1px solid var(--ui-border-dark);
    border-radius: 2px;
    color: var(--ui-text-bright);
    padding: 0 8px;
    height: 24px;
    outline: none;
    font-size: 12px;
    font-family: inherit;
    box-sizing: border-box;
}

input[type="text"]:focus, #manualPath:focus, .git-controls input:focus {
    border-color: var(--ui-accent);
}

input[type="checkbox"] {
    accent-color: var(--ui-text-muted);
    cursor: pointer;
    margin: 0;
}

/* Global design architecture for interactive action elements */
button, select, .controls select, #viewportControls select {
    height: 24px;
    background: var(--ui-bg-surface);
    color: var(--ui-text-main);
    border: 1px solid var(--ui-border-dark);
    padding: 0 10px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    outline: none;
    border-radius: 2px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: background 0.1s ease, border-color 0.1s ease, color 0.1s ease;
}

button:hover, select:hover, .controls select:hover, #viewportControls select:hover {
    background: var(--ui-bg-hover);
    color: var(--ui-text-bright);
    border-color: var(--ui-accent);
}

button.active, .controls button.active, .toolbar button.active, #viewportControls button.active {
    background: var(--ui-bg-hover);
    color: var(--ui-text-bright);
    border-color: var(--ui-accent);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.5);
}

/* Explicit square boundary locks for navigational or formatting micro-actions */
.toolbar button[title="Back"],
.toolbar button[title="Forward"],
.toolbar button[title="Parent Directory"],
.toolbar button[title="Refresh Tree"],
#viewportControls .btn-action {
    width: 24px;
    min-width: 24px;
    padding: 0;
}

/* Select specific structural overrides */
select option, .controls select option, #viewportControls select option {
    background: var(--ui-bg-base);
    color: var(--ui-text-bright);
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--ui-border-dark);
    margin: -15px -15px 15px -15px;
    background: var(--ui-bg-base);
}

.sidebar-tabs button {
    flex: 1;
    background: transparent;
    border: none;
    border-right: 1px solid var(--ui-border-dark);
    border-bottom: 2px solid transparent;
    padding: 10px 0;
    color: var(--ui-text-muted);
    font-size: 10px;
    border-radius: 0;
    height: auto;
}

.sidebar-tabs button.active {
    color: var(--ui-text-bright);
    border-bottom: 2px solid var(--ui-accent);
    background: var(--ui-bg-panel);
}

.sidebar-view {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
}

.sidebar-view.active {
    display: flex;
}

.git-controls input {
    width: 100%;
    margin-bottom: 0;
}

.git-list {
    flex-grow: 1;
    overflow-y: auto;
    font-size: 11px;
    margin-top: 10px;
}

.git-header {
    font-size: 10px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 10px 0 5px 0;
    display: flex;
    justify-content: space-between;
}

.git-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    cursor: pointer;
    border-bottom: 1px solid var(--ui-border-dark);
}

.git-item:hover {
    background: var(--ui-bg-hover);
}

.git-status-badge {
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 2px;
    background: var(--ui-border-light);
}

.status-M {
    color: #f1c40f;
}
.status-A {
    color: #2ecc71;
}
.status-D {
    color: #e74c3c;
}
.status-U {
    color: #3498db;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: var(--ui-bg-surface);
    border: 1px solid var(--ui-border-light);
    width: 500px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    border-radius: 4px;
}

/* --- ORPHANED BY TAB REFACTOR ---
 * .modal-header {
 * display: flex;
 * justify-content: space-between;
 * align-items: center;
 * border-bottom: 1px solid var(--ui-border-dark);
 * padding-bottom: 10px;
 * }
 *
 * .modal-header h3 {
 * margin: 0;
 * color: var(--ui-text-bright);
 * font-size: 12px;
 * text-transform: uppercase;
 * letter-spacing: 1px;
 * border-top-left-radius: 12px;
 * border-top-right-radius: 12px;
 * }
 * ----------------------------------- */

.close-btn {
    cursor: pointer;
    color: var(--ui-text-muted);
    font-size: 14px;
    background: none;
    border: none;
    padding: 0;
    height: auto;
    width: auto;
}

.close-btn:hover {
    color: #f44336;
    background: transparent;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group label {
    font-size: 10px;
    color: var(--ui-text-muted);
    text-transform: uppercase;
}

.settings-group select,
.settings-group input[type="number"],
.settings-group input[type="text"],
.settings-group input[type="password"] {
    background: var(--ui-bg-base);
    border: 1px solid var(--ui-border-light);
    color: var(--ui-text-bright);
    padding: 6px;
    font-size: 11px;
    outline: none;
    font-family: inherit;
    border-radius: 2px;
    color-scheme: dark;
    height: auto;
}

.settings-group select option {
    background: var(--ui-bg-panel);
    color: var(--ui-text-bright);
}

.settings-group select:focus, .settings-group input:focus {
    border-color: var(--ui-text-dim);
}

.settings-group input[type="color"] {
    padding: 0;
    border: 1px solid var(--ui-border-light);
    border-radius: 2px;
    width: 100%;
    height: 26px;
    cursor: pointer;
    background: none;
}

.settings-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.settings-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 1px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --- TABBED SETTINGS DIALOG --- */
.settings-modal-content {
    width: 650px;
    max-width: 90vw;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.settings-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--ui-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--ui-bg-panel);
}

.settings-body {
    display: flex;
    flex-direction: row;
    height: 450px;
}

.settings-nav {
    width: 160px;
    background: var(--ui-bg-panel);
    border-right: 1px solid var(--ui-border-dark);
    display: flex;
    flex-direction: column;
    padding: 10px 0;
}

.settings-tab-btn {
    background: transparent;
    border: none;
    color: var(--ui-text-dim);
    text-align: left;
    padding: 12px 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    border-radius: 0;
    height: auto;
    justify-content: flex-start;
}

.settings-tab-btn:hover {
    color: var(--ui-text-main);
    background: var(--ui-bg-surface);
}

.settings-tab-btn.active {
    color: var(--ui-accent);
    background: var(--ui-bg-base);
    border-left: 3px solid var(--ui-accent);
}

.settings-panes {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background: var(--ui-bg-base);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

.settings-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--ui-border-light);
    display: flex;
    justify-content: flex-end;
    background: var(--ui-bg-panel);
}

/* File Tree Selection State Highlight */
.fs-item.selected {
    background: var(--ui-border-light) !important;
    color: var(--ui-text-bright) !important;
    border-left: 2px solid var(--ui-accent);
    padding-left: 4px;
    <<<<<<< HEAD
    =======
    /* Adjusts for the border width to prevent text shifting */
    >>>>>>> 758864b (Huge changes. Working on python integration.)
}

/* Visual marker indicating an active debugger breakpoint node */
.ace_gutter-cell.breakpoint {
    border-radius: 50%;
    background: #e74c3c !important;
    box-shadow: none;
    margin-left: 4px;
    width: 8px !important;
    height: 8px !important;
    display: inline-block;
    <<<<<<< HEAD
}

/* ==========================================
    VIEWPORT & PREVIEW FORMAT CONTROLS
   ========================================== */
#viewportControls {
    background: var(--ui-bg-panel);
    padding: 2px 6px;
    border: none;
    border-radius: 0;
    /* Changed from height: 32px to allow multi-row expansion without spilling */
    min-height: 24px;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

#viewportControls .btn-viewport {
    min-width: 55px;
}

#viewportControls .select-format {
    width: 75px;
}

/* Explicit geometric separator elements */
.control-separator, .toolbar span[style*="width: 10px"] {
    width: 1px !important;
    height: 14px;
    background: var(--ui-border-light);
    margin: 0 6px;
    display: inline-block;
}

/* Locate your Diff-Viewer wrapper class (e.g., .diff-viewer-wrapper) */
.diff-viewer-wrapper {
    display: flex;
    flex-direction: row;
    height: 100%;
    /* Ensure it fills available space */
    width: 100%;
    overflow: hidden;
    /* Do not let the wrapper scroll */
}

/* Force the children (the editors) to occupy available width/height */
.diff-viewer-wrapper > div {
    flex: 1;
    /* Both editors share space equally */
    height: 100%;
    /* Occupy full height of the parent */
    min-height: 0;
    /* CRITICAL: Allows children to be smaller than the parent */
    overflow: hidden;
    /* ACE handles internal scrolling */
}

.forge-btn {
    background: transparent;
    border: 1px solid #444;
    color: #ccc;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.forge-btn:hover {
    background: #333;
    color: #fff;
    border-color: #666;
}