/* ===== Sidebar组件样式 ===== */
/* 职责：定义Sidebar组件的视觉外观和布局 */
/* 与全局样式系统完全分离，使用CSS变量和工具类 */

/* === 组件主容器 === */
.sidebar-component {
    /* 固定定位 - 旧版样式 */
    position: fixed;
    left: 0;
    top: calc(60px + 10px); /* 往上移动：从20px改为10px */
    
    /* 尺寸 */
    width: 230px; /* 旧版固定宽度 */
    height: calc(100vh - 60px - 10px); /* 相应调整高度计算 */
    
    /* 背景和边框 - 旧版样式 */
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-right: none; /* 旧版无边框 */
    
    /* 层级和滚动 */
    z-index: 1000;
    overflow: hidden; /* 修复：隐藏滚动条 */
    
    /* 保留平滑的宽度过渡动画 */
    transition: width 0.3s ease;
}

/* === 收起状态 === */
body.sidebar-collapsed .sidebar-component {
    width: 60px; /* 旧版收起宽度 */
    overflow: hidden; /* 修复：收起状态下也隐藏滚动条 */
}

/* === 导航容器 === */
.sidebar-nav {
    /* 布局 */
    display: flex;
    flex-direction: column;
    height: 100%;
    
    /* 内边距 */
    padding: var(--spacing-md) 0;
    
    /* 修复：防止内容溢出 */
    overflow: hidden; 
    width: 100%;
}

/* === 导航区域 === */
.nav-section {
    /* 区域间距 */
    margin-bottom: var(--spacing-lg);
}

/* === AI工作台区域 - 取消下边距 === */
.ai-nav {
    margin-bottom: 0 !important; /* 取消16px的下边距 */
}

/* === 导航链接 === */
.nav-link {
    /* 布局 */
    display: flex;
    align-items: center;
    text-decoration: none;
    
    /* 尺寸 - 旧版样式 */
    height: 52px;
    margin: 4px 6px; /* 旧版外边距 */
    padding: 15px 15px 15px 13px; /* 旧版内边距 */
    
    /* 文字 - 旧版样式 */
    color: #333; /* 旧版固定颜色 */
    font-size: 15px; /* 旧版字体大小 */
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    
    /* 边框和圆角 - 旧版8px圆角 */
    border-radius: 8px;
    
    /* 防止文字选择 */
    user-select: none;
    
    /* 移除鼠标悬停时的手指指针 */
    cursor: default;
}

/* === 收起状态下的导航链接 === */
body.sidebar-collapsed .nav-link {
    /* 居中对齐 */
    justify-content: center;
    
    /* 内边距调整 - 旧版样式 */
    padding: 15px 0; /* 旧版收起状态下保持15px内边距 */
    margin: 4px 6px; /* 旧版外边距 */
    
    /* 修复：防止水平溢出 */
    width: 52px; /* 匹配收起状态宽度 */
    min-width: 52px;
    max-width: 52px;
}

/* === 导航图标 === */
.nav-icon {
    /* 尺寸 */
    width: 24px;
    height: 24px;
    font-size: var(--font-size-lg);
    
    /* 布局 */
    margin-right: var(--spacing-md);
    text-align: center;
    transition: none !important; /* 强制取消图标过渡动画 */
}

/* === AI图标容器 === */
.ai-icon-container {
    /* 尺寸 */
    width: 24px;
    height: 24px;
    
    /* 布局 */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 强制取消所有过渡动画，避免回弹效果 */
    transition: none !important;
}

