/* =========================================
   产品列表页样式 (完整重构版)
   主色: var(--brand-blue, #2793ff)
   层级规则:
   第一级 = 白底 + 粗体深色 + 选中蓝色左竖条
   第二级 = 浅灰底 + 缩进 + 树线 + 小字号
   ========================================= */

.products-page-wrapper {
    padding: 40px 0 80px;
    background-color: #fff;
    min-height: 600px;
}

.products-layout {
    display: flex;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   左侧侧边栏
   ========================================= */
.products-sidebar {
    width: 240px;
    flex-shrink: 0;
}

.sidebar-header {
    background-color: var(--brand-blue, #2793ff);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 20px;
    margin-bottom: 0;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border: 1px solid #e5e5e5;
    border-top: none;
    background: #fff;
}

.category-list li {
    border-bottom: 1px solid #f0f0f0;
}
.category-list li:last-child {
    border-bottom: none;
}

/* ---------- 第一级（All Products / 父分类） ----------
   白底 + 粗体 + 深色字，和第二级形成强对比 */
.category-list > li > a {
    display: block;
    padding: 13px 20px;
    color: #22314a;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    background: #fff;
    position: relative;
    transition: all .2s;
}
.category-list > li > a:hover {
    color: var(--brand-blue, #2793ff);
    background: #f5f9ff;
}

/* 第一级高亮：蓝色左竖条 + 浅蓝底 */
.category-list > li.active > a {
    color: var(--brand-blue, #2793ff);
    background: #eaf4ff;
}
.category-list > li.active > a::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--brand-blue, #2793ff);
}

/* ---------- 第二级容器：浅灰底，视觉“嵌套”进父级 ---------- */
.category-list .sub-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- 第二级链接：缩进 + 小字号 + 常规字重 ---------- */
.category-list .sub-cat-list li a {
    display: block;
    padding: 10px 15px 10px 46px;
    font-size: 13px;
    font-weight: 400;
    color: #000;
    text-decoration: none;
    position: relative;
    transition: all .2s;
}
.category-list .sub-cat-list li a:hover {
    color: var(--brand-blue, #2793ff);
    background: #eef4fa;
}

/* 第二级高亮：只变蓝加粗，缩进/树线/灰底全部保留，
   所以即使选中也一眼能看出是子级 */
.category-list .sub-cat-list li.active > a {
    color: var(--brand-blue, #2793ff);
    font-weight: 600;
    background: #e9f2fb;
}

/* ---------- 树状连接线：看出父子关系 ---------- */
.category-list .sub-cat-list li { position: relative; }
.category-list .sub-cat-list li::before {
    content: '';
    position: absolute;
    left: 26px; top: 0; bottom: 0;
    border-left: 1px solid #d8e0ea;
}
.category-list .sub-cat-list li:last-child::before { bottom: 50%; }
.category-list .sub-cat-list li::after {
    content: '';
    position: absolute;
    left: 26px; top: 50%;
    width: 10px;
    border-top: 1px solid #d8e0ea;
}

/* 第三级预留（更深层继续加大缩进） */
.category-list .sub-cat-list .sub-cat-list li::before,
.category-list .sub-cat-list .sub-cat-list li::after { left: 46px; }
.category-list .sub-cat-list .sub-cat-list li a { padding-left: 66px; }

/* =========================================
   右侧主内容
   ========================================= */
.products-main {
    flex: 1;
    min-width: 0;
}

.products-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.category-title {
    color: var(--brand-blue, #2793ff);
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

/* ---------- 无按钮搜索框 ---------- */
.products-search { flex-shrink: 0; }

.product-search-box {
    position: relative;
    border: 2px solid var(--brand-blue, #2793ff);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    transition: box-shadow .25s ease, border-color .25s ease;
}
.product-search-box:focus-within {
    box-shadow: 0 0 0 3px rgba(39, 147, 255, .15);
}
.product-search-box .search-field {
    border: none;
    outline: none;
    padding: 10px 42px 10px 15px;
    font-size: 14px;
    width: 260px;
    background: transparent;
}
.product-search-box .search-field::placeholder { color: #999; }
.product-search-box .search-icon {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--brand-blue, #2793ff);
    pointer-events: none;
    font-size: 15px;
}

/* ---------- 产品网格 ---------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.product-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    text-align: center;
    transition: box-shadow .3s, transform .3s;
}
.product-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transform: translateY(-3px);
}

.product-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.product-image-box {
    height: 220px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    overflow: hidden;
}

.product-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.no-img-placeholder {
    color: #999;
    font-size: 14px;
}

.product-info { padding: 15px 10px; }

.product-name {
    font-size: 14px;
    color: #333;
    margin: 0;
    line-height: 1.4;
    font-weight: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}
.product-link:hover .product-name {
    color: var(--brand-blue, #2793ff);
}

/* ---------- All Products 分组标题 ---------- */
.product-group { margin-bottom: 48px; }
.product-group:last-of-type { margin-bottom: 8px; }

.group-title {
    font-size: 22px;
    font-weight: 700;
    color: #2c3e50;
    border-left: 4px solid var(--brand-blue, #2793ff);
    padding-left: 12px;
    margin: 0 0 22px 0;
    line-height: 1.2;
}

/* ---------- 加载 / 无产品提示 ---------- */
.products-loading {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 15px;
}
.no-products-message {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border-radius: 8px;
}
.no-products-message p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* =========================================
   翻页器（蓝色，hover 微抬升）
   ========================================= */
.products-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 45px;
}
.products-pagination a,
.products-pagination .page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #4a5568;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, color .2s ease, background .2s ease, box-shadow .2s ease;
}
.products-pagination a.page-num:hover,
.products-pagination a.prev:hover,
.products-pagination a.next:hover {
    transform: translateY(-2px);
    border-color: var(--brand-blue, #2793ff);
    color: var(--brand-blue, #2793ff);
    background: #f0f7ff;
    box-shadow: 0 4px 10px rgba(39, 147, 255, .12);
}
.products-pagination .page-num.current {
    background: var(--brand-blue, #2793ff);
    border-color: var(--brand-blue, #2793ff);
    color: #fff;
    box-shadow: 0 4px 12px rgba(39, 147, 255, .3);
    cursor: default;
}
.products-pagination a.prev,
.products-pagination a.next { min-width: 84px; }

/* =========================================
   响应式适配
   ========================================= */
@media (max-width: 992px) {
    .products-grid { grid-template-columns: repeat(2, 1fr); }
    .products-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .products-search { width: 100%; }
    .product-search-box,
    .product-search-box .search-field { width: 100%; }
}

@media (max-width: 768px) {
    .products-page-wrapper { padding: 20px 0 50px; }
    .products-layout {
        flex-direction: column;
        gap: 20px;
    }
    .products-sidebar {
        width: 100%;
        margin-bottom: 10px;
    }
    .products-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .category-title { font-size: 22px; }
    .product-image-box { height: 200px; }
    .products-pagination a,
    .products-pagination .page-num {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    .products-pagination a.prev,
    .products-pagination a.next { min-width: 70px; }
}