/* ERP风格侧边栏样式 - 顶部导航全宽，侧边栏在下方 */

/* 页面布局容器 */
.erp-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 主内容区容器 - 在顶部导航下方 */
.erp-main-container {
    display: flex;
    flex: 1;
    overflow: visible;
    position: relative;
}

/* 侧边栏容器 */
.erp-sidebar {
    width: 200px;
    background-color: #f8f9fa;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

/* 侧边栏折叠状态 */
.erp-sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

/* 侧边栏展开/收起按钮 - 固定定位 */
/* z-index: 20 必须小于模态框的 z-50，避免遮挡弹窗 */
.erp-sidebar-toggle {
    position: fixed;
    left: 200px;
    top: 40%;
    transform: translateY(-50%);
    width: 10px;
    height: 60px;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to right, #e0e0e0, #f5f5f5);
    border: 1px solid #ccc;
    border-left: none;
    border-radius: 0 4px 4px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 1px 0 3px rgba(0,0,0,0.1);
}

.erp-sidebar-toggle:hover {
    background: linear-gradient(to right, #d0d0d0, #e8e8e8);
    width: 12px;
}

.erp-sidebar-toggle i {
    font-size: 10px;
    color: #555;
    transition: transform 0.3s ease;
}

/* 侧边栏收起时按钮位置 */
.erp-sidebar-toggle.collapsed {
    left: 0;
}

.erp-sidebar-toggle.collapsed i {
    transform: rotate(180deg);
}

/* 右侧内容区域需要让按钮可见 */
.erp-content {
    flex: 1;
    overflow-y: auto;
    background-color: #f8f9fa;
    position: relative;
    z-index: 1;
}

/* ===== ERP 嵌入模式：隐藏商城 header 和 sidebar，内容区全宽 ===== */
body.erp-mode #header-container,
body.erp-mode .erp-sidebar,
body.erp-mode .erp-sidebar-toggle {
    display: none !important;
}
body.erp-mode .erp-content {
    width: 100% !important;
    max-width: 100% !important;
}

/* 菜单分组容器 */
.erp-sidebar-section {
    margin-bottom: 1px;
}

/* 菜单分组标题 */
.erp-sidebar-title {
    padding: 10px 16px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    background-color: #e9ecef;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    user-select: none;
}

.erp-sidebar-title:hover {
    background-color: #dde2e8;
}

/* 分组展开/收起图标 */
.erp-sidebar-title .toggle-icon {
    transition: transform 0.2s ease;
    font-size: 10px;
    color: #666;
}

/* 分组收起时图标旋转 */
.erp-sidebar-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* 子菜单容器 */
.erp-sidebar-subitems {
    display: block !important;
    overflow: hidden !important;
}

/* 分组收起时隐藏子菜单 */
.erp-sidebar-section.collapsed .erp-sidebar-subitems {
    display: none !important;
}

/* 菜单项 */
.erp-menu-item {
    padding: 9px 24px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    color: #333;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.erp-menu-item:hover {
    background-color: #f1f3f5;
    padding-left: 28px;
    color: #2c3e50;
}

/* 活跃菜单项 */
.erp-menu-item.active {
    background-color: #a5c8ff !important;
    font-weight: 500;
    border-left: 3px solid #4a6fa5;
    color: #2c3e50;
}

/* 次级菜单项样式 */
.erp-menu-item.secondary {
    color: #666;
    padding-left: 16px;
}

.erp-menu-item.secondary:hover {
    padding-left: 20px;
}

/* 菜单图标 */
.erp-menu-item i {
    width: 16px;
    text-align: center;
}

/* 右侧内容区域 */
.erp-content {
    flex: 1;
    overflow-y: auto;
    background-color: #f8f9fa;
}

/* 滚动条美化 */
.erp-sidebar::-webkit-scrollbar {
    width: 6px;
}

.erp-sidebar::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.erp-sidebar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.erp-sidebar::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 响应式适配 */
@media (max-width: 768px) {
    .erp-sidebar {
        width: 160px;
    }
    
    .erp-sidebar-toggle {
        left: 160px;
    }
    
    .erp-menu-item {
        padding: 9px 16px;
        font-size: 13px;
    }
    
    .erp-menu-item:hover {
        padding-left: 20px;
    }
}