:root {
    --sidebar-width: 320px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html {
    min-height: 100svh;
}

body {
    background-color: var(--darkgray);
    color: var(--text-primary);
    min-height: 100svh;
    max-width: 100%;
    line-height: 1.6;
}

#setup {
    display: flex;
    min-height: calc(100svh - var(--pageheader-height));
}

/* Modern Sidebar */
#sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    max-height: calc(100svh - var(--pageheader-height));
    background-color: var(--gray);
    border-right: 1px solid var(--border-color);
    color: var(--text-primary);
    overflow-y: auto;
    position: sticky;
    top: var(--pageheader-height);
    z-index: 100;
}

.sidebar-btns {
    display: none;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-close-btn {
    width: 32px;
    height: 32px;
    fill: var(--text-secondary);
    cursor: pointer;
    margin-left: auto;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    fill: var(--text-primary);
    background-color: var(--lightgray);
}

/* Subtopic Sections */
.subtopic {
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
}

.subtopic:last-child {
    border-bottom: none;
}

.subtopic-header {
    padding: 0 1.5rem 1rem;
}

.subtopic h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    margin-bottom: 0.5rem;
}

.no-content {
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Navigation Items */
.subtopic-list {
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item-container {
    display: flex;
    align-items: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item-container:hover {
    background-color: var(--lightgray);
}

.nav-item-container.active {
    background-color: rgba(15, 132, 255, 0.1);
    border-left: 3px solid var(--primary);
}

.nav-item-container.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary);
    border-radius: 0 3px 3px 0;
}

.nav-item-container a {
    flex: 1;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    border-radius: 8px;
    line-height: 1.4;
}

.nav-item-container:hover a {
    color: var(--text-primary);
}

.nav-item-container.active a {
    color: var(--primary);
    font-weight: 600;
}

/* Admin Buttons */
.subtopicentry-btn {
    width: 28px;
    height: 28px;
    fill: var(--text-secondary);
    cursor: pointer;
    margin: 0 0.25rem;
    padding: 0.25rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subtopicentry-btn:hover {
    background-color: var(--lightgray);
    fill: var(--text-primary);
}

.subtopicentry-btn.remove:hover {
    background-color: rgba(231, 76, 60, 0.1);
    fill: var(--error);
}

.subtopicentry-btn.edit:hover,
.subtopicentry-btn.add:hover {
    background-color: rgba(15, 132, 255, 0.1);
    fill: var(--primary);
}

.subtopicentry-btn.remove {
    opacity: 0;
    transform: scale(0.8);
}

.nav-item-container:hover .subtopicentry-btn.remove {
    opacity: 1;
    transform: scale(1);
}

/* Content Area */
.content-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: var(--darkgray);
    overflow-y: auto;
}

/* Content Header */
.content-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    height: 42px;
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    margin-left: .5rem;
}

.mobile-sidebar-toggle:hover {
    background-color: var(--lightgray);
    color: var(--primary);
}


.content-body {
    --cms-container-gap: 1rem;

    flex-grow: 1;
    width: 100%;
    min-height: calc(calc(100vh - var(--navbar-height)) - 42px);
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    display: flex;
    flex-direction: column;
    gap: var(--cms-container-gap);
    line-height: 1.7;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Article Elements Styling */
/* .content-body h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.content-body h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 2rem 0 1rem;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.content-body h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 1.5rem 0 0.75rem;
    line-height: 1.4;
}

.content-body p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 1.5rem 0;
}

.content-body code {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
    font-size: 0.9rem;
    color: var(--primary);
}

.content-body pre {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.content-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.content-body blockquote {
    border-left: 4px solid var(--primary);
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text-secondary);
}

.content-body ul,
.content-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.content-body li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.content-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.content-body th,
.content-body td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.content-body th {
    background-color: var(--gray);
    font-weight: 600;
    color: var(--text-primary);
}

.content-body td {
    color: var(--text-primary);
}

.content-body tr:last-child td {
    border-bottom: none;
} */

/* Welcome Content */
.welcome-content {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.welcome-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
}

.welcome-content > p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 3rem;
}


/* Subtopic Actions */
.subtopic-actions {
    display: flex;
    gap: 0.25rem;
}

/* Responsive Design */
@media screen and (max-width: 1024px) {
    .mobile-sidebar-toggle {
        display: block;
    }

    #sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        max-height: 100vh;
        min-width: 0;
        width: 0;
        transition: width 0.3s ease;
        z-index: 1000;
        border-right: none;
    }

    #sidebar.open {
        width: var(--sidebar-width);
        border-right: 1px solid var(--border-color);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    }

    .sidebar-btns {
        display: flex;
        justify-content: flex-end;
    }

    .content-body {
        padding: 2rem 1.5rem;
    }

    .welcome-content {
        padding: 3rem 1.5rem;
    }

    .content-body h1 {
        font-size: 2rem;
    }

    .content-body h2 {
        font-size: 1.5rem;
    }

    .content-body h3 {
        font-size: 1.25rem;
    }
}

@media screen and (max-width: 768px) {
    .content-body {
        padding: 1.5rem 1rem;
        font-size: 1rem;
    }

    .welcome-content {
        padding: 2rem 1rem;
    }

    .welcome-content h1 {
        font-size: 2rem;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
    }

    .content-body h1 {
        font-size: 1.75rem;
    }

    .content-body h2 {
        font-size: 1.4rem;
    }

    .content-body h3 {
        font-size: 1.2rem;
    }

    .content-body table {
        font-size: 0.9rem;
    }

    .content-body th,
    .content-body td {
        padding: 0.75rem;
    }
}