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

/* Additional reset for code elements */
pre, code {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-sizing: border-box !important;
}

body {
    font-family: 'JuliaMono', 'Courier New', monospace;
    background-color: #1e1e1e;
    color: #d4d4d4;
    height: 100vh;
    overflow: hidden;
}

@font-face {
    font-family: JuliaMono;
    src: url("./JuliaMono-Regular.ttf");
    text-rendering: optimizeLegibility;
    font-display: block;
}

/* Ensure consistent font rendering across elements */
.editor-wrapper * {
    font-variant-ligatures: none;
    font-feature-settings: normal;
    text-rendering: optimizeLegibility;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.toolbar {
    background-color: #2d2d30;
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e42;
    display: flex;
    gap: 10px;
    align-items: center;
}

.toolbar button {
    background-color: #0e639c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.toolbar button:hover {
    background-color: #1177bb;
}

.toolbar button:active {
    background-color: #0a527a;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    font-family: 'JuliaMono', 'Courier New', monospace;
    background-color: #252526;
    width: 250px;
    border-right: 1px solid #3e3e42;
    padding: 15px;
    overflow-y: auto;
}

.sidebar h3 {
    color: #cccccc;
    margin-bottom: 15px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.file-list {
    list-style: none;
}

.file-item {
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s;
}

.file-item:hover {
    background-color: #2a2d2e;
}

.file-item.active {
    background-color: #094771;
}

.file-icon {
    width: 16px;
    height: 16px;
    background-color: #569cd6;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
}

.file-tab {
    background-color: #2d2d30;
    padding: 10px 15px;
    border-bottom: 1px solid #3e3e42;
    color: #cccccc;
    font-size: 14px;
}

.editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.editor {
    width: 100%;
    height: 100%;
    background-color: transparent;
    color: transparent; /* Make text transparent so highlighting shows through */
    border: none;
    padding: 20px;
    margin: 0;
    font-family: 'JuliaMono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
    overflow-y: auto;
    tab-size: 4;
    position: absolute;
    top: 0;
    left: 0;
    color: transparent;
    z-index: 3; /* Above the highlight layer */
    caret-color: #ffffff;
    box-sizing: border-box;
}

.editor:focus {
    outline: none;
}

.highlight-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 20px;
    margin: 0;
    font-family: 'JuliaMono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
    z-index: 2; /* Below the textarea but above background */
    background-color: #1e1e1e;
    tab-size: 4;
    box-sizing: border-box;
    transform: translateY(-42px); /* Move up by 2 lines */
}

.highlight-layer pre {
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    font-family: 'JuliaMono', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    white-space: pre !important;
    overflow: visible;
    height: 100%;
    box-sizing: border-box !important;
    position: relative;
    top: 0 !important;
}

.highlight-layer code {
    font-family: 'JuliaMono', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    display: block;
    box-sizing: border-box !important;
}

/* Override highlight.js styles that might interfere */
.highlight-layer .hljs {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block;
    overflow: visible;
    border: none !important;
    font-family: 'JuliaMono', 'Courier New', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
}

/* Force remove any potential spacing from highlight.js theme */
.highlight-layer .hljs::before,
.highlight-layer .hljs::after,
.highlight-layer pre::before,
.highlight-layer pre::after,
.highlight-layer code::before,
.highlight-layer code::after {
    content: none !important;
    display: none !important;
}

/* Ensure no line-height inheritance issues */
.highlight-layer .hljs * {
    line-height: inherit !important;
    margin: 0 !important;
    padding: 0 !important;
}

.status-bar {
    background-color: #007acc;
    color: white;
    padding: 5px 15px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auto-save-indicator {
    color: #4CAF50;
    font-size: 12px;
}

.auto-save-indicator.saving {
    color: #ff9800;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    
    .toolbar {
        flex-wrap: wrap;
        padding: 8px 10px;
    }
    
    .toolbar button {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 600px) {
    .sidebar {
        position: absolute;
        left: -250px;
        z-index: 1000;
        height: 100%;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .menu-toggle {
        display: block !important;
    }
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #cccccc;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

/* Custom scrollbars */
.sidebar::-webkit-scrollbar,
.editor::-webkit-scrollbar {
    width: 12px;
}

.sidebar::-webkit-scrollbar-track,
.editor::-webkit-scrollbar-track {
    background: #1e1e1e;
}

.sidebar::-webkit-scrollbar-thumb,
.editor::-webkit-scrollbar-thumb {
    background: #424242;
    border-radius: 6px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.editor::-webkit-scrollbar-thumb:hover {
    background: #555;
}
