/* =========================
   页面基础
========================= */

.product-page {
    padding: 24px 16px;
}

.product-page .page-layout {
    width: 100%;
}


/* =========================
   主布局
========================= */

.page-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}


/* =========================
   sidebar
========================= */

.sidebar {
    position: sticky;
    top: 20px;

    background: #fff;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #eee;
}

.card-header {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}


/* =========================
   分类列表
========================= */

.category-list a {
    display: block;
    padding: 10px 12px;
    border-radius: 6px;
    color: #333;
    cursor: pointer;
    transition: 0.2s;
}

.category-list a:hover {
    background: #f2f6ff;
}

.category-list a.active {
    background: #1677ff;
    color: #fff;
}


/* =========================
   分类两级结构
========================= */

.category-group {
    margin-bottom: 10px;
}

.category-parent {
    font-weight: 600;
    padding: 10px 12px;
    background: #f5f7fa;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

.category-parent:hover {
    background: #eaf2ff;
}

.category-children {
    padding-left: 12px;
    margin-top: 5px;
}

.category-children a {
    display: block;
    padding: 6px 10px;
    font-size: 13px;
    color: #555;
    border-radius: 4px;
    transition: 0.2s;
}

.category-children a:hover {
    background: #eef3ff;
    color: #1677ff;
}


/* =========================
   active 状态
========================= */

.category-parent.active,
.category-children a.active {
    background: #1677ff;
    color: #fff;
    border-radius: 6px;
}

.category-group.active-group > .category-parent {
    background: #e0ecff;
}


/* =========================
   产品网格
========================= */

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}


/* =========================
   产品卡片
========================= */

.product-card {
    display: block;
    overflow: hidden;

    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;

    cursor: pointer;
    transition: 0.25s;

    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}


/* =========================
   图片容器
========================= */

.product-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;

    background: #f5f5f5;

    display: flex;
    align-items: center;
    justify-content: center;
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;

    transition: transform 0.3s ease;
}

.product-card:hover .product-img img {
    transform: scale(1.05);
}


/* =========================
   产品信息
========================= */

.product-info {
    padding: 12px 8px;
    text-align: center;
}

.product-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
}

.product-info p {
    font-size: 12px;
    color: #888;
    margin: 0;
}


/* =========================
   空状态
========================= */

.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: #999;
    padding: 40px 0;
}


/* =========================
   移动端分类按钮
========================= */

.mobile-filter-bar {
    display: none;
    position: relative;
    z-index: 30;
    margin-bottom: 12px;
}

.mobile-filter-bar button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 38px;
    padding: 0 18px;

    border-radius: 8px;
    border: 1px solid #dcdfe6;
    background: #fff;

    font-size: 14px;
    font-weight: 500;
}


/* =========================
   遮罩层
========================= */

.category-mask {
    display: none;
}


/* =========================
   平板 / 手机
========================= */

@media (max-width: 992px) {

    .product-page {
        padding: 22px 14px 24px;
    }

    .page-layout {
        display: grid;
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mobile-filter-bar {
        display: block;
        margin-top: 12px;
        margin-bottom: 16px;
    }

    .content {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* 侧边栏：只用 left 控制，不混用 transform */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;

        width: 260px;
        height: 100vh;

        z-index: 1001;

        border-radius: 0;
        border: none;
        border-right: 1px solid #eee;

        overflow-y: auto;

        transition: left 0.25s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .category-mask {
        display: none;

        position: fixed;
        inset: 0;

        background: rgba(0, 0, 0, 0.35);

        z-index: 1000;
    }

    .category-mask.open {
        display: block;
    }

    body.category-open {
        overflow: hidden;
    }

}


/* =========================
   小屏手机
========================= */

@media (max-width: 576px) {

    .product-page {
        padding: 24px 14px 26px;
    }

    .mobile-filter-bar {
        margin-top: 14px;
        margin-bottom: 16px;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .product-info {
        padding: 8px 6px 10px;
    }

    .product-info h4 {
        font-size: 13px;
        line-height: 1.35;
    }

}


/* =========================
   超小屏
========================= */

@media (max-width: 380px) {

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .product-info h4 {
        font-size: 12px;
    }

}