/* ============================================================
   ranking/report.php — 两栏文档风格（左导航 + 右主体）
   复用 geoscan/report.php 的分栏导航风格，配色对齐 ranking 当前紫调
   #6d28d9 / #8b5cf6 / #6366f1
   说明：ranking 报告页由 page_head 渲染顶部玻璃导航（.topbar z-index:60），
   因此桌面端侧栏顶部留 72px 给顶栏，避免被遮挡。
   ============================================================ */
/* 全局盒模型（仅影响本页新增元素，标准无副作用） */
*, *::before, *::after { box-sizing: border-box; }
/* 去掉浏览器默认 body 8px 外边距，避免页面四周白边（原 page_head 经 nav.css 设置，本页不再加载） */
body { margin: 0; }

:root {
    --rk-purple:      #6d28d9;
    --rk-purple-light:#8b5cf6;
    --rk-indigo:      #6366f1;
    --rk-violet:      #7c3aed;
    --rk-purple-50:   #f5f3ff;
    --rk-purple-100:  #ede9fe;
    --rk-text:        #1e1b4b;
    --rk-text-2:      #475569;
    --rk-text-muted:  #8a86a0;
    --rk-border:      #efeafb;
    --rk-sidebar-w:   228px;
    --rk-topbar-h:    0px; /* 本页已去除顶栏（公告条+导航条），侧栏贴顶 full-height */
}

/* 两栏布局 */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* 侧边栏（桌面端贴顶栏下方） */
.sidebar-nav {
    width: var(--rk-sidebar-w);
    flex-shrink: 0;
    position: sticky;
    top: var(--rk-topbar-h);
    height: calc(100vh - var(--rk-topbar-h));
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, #fdfbff 0%, #eeedff 100%);
    border-right: 1px solid #e7def8;
    display: flex;
    flex-direction: column;
    padding: 24px 0 24px;
    scrollbar-width: thin;
    scrollbar-color: #ddd6fe transparent;
    z-index: 50;
    transition: width 280ms ease, transform 280ms ease;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #ddd6fe; border-radius: 4px; }

.sidebar-doc-title {
    font-size: 12px; font-weight: 700; color: var(--rk-text);
    letter-spacing: 0.04em; padding: 0 18px 16px;
    border-bottom: 1px solid #ece4fb;
    margin-bottom: 2px; line-height: 1.4;
    position: relative; z-index: 1;
}
.sidebar-doc-title .doc-tag {
    display: inline-block; margin-bottom: 6px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--rk-purple); background: var(--rk-purple-50);
    padding: 2px 7px; border-radius: 4px;
}

.toc-section { padding: 0 8px; }
.toc-group-label {
    font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--rk-text-muted); padding: 2px 10px 4px; margin-bottom: 2px;
}
.toc-link {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 11px; border-radius: 6px;
    font-size: 13px; font-weight: 500; color: #57534e;
    text-decoration: none; cursor: pointer;
    border-left: 3px solid transparent;
    margin-bottom: 1px; line-height: 1.4;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.toc-link:hover { background: rgba(255, 255, 255, .55); color: var(--rk-text); text-decoration: none; }
.toc-link.toc-active {
    background: #ecdef9; color: #4c1d95;
    border-left-color: #7c3aed; font-weight: 600;
}

/* 阅读进度条 */
.reading-progress-wrap { margin-top: auto; padding: 16px 18px 0; border-top: 1px solid #ece4fb; }
.reading-progress-label {
    font-size: 10px; font-weight: 600; color: var(--rk-text-muted);
    letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px;
}
.reading-progress-track { height: 4px; background: #e7def8; border-radius: 2px; overflow: hidden; }
.reading-progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(135deg, var(--rk-indigo), var(--rk-purple));
    border-radius: 2px; transition: width .15s linear;
}

/* 折叠按钮 */
.sidebar-collapse-btn {
    position: fixed;
    top: 50%; left: var(--rk-sidebar-w);
    transform: translate(-50%, -50%);
    width: 20px; height: 36px;
    background: #fff; border: 1px solid var(--rk-border);
    border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--rk-text-muted);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    transition: left 280ms ease, background .15s ease, color .15s ease;
    z-index: 60;
}
.sidebar-collapse-btn:hover { background: var(--rk-purple-50); color: var(--rk-purple); }
.sidebar-collapse-btn.collapsed-pos { left: 12px; }

/* 移动端抽屉遮罩 */
.sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    opacity: 0; visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    z-index: 150;
}
.sidebar-backdrop.show { opacity: 1; visibility: visible; }
body.no-scroll { overflow: hidden; }
@media (min-width: 769px) { .sidebar-backdrop { display: none; } }

