* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #f5f7fb;
}

/* 移动端菜单按钮 */
.menu-toggle {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1000;
    width: 35px;
    height: 35px;
    background: #2c3e50;
    border: none;
    border-radius: 5px;
    color: white;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: none;
    align-items: center;
    justify-content: center;
}

/* 侧边栏容器 - 使用 flex 列布局，确保内容区可滚动，用户区固定底部 */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #fff;
    z-index: 1000;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止整体滚动，内部菜单区域独立滚动 */
}

/* 侧边栏头部 - 固定顶部区域 */
.sidebar-header {
    flex-shrink: 0;
    padding: 20px 16px 12px 16px;
    border-bottom: 1px solid rgb(161 142 142 / 34%);
    margin-bottom: 0;
    display: flex;
    gap: 10px;
}

.sidebar-header h3 {
    font-size: 1.1rem;
    margin: 0 0 4px 0;
    font-weight: 600;
}

.sidebar-header p {
    font-size: 0.7rem;
    opacity: 0.7;
    margin: 0;
}

/* 菜单包裹层 - 可滚动区域，占据剩余空间 */
.sidebar-menu-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0; /* flex 限制溢出 */
}

/* 侧边栏菜单 */
.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-bottom: 120px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 3px solid #4a90e2;
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

/* 用户信息区域 - 始终固定在底部 */
.sidebar-user {
    flex-shrink: 0;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(180deg, #16213e 0%, #1a1a2e 100%);
    margin-top: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.12);
    border-radius: 8px;
    padding: 6px 10px;
    color: #ffffff;
    transition: background 0.2s;
}

.user-info:hover {
    background: rgba(255,255,255,0.2);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-top: 0;
    border: 1px solid rgba(255,255,255,0.3);
}

.user-details {
    flex: 1;
    min-width: 0;  /* 允许flex子项收缩到内容宽度以下 */
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
}

.user-email {
    font-size: 11px;
    opacity: 0.7;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ddd;
}

.user-actions {
    display: flex;
    gap: 10px;
}

.user-actions a {
    flex: 1;
    text-align: center;
    padding: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s;
}

.user-actions a:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* 右侧主内容区 */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
    padding: 20px;
    transition: margin-left 0.3s ease;
}

/* 移动端样式 */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 60px 12px 20px 12px;
    }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        display: none;
    }
    
    .overlay.show {
        display: block;
    }
    
    /* 手机端二级菜单调整 */
    .sub-menu {
        padding-left: 40px;
    }
}

/* 桌面端优化 */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
    }
}

/* 内容卡片样式 */
.content-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* 滚动条美化 - 菜单区域滚动条 */
.sidebar-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu-wrapper::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar-menu-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

/* 提示信息动画 */
.alert {
    border-radius: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 二级菜单样式 */
.menu-parent {
    position: relative;
    border-top: 1px solid #3e405324;
}

.menu-toggle-sub {
    display: flex !important;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.menu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.menu-parent.open .menu-arrow {
    transform: rotate(180deg);
}

.sub-menu {
    list-style: none;
    padding-left: 48px;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.menu-parent.open .sub-menu {
    max-height: 300px;
}

.sub-menu li {
    margin-bottom: 4px;
}

.sub-menu a {
    padding: 10px 0 !important;
    font-size: 0.85rem !important;
    color: rgba(255,255,255,0.7) !important;
}

.sub-menu a:hover,
.sub-menu a.active {
    color: #fff !important;
    background: none !important;
    border-left: none !important;
}

/* 分页样式 */
.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-left: 0;
    list-style: none;
    align-items: center;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: block;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
}

.page-link:hover {
    background: #e9ecef;
}

.page-item.active .page-link {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

.page-item.disabled .page-link {
    color: #999;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .page-link {
        padding: 6px 10px;
        font-size: 12px;
    }
}

/* 表格行悬停效果 */
tr:hover {
    background: #e3e3e3;
}

/* 遮罩层（移动端共用） */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.overlay.show {
    display: block;
}