/* ASIDE STUFF */

aside {
    width: 250px;
    background-color: var(--color-sidebar-background);
    padding: 1em;
    border-right: 1px solid var(--color-sidebar-border);
    overflow-y: auto;
    flex-shrink: 0; /* Prevent sidebar from shrinking */
}

aside ul {
    list-style: none;
    padding: 0;
}

aside li {
    margin-bottom: 0.5em;
}

aside a {
    text-decoration: none;
    color: var(--color-link-text);
}

aside a:hover {
    text-decoration: underline;
}


/* Directory Tree Styles */

.file-browser {
    padding: 0;
    margin: 0;
}

.file-tree {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-tree li {
    margin: 0;
    padding: 0;
}

/* Folder toggle form and button styles */
.folder-toggle-form {
    display: inline;
    margin: 0;
    padding: 0;
}

.folder-label-button {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    cursor: pointer;
    border: none;
    background: none;
    border-radius: 4px;
    transition: background-color 0.15s ease;
    user-select: none;
    font-weight: 500;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
}

.folder-label-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.folder-label-button:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

.folder-contents {
    margin-left: 20px;
    margin-top: 4px;
    padding-left: 8px;
    border-left: 2px solid #e0e0e0;
}

/* Remove the old checkbox-based styles */
.folder-toggle {
    display: none;
}

.folder-label {
    display: none;
}

.folder-icon {
    margin-right: 8px;
    font-size: 14px;
    transition: transform 0.15s ease;
}

.folder-name {
    font-size: 14px;
    color: #e9e9e9;
}

/* Remove old checkbox-based folder logic */
/* These rules are no longer needed with session-based state */

/* File Styles */
.file-item {
    margin-bottom: 1px;
}

.file-link {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    text-decoration: none;
    color: inherit;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.file-link:hover {
    background-color: rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.file-link:active {
    background-color: rgba(0, 0, 0, 0.12);
}

.file-icon {
    margin-right: 8px;
    font-size: 12px;
    opacity: 0.7;
}

.file-name {
    font-size: 13px;
    color: #d8d8d8;
}

/* Root level adjustments */
.root-tree {
    padding-left: 4px;
}

/* Active file highlighting */
.file-link.active {
    background-color: #007bff;
    color: white;
    font-weight: 500;
}

.file-link.active .file-name {
    color: white;
}

.file-link.active .file-icon {
    opacity: 1;
}

/* Ensure active state is visible even on hover */
.file-link.active:hover {
    background-color: #0056b3;
}

/* Add a subtle border to make active state more obvious */
.file-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #fff;
    border-radius: 0 2px 2px 0;
}

.file-link {
    position: relative; /* Needed for the ::before pseudo-element */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .folder-toggle:checked + .folder-label + .file-tree {
        margin-left: 16px;
    }
    
    .folder-name,
    .file-name {
        font-size: 12px;
    }
}

/* Smooth scrolling for the file browser */
.file-browser {
    max-height: calc(100vh - 120px); /* Adjust based on your header height */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.file-browser::-webkit-scrollbar {
    width: 6px;
}

.file-browser::-webkit-scrollbar-track {
    background: transparent;
}

.file-browser::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

.file-browser::-webkit-scrollbar-thumb:hover {
    background-color: #999;
}