:root {
    --sidebar-background-color: #252525;
    --sidebar-text-color: #f8f9fa;
    --sidebar-highlight-color: #353535;
    --background-color: #151515;
    --note-content-color: #f8f9fa;
    --link-color: #007bff;
    --tags-topic-background-color: #ff8000;
    --tags-topic-color: #7c4000;
    --tags-topic-border-color: #7c4000;
    --tags-type-background-color: #80ff00;
    --tags-type-color: #407c00;
    --tags-type-border-color: #407c00;
    --related-color: #40aaff;
}

body {
    font-family:
        "Segoe UI", "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
    background: var(--background-color);
    color: var(--note-content-color);
    display: flex;
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar styles */
#sidebar {
    min-width: 150px;
    flex-basis: 260px;
    background: var(--sidebar-background-color);
    color: var(--sidebar-text-color);
}

#sidebar h2 {
    font-size: 1.5rem;
    margin: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

#resizer {
    flex-basis: 5px;
    z-index: 2;
    cursor: col-resize;
    background: #000;
}

#search-bar {
    position: relative;
    width: calc(100% - 60px);
    padding: 0.5rem 0.75rem;
    margin: 0px 15px;
    border-radius: 6px;
    border: none;
    font-size: 1rem;
    background: var(--sidebar-background-color);
    color: var(--sidebar-text-color);
    outline: none;
    transition: background 0.2s;
    background: #444;
}

#search-bar:focus {
    background: #666;
}

#search-results {
    position: fixed;
    z-index: 10;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    border-radius: 4px #fff;
    background: #505050;
    margin: 0.2rem 0.5rem;
    transition: background 0.15s;
    display: none;
    flex-direction: column;
}

#search-results div:hover {
    background: #444;
}

#search-results .search-item {
    z-index: 10;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    border-radius: 4px #494949;
    color: #f8f9fa;
    background: #292929;
    margin-bottom: 0.2rem;
    transition: background 0.15s;
}

#search-results .search-item:hover {
    background: #444;
}

#sidebar .folder {
    position: relative;
    cursor: pointer;
    /*padding-left: 1.2em;*/
}

li.folder.is-collapsed ul {
    display: none;
}

/* Style for the clickable folder header */
.folder-header {
    display: flex; /* Arrange icon and name side-by-side */
    align-items: center; /* Vertically align them */
    cursor: pointer; /* Indicate it's clickable */
    padding: 5px 0; /* Add some vertical spacing */
    user-select: none; /* Prevent text selection on folder name */
    background-color: transparent; /* Default background */
    transition: background-color 0.2s ease; /* Smooth hover effect */
}

.folder-header:hover {
    background-color: var(--sidebar-highlight-color);
}

.folder-name {
    font-weight: bold; /* Make folder names stand out */
}

.folder-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 4px solid transparent; /* Creates triangle shape */
    border-right: 4px solid transparent;
    border-top: 4px solid var(--sidebar-text-color); /* Points down by default (expanded) */
    margin-right: 8px; /* Space between icon and name */
    transition: transform 0.2s ease-in-out; /* Smooth rotation */
    transform-origin: center; /* Ensure rotation is around its center */
}

/* Rotate icon when folder is collapsed */
.folder.is-collapsed > .folder-header > .folder-icon {
    transform: rotate(-90deg); /* Points right when collapsed */
}

/* Style for file items */
.file a {
    text-decoration: none; /* Remove underline from links */
    color: #555; /* Default link color */
    display: block; /* Make the whole area clickable */
    padding: 5px 0; /* Add some spacing */
    transition: background-color 0.2s ease;
}

.file a:hover {
    background-color: #f0f0f0; /* Hover background for files */
    color: #000; /* Darker text on hover */
}

/* Optional: Add active state for selected file */
.file a.active {
    background-color: #d1e7ff;
    color: #0056b3;
    font-weight: bold;
}

#nav-menu {
    overflow: hidden;
    flex: 1;
    margin: 15px 0px 15px 15px;
    height: calc(100vh - 130px);
    overflow-y: auto;
}

#nav-menu .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#nav-menu .nav-list .nav-list {
    padding-left: 20px;
}

#nav-menu a {
    display: block;
    color: #f8f9fa;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1rem;
    transition: background 0.15s;
}

#nav-menu a:hover,
#nav-menu a.active {
    background: #444;
}

main {
    flex: 1;
    display: flex;
    justify-content: center;
    overflow-y: auto;
}

/* Main content styles */
#main-content {
    padding: 1rem 1rem 1rem 1rem;
    max-width: 900px;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

#tags,
#tags span {
    font-size: 0.95rem;
    border-radius: 14px;
    border: 1px;
    margin: 0rem 0.3rem 0rem 0rem;
    padding: 0.3rem 0.8rem;
    font-size: 0.9rem;
    font-weight: bold;
}

#tags .tags-type {
    background: var(--tags-type-background-color);
    color: var(--tags-type-color);
    border-color: var(--tags-type-border-color);
}

#tags .tags-topic {
    background: var(--tags-topic-background-color);
    color: var(--tags-topic-color);
    border-color: var(--tags-topic-border-color);
}

#note-content {
    font-size: 1.13rem;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

#note-content h1,
#note-content h2,
#note-content h3,
#note-content h4 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--note-content-color);
}

#note-content h1 {
    font-size: 2.1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

#note-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 0.3rem;
}

#note-content h3 {
    font-size: 1.2rem;
}

#note-content h4 {
    font-size: 1.05rem;
}

#note-content ul,
#note-content ol {
    margin-left: 2rem;
    margin-bottom: 1.2rem;
}

#note-content li {
    margin-bottom: 0.5rem;
}

#note-content a {
    color: #0074d9;
    text-decoration: underline;
    transition: color 0.15s;
}

#note-content a:hover {
    color: #005fa3;
}

#note-content .admonition {
    border-left: 4px solid #444;
    background: #232323;
    padding: 0.8rem 1rem;
    margin: 1.2rem 0;
    color: #e0e0e0;
    font-style: italic;
    border-radius: 10px;
}

#note-content .admonition-title {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

#note-content blockquote {
    border-left: 4px solid #e9ecef;
    background: #f6f6f6;
    padding: 0.8rem 1rem;
    margin: 1.2rem 0;
    color: #555;
    font-style: italic;
}

#note-content pre,
#note-content code {
    font-family: "Fira Mono", "Consolas", "Menlo", monospace;
    background: #f3f3f3;
    color: #222;
    border-radius: 6px;
}

#note-content pre {
    padding: 1rem;
    overflow-x: auto;
    margin: 1.2rem 0;
}

#note-content code {
    padding: 0.2rem 0.5rem;
    font-size: 0.98rem;
}

#note-content img,
#note-content svg,
#note-content .MathJax {
    max-width: 100%;
    height: auto;
    margin: 1.2rem auto;
}

#note-content .MathJax {
    font-size: 1.15em;
}

.tikz {
    display: flex;
    justify-content: center;
}

.tikz g[stroke="#000"],
.tikz g[fill="#000"] {
    stroke: var(--note-content-color);
    fill: var(--note-content-color);
}

.tikz g[stroke="#fff"],
.tikz g[fill="#fff"] {
    stroke: var(--background-color);
    fill: var(--background-color);
}

#related {
    position: relative;
    margin-top: auto;
}

#related-section {
    margin-top: auto;
    border-top: 1px solid #e9ecef;
}

#related a,
#related p {
    font-size: 0.8rem;
    color: var(--related-color);
}
