/* --- Sidebar Menu Styles --- */
.page-container {
    display: flex;
}

.sidebar {
    width: 250px;
    background-color: #111827;
    color: white;
    padding: 1.5rem;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    transition: transform 0.3s ease-in-out, background-color 0.3s, color 0.3s;
    z-index: 1000;
    /* Start off-screen by default */
    transform: translateX(-100%);
}

/* When the .open class is added by JS, slide the menu in */
.sidebar.open,
html.sidebar-open .sidebar {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
    color: white;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text-main); /* Default color matches theme text */
    font-size: 1.5rem;
    cursor: pointer;
    position: fixed;
    top: 1.5rem;
    left: 1.5rem; /* Always on the left */
    z-index: 1001;
    transition: color 0.3s;
}

/* When the sidebar is open, make the button color match the sidebar text */
.sidebar.open + .main-content .menu-toggle {
    color: white;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 4rem;
}

.sidebar-nav li a,
.sidebar-nav li button {
    display: block;
    color: #d1d5db;
    text-decoration: none;
    padding: 0.75rem 0;
    font-size: 1rem;
    white-space: nowrap;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 0.375rem;
    padding-left: 0.5rem;
}

.sidebar-nav li a:hover,
.sidebar-nav li button:hover {
    color: #ffffff;
    background-color: #374151;
}

.sidebar-nav li a.active {
    color: #FFFFFF;
    font-weight: 600;
    background-color: #2563EB;
}

/* Dark mode toggle button styling */
#dark-mode-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    width: 100%;
}

.main-content {
    /* Default state: full width */
    margin-left: 0;
    width: 100%;
    padding: 4rem 1.5rem 1.5rem;
    transition: margin-left 0.3s ease-in-out;
    box-sizing: border-box; /* Prevents padding from adding to the width and causing overflow */
}

/* When the .sidebar-open class is added by JS, push the content over */
.main-content.sidebar-open,
html.sidebar-open .main-content {
    margin-left: 250px;
}

/* Dark mode sidebar adjustments */
body.dark-mode .sidebar,
html.dark-mode .sidebar {
    background-color: var(--bg-card);
    color: var(--text-main);
    border-right: 1px solid var(--border-color);
}

body.dark-mode .sidebar-title,
html.dark-mode .sidebar-title {
    color: var(--text-title);
}

body.dark-mode .sidebar-nav li a,
body.dark-mode .sidebar-nav li button,
html.dark-mode .sidebar-nav li a,
html.dark-mode .sidebar-nav li button {
    color: var(--text-sub);
}

body.dark-mode .sidebar-nav li a:hover,
body.dark-mode .sidebar-nav li button:hover,
html.dark-mode .sidebar-nav li a:hover,
html.dark-mode .sidebar-nav li button:hover {
    color: var(--text-title);
    background-color: var(--bg-body);
}

body.dark-mode .sidebar-nav li a.active,
html.dark-mode .sidebar-nav li a.active {
    color: #FFFFFF;
    background-color: var(--color-primary);
}

body.dark-mode .sidebar.open + .main-content .menu-toggle,
html.dark-mode .sidebar.open + .main-content .menu-toggle {
    color: var(--text-main);
}
