/* 基本样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    /* 修复：始终显示滚动条，防止页面宽度跳动 */
    overflow-y: scroll;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏样式 */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-brand h1 {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.nav-links a:hover {
    background-color: #34495e;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 文章列表样式 */
.article-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.article-title {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 1rem;
}

/* 新增：文章描述样式 - 统一所有页面 */
.article-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
    margin: 8px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 修改：文章详情页描述样式 - 与作者信息行保持一致 */
.article-content .article-description {
    font-style: normal;
    color: #7f8c8d;
    text-align: center;
    margin: 0.3rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    background: transparent;
    padding: 0;
    border-left: none;
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

/* 修改文章列表关键字样式 */
.article-keywords {
    font-style: italic;
    color: #666; /* 改为灰色，而不是蓝色 */
    font-size: 14px; /* 减小字体大小 */
    margin-top: 5px;
}

/* 修改：文章详情页关键字样式 - 与作者信息行保持一致 */
.article-content .article-keywords {
    font-style: normal;
    color: #7f8c8d;
    text-align: center;
    margin: 0.3rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
    background: transparent;
    padding: 0;
    border-left: none;
}

/* 分页样式 */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.pagination button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.pagination button:hover:not(.active) {
    background: #f8f9fa;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* 新的分类导航样式 - 直线排列带下拉菜单 */
.category-navigation {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
    position: relative;
}

.nav-menu > li {
    position: relative;
    margin: 0;
}

.nav-menu > li > a {
    display: block;
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    border-right: 1px solid #eee;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
    background-color: #d6dbe0; /* 修改：导航栏目录背景用更深颜色标注 */
}

.nav-menu > li:first-child > a {
    border-left: 1px solid #eee;
}

.nav-menu > li > a:hover,
.nav-menu > li > a.active {
    background: #3498db;
    color: white;
}

.nav-menu > li > a.active {
    font-weight: bold;
}

/* 下拉菜单样式 */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    list-style: none;
    padding: 0;
    margin: 0;
}

.dropdown-menu.level-2 {
    top: 0;
    left: 100%;
    margin-left: 2px;
}

.nav-menu > li:hover > .dropdown-menu,
.dropdown-menu li:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    position: relative;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu a {
    display: block;
    padding: 12px 20px;
    color: #333;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
    position: relative;
    /* 修改：下拉菜单背景保持白色，不加深 */
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background: #e9ecef; /* 修改：悬停时背景更深 */
    color: #3498db;
}

.dropdown-menu a::after {
    content: "›";
    position: absolute;
    right: 15px;
    color: #999;
    font-size: 16px;
}

.dropdown-menu.level-2 a::after {
    content: "";
}

.article-count {
    font-size: 0.8em;
    color: #6c757d;
    margin-left: 5px;
}

.nav-menu > li > a.active .article-count,
.dropdown-menu a.active .article-count {
    color: rgba(255, 255, 255, 0.8);
}

.dropdown-menu a .article-count {
    color: #999;
}

/* 分类页面样式 */
.category-header {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.category-title {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 1rem;
}

.category-description {
    color: #7f8c8d;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.category-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1rem;
    color: #7f8c8d;
}

/* 编辑器分类选择样式 */
.category-selection {
    margin-top: 15px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.category-selection .form-group {
    margin: 0;
}

.category-selection select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    min-width: 150px;
    background: white;
}

/* 草稿相关样式 */
.draft-type-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

.draft-type-manual {
    background: #3498db;
    color: white;
}

.draft-type-auto {
    background: #95a5a6;
    color: white;
}

.draft-actions {
    margin-top: 10px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 移动设备分类按钮样式 */
.mobile-category-btn {
    display: none;
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 15px;
    font-size: 16px;
    width: 100%;
    text-align: center;
}

.mobile-category-btn:hover {
    background: #2980b9;
}

/* 移动设备分类导航样式 */
.mobile-category-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-category-item {
    margin-bottom: 0.5rem;
}

.mobile-category-link {
    display: block;
    padding: 12px 15px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
    font-weight: 500;
}

.mobile-category-link:hover,
.mobile-category-link.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.mobile-category-link .article-count {
    float: right;
    background: rgba(255,255,255,0.2);
    color: inherit;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
}

.mobile-subcategory {
    list-style: none;
    padding: 0;
    margin: 5px 0 0 15px;
    display: none;
}

.mobile-subcategory.show {
    display: block;
}

.mobile-subcategory-item {
    margin-bottom: 3px;
}

.mobile-subcategory-link {
    display: block;
    padding: 8px 12px;
    background: white;
    color: #555;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
    font-size: 14px;
}

.mobile-subcategory-link:hover,
.mobile-subcategory-link.active {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #bbdefb;
}

.mobile-subcategory-link .article-count {
    float: right;
    background: #f8f9fa;
    color: #6c757d;
    padding: 1px 4px;
    border-radius: 8px;
    font-size: 11px;
}

/* 移动设备目录模态框 */
.mobile-category-modal,
.mobile-toc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.mobile-category-content,
.mobile-toc-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.mobile-category-header,
.mobile-toc-header {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-category-close,
.mobile-toc-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-category-body,
.mobile-toc-body {
    padding: 1rem;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* 新增：全宽分类导航样式 - 延伸到页面两侧 */
.fullwidth-category-nav {
    background: #d6dbe0;
    margin: 0;
    padding: 0;
    width: 100%;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    max-width: 100vw;
    width: 100vw;
}

.fullwidth-category-nav .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.fullwidth-category-nav .desktop-category-nav {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 响应式设计 - 改进小屏幕下的显示 */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .nav-menu > li > a {
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .nav-menu > li:first-child > a {
        border-left: none;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f9fa;
        margin-left: 20px;
    }
    
    .dropdown-menu.level-2 {
        position: static;
        margin-left: 20px;
    }
    
    .category-selection {
        flex-direction: column;
        align-items: center;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    .article-keywords {
        font-size: 13px;
    }
    
    .article-description {
        -webkit-line-clamp: 3;
        font-size: 13px;
    }
    
    .mobile-category-btn {
        display: block;
    }
    
    /* 修改：在移动端隐藏整个全宽分类导航 */
    .fullwidth-category-nav {
        display: none;
    }
    
    .draft-actions {
        flex-direction: column;
    }
    
    .draft-actions .btn-small {
        width: 100%;
    }
    
    /* 新增：移动端隐藏关键字和描述 - 全局规则 */
    .article-keywords,
    .article-description {
        display: none !important;
    }
    
    /* 确保在文章详情页也隐藏 */
    .article-content .article-keywords,
    .article-content .article-description {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .mobile-category-btn {
        display: none;
    }
    
    .desktop-category-nav {
        display: block;
    }
}