/* 基础样式重置与全局设置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    margin: 0;
    padding: 0;
    min-height: 100vh; /* 确保body至少占满视口高度 */
    display: flex;
    flex-direction: column; /* 使body成为flex容器 */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

/* 容器布局核心样式 */
.container {
    display: flex;
    flex-direction: column;
    flex: 1; /* 让容器填充body的剩余空间 */
    width: 100%;
    padding: 0;
}

/* 内容容器：包裹侧边栏和主内容 */
.content-container {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    padding: 20px;
    gap: 20px;
    box-sizing: border-box;
    transition: all 0.5s ease;
    position: relative;
    flex-grow: 1;
}

/* 初始状态：菜单居中 */
.content-container.initial-state {
    justify-content: center;
}

/* 初始状态隐藏主内容区 */
.content-container.initial-state .main-content {
    display: none;
}

/* 遮罩层样式 */
.content-container.has-overlay::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    transition: opacity 0.3s ease;
}

/* 侧边栏样式（合并搜索功能） */
.left-sidebar {
    width: 400px;
    height: 600px; /* 固定高度 - 电脑版 */
    overflow-y: auto; /* 内容溢出时垂直滚动 */
    background-color: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    box-sizing: border-box;
    transition: all 0.3s ease;
    z-index: 20;
    overflow-x: hidden;
}

.left-sidebar h3 {
    color: #2c3e50;
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    border-radius: 4px;
}

.left-sidebar ul {
    list-style: none;
    padding-left: 0;
}

.left-sidebar li {
    cursor: pointer;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    color: #34495e;
}

.left-sidebar li:hover {
    background-color: #e1f0fa;
    transform: translateX(5px);
}

.left-sidebar li.active {
    background-color: #3498db;
    color: white;
    font-weight: 500;
}

/* 搜索框样式 */
.search-container {
    padding: 0 0 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-results {
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
    text-align: right;
}

/* 搜索高亮样式 */
.highlight {
    background-color: #8de4ce;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: bold;
}

/* 当前选择项长条样式 */
.current-selection {
    display: none;
    background-color: #3498db;
    color: white;
    border-radius: 8px;
    margin-bottom: 15px;
    cursor: pointer;
    font-size: 1rem;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 15;
    width: 100%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.current-selection .arrow {
    transition: transform 0.3s ease;
}

/* 主内容区样式 */
.main-content {
    flex: 1;
    min-width: 300px;
    max-width: calc(100% - 420px);
    height: 600px; /* 固定高度 - 电脑版 */
    overflow-y: auto; /* 独立滚动区域 */
    background-color: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    box-sizing: border-box;
    transition: all 0.5s ease;
    opacity: 0;
    transform: translateY(20px);
    z-index: 5;
    overflow-x: hidden;
}

/* 移动端返回按钮样式 */
.mobile-back-btn {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background-color: #3498db;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 40px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.mobile-back-btn:hover {
    background-color: #2980b9;
    transform: scale(1.05);
}

/* 内容显示时的动画 */
.main-content.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 内容项显示控制与动画 */
.content-item {
    display: none;
}

.content-item.active {
    display: block;
    animation: fadeIn 0.4s ease;
}

.content-item h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* 文本内容样式 */
.text-content {
    line-height: 1.8;
}

.text-content p {
    margin-bottom: 15px;
}

.text-content ul {
    margin-bottom: 15px;
    padding-left: 25px;
}

/* 表格样式 */
.asset-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.asset-table th, .asset-table td {
    border: 1px solid #ddd;
    padding: 8px 12px;
    text-align: left;
    font-family: inherit;
}

.asset-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.asset-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.asset-table tr:hover {
    background-color: #f1f1f1;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 页脚样式调整 - 关键部分 */
footer {
    width: 100%;
    margin-top: auto; /* 强制页脚在页面底部 */
    padding: 20px 0;
    background-color: #f1f1f1;
    box-sizing: border-box;
}

/* 导航栏样式补充 - 防止顶部空白 */
.nav-container {
    width: 100%;
    padding: 0;
    margin: 0;
}

/* 响应式设计 - 移动端 */
@media (max-width: 768px) {
    /* 移动端整体滑动设置 */
    body {
        overflow-x: hidden;
    }
    
    .content-container {
        flex-direction: column;
        padding: 15px;
        max-height: none; /* 移除最大高度限制，允许整体滑动 */
        height: auto;
    }
    
    /* 侧边栏样式调整 */
    .left-sidebar {
        width: 100%;
        height: auto; /* 自动高度，内容决定高度 */
        max-height: none; /* 移除最大高度限制 */
        margin-bottom: 15px;
        box-shadow: none;
    }
    
    .left-sidebar.collapsed {
        max-height: 120px;
        overflow: hidden;
        padding-bottom: 15px;
    }
    
    .left-sidebar.collapsed ul {
        display: none;
    }
    
    .left-sidebar:not(.collapsed) {
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
    
    .left-sidebar:not(.collapsed) .current-selection .arrow {
        transform: rotate(180deg);
    }
    
    /* 主内容区样式调整 */
    .main-content {
        width: 100%;
        max-width: 100%;
        height: auto; /* 自动高度，内容决定高度 */
        max-height: none; /* 移除最大高度限制 */
        padding: 20px 15px;
        margin-top: 5px;
        margin-bottom: 30px; /* 底部留出空间 */
    }
    
    /* 移动端详情视图 */
    .content-container.viewing-detail {
        padding-top: 60px; /* 为固定的返回按钮留出空间 */
    }
    
    .content-container.viewing-detail .left-sidebar {
        display: none;
    }
    
    /* 显示返回按钮 */
    .mobile-back-btn {
        display: block;
    }
    
    /* 表格在移动端的响应式处理 */
    .asset-table {
        min-width: 480px; /* 确保表格可以横向滚动 */
    }
    
    .text-content {
        overflow-x: auto; /* 允许内容区域横向滚动 */
    }
    
    .current-selection {
        display: flex;
    }
}

/* 电脑版样式保持不变 */
@media (min-width: 769px) {
    .current-selection,
    .content-container.has-overlay::after,
    .mobile-back-btn {
        display: none !important;
    }
}
