/*!
 * shopxo 主题 —— 分类列表页（对齐 design/prototype 的分类页版式）
 * 结构：左侧属性筛选（有筛选才出现，无则整栏消失）
 *      → 右侧排序条（分类名 + 子分类 + 排序 tabs + 总数）→ 4 列商品网格 → 分页
 * 注：左侧一级分类导航已按用户要求移除（分类入口由首页左侧分类列承担）。
 */

/* ===================== 两栏骨架 ===================== */
.sx-list-body {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.sx-list-side {
    flex: 0 0 200px;
    width: 200px;
}

.sx-list-side .sx-side-card {
    margin-bottom: 12px;
}

.sx-list-side .sx-side-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    font-weight: 700;
    color: var(--color-title);
}

.sx-list-main {
    flex: 1;
    min-width: 0;
}

/* ===================== 属性筛选 ===================== */
/* 注：左侧一级分类导航已按用户要求移除（分类入口由首页左侧分类列承担），
   分类页左栏现在只剩属性筛选卡；无属性筛选时模板整块不输出，左栏消失。 */
.sx-filter {
    margin-top: 12px;
    padding: 4px 14px 10px;
    border: 1px solid var(--color-border);
    border-radius: 0;
    background: #fff;
}

.sx-filter .sx-side-title {
    margin-top: 10px;
}

.sx-filter-row {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px dashed var(--color-border);
}

.sx-filter-row:last-child {
    border-bottom: 0;
}

.sx-filter-title {
    flex: 0 0 62px;
    color: var(--color-title);
    font-size: 13px;
    line-height: 24px;
}

.sx-filter-values {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sx-filter-values li {
    list-style: none;
}

.sx-filter-values li a {
    display: inline-block;
    margin: 0 8px 6px 0;
    padding: 2px 10px;
    border-radius: 12px;
    color: var(--color-sub);
    font-size: 12px;
    text-decoration: none;
}

.sx-filter-values li a:hover {
    color: var(--color-main);
}

.sx-filter-values li.sx-active a {
    background: var(--color-main-light);
    color: var(--color-main);
}

.sx-filter-extra {
    padding: 8px 0 2px;
    border-bottom: 1px dashed var(--color-border);
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--color-sub);
    white-space: nowrap;
}

/* ===================== 排序条 ===================== */
.sx-sortbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    background: #fff;
    font-size: 13px;
}

.sx-sort-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sx-sort-cat {
    font-weight: 700;
    color: var(--color-title);
    white-space: nowrap;
}

.sx-sort-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.sx-sort-subs a {
    color: var(--color-sub);
    text-decoration: none;
}

.sx-sort-subs a:hover {
    color: var(--color-main);
}

.sx-sort-tabs {
    display: flex;
    margin: 0 0 0 auto;
    padding: 0;
    list-style: none;
}

.sx-sort-tabs li {
    list-style: none;
}

.sx-sort-tabs li a {
    display: inline-block;
    margin-right: 18px;
    color: var(--color-sub);
    text-decoration: none;
}

.sx-sort-tabs li a:hover {
    color: var(--color-main);
}

.sx-sort-tabs li.sx-active a {
    color: var(--color-main);
    font-weight: 600;
}

.sx-sort-total {
    color: var(--color-weak);
    font-size: 12px;
    white-space: nowrap;
}

/* ===================== 商品网格 ===================== */
.sx-list-main .sx-goods-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 0;
}

.sx-list-main .sx-goods-cell {
    width: auto;
    padding: 0;
}

.sx-list-main .sx-goods-card {
    border-color: var(--color-border);
}

/* 空态 .sx-empty 与分页 .sx-pager 的公共基元已收口到 theme.css */

/* ===================== 响应式 ===================== */
@media only screen and (max-width: 1199px) {
    .sx-list-main .sx-goods-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media only screen and (max-width: 1024px) {
    .sx-list-side {
        flex: 0 0 180px;
        width: 180px;
    }

    .sx-list-main .sx-goods-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media only screen and (max-width: 640px) {
    .sx-list-main .sx-goods-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ===================== 移动端（≤768）：筛选整行 + 商品流 =====================
   左侧一级分类竖列已按用户要求移除，窄屏下属性筛选不再挤在窄列里，
   改为整行放在商品区上方。

   实现：.sx-list-side 用 display:contents 变成「透明」，让里面的筛选卡
   直接成为 .sx-list-body 的 grid 子项，从而能放到独立的网格区域
   （桌面端 display:contents 不生效，侧栏仍是普通 flex 栏，行为不变）。 */
@media only screen and (max-width: 768px) {
    /* 分类页整页白底 */
    body.sx-page-list {
        background: #fff;
    }

    .sx-list-body {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "main"
            "filter";
        column-gap: 10px;
        row-gap: 12px;
        align-items: start;
    }

    .sx-list-side {
        display: contents;
    }

    /* 筛选卡整行铺在商品区上方 */
    .sx-filter {
        grid-area: filter;
        margin: 0;
    }

    .sx-filter-row {
        display: block;
        padding: 8px 0;
    }

    .sx-filter-title {
        margin-bottom: 4px;
    }

    .sx-list-main {
        grid-area: main;
    }

    .sx-sortbar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
        margin-bottom: 10px;
    }

    .sx-sort-info {
        width: 100%;
    }

    .sx-sort-subs {
        display: none;
    }

    .sx-sort-tabs {
        margin-left: 0;
    }

    .sx-sort-tabs li a {
        margin-right: 12px;
    }
}