/* === AI图标 === */
.ai-icon {
    /* 文字样式 */
    font-style: normal;
    font-weight: var(--font-weight-bold);
    font-size: 18px;
    line-height: 18px;
    
    /* 紫色渐变 */
    background: linear-gradient(90deg, #7c3aed 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* === 资讯下方的分隔线 - 往上移动（AI工作台区域整体上移） === */
.main-nav + .nav-divider {
    margin-top: 4px !important; /* 往上移动，减少上方间距 */
    margin-bottom: 4px !important; /* 往下移动，减少下方间距 */
}

/* === AI工作台下方的分隔线 - 继续往上移动（进一步缩小间距） === */
.ai-nav-link + .nav-divider {
    margin-top: 1px !important; /* 进一步减少上边距，让分割线更靠近AI工作台 */
    margin-bottom: 4px !important; /* 保持下边距不变 */
}

/* === AI工作台选项间距调整 === */
.ai-nav-link {
    margin-top: 4px !important; /* 确保与上方分割线间距一致 */
    margin-bottom: 4px !important; /* 确保与下方分割线间距一致 */
}

/* === AI工作台文字位置调整 - 往右侧移动 === */
.ai-nav-link .nav-text {
    margin-left: 8px; /* 文字往右侧移动8px */
}

/* === 导航文字 === */
.nav-text {
    /* 白色空间 */
    white-space: nowrap;
    opacity: 1;
    
    /* 强制取消所有过渡动画，避免回弹效果 */
    transition: none !important;
}

/* === 收起状态下的文字隐藏 === */
body.sidebar-collapsed .nav-icon,
body.sidebar-collapsed .ai-icon-container {
    margin-right: 0;
    transition: none !important; /* 强制取消图标margin动画 */
}

body.sidebar-collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
    flex: 0; /* 修复：防止文字占用空间 */
    transition: none !important; /* 强制取消文字隐藏动画 */
}



/* === 悬停状态 === */
.nav-link:hover {
    background: rgba(0, 0, 0, 0.05); /* 悬浮阴影效果 */
    /* 移除transform效果，避免文字抖动 */
}

body.sidebar-collapsed .nav-link:hover {
    background: rgba(0, 0, 0, 0.05); /* 收起状态下的悬浮阴影 */
    /* 移除transform效果，避免文字抖动 */
}

/* === 激活状态 === */
.nav-link.active {
    background: rgba(255, 107, 107, 0.15); /* 激活状态背景 */
    color: #ff4500; /* 激活状态文字颜色 */
    font-weight: var(--font-weight-semibold);
    /* 移除transform效果，避免文字抖动 */
}

body.sidebar-collapsed .nav-link.active {
    background: rgba(255, 107, 107, 0.15); /* 收起状态下的激活背景 */
    color: #ff4500; /* 收起状态下的激活文字颜色 */
    font-weight: var(--font-weight-semibold);
    /* 移除transform效果，避免文字抖动 */
}

/* === 分隔线 === */
.nav-divider {
    /* 尺寸 */
    height: 1px;
    
    /* 样式 */
    background: var(--divider-color, var(--border-color));
    
    /* 间距 - 按照旧版标准调整为10px */
    margin: 10px; /* 按照旧版标准，上下左右各10px间距 */
    
    /* 圆角（可选） */
    border-radius: var(--border-radius-sm);
}

/* === 页脚 === */
.sidebar-footer {
    /* 移除 margin-top: auto，避免页脚被推到最底部 */
    margin-top: 5px; /* 固定上边距，与上方分割线保持合理距离 */
    
    /* 内边距 - 大幅减少上边距，让备案信息更靠近分割线 */
    padding: 8px var(--spacing-lg) 12px; /* 上边距8px，左右边距保持，下边距12px */
}

/* === 收起状态下隐藏页脚 === */
body.sidebar-collapsed .sidebar-footer {
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding: 0;
    margin: 0;
}

/* === 页脚内容 === */
.footer-content {
    /* 文字样式 */
    font-size: var(--font-size-xs);
    color: var(--text-light);
    
    /* 行高 */
    line-height: var(--line-height-relaxed);
}

/* === 页脚链接 === */
.footer-link {
    /* 文字 */
    color: inherit;
    text-decoration: none;
    
    /* 移除鼠标悬停时的手指指针 */
    cursor: default;
}

.footer-link:hover {
    color: var(--text-secondary);
    text-decoration: underline;
}

/* === 链接分隔符 === */
.link-separator {
    margin: 0 var(--spacing-xs);
}

/* === 主体内容边距（根据侧边栏状态调整） === */
/* 展开状态 */
body.sidebar-expanded main,
body.sidebar-expanded .page-wrapper {
    margin-left: 230px; /* 旧版展开状态边距 */
    transition: margin-left 0.3s ease; /* 旧版过渡时间 */
}

/* 收起状态 */
body.sidebar-collapsed main,
body.sidebar-collapsed .page-wrapper {
    margin-left: 60px; /* 旧版收起状态边距 */
    transition: margin-left 0.3s ease; /* 旧版过渡时间 */
}

/* === 响应式设计 === */
@media (max-width: 768px) {
    /* 移动端默认收起 */
    .sidebar-component {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
    }
    
    body.sidebar-expanded .sidebar-component {
        transform: translateX(0);
    }
    
    body.sidebar-collapsed main {
        margin-left: 0;
    }
    
    /* 移动端展开时覆盖整个屏幕 */
    .sidebar-component {
        width: var(--sidebar-width);
    }
}

@media (max-width: 480px) {
    .sidebar-component {
        width: 100vw;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
    }
    
    body.sidebar-expanded main {
        margin-left: 0;
    }
}