/* Fixed Sidebar Layout */
.sidebar-wrapper {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    background: #f8f9fa !important;
    border-right: 1px solid #dee2e6 !important;
    overflow-y: auto !important;
    z-index: 1000 !important;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1) !important;
    transition: width 0.3s ease !important;
}

/* Minimized sidebar state - more specific selectors */
#sidebar.sidebar-wrapper.minimized {
    width: 60px !important;
    padding-right: 8px !important;
}

#sidebar.sidebar-wrapper.minimized .sidebar-header img {
    display: none !important;
}

#sidebar.sidebar-wrapper.minimized .sidebar-header {
    justify-content: center !important;
    padding: 0.5rem !important;
}

#sidebar.sidebar-wrapper.minimized .sidebar-toggle-btn {
    margin: 0 !important;
}

#sidebar.sidebar-wrapper.minimized .sidebar-body {
    padding: 0.5rem !important;
    padding-right: 8px !important;
}

.sidebar-wrapper.minimized .nav-link {
    padding: 0.75rem 0.5rem !important;
    text-align: center !important;
}

.sidebar-wrapper.minimized .nav-link span,
.sidebar-wrapper.minimized .dropdown > a span {
    display: none !important;
}

.sidebar-wrapper.minimized .nav-link i {
    margin-right: 0 !important;
    width: 100% !important;
    font-size: 1.2rem !important;
}

.sidebar-wrapper.minimized .dropdown > a img {
    margin-right: 0 !important;
}

.sidebar-wrapper.minimized .dropdown-menu {
    position: absolute !important;
    left: 100% !important;
    top: 0 !important;
    width: 200px !important;
    margin-left: 0.5rem !important;
}

.sidebar-wrapper.minimized .sidebar-toggle-btn i {
    transform: rotate(180deg) !important;
}

/* Sidebar header with toggle button */
.sidebar-header {
    padding: 1rem !important;
    background: #fff !important;
    border-bottom: 1px solid #dee2e6 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    min-height: 60px !important;
}

.sidebar-toggle-btn {
    padding: 0.25rem 0.5rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.3s ease !important;
    flex-shrink: 0 !important;
    z-index: 1001 !important;
}

.sidebar-toggle-btn:hover {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
}

.sidebar-body {
    padding: 1rem !important;
}

/* Main content adjustment - more specific selectors */
.container-fluid .row .main-content {
    margin-left: 280px !important; /* Same as sidebar width */
    width: calc(100% - 280px) !important;
    min-height: 100vh !important;
    background: #fff !important;
    padding: 1rem !important;
    transition: margin-left 0.3s ease, width 0.3s ease !important;
}

/* Main content when sidebar is minimized */
.container-fluid .row .main-content.sidebar-minimized {
    margin-left: 60px !important;
    width: calc(100% - 60px) !important;
}

/* Ensure the main content takes full width when sidebar is not present */
.container-fluid .row:not(:has(.sidebar-wrapper)) .main-content {
    margin-left: 0 !important;
    width: 100% !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar-wrapper {
        width: 100% !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s ease !important;
    }
    
    .sidebar-wrapper.show {
        transform: translateX(0) !important;
    }
    
    .container-fluid .row .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Mobile toggle button */
    .sidebar-toggle {
        position: fixed !important;
        top: 1rem !important;
        left: 1rem !important;
        z-index: 1001 !important;
        background: #007bff !important;
        color: white !important;
        border: none !important;
        padding: 0.5rem !important;
        border-radius: 0.25rem !important;
        cursor: pointer !important;
    }
}

/* Sidebar navigation styling */
.sidebar-wrapper .nav-link {
    color: #495057 !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
    margin-bottom: 0.25rem !important;
    transition: all 0.2s ease !important;
}

.sidebar-wrapper .nav-link:hover {
    background-color: #e9ecef !important;
    color: #212529 !important;
}

.sidebar-wrapper .nav-link.active {
    background-color: #007bff !important;
    color: white !important;
}

.sidebar-wrapper .nav-link i {
    margin-right: 0.5rem !important;
    width: 1.25rem !important;
    text-align: center !important;
}

/* Dropdown styling */
.sidebar-wrapper .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    margin-top: 0.25rem !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.125rem 0.25rem rgba(0,0,0,0.075) !important;
}

/* User profile section */
.sidebar-wrapper .dropdown > a {
    padding: 0.75rem 1rem !important;
    border-radius: 0.375rem !important;
    transition: all 0.2s ease !important;
}

.sidebar-wrapper .dropdown > a:hover {
    background-color: #e9ecef !important;
}

.sidebar-wrapper .dropdown > a img {
    margin-right: 0.5rem !important;
}

/* Scrollbar styling */
.sidebar-wrapper::-webkit-scrollbar {
    width: 6px !important;
}

.sidebar-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.sidebar-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1 !important;
    border-radius: 3px !important;
}

.sidebar-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8 !important;
}
