
/* 关键：让主内容区可以被压缩，否则标签栏会把页面撑宽，永远不出现横向滚动 */
.layout-main > .main-content,
.main-content {
    min-width: 0;
}

/* ==========================================================================
   前台 · 动态分类标签栏
   ========================================================================== */

.filter-scroll {
    position: relative;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.filter-bar {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    padding: 8px 4px;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-x;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-bar.is-dragging {
    cursor: grabbing;
}

/* 拖拽时不禁用按钮 pointer-events：否则 click 目标会变成容器，导致标签点不动；
   改为在 JS 里用移动距离判断是否算拖拽并拦截 click */

/* 左右渐变遮罩，提示可滑动 */
.filter-scroll::before,
.filter-scroll::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 34px;
    z-index: 2;
    pointer-events: none;
}

.filter-scroll::before {
    left: 0;
    background: linear-gradient(to right, rgba(247, 247, 251, 0.92), rgba(247, 247, 251, 0));
}

.filter-scroll::after {
    right: 0;
    background: linear-gradient(to left, rgba(247, 247, 251, 0.92), rgba(247, 247, 251, 0));
}

/* 二级分类行：默认收起（高度 0），展开时高度 + 透明度过渡，避免闪现/留白 */
.filter-bar--sub {
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding-left: 14px;
    border-left: 3px solid var(--color-primary-light);
    cursor: default;
    transition: max-height 0.22s ease, opacity 0.22s ease, margin-top 0.22s ease, padding 0.22s ease;
}

.filter-bar--sub.is-open {
    margin-top: -6px;
    padding-top: 8px;
    padding-bottom: 8px;
    max-height: 90px;
    opacity: 1;
}

.filter-btn--child {
    font-size: 13px;
    padding: 5px 12px;
}

/* 加载骨架 */
.filter-skeleton {
    display: inline-block;
    width: 64px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(90deg, #ececf3 25%, #f7f7fb 37%, #ececf3 63%);
    background-size: 400% 100%;
    animation: filterShimmer 1.2s ease infinite;
    flex: 0 0 auto;
}

@keyframes filterShimmer {
    0% { background-position: 100% 0; }
    100% { background-position: 0 0; }
}

/* 侧栏子分类缩进 */
.tag-cloud .tag--child {
    font-size: 12px;
    padding: 4px 10px;
}

@media (max-width: 768px) {
    .filter-bar {
        gap: 8px;
        padding: 6px 2px;
    }
    .filter-scroll::before,
    .filter-scroll::after {
        width: 20px;
    }
}

/* 标签本身：禁止被 flex 压缩、禁止文字换行（关键） */
.filter-bar .filter-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    align-self: center;
}
