/* ===============================
   EXPLORER LAYOUT
================================ */
.layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

.sidebar {
    width: 250px;
    border-right: 1px solid #aaa;
    padding: 1rem;
    overflow-y: auto;
    background: var(--bgsub);
}

.content {
    position: relative; /* so buttons are relative to this container */
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

/* ===============================
   TREE STRUCTURE
================================ */
.tree,
.tree ul {
    list-style: none;
    position: relative;
}

.tree li {
    position: relative;
    padding-left: 20px;
}

.tree li::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 100%;
    border-left: 1px solid #555;
}

.tree li::after {
    content: "";
    position: absolute;
    top: 1em;
    left: 0;
    width: 20px;
    border-top: 1px solid #555;
}

.tree li:last-child::before {
    height: 1em;
}

/* ===============================
   FILE / FOLDER
================================ */
.file-header {
    background-color: var(--primary);
    text-align: center;
    color: white;
}

.folder,
.file {
    cursor: pointer;
    display: inline-block;
}

.folder:hover,
.file:hover {
    text-decoration: underline;
}

.tree ul {
    display: none;
    padding-left: 10px;
}

.folder.open + ul {
    display: block;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 10px;
    font-size: 14px;
}
.breadcrumb span {
    cursor: pointer;
    color: var(--primary);
}
.breadcrumb span:hover {
    text-decoration: underline;
}
/* Active file */
.file.active {
    color: var(--accent);
}

/* ===============================
   TEXT SIZE BUTTON
================================ */
.segmented-btn {
    position: absolute; /* absolute inside .file-view */
    top: 10px; /* distance from top of file-view */
    right: 10px; /* distance from right of file-view */
    display: inline-flex;
    border: 2px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 0 5px var(--neon),
        0 0 10px var(--neon);
    z-index: 100;
    background-color: var(--bgmain);
}

.segmented-btn button {
    background-color: var(--bgsub);
    color: var(--primary);
    border: none;
    padding: 10px 16px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.segmented-btn button:not(:last-child) {
    border-right: 2px solid var(--border2);
}

.segmented-btn button:hover {
    background-color: var(--accent);
    color: white;
    transform: scale(1.05);
}

.segmented-btn button:active {
    background-color: var(--primary);
    transform: scale(0.95);
}

/* ===============================
   FILE CONTENT
================================ */
.file-view * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.file-view {
    font-family: "VT323", serif;
    line-height: 1.6;
    font-size: 16px;
    color: #333;
}

/* Headings */
.file-view h1 {
    font-size: 2rem;
    color: #222;
    margin: 0;
}
.file-view h2 {
    font-size: 1.75rem;
    color: #333;
    margin: 0;
}
.file-view h3 {
    font-size: 1.5rem;
    color: #444;
    margin: 0;
}
.file-view h4 {
    font-size: 1.25rem;
    color: #555;
    margin: 0;
}
.file-view h5 {
    font-size: 1rem;
    color: #666;
    margin: 0;
}
.file-view h6 {
    font-size: 0.875rem;
    color: #777;
    margin: 0;
}

/* Paragraphs */
.file-view p {
    line-height: 1.6;
    margin: 0;
}

/* Links */
.file-view a {
    color: #0066cc;
    text-decoration: none;
}
.file-view a:hover {
    text-decoration: underline;
}

/* Lists */
.file-view ul,
.file-view ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}
.file-view li {
    margin-bottom: 0.5rem;
}

/* Code blocks */
.file-view pre,
.file-view code {
    font-family: "Courier New", Courier, monospace;
    background-color: #f5f5f5;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* Blockquotes */
.file-view blockquote {
    border-left: 4px solid #ccc;
    padding-left: 1rem;
    color: #666;
    margin: 1rem 0;
    font-style: italic;
}

/* Images */
.file-view img {
    max-width: 100%;
    height: auto;
}

/* Tables */
.file-view table {
    border-collapse: collapse;
    margin-bottom: 1rem;
    width: 100%;
}
.file-view th,
.file-view td {
    border: 1px solid #ddd;
    padding: 0.5rem;
    text-align: left;
}
.file-view th {
    background-color: #f2f2f2;
}

/* ===============================
   MOBILE RESPONSIVE
================================ */

.sidebar-toggle {
    display: none;
    padding: 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    width: 100%;
    font-size: 16px;
    cursor: pointer;
}

/* Tablet & Mobile */
@media (max-width: 768px) {
    .layout {
        flex-direction: column;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #aaa;
        display: none;
    }

    .sidebar.open {
        display: block;
    }

    .content {
        padding: 1rem;
    }
}
