/* Sidebar Styles */
:root {
    --sidebar-w: 200px; /* Reduced from 230px */
}

.sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 6px 4px;
    overflow: auto;
     z-index: 1100 !important; /* Ensure sidebar stays on top */
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: transform 0.28s ease, width 0.2s;
    font-size: 0.9rem; /* Slightly smaller font size */
}

/* Active page indicator */
.sidebar .nav-link.active {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #fff !important;
    font-weight: 500;
    position: relative;
}

.sidebar .nav-link.active:before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #4a90e2;
    border-radius: 0 3px 3px 0;
}

/* Keep parent menu expanded when child is active */
.sidebar .has-child.active > .nav-link {
    background: rgba(255, 255, 255, 0.1);
}

/* Rotate dropdown arrow when expanded */
.sidebar .has-child.active > .nav-link .arrow {
    transform: rotate(90deg);
}

/* Show submenu when parent has active child */
.sidebar .has-child.active > .submenu {
    max-height: 1000px;
    transition: max-height 0.5s ease-in-out;
}

/* Active state for submenu items */
.sidebar .submenu .nav-link.active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
    font-weight: 500;
}

.sidebar .submenu .nav-link.active:before {
    display: none;
}

/* Sidebar Title */
.sidebar .nav-link i {
    width: 16px;
    margin-right: 6px;
    text-align: center;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar .title {
    font-weight: 600;
    padding: 4px 8px;
    margin-bottom: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: rgba(255,255,255,0.7);
}

/* Navigation Links */
.sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 4px;
    margin: 2px 0;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

/* Submenu Styles */
.sidebar .submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding: 0;
    margin: 2px 0 2px 0;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.submenu.show {
    max-height: 500px;
}

.submenu .nav-link {
    padding: 6px 8px 6px 10px; /* Reduced left padding */
    font-size: 0.8rem;
    margin: 1px 0;
    color: rgba(255, 255, 255, 0.9) !important;
    position: relative;
    left: 0;
    width: 100%;
    background-color: transparent;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    text-indent: 10px; /* Indent text instead of using padding */
}

/* Add a subtle left border for visual separation */
.submenu .nav-link:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Hover and active states for submenu items */
.submenu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

/* Active state for submenu items */
.submenu .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15) !important;
    border-left-color: #4a90e2;
    font-weight: 500;
}

.submenu .nav-link:hover {
    opacity: 1;
}

/* When sidebar is hidden (for mobile) */
body.sidebar-hidden .sidebar {
    transform: translateX(-100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        z-index: 1001; /* Even higher z-index for mobile */
    }
}
