.resize {
    background: var(--background-modifier-border);
    width: 2px;
    cursor: ew-resize;
    transition: background-color 0.2s ease;
    display: none;
}

.resize:hover {
    background: var(--interactive-accent);
}

.controls {
    padding: 8px;
    display: flex;
}

.sidebar {
    min-width: 4rem;
    display: flex;
    flex-direction: column;
    width: 250px;
    overflow-y: auto;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    background-color: transparent;
}

.sidebar.shown {
    position: unset;
    background-color: var(--background-secondary);
}

.sidebar.shown + .resize {
    display: unset;
}

.sidebar.shown .file-tree {
    display: unset;
}

.sidebar.shown .controls {
    border-bottom: 1px solid var(--background-modifier-border);
}

.sidebar-toggle {
    border-radius: 4px;
    padding: 8px;
    aspect-ratio: 1;
}

.sidebar-toggle:hover {
    background-color: var(--background-modifier-border);
}

.file-tree {
    list-style-type: none;
    display: none;
    overflow-y: auto;
    padding: 16px 0 30vh;
}

.file-tree ul {
    list-style-type: none;
    padding-left: 16px;
    margin: 0;
}

.file-tree li {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    width: 100%;
}

.file-tree a {
    color: inherit;
    text-decoration: none;
    display: block;
    width: auto;
}

.folder,
.file-container {
    color: var(--text-normal);
    text-decoration: none;
    display: block;
    padding: 2px 8px;
    border-radius: 4px 0 0 4px;
    font-size: 0.9em;
    cursor: pointer;
}

.folder:hover,
.file-container:hover,
.file-container.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--interactive-accent);
}

.folder {
    cursor: pointer;
    user-select: none;
    padding: 2px 8px;
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
}

.folder-icon {
    margin-right: 5px;
    display: inline-block;
    width: 12px;
    text-align: center;
    font-size: 0.8em;
    transition: transform .2s;
}

.folder-open {
    transform: rotate(90deg);
}

/* Fix for folder display */
.folder-container {
    display: block;
    width: 100%;
}

#file-tree ul {
    position: relative;
}

#file-tree>ul>.folder-container ul:before {
    content: "";
    background-color: var(--text-faint);
    display: block;
    position: absolute;
    top: 0.3rem;
    left: 1.5ch;
    bottom: 0.3rem;
    width: 1px;
}

@media screen and (max-aspect-ratio: 2/3) {
    .sidebar {
        position: fixed !important;
        z-index: 5;
    }
    .sidebar.shown {
        width: 100% !important;
        height: 100% !important;
    }
}