/* PaiUI Wiki 展示页样式 - Minecraft 主题 */

/* ========== 搜索框 ========== */
.wiki-search-box {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 1rem;
}
.wiki-search-box input {
    background: rgba(0,0,0,0.6);
    border: 2px solid #555;
    color: #fff;
    padding: 0.4rem 0.8rem 0.4rem 2rem;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    width: 200px;
    outline: none;
}
.wiki-search-box input:focus {
    border-color: #8b8b8b;
}
.wiki-search-btn {
    background: linear-gradient(180deg, #8b8b8b 0%, #737373 50%, #8b8b8b 100%);
    border: 2px solid;
    border-color: #fff #373737 #373737 #fff;
    color: #fff;
    padding: 0.4rem 0.8rem;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    text-shadow: 2px 2px 0px #3f3f3f;
}
.wiki-search-btn:hover {
    background: linear-gradient(180deg, #9d9d9d 0%, #858585 50%, #9d9d9d 100%);
}

/* ========== 管理后台按钮 ========== */
.wiki-admin-btn {
    margin-right: 0.5rem;
    background: linear-gradient(180deg, #5a8a3c 0%, #4a7a2c 50%, #5a8a3c 100%) !important;
    border-color: #7cfc00 #2d5a1e #2d5a1e #7cfc00 !important;
}
.wiki-admin-btn:hover {
    background: linear-gradient(180deg, #6a9a4c 0%, #5a8a3c 50%, #6a9a4c 100%) !important;
}

/* ========== 三栏布局 ========== */
.wiki-layout {
    display: grid;
    grid-template-columns: fit-content(400px) 1fr 220px;
    gap: 0;
    margin-top: 60px;
    margin-left: 0;
    min-height: calc(100vh - 60px);
    position: relative;
}

/* ========== 左侧目录 ========== */
.wiki-sidebar {
    background: rgba(30, 30, 30, 0.92);
    border-right: 2px solid #444;
    overflow-y: auto;
    overflow-x: hidden;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    min-width: 200px;
    max-width: 400px;
}

/* 目录文本不换行 */
.wiki-tree-category-name,
.wiki-tree-article span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wiki-tree-category-header {
    white-space: nowrap;
}
.wiki-tree-article {
    white-space: nowrap;
}

/* 拖拽调整宽度把手 */
.wiki-resize-handle {
    position: absolute;
    top: 0;
    right: -4px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 50;
    background: transparent;
    transition: background 0.15s;
}
.wiki-resize-handle:hover,
.wiki-resize-handle.active {
    background: rgba(124, 252, 0, 0.4);
}
.wiki-sidebar-header {
    padding: 1rem 1.2rem 0.5rem;
    border-bottom: 1px solid #444;
}
.wiki-sidebar-header h3 {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #aaa;
    text-shadow: 1px 1px 0 #222;
}

/* 侧边栏内搜索框 */
.wiki-sidebar-search {
    position: relative;
    margin-top: 0.6rem;
}
.wiki-sidebar-search input {
    width: 100%;
    background: rgba(0,0,0,0.5);
    border: 2px solid #444;
    color: #ddd;
    padding: 0.4rem 0.6rem 0.4rem 2rem;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    outline: none;
    box-sizing: border-box;
}
.wiki-sidebar-search input:focus {
    border-color: #7cfc00;
}
.wiki-sidebar-search input::placeholder {
    color: #666;
}
.wiki-sidebar-search-icon {
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0.9rem;
    height: 0.9rem;
    fill: #666;
    pointer-events: none;
}

/* 搜索结果下拉 */
.wiki-sidebar-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(25, 25, 25, 0.98);
    border: 2px solid #555;
    border-top: none;
    max-height: 400px;
    overflow-y: auto;
    z-index: 60;
}
.wiki-sidebar-search-loading {
    padding: 0.8rem;
    text-align: center;
    color: #888;
    font-family: 'VT323', monospace;
    font-size: 0.85rem;
}
.wiki-sidebar-search-item {
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.15s;
}
.wiki-sidebar-search-item:hover {
    background: rgba(80, 120, 60, 0.25);
}
.wiki-sidebar-search-item:last-child {
    border-bottom: none;
}
.wiki-sidebar-search-title {
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    color: #e0c060;
    margin-bottom: 0.15rem;
}
.wiki-sidebar-search-snippet {
    font-size: 0.78rem;
    color: #888;
    line-height: 1.35;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.wiki-sidebar-search-snippet mark {
    background: rgba(224, 192, 96, 0.3);
    color: #e0c060;
}
.wiki-sidebar-search-results::-webkit-scrollbar {
    width: 4px;
}
.wiki-sidebar-search-results::-webkit-scrollbar-thumb {
    background: #555;
}

/* 目录树 */
.wiki-tree {
    padding: 0.5rem 0;
}
.wiki-loading {
    padding: 2rem;
    text-align: center;
    color: #888;
    font-family: 'VT323', monospace;
}

/* 分类节点 */
.wiki-tree-category {
    margin: 0;
}
.wiki-tree-category-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: #ccc;
    font-family: 'VT323', monospace;
    font-size: 1rem;
    transition: background 0.15s;
    user-select: none;
}
.wiki-tree-category-header:hover {
    background: rgba(255,255,255,0.05);
}
.wiki-tree-toggle {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.4rem;
    transition: transform 0.2s;
    fill: #888;
    flex-shrink: 0;
}
.wiki-tree-toggle.expanded {
    transform: rotate(90deg);
}
.wiki-tree-category-icon {
    margin-right: 0.4rem;
    font-size: 1rem;
}
.wiki-tree-category-name {
    font-weight: bold;
    color: #e0c060;
    text-shadow: 1px 1px 0 #333;
}

/* 文章节点 */
.wiki-tree-articles {
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.wiki-tree-articles.collapsed {
    max-height: 0 !important;
}
.wiki-tree-article {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.4rem 1rem 0.4rem 2.8rem;
    background: none;
    border: none;
    color: #bbb;
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.wiki-tree-article:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.wiki-tree-article.active {
    background: rgba(80, 120, 60, 0.3);
    color: #7cfc00;
    border-left: 3px solid #7cfc00;
    padding-left: calc(2.8rem - 3px);
}

/* 单篇文章分类 — 直接点击进入，无展开箭头 */
.wiki-tree-single-header {
    cursor: pointer;
}
.wiki-tree-single-header .wiki-tree-category-name {
    font-weight: bold;
}
.wiki-tree-single-header:hover .wiki-tree-category-name {
    color: #fff;
}
.wiki-tree-single-header.active {
    background: rgba(80, 120, 60, 0.25);
}
.wiki-tree-single-header.active .wiki-tree-category-name {
    color: #7cfc00;
}

/* 文档图标（单篇分类头部 & 文章列表） */
.wiki-tree-doc-icon {
    width: 1rem;
    height: 1rem;
    fill: #777;
    margin-right: 0.4rem;
    flex-shrink: 0;
    vertical-align: middle;
}
.wiki-tree-single-header:hover .wiki-tree-doc-icon,
.wiki-tree-single-header.active .wiki-tree-doc-icon {
    fill: #aaa;
}
.wiki-tree-article-icon {
    width: 0.85rem;
    height: 0.85rem;
    fill: #666;
    margin-right: 0.35rem;
    flex-shrink: 0;
    vertical-align: middle;
}
.wiki-tree-article:hover .wiki-tree-article-icon {
    fill: #aaa;
}
.wiki-tree-article.active .wiki-tree-article-icon {
    fill: #7cfc00;
}

/* 文章数量角标 */
.wiki-tree-count {
    margin-left: auto;
    font-size: 0.75rem;
    color: #666;
    background: rgba(255,255,255,0.06);
    padding: 0 0.4rem;
    line-height: 1.4;
    flex-shrink: 0;
}

/* 嵌套分类缩进 */
.wiki-tree-nested {
    border-left: 1px solid rgba(255,255,255,0.08);
    margin-left: 0.6rem;
}

/* 文章按钮内部布局 */
.wiki-tree-article {
    display: flex;
    align-items: center;
}

/* ========== 中间内容区 ========== */
.wiki-main {
    background: rgba(20, 20, 20, 0.88);
    min-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 2rem 2.5rem;
}

/* 欢迎占位 */
.wiki-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    color: #888;
    font-family: 'VT323', monospace;
    text-align: center;
}
.wiki-welcome h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0 #222;
}
.wiki-welcome p {
    font-size: 1.1rem;
    color: #666;
}

/* 文章内容渲染 */
.wiki-article h1, .wiki-article h2, .wiki-article h3,
.wiki-article h4, .wiki-article h5, .wiki-article h6 {
    font-family: 'VT323', monospace;
    color: #e0c060;
    text-shadow: 1px 1px 0 #333;
    margin: 1.5rem 0 0.8rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.wiki-article h1 { font-size: 2rem; }
.wiki-article h2 { font-size: 1.6rem; }
.wiki-article h3 { font-size: 1.3rem; }
.wiki-article h4 { font-size: 1.15rem; }
.wiki-article p {
    color: #ddd;
    line-height: 1.8;
    margin: 0.6rem 0;
    font-size: 1rem;
}
.wiki-article a {
    color: #6d9eeb;
    text-decoration: none;
}
.wiki-article a:hover {
    text-decoration: underline;
}
.wiki-article ul, .wiki-article ol {
    padding-left: 1.8rem;
    margin: 0.5rem 0;
    color: #ccc;
}
.wiki-article li {
    margin: 0.3rem 0;
    line-height: 1.7;
}
.wiki-article img {
    max-width: 100%;
    border: 2px solid #444;
    margin: 0.5rem 0;
}
.wiki-article code {
    background: rgba(0,0,0,0.5);
    color: #7cfc00;
    padding: 0.15rem 0.4rem;
    font-size: 0.9em;
    border: 1px solid #444;
}
.wiki-article pre {
    background: rgba(0,0,0,0.6);
    border: 2px solid #444;
    padding: 1rem;
    overflow-x: auto;
    margin: 0.8rem 0;
}
.wiki-article pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}
.wiki-article blockquote {
    border-left: 4px solid #e0c060;
    background: rgba(224, 192, 96, 0.08);
    padding: 0.5rem 1rem;
    margin: 0.8rem 0;
    color: #ccc;
}
.wiki-article table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8rem 0;
}
.wiki-article th, .wiki-article td {
    border: 1px solid #555;
    padding: 0.5rem 0.8rem;
    text-align: left;
    color: #ccc;
}
.wiki-article th {
    background: rgba(80, 120, 60, 0.3);
    color: #e0c060;
}
.wiki-article tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

/* 文章标题区 */
.wiki-article-title {
    font-family: 'VT323', monospace;
    font-size: 2.2rem;
    color: #fff;
    text-shadow: 2px 2px 0 #222;
    margin-bottom: 0.3rem;
    border-bottom: 2px solid rgba(224, 192, 96, 0.4);
    padding-bottom: 0.5rem;
}
.wiki-article-meta {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    font-family: 'VT323', monospace;
}
.wiki-article-meta span {
    margin-right: 1.5rem;
}

/* 前后翻页 */
.wiki-nav-buttons {
    display: flex;
    justify-content: space-between;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid #444;
}
.wiki-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(80, 120, 60, 0.2);
    border: 2px solid #555;
    color: #ccc;
    padding: 0.6rem 1rem;
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    cursor: pointer;
    max-width: 45%;
    transition: background 0.2s, border-color 0.2s;
}
.wiki-nav-btn:hover {
    background: rgba(80, 120, 60, 0.4);
    border-color: #7cfc00;
    color: #fff;
}

/* ========== 右侧 TOC ========== */
.wiki-toc {
    background: rgba(30, 30, 30, 0.92);
    border-left: 2px solid #444;
    overflow-y: auto;
    height: calc(100vh - 60px);
    position: sticky;
    top: 60px;
    padding: 1rem;
}
.wiki-toc-header h4 {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.8rem;
    text-shadow: 1px 1px 0 #222;
}
.wiki-toc-list a {
    display: block;
    padding: 0.25rem 0;
    color: #999;
    text-decoration: none;
    font-family: 'VT323', monospace;
    font-size: 0.9rem;
    transition: color 0.15s;
    line-height: 1.4;
}
.wiki-toc-list a:hover {
    color: #e0c060;
}
.wiki-toc-list a.active {
    color: #7cfc00;
}
.wiki-toc-list a.toc-h3 {
    padding-left: 1rem;
    font-size: 0.85rem;
}
.wiki-toc-list a.toc-h4 {
    padding-left: 2rem;
    font-size: 0.8rem;
}

/* ========== 搜索结果 ========== */
.wiki-search-results {
    background: rgba(20, 20, 20, 0.95);
}
.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.search-results-header h3 {
    font-family: 'VT323', monospace;
    color: #e0c060;
    font-size: 1.4rem;
}
.btn-close-search {
    background: rgba(80, 120, 60, 0.3);
    border: 2px solid #555;
    color: #ccc;
    padding: 0.3rem 0.8rem;
    font-family: 'VT323', monospace;
    cursor: pointer;
}
.btn-close-search:hover {
    border-color: #7cfc00;
    color: #fff;
}
.search-result-item {
    padding: 1rem;
    border: 1px solid #444;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    background: rgba(40, 40, 40, 0.8);
}
.search-result-item:hover {
    background: rgba(80, 120, 60, 0.2);
    border-color: #7cfc00;
}
.search-result-title {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: #e0c060;
    margin-bottom: 0.3rem;
}
.search-result-summary {
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.4;
}
.search-result-snippet {
    color: #999;
    font-size: 0.85rem;
    margin-top: 0.3rem;
    font-style: italic;
}
.search-result-snippet mark {
    background: rgba(224, 192, 96, 0.3);
    color: #e0c060;
}

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .wiki-layout {
        grid-template-columns: fit-content(400px) 1fr;
    }
    .wiki-toc {
        display: none;
    }
}
@media (max-width: 900px) {
    .wiki-layout {
        grid-template-columns: 1fr;
        margin-left: 0;
    }
    .wiki-sidebar {
        position: fixed;
        left: -300px;
        top: 60px;
        width: 280px;
        z-index: 100;
        transition: left 0.3s;
        height: calc(100vh - 60px);
    }
    .wiki-sidebar.mobile-open {
        left: 0;
    }
    .wiki-resize-handle {
        display: none;
    }
    .wiki-toc {
        display: none;
    }
    .wiki-main {
        padding: 1rem;
    }
    .wiki-search-box {
        display: none;
    }
}

