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

body {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

/* 主容器 */
.wiki-container {
    width: 100%;
    margin: 0;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 头部样式 */
.wiki-header {
    background-color: #2c3e50;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wiki-header h1 {
    font-size: 24px;
    font-weight: normal;
}

/* 搜索框样式 */
.search-box {
    display: flex;
    align-items: center;
}

.search-box input {
    padding: 8px 12px;
    border: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: 250px;
}

.search-box button {
    padding: 8px 15px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-size: 14px;
}

.search-box button:hover {
    background-color: #2980b9;
}

/* 主体内容布局 */
.wiki-main {
    display: flex;
    min-height: calc(100vh - 60px);
}

/* 左侧目录树样式 */
.wiki-sidebar {
    width: 350px;
    background-color: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 24px;
    overflow-y: auto;
    flex-shrink: 0;
    flex-grow: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.wiki-sidebar:hover {
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
}

.wiki-sidebar h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #1e293b;
    border-bottom: 2px solid #6366f1;
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wiki-sidebar h3::before {
    content: "📚";
    font-size: 20px;
}

/* 目录树样式 */
.category-tree {
    list-style: none;
    padding-left: 0;
}

.category-tree ul {
    list-style: none;
    padding-left: 0;
    margin-top: 8px;
}

.category-item {
    margin: 3px 0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.category-item:hover {
    background-color: rgba(99, 102, 241, 0.05);
}

.category-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6366f1;
    font-size: 14px;
    font-weight: 600;
    margin-right: 8px;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.toggle-icon:hover {
    color: #4f46e5;
    transform: scale(1.1);
}

.toggle-icon.empty {
    width: 20px;
    height: 20px;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}

.category-header a {
    color: #374151;
    text-decoration: none;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    flex: 1;
    position: relative;
    overflow: hidden;
}

.category-header a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background-color: #6366f1;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.category-header a:hover {
    background-color: #f8fafc;
    color: #6366f1;
    transform: translateX(4px);
}

.category-header a:hover::before {
    transform: scaleY(1);
}

.category-header a.active {
    background-color: #6366f1;
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3), 0 2px 4px -1px rgba(99, 102, 241, 0.2);
}

.category-header a.active::before {
    transform: scaleY(1);
    background-color: #fff;
}

.category-children {
    margin-left: 0;
    display: none; /* 默认折叠，通过JS控制显示 */
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.category-tree li ul {
    margin-left: 16px;
}

/* 文章列表样式 */
.article-list {
    list-style: none;
    padding-left: 0;
    margin-top: 8px;
    background-color: rgba(99, 102, 241, 0.02);
    border-radius: 6px;
    padding: 8px 0;
}

/* 多级目录文章缩进样式 */
.category-children .category-children .article-list {
    padding-left: 20px;
}

.category-children .category-children .category-children .article-list {
    padding-left: 40px;
}

.category-children .category-children .category-children .category-children .article-list {
    padding-left: 60px;
}

/* 更深层级的文章缩进，根据需要扩展 */
.category-children .category-children .category-children .category-children .category-children .article-list {
    padding-left: 80px;
}

.category-children .category-children .category-children .category-children .category-children .category-children .article-list {
    padding-left: 100px;
}

.article-item {
    margin: 2px 0;
    transition: all 0.2s ease;
}

.article-item:hover {
    background-color: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
}

.article-item a {
    color: #64748b;
    text-decoration: none;
    display: block;
    padding: 6px 12px 6px 36px;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 400;
    position: relative;
}

.article-item a::before {
    content: "📄";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.article-item a:hover {
    background-color: rgba(99, 102, 241, 0.1);
    color: #374151;
    transform: translateX(4px);
}

.article-item a:hover::before {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

.article-item a.active {
    background-color: #6366f1;
    color: #fff;
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.article-item a.active::before {
    content: "✅";
    opacity: 1;
}

/* 滚动条样式优化 */
.wiki-sidebar::-webkit-scrollbar {
    width: 8px;
}

.wiki-sidebar::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.wiki-sidebar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.wiki-sidebar::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* 响应式优化 */
@media (max-width: 1024px) {
    .wiki-sidebar {
        width: 300px;
        padding: 20px;
    }
}

/* 右侧内容区样式 */
.wiki-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* 文章容器样式 */
.article-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* 目录介绍样式 */
.category-description {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #3498db;
}

/* 分类文章列表样式 */
.category-articles-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-articles-list li {
    margin-bottom: 10px;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.category-articles-list li:hover {
    background-color: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.category-articles-list a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-bottom: 5px;
}

.category-articles-list a:hover {
    text-decoration: underline;
    color: #2980b9;
}

.article-view-count {
    font-size: 12px;
    color: #7f8c8d;
    float: right;
}

.article-container h2 {
    font-size: 28px;
    margin-bottom: 15px;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 10px;
}

.article-meta {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.article-body {
    font-size: 16px;
    line-height: 1.8;
}

.article-body p {
    margin-bottom: 15px;
}

.article-body img {
    max-width: 100%;
    height: auto;
    margin: 15px 0;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* 图片尺寸样式 */
.article-body img.img-small {
    max-width: 300px;
}

.article-body img.img-medium {
    max-width: 500px;
}

.article-body img.img-large {
    max-width: 800px;
}

/* 搜索结果样式 */
.search-results {
    margin-top: 20px;
}

.search-results h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.search-results ul {
    list-style: none;
}

.search-results li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.search-results h4 {
    font-size: 18px;
    margin-bottom: 5px;
}

.search-results h4 a {
    color: #3498db;
    text-decoration: none;
}

.search-results h4 a:hover {
    text-decoration: underline;
}

.search-results .excerpt {
    color: #7f8c8d;
    font-size: 14px;
    margin: 5px 0;
}

/* 登录页面样式 */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.login-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: #2c3e50;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
}

.login-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.login-form .captcha-group {
    display: flex;
    gap: 10px;
}

.login-form .captcha-group input {
    flex: 1;
}

.login-form .captcha-group img {
    width: 120px;
    height: 40px;
    cursor: pointer;
    border-radius: 4px;
}

.login-form button {
    width: 100%;
    padding: 10px;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
}

.login-form button:hover {
    background-color: #2980b9;
}

/* 管理页面样式 */
.admin-container {
    width: 100%;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.admin-header h1 {
    font-size: 24px;
    color: #2c3e50;
}

.admin-nav {
    display: flex;
    gap: 10px;
}

.admin-nav a {
    padding: 8px 15px;
    background-color: #3498db;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.admin-nav a:hover {
    background-color: #2980b9;
}

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

.admin-table th,
.admin-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.admin-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #2c3e50;
}

.admin-table tr:hover {
    background-color: #f5f5f5;
}

/* 按钮样式 */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    margin-right: 5px;
}

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

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

.btn-success {
    background-color: #2ecc71;
    color: #fff;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* 管理内容区样式 */
.admin-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

.article-tree {
    flex-shrink: 0;
    overflow-y: auto;
}

.article-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* 表单样式 */
.form-container {
    max-width: 100%;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-size: 14px;
    font-weight: bold;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 富文本编辑器样式 */
.ck-editor {
    margin: 10px 0;
    flex: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.ck-editor__main {
    flex: 1;
    overflow: hidden;
}

.ck-editor__editable {
    min-height: 400px;
    max-height: calc(100vh - 300px);
    overflow-y: auto;
}

/* 页脚样式 */
.wiki-footer {
    background-color: #2c3e50;
    color: #fff;
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

/* ICP备案号样式 */
.icp-record {
    margin: 10px 0;
}

.icp-record a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.icp-record a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .wiki-main {
        flex-direction: column;
    }
    
    .wiki-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: 200px;
    }
    
    .wiki-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .wiki-footer {
        padding: 15px;
    }
    
    .icp-record a {
        font-size: 12px;
    }
}