/* Sidebar container */
#sidebar-wrapper {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    z-index: 1050;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    padding-top: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

#sidebar-wrapper.toggled {
    left: 0;
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.15);
}

/* Overlay for mobile/desktop toggle */
#sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

#sidebar-overlay.active {
    opacity: 1.4;
    visibility: visible;
    transition: opacity 0.4s ease, visibility 0s linear 0s;
}

/* Header customization for Sidebar */
.sidebar-header {
    padding: 2rem 1rem;
    background: transparent;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.sidebar-header h5 {
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #1a202c;
    margin-bottom: 0.25rem !important;
}

.sidebar-header small {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #718096 !important;
    font-weight: 600;
}

/* Stylish decorative line for header */
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 20%;
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(66, 153, 225, 0.5), transparent);
}

/* MetisMenu Styles customization */
.metismenu {
    padding-left: 0;
    list-style: none;
}

.metismenu ul {
    padding-left: 0;
    list-style: none;
    background-color: rgba(0, 0, 0, 0.02);
}

.metismenu li {
    position: relative;
    display: block;
}

.metismenu a {
    position: relative;
    display: block;
    padding: 12px 15px;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background 0.2s;
    font-size: 0.95rem;
}

.metismenu a:hover,
.metismenu a.active {
    background-color: rgba(0, 0, 0, 0.05);
    color: #0d6efd;
}

/* Indentation for nested levels */
.metismenu ul a {
    padding-left: 30px;
}

.metismenu ul ul a {
    padding-left: 45px;
}

.metismenu ul ul ul a {
    padding-left: 60px;
}

.metismenu .has-arrow::after {
    position: absolute;
    content: '\f053';
    /* FontAwesome chevron-left */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    right: 1em;
    transform: translateY(-50%);
    top: 50%;
    transition: transform .3s ease-out;
    font-size: 0.8em;
}

/* Bold text for folder headers */
.metismenu .has-arrow {
    font-weight: 600;
}

/* MetisMenu specific active class is usually on LI */
.metismenu li.mm-active>a>.has-arrow::after,
.metismenu li.active>a>.has-arrow::after,
.metismenu a[aria-expanded="true"]>.has-arrow::after {
    transform: translateY(-50%) rotate(-90deg);
    /* Rotate to point down */
}

/* Dark mode specific sidebar adjustments */
/* Dark mode specific sidebar adjustments */
[data-theme="dark"] #sidebar-wrapper {
    background: rgba(26, 32, 44, 0.95);
    /* Dark background with slight opacity */
    border-right-color: rgba(255, 255, 255, 0.05);
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .sidebar-header {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .sidebar-header h5 {
    color: #f7fafc;
}

[data-theme="dark"] .sidebar-header small {
    color: #a0aec0 !important;
}

[data-theme="dark"] .metismenu a {
    color: #cbd5e0;
    border-bottom-color: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .metismenu ul {
    background-color: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .metismenu a:hover,
[data-theme="dark"] .metismenu a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: #63b3ed;
}

[data-theme="dark"] #theme-toggle-btn {
    background-color: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

[data-theme="dark"] #theme-dropdown {
    background-color: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .theme-option {
    color: #e2e8f0;
}

[data-theme="dark"] .theme-option:hover {
    background-color: #4a5568;
}