/* 滚动条样式 */
.wiki-sidebar::-webkit-scrollbar,
.wiki-toc::-webkit-scrollbar {
    width: 6px;
}
.wiki-sidebar::-webkit-scrollbar-track,
.wiki-toc::-webkit-scrollbar-track {
    background: transparent;
}
.wiki-sidebar::-webkit-scrollbar-thumb,
.wiki-toc::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 0;
}

/* ========== 面包屑导航 ========== */
.wiki-breadcrumb {
    font-family: 'VT323', monospace;
    font-size: 0.85rem;
    color: #777;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
}
.wiki-breadcrumb-item {
    color: #888;
    transition: color 0.15s;
}
.wiki-breadcrumb-item:hover {
    color: #e0c060;
}
.wiki-breadcrumb-sep {
    margin: 0 0.35rem;
    color: #555;
}
.wiki-breadcrumb-current {
    color: #aaa;
}

/* ========== 文章元信息增强 ========== */
.wiki-meta-item {
    display: inline-flex;
    align-items: center;
    color: #777;
    margin-right: 1.2rem;
}

/* ========== 阅读进度条 ========== */
.wiki-reading-progress {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 2px;
    background: rgba(0,0,0,0.3);
    margin: -2rem -2.5rem 0;
    /* 紧贴 wikiMain 顶部，占满宽度 */
}
.wiki-reading-progress-fill {
    height: 100%;
    width: 0%;
    background: #7cfc00;
    transition: width 0.1s linear;
}

