/**
 * 目录树样式（多级目录）
 * - 侧栏导航：浅色层级引导线 + 当前项高亮
 * - 后台目录管理：层级缩进
 * 仅作用于文档系统的目录相关组件，不影响其它页面样式。
 *
 * 注意：侧栏规则统一加 .doc-tree-nav 前缀，
 * 以覆盖主题 timelog.css 中的 `.tm-sidebar li a{padding:0.7rem}`（优先级 0,1,2）。
 */

/* ============ 侧栏容器 ============ */
.tm-sidebar-inner {
    padding: 4px 6px 16px;
}

.doc-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: #2b3441;
    padding: 4px 8px 12px;
    margin-bottom: 10px;
    border-bottom: 1px solid #ededed;
    line-height: 1.4;
}

/* ============ 侧栏目录树 ============ */
.doc-tree-nav {
    font-size: 14px;
    line-height: 1.45;
}

.doc-tree-nav .doc-tree-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.doc-tree-nav .doc-tree-item,
.doc-tree-nav .doc-tree-list li {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 层级引导线：每一层子列表左侧一条浅色细线 */
.doc-tree-nav .doc-tree-item > .doc-tree-list {
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid #ebedf0;
}

.doc-tree-nav .doc-tree-item.is-collapsed > .doc-tree-list {
    display: none;
}

/* 层级连接短线：从引导线横向连到条目，形成 └─ 的层次感 */
.doc-tree-nav .doc-tree-item > .doc-tree-list > .doc-tree-item > .doc-tree-link::after {
    content: "";
    position: absolute;
    left: -11px;
    top: 50%;
    width: 9px;
    height: 1px;
    background: #ebedf0;
}

.doc-tree-nav .doc-tree-link {
    display: flex;
    align-items: center;
    position: relative;
    box-sizing: border-box;
    padding: 6px 8px 6px 4px;
    margin: 0;
    border-radius: 4px;
    color: #5b6572;
    font-size: 14px;
    line-height: 1.45;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease;
}

.doc-tree-nav .doc-tree-link:hover,
.doc-tree-nav .doc-tree-link:focus {
    background: #f4f6f8;
    color: #1f6feb;
    text-decoration: none;
}

/* 一级目录加粗，形成“分组标题”的层次感 */
.doc-tree-nav .doc-tree-root > .doc-tree-item > .doc-tree-link {
    font-weight: 600;
    color: #333b47;
}

/* 文档条目字号略小、颜色略浅，与目录区分 */
.doc-tree-nav .doc-tree-docs > .doc-tree-item > .doc-tree-link {
    font-size: 13px;
    color: #6b7684;
    padding-top: 5px;
    padding-bottom: 5px;
}

.doc-tree-nav .doc-tree-link.is-active {
    background: #f0f6ff;
    color: #1f6feb;
    font-weight: 600;
}

/* 当前项左侧高亮竖条 */
.doc-tree-nav .doc-tree-link.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: 2px;
    background: #1f6feb;
}

.doc-tree-nav .doc-tree-link.is-empty {
    color: #9aa4b2;
    cursor: default;
}

.doc-tree-nav .doc-tree-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-tree-nav .doc-tree-arrow {
    flex: 0 0 14px;
    width: 14px;
    display: inline-block;
    color: #b8c0cc;
    cursor: pointer;
    text-align: center;
    font-style: normal;
}

.doc-tree-nav .doc-tree-arrow::before {
    content: "\25B8";
    font-size: 11px;
    line-height: 1;
}

.doc-tree-nav .doc-tree-item.is-open > .doc-tree-link .doc-tree-arrow::before {
    content: "\25BE";
}

.doc-tree-nav .doc-tree-item.is-open > .doc-tree-link .doc-tree-arrow {
    color: #8f9bab;
}

/* ============ 后台目录管理 ============ */
.doc-tree-cell {
    line-height: 2;
}

.doc-tree-branch {
    color: #ccd3dd;
    margin-right: 2px;
    font-size: 12px;
}

.doc-tree-level {
    display: inline-block;
    width: 0;
}

#create-tree-form.doc-tree-form-active {
    outline: 2px solid #ffe58f;
    outline-offset: 4px;
    transition: outline .25s ease;
}

.doc-tree-select {
    max-width: 360px;
}

/* ============ 目录页（分类页） ============ */
.doc-category-card {
    display: block;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #eee;
    border-radius: 6px;
    background: #fff;
    color: #2b3441;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.doc-category-card:hover {
    border-color: #cfe0ff;
    box-shadow: 0 2px 10px rgba(31, 111, 235, .08);
    text-decoration: none;
    color: #1f6feb;
}

.doc-category-card-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.doc-category-card-meta {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #98a2b3;
}

.doc-sort-table td {
    padding: 4px 6px;
}

/* ===== 访问统计趋势图 ===== */
.visit-trend {
    display: flex;
    align-items: flex-end;
    height: 140px;
    padding: 0 0.5rem;
}
.visit-trend-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    padding: 0 2px;
}
.visit-trend-bar {
    width: 70%;
    max-width: 28px;
    margin: 0 auto 4px;
    min-height: 2px;
    background: #0e76a8;
    border-radius: 2px 2px 0 0;
    opacity: .85;
}
.visit-trend-col:hover .visit-trend-bar {
    opacity: 1;
}