/* 折叠状态 */
.layout-wrapper.sidebar-collapsed .sidebar-nav {
    width: 0; min-width: 0; padding-left: 0; padding-right: 0;
    overflow: hidden; border-right: none;
}
.layout-wrapper.sidebar-collapsed .sidebar-collapse-btn { left: 12px; }

/* 内容区 */
.content-area { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }

/* 顶部返回条（替代被移除的全局导航条，保留返回入口） */
.rk-back {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--rk-purple); text-decoration: none;
    background: rgba(255,255,255,.72); border: 1px solid var(--rk-border);
    border-radius: 999px; padding: 7px 14px; transition: .15s;
}
.rk-back:hover { background: #fff; box-shadow: 0 4px 12px rgba(109,40,255,.12); }
/* 返回按钮（置于主体内容下方） */
.rk-pagebar-bot { width: 100%; max-width: 1040px; padding: 16px 28px 30px; display: flex; justify-content: flex-start; flex: 0 0 auto; }

/* 回到顶部 */
.scroll-to-top {
    position: fixed; right: 24px; bottom: 28px;
    width: 40px; height: 40px;
    background: #fff; border: 1px solid var(--rk-border);
    border-radius: 50%; cursor: pointer;
    font-size: 16px; color: var(--rk-text-muted);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,.07);
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 50;
}
.scroll-to-top.visible { opacity: 1; pointer-events: auto; }
.scroll-to-top:hover { transform: translateY(-2px); color: var(--rk-purple); }

/* ===== 响应式 ===== */
/* 大屏：更充分利用横向空间，内容区放宽 */
@media (min-width: 1600px) {
    .rk-report { max-width: 1180px; }
}
@media (min-width: 2200px) {
    .rk-report { max-width: 1340px; }
}

@media (max-width: 1024px) {
    .rk-report { padding-left: 20px; padding-right: 20px; }
}

@media (max-width: 900px) {
    /* 平板竖屏：概览区堆叠，避免在窄列里挤压 */
    .rk-overview { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar-nav {
        position: fixed; top: 0; left: 0; bottom: 0;
        transform: translateX(-100%); width: min(var(--rk-sidebar-w), 82vw) !important;
        height: 100vh; z-index: 200; box-shadow: 0 12px 32px rgba(0,0,0,.18);
    }
    .sidebar-nav.mobile-open { transform: translateX(0); }
    /* 折叠按钮在手机上作为汉堡菜单：固定左上角、放大可点区域 */
    .sidebar-collapse-btn,
    .sidebar-collapse-btn.collapsed-pos {
        left: 12px; top: 12px; transform: none;
        width: 38px; height: 38px; border-radius: 10px; z-index: 210;
        font-size: 0; /* 隐藏 «，用图标替代 */
    }
    .sidebar-collapse-btn::before {
        content: "\2630"; font-size: 18px; line-height: 1; color: var(--rk-purple);
    }
    .rk-report { padding: 14px 14px 72px; }
}
@media (max-width: 600px) {
    .rk-report { padding: 12px 12px 64px; }
}
@media (max-width: 480px) {
    /* 极窄屏：统计卡单列，避免挤成两列看不清 */
    .rk-stats { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
    .rk-report { padding: 10px 10px 60px; }
}
