/* Sidebar Styles */

:root {
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 60px;
    --sidebar-bg: #ffffff;
    --sidebar-border-color: #e0e0e0;
    --sidebar-text-color: #333333;
    --sidebar-text-color-hover: #0cb138;
    --sidebar-bg-active: #f0f7f2;
    --sidebar-bg-hover: #f8f9fa;
    --sidebar-section-padding: 20px 15px;
    --sidebar-item-padding: 12px 15px;
    --sidebar-icon-size: 18px;
    --sidebar-icon-margin: 12px;
    --sidebar-transition: 0.3s ease;
    --sidebar-backdrop-bg: rgba(0, 0, 0, 0.5);
    --sidebar-z-index: 998;
    --sidebar-header-height: 60px;
}

/* Dark Mode Overrides */
.dark-mode,
[data-theme="dark"] {
    --sidebar-bg: var(--theme-bg-secondary, #343a40);
    --sidebar-border-color: var(--theme-border-color, #495057);
    --sidebar-text-color: var(--theme-text-primary, #ffffff);
    --sidebar-text-color-hover: #0cb138;
    --sidebar-bg-active: rgba(12, 177, 56, 0.15);
    --sidebar-bg-hover: var(--theme-bg-tertiary, #495057);
}

/* Sidebar Backdrop (Mobile Only) */
.mc-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--sidebar-backdrop-bg);
    z-index: calc(var(--sidebar-z-index) - 1);
    opacity: 0;
    transition: opacity var(--sidebar-transition);
}

.mc-sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

/* Sidebar Container */
.mc-sidebar {
    position: fixed;
    top: var(--menu-height, var(--page-container-padding-top));
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--menu-height, var(--page-container-padding-top)));
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border-color);
    box-shadow: 2px 0 6px rgba(0, 0, 0, 0.1);
    z-index: var(--sidebar-z-index);
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--sidebar-transition), width var(--sidebar-transition);
    transform: translateX(0);
}

/* Sidebar Header - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    height: var(--sidebar-header-height);
    border-bottom: 1px solid var(--sidebar-border-color);
}

.mc-sidebar .mc-sidebar-collapse {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text-color);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: color var(--sidebar-transition), transform var(--sidebar-transition);
    opacity: 0.7;
}

.mc-sidebar .mc-sidebar-collapse:hover {
    color: var(--sidebar-text-color-hover);
    opacity: 1;
}

.mc-sidebar .mc-sidebar-collapse i {
    transition: transform var(--sidebar-transition);
}

.mc-sidebar.collapsed .mc-sidebar-collapse i {
    transform: rotate(180deg);
}

.mc-sidebar .mc-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text-color);
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: color var(--sidebar-transition);
}

.mc-sidebar .mc-sidebar-close:hover {
    color: var(--sidebar-text-color-hover);
}

/* Sidebar Navigation - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-nav {
    padding: 10px 0;
}

/* Sidebar Section - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-section {
    margin-bottom: 20px;
}

.mc-sidebar .mc-sidebar-section:last-child {
    margin-bottom: 0;
}

.mc-sidebar .mc-sidebar-section-title {
    display: flex;
    align-items: center;
    padding: var(--sidebar-section-padding);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    border-bottom: 1px solid var(--sidebar-border-color);
    margin-bottom: 5px;
    transition: opacity var(--sidebar-transition);
    white-space: nowrap;
    overflow: hidden;
}

.dark-mode .mc-sidebar .mc-sidebar-section-title,
[data-theme="dark"] .mc-sidebar .mc-sidebar-section-title {
    color: var(--theme-text-muted, #adb5bd);
}

.mc-sidebar .mc-sidebar-section-title i {
    margin-right: var(--sidebar-icon-margin);
    font-size: 14px;
    flex-shrink: 0;
}

.mc-sidebar .mc-sidebar-section-title span {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sidebar List - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Sidebar Item - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-item {
    margin: 0;
}

/* Sidebar Link - Scoped to .mc-sidebar */
.mc-sidebar .mc-sidebar-link {
    display: flex;
    align-items: center;
    padding: var(--sidebar-item-padding);
    color: var(--sidebar-text-color);
    text-decoration: none;
    transition: background-color var(--sidebar-transition), color var(--sidebar-transition);
    border-left: 3px solid transparent;
}

