/* ============================================================
 * 标签工作台（/documents/tag）专属样式
 * ============================================================
 * 2026-11-04 从 tags.css 拆出：这些规则全部以 .tag-page 开头，只在本页命中，
 * 原先随 tags.css 全站加载 = 每个页面白下 7.1KB（gzip 2.3KB）。
 * 现在由 layout/base.html 按 $__tag_page_css 条件加载（只有 document/tag.html 设置）。
 * ⛔ tags.css 里的 .tag-pills / .tag-platform / 徽章 / 详情页 .doc-info-tag 是**全站**共用的，
 *   别搬回本文件。
 * ============================================================ */

/* ============================================================
 * 标签工作台（2026-11-04 用户草图）：主内容在左，筛选面板在右
 * 本页不注入站点右栏（$__rightbar 为空），.app-main-inner 保持单列，
 * 右列空间由 .tag-panel 独占，避免「右栏 + 筛选」挤成两条窄栏。
 * ============================================================ */
.tag-page .tag-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(210px, 23%, 268px);
    gap: 20px;
    align-items: start;
}
.tag-page .tag-main { min-width: 0; }

/* ---- 已选条件条（左侧主区顶部）---- */
.tag-page .tag-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 13px;
}
.tag-page .tag-crumb {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--color-bg-tag);
    color: var(--color-text-title);
    font-weight: 500;
    text-decoration: none;
    transition: background .15s;
}
.tag-page .tag-crumb-cat { background: var(--color-accent-soft); color: var(--color-accent); }
.tag-page .tag-crumb:hover { background: var(--color-bg-tag-hover); }
.tag-page .tag-crumb-x { font-size: 12px; opacity: .6; }
.tag-page .tag-crumbs-reset { font-size: 12px; color: var(--color-accent); text-decoration: none; }
.tag-page .tag-crumbs-reset:hover { text-decoration: underline; }

/* ---- 视图切换（复用 toolbar.css 的 .view-switch / .view-btn，只补链接态）----
   本页是服务端链接跳转（无 document.js 的 AJAX 重绘），所以按钮渲染成 <a>。
   三种模式的容器列数 / 显隐由 responsive.css + toolbar.css 的 .doc-view-* 负责。 */
.tag-page .tag-view-switch { margin-left: auto; flex: 0 0 auto; }
.tag-page .tag-view-switch .view-btn { text-decoration: none; }

/* ---- 右侧筛选面板 ---- */
.tag-page .tag-panel {
    position: sticky;
    top: 84px;
    align-self: start;
    padding: 14px 16px 16px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
}
.tag-page .tag-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.tag-page .tag-panel-head-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-title);
}
.tag-page .tag-panel-toggle { display: none; }

.tag-page .tag-side-sec { margin-bottom: 16px; }
.tag-page .tag-side-sec:last-child { margin-bottom: 0; }
.tag-page .tag-side-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.tag-page .tag-side-title::after {
    content: '';
    flex: 1 1 auto;
    height: 1px;
    background: var(--color-border);
}
.tag-page .tag-side-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
/* 类型列表可能很长（线上 170+ 标签），限高滚动，避免把面板拉成一整屏；
   2026-11-04 用户要求「类型再加高」→ 由 360 提到 520（平台段已删除，该列由类型面板独占） */
.tag-page .tag-type-list {
    max-height: 520px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 2px;
}
.tag-page .tag-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.tag-page .tag-opt:hover { background: var(--color-bg-card-2); color: var(--color-text-title); }
.tag-page .tag-opt.is-active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 600;
}
.tag-page .tag-opt.is-disabled { opacity: .45; cursor: not-allowed; }
/* 大类：可展开分组（子分类 = 左侧菜单的缩进层；2026-11-04 起「平台」并入游戏的子分类） */
.tag-page .tag-cat-list { display: flex; flex-direction: column; gap: 2px; }
.tag-page .tag-cat-group { display: flex; flex-direction: column; gap: 2px; }
.tag-page .tag-cat-head { width: 100%; }
.tag-page .tag-caret {
    margin-left: auto;
    font-size: 11px;
    line-height: 1;
    opacity: .6;
    transition: transform .15s;
}
.tag-page .tag-cat-group.is-open .tag-caret { transform: rotate(90deg); opacity: 1; }
.tag-page .tag-sub-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 2px 0 6px 14px;
    padding-left: 8px;
    border-left: 1px dashed var(--color-border);
}
.tag-page .tag-sub-opt {
    display: block;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--color-text-dim);
    text-decoration: none;
    transition: background .15s, color .15s;
}
.tag-page .tag-sub-opt:hover { background: var(--color-bg-card-2); color: var(--color-text-title); }
.tag-page .tag-sub-opt.is-active {
    background: var(--color-accent-soft);
    color: var(--color-accent);
    font-weight: 600;
}
.tag-page .tag-opt-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tag-page .tag-opt-count {
    flex: 0 0 auto;
    font-style: normal;
    font-size: 11px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--color-text-title) 10%, transparent);
    color: var(--color-text-dim);
}
.tag-page .tag-opt.is-active .tag-opt-count {
    background: color-mix(in srgb, var(--color-accent) 18%, transparent);
    color: var(--color-accent);
}
/* 单选圆点（大类 / 类型共用） */
.tag-page .tag-opt-dot {
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--color-border);
    border-radius: 50%;
    background: transparent;
    transition: border-color .15s, background .15s;
}
.tag-page .tag-opt.is-active .tag-opt-dot {
    border-color: var(--color-accent);
    background: var(--color-accent);
}

/* 移动端（<992px）：双列改单列，筛选面板落到结果区上方并可折叠 */
@media (max-width: 991px) {
    .tag-page .tag-workbench { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .tag-page .tag-panel { position: static; order: -1; padding: 10px 12px; }
    .tag-page .tag-panel-head { margin-bottom: 0; }
    .tag-page .tag-panel-head-title { display: none; }
    .tag-page .tag-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 8px 10px;
        font-size: 13px;
        font-weight: 600;
        color: var(--color-accent);
        background: var(--color-accent-soft);
        border: 1px solid transparent;
        border-radius: var(--radius-sm);
        cursor: pointer;
    }
    .tag-page .tag-panel-body { display: none; margin-top: 12px; }
    .tag-page .tag-panel.is-open .tag-panel-body { display: block; }
    .tag-page .tag-type-list { max-height: none; overflow: visible; }
}

/* 分页栏：pagination.css 的默认 20px 上间距在本页白底卡片里显得空旷，收紧为 8px。
   ⚠️ 2026-11-04 前这条写在 home.css，而本页不注入右栏 → 不加载 home.css → 从未生效。
   现在归位到本文件（本页专属样式只放这里）。 */
.tag-page .app-card-pager { margin-top: 8px; }
