:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-canvas: #f1f5f9;
    /* --bg-canvas: #adfff1cb; */
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --text-main: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --code-bg: #f8fafc;
    --code-text: #1e293b;
    --line-number-bg: #f1f5f9;
    --line-number-text: #94a3b8;
    --radius: 12px;
    --radius-sm: 8px;
    --font-mono: 'Fira Code', 'JetBrains Mono', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-canvas);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* --- CHANGES HERE --- */
    height: 100vh;        /* Lock to viewport height */
    overflow: hidden;     /* Prevent the whole page from scrolling */

}

/* NAVBAR */
.navbar {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 5px 20px;
    height: 45px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    justify-content: space-between;
}

.brand { font-size: 1.35rem; font-weight: 700; color: #fff; display: flex; align-items: center; }
.brand::before { content: '◆'; color: #60a5fa; font-size: 1.4rem; }
.brand span {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    font-size: 0.7rem;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    margin-left: 6px;
}

.nav-tabs { display: flex; gap: 4px; background: rgba(255,255,255,0.1); padding: 4px; border-radius: 10px;  }
.nav-tabs button {
    border: none; background: transparent; padding: 6px 20px; border-radius: 7px;
    cursor: pointer; font-weight: 600; font-size: 0.8rem; color: rgba(255,255,255,0.7);
}
.nav-tabs button.active { background: #fff; color: var(--primary); }

/* MAIN LAYOUT */
main { flex: 1; padding: 4px; display: flex; overflow: hidden; }
.panel { display: none; width: 100%; height: 100%; }
.panel.active { display: flex; flex-direction: row; }

/* RESIZER */
.resizer {
    width: 10px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.resizer:hover { background: rgba(29, 65, 122, 0.692); }
.resizer::after {
    content: '|';
    color: black;
    font-weight: bold;
}

/* WORKSPACE CARDS */
.workspace-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-width: 100px;
}

.left-card, .right-card { flex: 1; }

.full-row { width: 100%; ; margin-bottom: 10px; }

#diff.panel.active { flex-direction: column; }
#diff .full-row + .workspace-card { flex-direction: row; display: flex; flex: 1; width: 100%;}
/* Adjusting diff for dual layout */
#diff { display: none; }
#diff.panel.active { display: block; overflow-y: auto;}
.diff-row-container { display: flex; height: 500px; width: 100%;}

.card-header {
    padding: 6px 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.card-header h3::before { content: ''; width: 3px; height: 14px; background: var(--primary); border-radius: 2px; }

/* EDITORS */
.editor-container { flex: 1; display: flex; background: #fff; overflow: hidden; position: relative;}
.line-numbers {
    padding: 14px 10px; background: var(--line-number-bg); border-right: 1px solid var(--border-color);
    text-align: right; font-family: var(--font-mono); font-size: 12px; color: var(--line-number-text);
    min-width: 35px; overflow-y: hidden;
}

textarea, .code-output {
    flex: 1; padding: 14px 16px; border: none; outline: none;
    font-family: var(--font-mono); font-size: 12px; line-height: 1.65;
    resize: none; white-space: pre; overflow: auto; color: var(--text-main);
}

.wrapped { white-space: pre-wrap !important; word-wrap: break-word !important; }

/* TOOLBAR & BUTTONS */
.toolbar { padding: 12px 16px; background: #f8fafc; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; gap: 8px; flex-shrink: 0;}
.btn {
    padding: 6px 12px; border-radius: var(--radius-sm); font-size: 0.75rem; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border-color); background: #fff;
}
.btn-primary { background: var(--primary); color: #fff; border: none; }
.btn-copy { background: var(--success); color: #fff; border: none; }
.btn-danger { color: var(--danger); background: #fef2f2; }

/* TREE VIEW STYLES */
.tree-content { margin-left: 18px; border-left: 1px solid var(--border-color); padding-left: 8px; }
.tree-header { cursor: pointer; display: flex; align-items: center; padding: 2px; font-size: 11px; font-family: var(--font-mono); }
.tree-toggle { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--primary); margin-right: 8px; transition: transform 0.2s; }
.tree-toggle.collapsed { transform: rotate(-90deg); }
.tree-key { color: #7c3aed; font-weight: 600; }
.tree-val-string { color: green; }
.tree-val-number { color: red; }
.hidden { display: none; }

/* DIALOGS */
.modal-dialog {
    border: none; border-radius: 16px; padding: 25px; background: #fff;
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    box-shadow: var(--shadow-lg); width: 90%; max-width: 500px;
}
.modal-dialog input { width: 100%; padding: 10px; margin: 10px 0; border: 1px solid var(--border-color); border-radius: 8px; }

#notes textarea {
    background: linear-gradient(180deg, #f8fafc, #ffffff);
}
/* ===== NOTES EDITOR ALIGNMENT FIX ===== */
#notes textarea,
#notes .line-numbers {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
}

/* TOAST */
#toast {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(100px);
    background: #1e293b; color: #fff; padding: 10px 20px; border-radius: 20px;
    transition: transform 0.3s; z-index: 1000;
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* RESPONSIVE */
@media (max-width: 800px) {
    .panel.active { flex-direction: column; }
    .resizer { display: none; }
}