/* ============================================================
   bgrdh 风格导航布局样式
   三栏布局：左侧分类菜单(230px) + 内容区 + 右侧广告栏(300px)
   适用于：首页 / 网址菜单页 / 文章菜单页
   ============================================================ */

/* ---------- 三栏容器 ---------- */
.nav-layout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    max-width: 1520px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- 左侧分类菜单 ---------- */
.nav-sidebar {
    width: 230px;
    flex-shrink: 0;
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
    z-index: 20;
}
.nav-sidebar::-webkit-scrollbar { width: 4px; }
.nav-sidebar-header {
    padding: 12px 14px;
    font-size: .82rem;
    font-weight: 700;
    color: var(--theme-text-secondary, #4b5563);
    border-bottom: 1px solid var(--theme-border, #e5e7eb);
    background: var(--theme-bg-secondary, #f8fafc);
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 6px;
}
.nav-sidebar-item {
    margin-bottom: 2px;
}
.nav-sidebar-item > .nav-sidebar-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--theme-text-primary, #111827);
    text-decoration: none;
    font-size: .88rem;
    font-weight: 500;
    transition: all .2s ease;
    cursor: pointer;
}
.nav-sidebar-item > .nav-sidebar-link:hover {
    background: rgba(30,115,190,.07);
    color: #1e73be;
}
.nav-sidebar-item.active > .nav-sidebar-link {
    background: #1e73be;
    color: #fff;
}
.nav-sidebar-link .sidebar-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}
.nav-sidebar-link .sidebar-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 4px;
}
.nav-sidebar-link .sidebar-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-sidebar-link .sidebar-arrow {
    font-size: .7rem;
    color: var(--theme-text-weak, #9ca3af);
    transition: transform .25s ease;
    flex-shrink: 0;
}
.nav-sidebar-item.open > .nav-sidebar-link .sidebar-arrow {
    transform: rotate(90deg);
}
.nav-sidebar-sub {
    list-style: none;
    margin: 0;
    padding: 0 0 4px 14px;
    display: none;
}
.nav-sidebar-item.open > .nav-sidebar-sub {
    display: block;
}
.nav-sidebar-sub li a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px 7px 26px;
    border-radius: 7px;
    color: var(--theme-text-secondary, #4b5563);
    text-decoration: none;
    font-size: .83rem;
    transition: all .2s ease;
    border-left: 2px solid transparent;
}
.nav-sidebar-sub li a:hover {
    color: #1e73be;
    background: rgba(30,115,190,.06);
}
.nav-sidebar-sub li a.active {
    color: #1e73be;
    background: rgba(30,115,190,.08);
    border-left-color: #1e73be;
    font-weight: 600;
}
.nav-sidebar-sub li a .sub-count {
    margin-left: auto;
    font-size: .72rem;
    color: var(--theme-text-weak, #9ca3af);
}
.nav-sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--theme-border, #e5e7eb);
    font-size: .78rem;
    color: var(--theme-text-weak, #9ca3af);
    text-align: center;
}
.nav-sidebar-group-title {
    padding: 10px 10px 4px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--theme-text-muted, #6b7280);
    display: flex;
    align-items: center;
    gap: 5px;
    border-bottom: 1px dashed var(--theme-border, #e5e7eb);
    margin: 4px 0 6px;
}

/* ---------- 中间内容区 ---------- */
.nav-content {
    flex: 1;
    min-width: 0;
}
.nav-mobile-cat-btn {
    display: none;
}

/* 分类区块 */
.cat-block {
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border, #e5e7eb);
    border-radius: 10px;
    margin-bottom: 16px;
    overflow: hidden;
    scroll-margin-top: 80px;
}
.cat-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-bottom: 1px solid var(--theme-border, #e5e7eb);
    background: var(--theme-bg-secondary, #f8fafc);
    flex-wrap: wrap;
}
.cat-block-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--theme-text-primary, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
}
.cat-block-title .cat-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#1e73be,#1e5f9e);
    color: #fff;
    font-size: .9rem;
    flex-shrink: 0;
}
.cat-block-title .cat-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 5px;
}
.cat-block-desc {
    font-size: .78rem;
    color: var(--theme-text-muted, #6b7280);
    margin-left: 4px;
}
.cat-block-more {
    margin-left: auto;
    font-size: .8rem;
    color: #1e73be;
    text-decoration: none;
    white-space: nowrap;
}
.cat-block-more:hover { color: #0a56c9; }

/* 二级分类 Tab */
.sub-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--theme-card-bg, #fff);
    border-bottom: 1px solid var(--theme-border-light, #f3f4f6);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
    padding: 5px 14px;
    border-radius: 999px;
    font-size: .82rem;
    color: var(--theme-text-secondary, #4b5563);
    background: var(--theme-bg-tertiary, #f1f5f9);
    text-decoration: none;
    white-space: nowrap;
    transition: all .2s ease;
    border: 1px solid transparent;
}
.sub-tab:hover {
    color: #1e73be;
    background: rgba(30,115,190,.08);
}
.sub-tab.active {
    color: #fff;
    background: #1e73be;
    border-color: #1e73be;
}
.sub-panes { position: relative; }
.sub-pane { display: none; padding: 14px; }
.sub-pane.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(4px)} to{opacity:1;transform:none} }

/* ---------- 网址卡片网格（bgrdh风格，自适应列数） ---------- */
.url-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 10px;
}
.url-card {
    position: relative;
    min-width: 0;
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border-light, #f3f4f6);
    border-radius: 8px;
    transition: all .2s ease;
}
.url-card:hover {
    border-color: #1e73be;
    box-shadow: 0 3px 10px rgba(30,115,190,.12);
}
.url-card-body {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    text-decoration: none;
    color: var(--theme-text-primary, #111827);
}
.url-card-body:hover { color: inherit; }
.url-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--theme-bg-tertiary, #f1f5f9);
    overflow: hidden;
}
.url-img img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
}
.url-img .fallback-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#1e73be,#0a56c9);
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}
.url-info {
    flex: 1;
    min-width: 0;
}
.url-title {
    font-size: .85rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.url-title .badge-rec {
    background: #f5576c;
    color: #fff;
    font-size: .62rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}
.url-desc {
    font-size: .75rem;
    color: var(--theme-text-muted, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 2px 0 0;
}
.url-togo {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 22px;
    height: 22px;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--theme-text-muted, #6b7280);
    border-radius: 50%;
    font-size: .75rem;
    text-decoration: none;
}
.url-card:hover .url-togo { display: flex; }
.url-card:hover .url-togo:hover { color: #1e73be; background: rgba(30,115,190,.1); }

/* 更多按钮 */
.sub-more {
    display: block;
    text-align: center;
    margin-top: 12px;
}
.sub-more a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .8rem;
    color: #1e73be;
    text-decoration: none;
    padding: 6px 18px;
    border: 1px solid rgba(30,115,190,.3);
    border-radius: 999px;
    transition: all .2s ease;
}
.sub-more a:hover {
    background: #1e73be;
    color: #fff;
    border-color: #1e73be;
}

/* ---------- 文章卡片（bgrdh风格，自适应列数） ---------- */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
}
.article-card {
    display: block;
    min-width: 0;
    padding: 12px 14px;
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border-light, #f3f4f6);
    border-radius: 8px;
    text-decoration: none;
    color: var(--theme-text-primary, #111827);
    transition: all .2s ease;
}
.article-card:hover {
    border-color: #1e73be;
    box-shadow: 0 3px 10px rgba(30,115,190,.12);
    color: inherit;
}
.article-card-title {
    font-size: .88rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.article-card-title .badge-rec {
    background: #f5576c;
    color: #fff;
    font-size: .62rem;
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
    flex-shrink: 0;
}
.article-card-desc {
    font-size: .78rem;
    color: var(--theme-text-muted, #6b7280);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}
.article-card-time {
    font-size: .72rem;
    color: var(--theme-text-weak, #9ca3af);
    margin-top: 6px;
    display: block;
}

/* ---------- 右侧广告栏 ---------- */
.nav-rightbar {
    width: 300px;
    flex-shrink: 0;
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 96px);
    overflow-y: auto;
}
.nav-rightbar::-webkit-scrollbar { width: 4px; }
.nav-right-ad {
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border, #e5e7eb);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 14px;
    overflow: hidden;
}
.nav-right-ad-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--theme-text-muted, #6b7280);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.nav-right-ad .ad-content {
    text-align: center;
    overflow: hidden;
}
.nav-right-ad .ad-content img { max-width: 100%; }
.nav-right-ad .ad-content a { display: inline-block; }

/* ---------- 手机端广告横幅 ---------- */
.nav-mobile-ad {
    display: none;
    background: var(--theme-card-bg, #fff);
    border: 1px solid var(--theme-border, #e5e7eb);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 14px;
    text-align: center;
    overflow: hidden;
}

/* ---------- 空状态 ---------- */
.nav-empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--theme-text-muted, #6b7280);
}
.nav-empty i { font-size: 2.6rem; opacity: .5; display: block; margin-bottom: 10px; }

/* ---------- 网格响应式（自适应列数，由 auto-fill 自动计算，不再被右侧广告栏挤压） ---------- */
@media (max-width: 1199px) and (min-width: 992px) {
    /* 992-1199 隐藏右侧广告栏，宽度不足 */
    .nav-rightbar { display: none; }
}
@media (max-width: 991px) {
    /* 平板/手机：三栏变两栏（菜单+内容） */
    .nav-layout { padding: 0 12px; }
    .nav-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform .3s ease;
        box-shadow: 0 0 30px rgba(0,0,0,.15);
    }
    .nav-sidebar.open { transform: translateX(0); }
    .nav-sidebar-mask {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 1040;
        display: none;
    }
    .nav-sidebar-mask.show { display: block; }
    .nav-mobile-cat-btn {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: .82rem;
        padding: 6px 12px;
        border-radius: 8px;
        border: 1px solid var(--theme-border, #e5e7eb);
        background: var(--theme-card-bg, #fff);
        color: var(--theme-text-secondary, #4b5563);
        cursor: pointer;
        margin-bottom: 10px;
    }
    .nav-mobile-cat-btn:hover { color: #1e73be; border-color: #1e73be; }
    .url-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .article-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
@media (max-width: 767px) {
    .url-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .article-grid { grid-template-columns: 1fr; }
    .cat-block-header { padding: 11px 13px; }
    .sub-tabs { padding: 7px 13px; }
    .sub-pane { padding: 10px; }
    .url-card-body { padding: 8px; gap: 8px; }
    .url-img { width: 34px; height: 34px; }
    .url-img img { width: 24px; height: 24px; }
    .url-title { font-size: .8rem; }
    .url-desc { font-size: .7rem; }
    /* 手机端隐藏广告栏 */
    .nav-rightbar { display: none; }
    .nav-mobile-ad { display: block; }
}
@media (max-width: 480px) {
    .url-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .cat-block-title { font-size: .92rem; }
    .cat-block-desc { display: none; }
    .nav-layout { padding: 0 8px; }
}
@media (max-width: 360px) {
    .url-grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
    .url-title { font-size: .75rem; }
    .url-img { width: 30px; height: 30px; }
    .url-img img { width: 21px; height: 21px; }
}

/* 电脑端：二级分类默认折叠，点击一级分类后展开（bgrdh风格） */
@media (min-width: 992px) {
    .nav-sidebar-sub { display: none; }
    .nav-sidebar-link .sidebar-arrow { display: inline-flex; }
}

/* 暗色主题适配 */
[data-bs-theme="dark"] .nav-sidebar,
[data-bs-theme="dark"] .cat-block,
[data-bs-theme="dark"] .nav-right-ad,
[data-bs-theme="dark"] .nav-mobile-ad {
    border-color: var(--theme-border, #334155);
}
[data-bs-theme="dark"] .sub-tab {
    background: var(--theme-bg-tertiary, #334155);
    color: var(--theme-text-secondary, #e2e8f0);
}
[data-bs-theme="dark"] .sub-tab.active {
    background: #1e73be;
    color: #fff;
}
[data-bs-theme="dark"] .url-card,
[data-bs-theme="dark"] .article-card {
    background: var(--theme-card-bg, #1e293b);
    border-color: var(--theme-border, #334155);
}
[data-bs-theme="dark"] .cat-block-header {
    background: var(--theme-bg-secondary, #1e293b);
}