.mc-sidebar .mc-sidebar-link:hover {
    background-color: var(--sidebar-bg-hover);
    color: var(--sidebar-text-color-hover);
}

.mc-sidebar .mc-sidebar-link.active {
    background-color: var(--sidebar-bg-active);
    color: var(--sidebar-text-color-hover);
    border-left-color: var(--sidebar-text-color-hover);
    font-weight: 500;
}

.mc-sidebar .mc-sidebar-link i {
    width: var(--sidebar-icon-size);
    font-size: var(--sidebar-icon-size);
    margin-right: var(--sidebar-icon-margin);
    text-align: center;
    flex-shrink: 0;
}

.mc-sidebar .mc-sidebar-link span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity var(--sidebar-transition), width var(--sidebar-transition);
}

/* Collapsed State */
.mc-sidebar.collapsed {
    width: var(--sidebar-width-collapsed);
}

.mc-sidebar.collapsed .mc-sidebar-section-title span {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
}

.mc-sidebar.collapsed .mc-sidebar-section-title {
    justify-content: center;
    padding: var(--sidebar-section-padding);
}

.mc-sidebar.collapsed .mc-sidebar-section-title i {
    margin-right: 0;
}

.mc-sidebar.collapsed .mc-sidebar-link span {
    opacity: 0;
    width: 0;
    margin: 0;
    padding: 0;
}

.mc-sidebar.collapsed .mc-sidebar-link {
    justify-content: center;
    padding: var(--sidebar-item-padding);
}

.mc-sidebar.collapsed .mc-sidebar-link i {
    margin-right: 0;
}

.mc-sidebar.collapsed .mc-sidebar-header {
    justify-content: center;
    padding: 15px 10px;
}

/* Desktop: Sidebar always visible - Scoped to .mc-sidebar */
@media (min-width: 768px) {
    .mc-sidebar {
        transform: translateX(0);
    }
    
    .mc-sidebar-backdrop {
        display: none !important;
    }
    
    .mc-sidebar .mc-sidebar-collapse {
        display: block;
    }
    
    .mc-sidebar .mc-sidebar-close {
        display: none;
    }
    
    /* Page content margin for sidebar */
    /* Default to collapsed width - JavaScript will update if needed */
    .page-container {
        margin-left: var(--sidebar-width-collapsed);
        transition: margin-left var(--sidebar-transition);
    }
}

/* Mobile: Sidebar overlay - Scoped to .mc-sidebar */
@media (max-width: 767px) {
    .mc-sidebar {
        transform: translateX(-100%);
        width: 280px;
        top: var(--menu-height, var(--page-container-padding-top));
    }
    
    .mc-sidebar.open {
        transform: translateX(0);
    }
    
    .mc-sidebar .mc-sidebar-close {
        display: block;
    }
    
    .page-container {
        margin-left: 0;
    }
}

/* Scrollbar Styling */
.mc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.mc-sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.mc-sidebar::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.mc-sidebar::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.dark-mode .mc-sidebar::-webkit-scrollbar-track,
[data-theme="dark"] .mc-sidebar::-webkit-scrollbar-track {
    background: var(--theme-bg-tertiary, #495057);
}

.dark-mode .mc-sidebar::-webkit-scrollbar-thumb,
[data-theme="dark"] .mc-sidebar::-webkit-scrollbar-thumb {
    background: var(--theme-text-muted, #6c757d);
}

.dark-mode .mc-sidebar::-webkit-scrollbar-thumb:hover,
[data-theme="dark"] .mc-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--theme-text-secondary, #adb5bd);
}