/* ========== 回到顶部按钮 ========== */
.wiki-back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 2.4rem;
    height: 2.4rem;
    background: rgba(80, 120, 60, 0.7);
    border: 2px solid #555;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s, background 0.2s, border-color 0.2s;
    z-index: 200;
}
.wiki-back-to-top svg {
    width: 1.4rem;
    height: 1.4rem;
}
.wiki-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.wiki-back-to-top:hover {
    background: rgba(80, 120, 60, 0.95);
    border-color: #7cfc00;
    color: #fff;
}

/* ========== 阅读体验增强 ========== */
/* 正文段落 */
.wiki-article-body {
    line-height: 1.85;
    font-size: 1rem;
    color: #ddd;
}
.wiki-article-body p {
    margin: 0.8rem 0;
}
.wiki-article-body > *:first-child {
    margin-top: 0;
}

/* 标题锚点偏移 */
.wiki-article-body h1,
.wiki-article-body h2,
.wiki-article-body h3,
.wiki-article-body h4 {
    scroll-margin-top: 1rem;
}

/* 行内代码 */
.wiki-article-body code {
    font-size: 0.88em;
    padding: 0.1rem 0.35rem;
    background: rgba(0,0,0,0.45);
    border: 1px solid #3a3a3a;
    color: #7cfc00;
}

