/* Sidebar Variables for easy theme changes */
:root {
    --sidebar-width: 250px;
    --sidebar-bg: #1a1d20;
    --active-bg: #3b82f6; /* Modern Blue */
    --text-color: #adb5bd;
    --hover-bg: #2c3034;
}

#sidebar {
    position: fixed;
    left: 0;
    width: var(--sidebar-width);
    height: 100%;
    background: var(--sidebar-bg);
    color: #fff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0,0,0,0.3);
}
 
#content {
    margin-left: var(--sidebar-width);
}

/* Sidebar Toggle Logic */
#wrapper.active #sidebar {
    left: 0;
}

#wrapper.active #content {
    margin-left: var(--sidebar-width);
}

/* Header & Logo */
.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid #2d3238;
}

.sidebar-header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--active-bg);
}

/* Navigation Links */
#sidebar ul.components {
    padding: 15px 0;
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
}

#sidebar ul.components::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

#sidebar ul li a {
    padding: 12px 25px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    transition: 0.2s;
}

#sidebar ul li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
}

/* Active State with an Accent Bar */
#sidebar ul li.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1) 0%, transparent 100%);
    position: relative;
}

#sidebar ul li.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--active-bg);
}

#sidebar ul li.active a {
    color: #fff;
}

#sidebar ul li:not(.active):hover {
    background: var(--hover-bg);
    color: #fff;
}

#sidebar ul li.has-sub > a::after {
    content: "▸";
    float: right;
    transition: transform 0.3s;
}

#sidebar ul li.open > a::after {
    transform: rotate(90deg);
}

/* Footer Section */
.sidebar-footer {
    padding: 20px;
    border-top: 1px solid #2d3238;
}

.logout-btn {
    color: #ff4d4d;
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* Sublist */
.sublist {
    display: none;
    background: #2b3035;
    list-style: none;
    nav-left: 10px;
    margin: 0;
}
#sidebar ul li.open .sublist {
    display: block;
    background: var(--sidebar-bg);
}

.sublist li a {
    padding-left: 40px;
    font-size: 14px;
}

.sublist li.active a {
    background: #495057;
}

.link-style-button {
    background: none;
    border: none;
    color: #ff4d4d; /* Your logout red */
    padding: 0;
    font: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    width: 100%;
}

.link-style-button i {
    margin-right: 15px; /* Matches your sidebar spacing */
}

/* Sidebar Overlay */
#sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    #content {
        margin-left: 0;
    }
    #wrapper.active #sidebar {
        left: 0;
    }
    #wrapper.active #content {
        margin-left: 0;
    }
    #wrapper.active #sidebar-overlay {
        display: block;
    }
    #wrapper.active {
        overflow: hidden;
    }
}
