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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    line-height: 1.6;
}

::-webkit-scrollbar {
    width: 3px;  /* 垂直滚动条宽度 */
    height: 3px; /* 水平滚动条高度 */
}

.container {
    width: 100%;
    min-height: 100vh;
    background: white;
}

.menu-toggle {
    display: none;
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.main-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* 侧边栏样式 - 固定宽度 */
.sidebar {
    width: 320px;
    background: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    background: #007bff;
    color: white;
}

.sidebar-header h2 {
    font-size: 18px;
}

/* 树形目录折叠功能样式 */
.article-tree {
    
}

.tree-container {
    font-size: 14px;
}

.tree-category-wrapper {
    margin: 0;
    padding: 0;
}

.tree-category {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border-bottom: 1px solid #e9ecef;
}

.tree-category:hover {
    background: #e9ecef !important;
}

.tree-category .category-name {
    padding: 10px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.toggle-icon {
    display: inline-block;
    width: 20px;
    font-size: 12px;
    color: #666;
    transition: transform 0.2s;
    text-align: center;
}

.folder-icon, .file-icon {
    font-size: 14px;
}

.cat-name-text {
    flex: 1;
    color: #2c3e50;
    font-size: 14px;
}

.category-count {
    font-size: 11px;
    color: #999;
    margin-left: 8px;
}

.category-content {
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 文章项样式 */
.tree-article {
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid #f0f0f0;
}

.tree-article .article-link {
    padding: 8px 10px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.tree-article .article-link:hover {
    background: #e9ecef;
}

.tree-article.active .article-link {
    background: #1174dd3d;
    color: white;
}

.tree-article.active .article-title-text {
    color: white;
}

.article-title-text {
    color: #495057;
    font-size: 13px;
    flex: 1;
}

.tree-article.active .article-title-text {
    color: white;
}

/* 内容区域样式 - 占满剩余宽度 */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-width: 0;
}

.article-detail {
    margin: 0 auto;
    width: 100%;
}

.article-header {
    border-bottom: 2px solid #007bff;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.article-header h1 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #333;
}

.article-info {
    font-size: 14px;
    color: #6c757d;
}

.article-info span {
    margin-right: 15px;
}

.article-image {
    margin: 20px 0;
    text-align: center;
}

.article-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 富文本内容样式 */
.article-body {
    font-size: 16px;
    color: #333;
    line-height: 1.8;
    width: 100%;
    overflow-x: auto;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.article-body h1 { font-size: 2em; }
.article-body h2 { font-size: 1.5em; }
.article-body h3 { font-size: 1.25em; }
.article-body h4 { font-size: 1em; }

.article-body p {
    margin-bottom: 1em;
}

.article-body ul,
.article-body ol {
    margin: 1em 0;
    padding-left: 2em;
}

.article-body li {
    margin: 0.5em 0;
}

.article-body blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 4px solid #007bff;
    background: #f8f9fa;
    font-style: italic;
}

.article-body pre {
    background: #f4f4f4;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.article-body code {
    background: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 1em 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.article-body th,
.article-body td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.article-body th {
    background: #f2f2f2;
    font-weight: 600;
}

.article-body a {
    color: #007bff;
    text-decoration: none;
}

.article-body a:hover {
    text-decoration: underline;
}

.article-body hr {
    margin: 2em 0;
    border: none;
    border-top: 1px solid #e9ecef;
}

.welcome-message {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-top: 10px;
}

.welcome-message h2 {
    color: #007bff;
}

.no-articles {
    text-align: center;
    padding: 30px;
    color: #6c757d;
}

.error-message {
    text-align: center;
    padding: 50px;
    color: #dc3545;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -320px;
        top: 0;
        z-index: 999;
        transition: left 0.3s ease;
        width: 280px;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .content {
        padding: 60px 15px 20px;
        width: 100%;
    }
    
    .article-header h1 {
        font-size: 22px;
    }
    
    .article-body {
        font-size: 15px;
    }
    
    .cat-name-text {
        font-size: 13px;
    }
    
    .article-title-text {
        font-size: 12px;
    }
    
    .toggle-icon {
        width: 16px;
        font-size: 10px;
    }
}

/* 首页分类板块样式 */
.categories-grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.category-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #e9ecef;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.category-card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-card-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.article-count {
    font-size: 12px;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 20px;
}

.category-card-body {
    padding: 10px 0;
}

.article-list-preview {
    list-style: none;
    margin: 0;
    padding: 0;
}

.preview-article-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.preview-article-item:hover {
    background: #f8f9fa;
}

.preview-dot {
    color: #007bff;
    font-size: 14px;
    margin-right: 10px;
    font-weight: bold;
}

.preview-title {
    flex: 1;
    font-size: 14px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-date {
    font-size: 12px;
    color: #999;
    margin-left: 10px;
}

.no-article {
    padding: 30px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.loading-categories {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .categories-grid-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-card-header h3 {
        font-size: 16px;
    }
    
    .preview-title {
        font-size: 13px;
    }
    
    .preview-date {
        font-size: 11px;
    }
}