/* ============================================
   TypechoOutline - 文章大纲侧边栏样式
   ============================================ */

/* ---------- 容器 ---------- */
#toc-outline {
    position: fixed;
    top: 120px;
    right: 24px;
    width: 240px;
    max-height: calc(100vh - 160px);
    z-index: 999;

    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);

    display: flex;
    flex-direction: column;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#toc-outline.toc-collapsed {
    width: auto;
    max-height: none;
    background: rgba(255, 255, 255, 0.95);
}

/* ---------- 标题栏 ---------- */
.toc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.toc-collapsed .toc-header {
    border-bottom: none;
    padding: 10px 12px;
}

.toc-title {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a2e;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.toc-title-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #e94560;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.toc-collapsed .toc-title span {
    display: none;
}

/* ---------- 折叠按钮 ---------- */
.toc-toggle {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
    padding: 0;
    flex-shrink: 0;
}

.toc-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
}

.toc-toggle svg {
    width: 14px;
    height: 14px;
    stroke: #666;
    stroke-width: 2;
    fill: none;
    transition: transform 0.3s ease;
}

.toc-collapsed .toc-toggle svg {
    transform: rotate(180deg);
}

/* ---------- 列表区域 ---------- */
.toc-body {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

.toc-body::-webkit-scrollbar {
    width: 4px;
}

.toc-body::-webkit-scrollbar-track {
    background: transparent;
}

.toc-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.toc-collapsed .toc-body {
    display: none;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- 列表条目 ---------- */
.toc-item {
    position: relative;
}

.toc-link {
    display: block;
    padding: 6px 16px 6px 16px;
    font-size: 13px;
    line-height: 1.5;
    color: #555;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toc-link:hover {
    color: #e94560;
    background: rgba(233, 69, 96, 0.04);
}

/* 当前激活项 */
.toc-link.active {
    color: #e94560;
    border-left-color: #e94560;
    background: rgba(233, 69, 96, 0.06);
    font-weight: 500;
}

/* ---------- 层级缩进 ---------- */
.toc-level-1 { padding-left: 16px; font-weight: 600; font-size: 13px; }
.toc-level-2 { padding-left: 16px; font-weight: 500; font-size: 13px; }
.toc-level-3 { padding-left: 28px; font-size: 12.5px; }
.toc-level-4 { padding-left: 40px; font-size: 12px; }
.toc-level-5 { padding-left: 52px; font-size: 12px; color: #888; }
.toc-level-6 { padding-left: 64px; font-size: 11.5px; color: #999; }

/* ---------- 进度指示条 ---------- */
.toc-progress {
    height: 2px;
    background: linear-gradient(90deg, #e94560, #0f3460);
    border-radius: 0 0 12px 12px;
    width: 0%;
    transition: width 0.15s ease;
    flex-shrink: 0;
}

/* ---------- 响应式 ---------- */
@media (max-width: 1360px) {
    #toc-outline {
        right: 12px;
        width: 200px;
    }
}

@media (max-width: 1200px) {
    #toc-outline {
        display: none;
    }
}

/* ---------- 暗色模式适配 ---------- */
@media (prefers-color-scheme: dark) {
    #toc-outline {
        background: rgba(30, 30, 46, 0.92);
        border-color: rgba(255, 255, 255, 0.08);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }

    .toc-header {
        border-bottom-color: rgba(255, 255, 255, 0.08);
    }

    .toc-title {
        color: #e0e0e0;
    }

    .toc-toggle:hover {
        background: rgba(255, 255, 255, 0.08);
    }

    .toc-toggle svg {
        stroke: #aaa;
    }

    .toc-link {
        color: #b0b0b0;
    }

    .toc-link:hover {
        color: #e94560;
        background: rgba(233, 69, 96, 0.08);
    }

    .toc-link.active {
        color: #e94560;
        background: rgba(233, 69, 96, 0.1);
    }

    .toc-level-5 { color: #777; }
    .toc-level-6 { color: #666; }

    .toc-body::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
    }
}