/* 代码块 */
.wiki-article-body pre {
    background: rgba(0, 0, 0, 0.55);
    border: 2px solid #3a3a3a;
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    overflow-x: auto;
    line-height: 1.6;
}
.wiki-article-body pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font-size: 0.9rem;
}

/* 引用块增强 */
.wiki-article-body blockquote {
    border-left: 3px solid #e0c060;
    background: rgba(224, 192, 96, 0.06);
    padding: 0.6rem 1.2rem;
    margin: 1rem 0;
    color: #bbb;
}
.wiki-article-body blockquote p {
    margin: 0.3rem 0;
}

/* 表格增强 */
.wiki-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.wiki-article-body thead,
.wiki-article-body tbody,
.wiki-article-body tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}
.wiki-article-body table {
    display: table;
}
.wiki-article-body th {
    background: rgba(80, 120, 60, 0.25);
    color: #e0c060;
    font-weight: bold;
    text-align: left;
    padding: 0.6rem 1rem;
    border: 1px solid #444;
    font-family: 'VT323', monospace;
    font-size: 0.95rem;
    white-space: nowrap;
}
.wiki-article-body td {
    padding: 0.55rem 1rem;
    border: 1px solid #3a3a3a;
    color: #ccc;
    line-height: 1.6;
    vertical-align: top;
}
.wiki-article-body tr:nth-child(even) {
    background: rgba(255,255,255,0.02);
}
.wiki-article-body tr:hover {
    background: rgba(80, 120, 60, 0.1);
}
/* 防止表格溢出容器 */
.wiki-article-body table {
    max-width: 100%;
    word-break: break-word;
}

/* 图片居中 */
.wiki-article-body img {
    max-width: 100%;
    display: block;
    margin: 1rem auto;
    border: 2px solid #3a3a3a;
}

/* 列表间距 */
.wiki-article-body ul,
.wiki-article-body ol {
    padding-left: 1.6rem;
    margin: 0.6rem 0;
}
.wiki-article-body li {
    margin: 0.25rem 0;
    line-height: 1.75;
    color: #ccc;
}

/* 分隔线 */
.wiki-article-body hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 1.5rem 0;
}

/* ========== 响应式: 回到顶部 ========== */
@media (max-width: 900px) {
    .wiki-back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 2.2rem;
        height: 2.2rem;
    }
    .wiki-reading-progress {
        margin: -1rem -1rem 0;
    }
}
