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

:root {
    --primary-color: #4a90e2;
    --secondary-color: #27ae60;
    --accent-color: #f39c12;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --error-color: #e74c3c;
    --mint-green: #2eeda1;
    --bg-dark: #1c1c1c;
    --bg-darker: #242424;
    --border-color: #2a2a2a;
    --text-color: #ffffff;
    --text-secondary: #aaaaaa;
    --transition-speed: 0.3s;
    --transition-easing: ease-in-out;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-dark);
}

/* 侧边栏容器 */
#sidebar-container {
    width: 260px;
    min-width: 260px;
    position: relative;
    z-index: 10;
}

.sidebar {
    width: 250px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav {
    background-color: #1c1c1c;
    position: fixed;
    top: 20px;
    left: 20px;
    bottom: 20px;
    border-radius: 12px;
    width: 220px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    position: relative;
}

.logo h2 {
    color: var(--mint-green);
    font-size: 1.3rem;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    position: relative;
}

.nav-menu {
    padding: 15px 0;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section h3 {
    padding: 6px 20px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    position: relative;
}

.nav-menu ul {
    list-style: none;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s;
    position: relative;
    z-index: 5;
}

.nav-menu a:hover {
    background-color: rgba(46, 237, 161, 0.1);
    color: var(--mint-green);
}

.nav-menu a.active {
    background-color: rgba(46, 237, 161, 0.2);
    color: var(--mint-green);
    border-left: 3px solid var(--mint-green);
}

.nav-menu a i {
    margin-right: 10px;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* 主内容区域 */
.main-content {
    margin-left: 250px;
    padding: 20px;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

header {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
    position: relative;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--text-color);
}

header p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* 用户信息样式 */
.user-info {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--mint-green);
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.user-dropdown {
    position: relative;
}

.logout-btn {
    background-color: transparent;
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.logout-btn:hover {
    background-color: var(--danger-color);
    color: white;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        overflow: visible;
    }
    
    .sidebar .logo h2 {
        display: none;
    }
    
    .nav-menu a span, .nav-section h3 {
        display: none;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .user-info {
        position: relative;
        margin-top: 20px;
        justify-content: flex-end;
    }
}

/* 错误状态样式 */
.sidebar-error {
    color: #ff4d4d;
    text-align: center;
    padding: 20px;
    font-size: 0.9rem;
}

/* 侧边栏子菜单样式 */
.nav-menu li.has-submenu {
    position: relative;
}

.nav-menu li.has-submenu > a:after {
    content: '\f107';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    margin-left: 5px;
    transition: transform 0.3s;
    position: absolute;
    right: 15px;
}

.nav-menu li.has-submenu.expanded > a:after {
    transform: rotate(180deg);
}

.nav-menu li.has-submenu.expanded .submenu {
    max-height: 500px !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin-top: 5px;
    margin-bottom: 8px;
    padding-left: 20px;
}

.submenu {
    max-height: 0;
    overflow: hidden;
    list-style: none;
    padding-left: 20px;
    margin: 0;
    transition: max-height 0.3s ease-out;
}

.nav-menu li.has-submenu.expanded .submenu {
    max-height: 1000px;
    padding-bottom: 8px;
}

.submenu li {
    margin: 5px 0;
}

.submenu li a {
    padding: 8px 10px;
    font-size: 0.9em;
    opacity: 0.8;
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 4px;
    position: relative;
    z-index: 5;
}

.submenu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.submenu li a.active-subitem {
    color: var(--mint-green) !important;
    font-weight: bold !important;
    opacity: 1 !important;
    background-color: rgba(46, 237, 161, 0.1);
    border-radius: 4px;
}

.submenu li a i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

/* 导出通知样式 */
.export-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 20px;
    width: 320px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-30px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    border-left: 4px solid var(--success-color);
}

.export-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.notification-content {
    display: flex;
    align-items: center;
    color: var(--text-primary);
    font-weight: 500;
}

.notification-content i {
    font-size: 20px;
    margin-right: 12px;
    flex-shrink: 0;
}

.notification-content.success {
    color: var(--success-color);
}

.notification-content.error {
    color: var(--error-color);
}

.notification-content span {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

/* 侧边栏切换按钮样式 */
.toggle-sidebar-btn {
    position: absolute;
    top: 20px;
    right: 10px;
    background-color: rgba(46, 237, 161, 0.1);
    color: var(--mint-green);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 100;
}

.toggle-sidebar-btn:hover {
    background-color: rgba(46, 237, 161, 0.3);
    transform: scale(1.1);
}

.toggle-sidebar-btn i {
    font-size: 14px;
}

/* 收起侧边栏样式 */
.sidebar.collapsed {
    width: 80px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .logo h2 {
    opacity: 0;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    visibility: hidden;
}

.sidebar.collapsed .nav {
    width: 60px;
    left: 10px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .nav-menu a span {
    opacity: 0;
    transition: opacity 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    visibility: hidden;
}

.sidebar.collapsed .nav-section h3 {
    opacity: 0;
    transition: opacity 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    visibility: hidden;
}

.sidebar.collapsed .nav-menu li.has-submenu:hover .submenu {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar.collapsed .nav-menu li.has-submenu > a:after {
    display: none;
}

.sidebar.collapsed .nav-menu li.has-submenu.expanded .submenu {
    max-height: none !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.sidebar.collapsed .submenu {
    position: absolute;
    left: 60px;
    top: 0;
    background-color: var(--bg-darker);
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    padding: 10px;
    z-index: 100;
    min-width: 180px;
    transform: translateX(10px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed .submenu li a span {
    display: inline-block;
}

/* 主内容区域适应折叠侧边栏 */
.main-content.expanded {
    margin-left: 80px;
    transition: margin-left 0.3s ease-in-out;
}

.nav-menu a span {
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    visibility: visible;
    position: relative;
}

/* 过渡状态样式 */
.sidebar.transitioning {
    pointer-events: none; /* 过渡期间禁止交互 */
}

.main-content.transitioning {
    pointer-events: none; /* 过渡期间禁止交互 */
}

/* 临时高亮样式 */
.nav-menu a.temp-active {
    background-color: rgba(46, 237, 161, 0.15);
    color: var(--mint-green);
}

/* 收起状态下悬停整个侧边栏时的样式 */
.sidebar.collapsed:hover {
    /* 不自动展开，但可以加入一些视觉提示 */
    box-shadow: 0 0 15px rgba(46, 237, 161, 0.3);
}

/* 确保子菜单项在展开后是可点击的 */
.sidebar:not(.collapsed) .nav-menu a {
    pointer-events: auto;
}

/* 确保子菜单项在收起状态下悬停区域足够大 */
.sidebar.collapsed .nav-menu a {
    padding: 15px 20px;
    margin: 5px 0;
}

/* 增强收起状态下的视觉提示 */
.sidebar.collapsed .nav-menu a:hover {
    background-color: rgba(46, 237, 161, 0.15);
} 