/* ===== 文档页元信息条 ===== */
.doc-meta-bar {
    padding-bottom: .6rem;
}
.doc-meta-bar a {
    margin-left: 1rem;
}
.doc-meta-bar .doc-view-count i {
    margin-right: .2rem;
}
#favorite-toggle i.am-icon-star {
    color: #f5a623;
}

/* ===== 全站文档索引页 ===== */
.all-catalog ul {
    padding-left: 1.2rem;
    border-left: 1px solid #ebedf0;
    margin: .3rem 0 .3rem .3rem;
    list-style: none;
}
.all-doc-list li {
    padding: .3rem 0;
    border-bottom: none;
}
.all-doc-list a {
    color: #0e76a8;
}

/* ===== 文档大纲（锚点导航）悬浮面板 ===== */
#doc-outline {
    position: fixed;
    right: 8px;
    top: 90px;
    width: 220px;
    max-height: 62vh;
    z-index: 1020;
    background: #fff;
    border: 1px solid #e3e6eb;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
    font-size: 13px;
}
#doc-outline-toggle {
    padding: .45rem .6rem;
    color: #666;
    cursor: pointer;
    border-bottom: 1px solid #f0f1f3;
    user-select: none;
}
#doc-outline-toggle:hover { color: #0e76a8; }
#doc-outline-list {
    overflow-y: auto;
    max-height: 52vh;
    padding: .3rem 0;
}
.doc-outline-item {
    display: block;
    padding: .25rem .6rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid transparent;
}
.doc-outline-item.tag-h3 {
    padding-left: 1.4rem;
    font-size: 12px;
}
.doc-outline-item:hover { background: #f5f7fa; color: #0e76a8; }
.doc-outline-item.is-active {
    color: #0e76a8;
    border-left-color: #0e76a8;
    background: #f2f8fc;
    font-weight: bold;
}
@media screen and (max-width: 1300px) {
    #doc-outline { width: 170px; }
}
@media screen and (max-width: 1100px) {
    #doc-outline { display: none; }
}

/* ===== 新版首页（参考 Outline / 语雀 / BookStack） ===== */
.home-hero {
    background: linear-gradient(135deg, #0e76a8 0%, #1391c7 55%, #31b0d5 100%);
    color: #fff;
    text-align: center;
    padding: 3rem 1rem 3.4rem;
    margin-bottom: 1.5rem;
}
.home-title {
    font-size: 1.9rem;
    margin: 0 0 .4rem;
    font-weight: 600;
}
.home-subtitle {
    margin: 0 0 1.4rem;
    opacity: .9;
    font-size: .95rem;
}
.home-search {
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
}
.home-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: .75rem 1.2rem;
    font-size: 15px;
    background: transparent;
}
.home-search-btn {
    border: none;
    background: #fff;
    color: #0e76a8;
    padding: 0 1.3rem;
    font-size: 15px;
    cursor: pointer;
    border-left: 1px solid #eef0f2;
}
.home-search-btn:hover {
    background: #f2f8fc;
}
.home-section-title {
    font-size: 1.05rem;
    margin: 1.2rem 0 .7rem;
    color: #333;
}
.home-section-title i {
    color: #0e76a8;
    margin-right: .4rem;
}
.home-books {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .8rem;
}
.home-book-card {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e9ebee;
    border-radius: 8px;
    padding: .8rem .9rem;
    text-decoration: none;
    transition: box-shadow .2s, transform .2s;
    overflow: hidden;
}
.home-book-card:hover {
    box-shadow: 0 4px 14px rgba(14, 118, 168, .15);
    transform: translateY(-2px);
    text-decoration: none;
}
.home-book-icon {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: .8rem;
}
.home-book-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.home-book-title {
    color: #333;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-book-meta {
    color: #999;
    font-size: 12px;
    margin-top: .2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-book-arrow {
    color: #c1c7cd;
    font-size: 18px;
    margin-left: .4rem;
}
.home-list {
    background: #fff;
    border: 1px solid #e9ebee;
    border-radius: 8px;
    padding: .3rem 0;
    list-style: none;
}
.home-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .5rem 1rem;
    border-bottom: 1px solid #f3f4f6;
}
.home-list li:last-child {
    border-bottom: none;
}
.home-list a {
    color: #444;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.home-list a:hover {
    color: #0e76a8;
    text-decoration: none;
}
.home-list-meta {
    color: #999;
    font-size: 12px;
    flex: 0 0 auto;
    margin-left: .8rem;
}
.home-hot-rank {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 4px;
    font-size: 12px;
    color: #fff;
    margin-right: .4rem;
    background: #c1c7cd;
}
.home-hot-rank.rank-1 { background: #e67e22; }
.home-hot-rank.rank-2 { background: #f0a04b; }
.home-hot-rank.rank-3 { background: #f2c14e; }
.home-side-tip {
    background: #fff;
    border: 1px solid #e9ebee;
    border-radius: 8px;
    padding: .8rem 1rem;
    margin-top: 1.2rem;
    color: #666;
    font-size: 13px;
}
.home-side-tip h3 {
    font-size: 14px;
    color: #333;
    margin: 0 0 .4rem;
}
.home-side-tip i {
    color: #f2c14e;
}
@media screen and (max-width: 768px) {
    .home-hero {
        padding: 2rem 1rem 2.4rem;
    }
    .home-title {
        font-size: 1.4rem;
    }
    .home-books {
        grid-template-columns: 1fr;
    }
}
