:root {
    --background: white;
    --body: black;
    --sidebar-bg: #1e1e1e;
    --sidebar-text: #cccccc;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #3c3c3c;
    --operator: #404350;
    --number: #55a255;
    --comment: #438543;
    --result: #1b7bbc;
    --result-denote: #7e8297;
    --function: #6e4b00;
    --error: #d53b3b;
    --current-line: #dbdbdb;
    --button-bg: #007bff;
    --button-text: #ffffff;
    --button-hover-bg: #0056b3;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #121212;
        --body: #f0f0f0;
        --sidebar-bg: #252526;
        --sidebar-text: #cccccc;
        --sidebar-active-text: #ffffff;
        --sidebar-border: #3c3c3c;
        --operator: #aeaeae;
        --number: #97c697;
        --comment: #49ac49;
        --result: #6dafdc;
        --result-denote: #7d7d7d;
        --function: #d8b873;
        --error: #e3a238;
        --current-line: #303030;
        --button-bg: #0d6efd;
        --button-text: #ffffff;
        --button-hover-bg: #0b5ed7;
    }
}

body {
    margin: 0;
    padding: 0;
    background: var(--background);
    color: var(--body);
    font-family: sans-serif;
}

#main-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#file-explorer {
    width: 250px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
}

#file-explorer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    font-weight: bold;
    border-bottom: 1px solid var(--sidebar-border);
}

#file-explorer-header #new-file-button {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
}

#file-explorer-header #new-file-button:hover {
    color: var(--sidebar-active-text);
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#file-list li {
    padding: 8px 10px;
    cursor: pointer;
}

#file-list li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#file-list li.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--sidebar-active-text);
}

.delete-button {
    float: right;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
}

.delete-button:hover {
    color: var(--sidebar-active-text);
}

.delete-button i {
    font-size: 16px;
}

#file-list li.unsaved::after {
    content: ' •';
    color: red;
}

#font-size-controls {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px;
    border-top: 1px solid var(--sidebar-border);
}

#font-size-controls button {
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
}

#font-size-controls button:hover {
    background-color: var(--button-hover-bg);
}

#font-size-display {
    color: var(--sidebar-text);
    font-size: 16px;
}

#no-file-placeholder {
    display: none;
    flex-grow: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#no-file-placeholder.visible {
    display: flex;
}

#no-file-placeholder p {
    font-size: 18px;
    margin-bottom: 20px;
}

#no-file-placeholder button {
    background-color: var(--button-bg);
    border: none;
    color: var(--button-text);
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
}

#no-file-placeholder button:hover {
    background-color: var(--button-hover-bg);
}

#editor-container.hidden {
    display: none;
}

button {
    font-family: inherit;
}

button i {
    margin-right: 5px;
    vertical-align: middle;
}

button.delete-button i {
    margin-right: 0;
}

#file-explorer button {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
}

#file-explorer button:hover {
    color: var(--sidebar-active-text);
}

#new-file-button i {
    font-size: 24px;
}

#editor-container {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

#line-numbers {
    position: absolute;
    top: 0;
    left: 0;
    width: auto;
    min-width: 50px;
    padding-right: 5px;
    padding-top: 10px;
    height: 100%;
    overflow: hidden;
    background-color: var(--background);
    color: var(--body);
    box-sizing: border-box;
    text-align: right;
    user-select: none;
    font-family: monospace;
    font-size: 16px;
    border-right: 1px solid #ccc;
}

.line-number {
    line-height: 1.2em;
    padding: 0 8px 0 0;
    margin: 0;
    border-radius: 0 3px 3px 0;
    color: var(--sidebar-text);
}

.line-number.current-line {
    color: white;
    font-weight: 600;
}

#editor-wrapper {
    position: absolute;
    top: 0;
    left: 50px;
    right: 0;
    bottom: 0;
    overflow: auto;
}

#editor-input,
#editor-output {
    font-family: 'Fira Code', 'Lucida Console', 'Courier New', Courier, monospace;
    font-size: 16px;
    line-height: 1.2em;
    padding: 10px;
    box-sizing: border-box;
    width: fit-content;
    min-width: 100%;
    height: 100%;
    margin: 0;
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    overflow-y: auto;
    white-space: pre;
    word-wrap: normal;
}

#editor-input {
    position: absolute;
    top: 0;
    left: 0;
    color: transparent;
    background: transparent;
    caret-color: var(--body);
    z-index: 1;
    -webkit-text-fill-color: transparent;
}

#editor-output {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--body);
    pointer-events: none;
    z-index: 0;
    white-space: pre;
    word-wrap: normal;
}

.line {
    line-height: 1.2em;
    padding: 0;
    margin: 0;
}

.current-line {
    background-color: var(--current-line);
}

.number {
    color: var(--number);
}

.operator {
    color: var(--operator);
}

.comment {
    color: var(--comment);
}

.function {
    color: var(--function);
}

.error,
.error * {
    color: var(--error) !important;
}

.result,
.result * {
    color: var(--result) !important;
}

.result::before {
    content: '⇒ ';
    color: var(--result-denote);
}
