/* ======== 产品页专属样式 ======== */

.section {
    padding: 60px 0;
}

/* ======== banner设置 ======== */
.page-banner {
    height: 520px;
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    position: relative;
    
}
.page-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
}
.page-banner-title {
    position: relative;
    z-index: 2;
    border-top: 2px solid rgba(255, 255, 255, 0.5);
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    padding: 20px 40px;
}
.page-banner-title h1 {
    font-size: 36px;
    font-weight: bold;
    letter-spacing: 2px;
}

/* ======== 页面两栏布局与粘性侧边栏 ======== */
.page-layout {
    display: grid;
    grid-template-columns: 280px 1fr; 
    gap: 40px; /* 间距可以适当大一些 */
    align-items: flex-start;
}

.sidebar {
    position: sticky;
    top: 100px; 
    border: 1px solid #eee;
    border-radius: 5px;
}

.category-title {
    padding: 15px 20px;
    background-color: #f8f8f8;
    border-bottom: 1px solid #eee;
    font-size: 18px;
}

/* ======== 侧边栏 ======== */
.category-item {
    position: relative;
    border-bottom: 1px solid #eee;
}
.category-item:last-child {
    border-bottom: none;
}
.category-item a {
    display: block;
    padding: 15px 20px;
    transition: background-color 0.3s, color 0.3s;
}
.category-item.active > a {
    background-color: var(--primary-color);
    color: #fff;
    font-weight: bold;
}
.category-item:not(.active) > a:hover {
    background-color: #f8f8f8;
    color: var(--primary-color);
}
.subcategory-list {
    display: none;
    background-color: #fdfdfd;
}
.subcategory-list .category-item a {
    padding-left: 40px;
}
.toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 56px;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: #ccc;
    font-size: 14px;
    transition: transform 0.3s;
}
.toggle-btn:hover {
    color: var(--primary-color);
}
.toggle-btn.open {
    transform: rotate(180deg);
}

/* ======== 产品显示 ======== */
.product-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}
.product-card {
    text-align: center;
    border: 1px solid #eee;
    border-radius: 5px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}
.product-card img {
    width: 100%;
    height: auto;
    display: block;
}
.product-title {
    padding: 15px;
    font-size: 16px;
}

/* ======== 响应式调整 ======== */
@media (max-width: 992px) {
    .page-layout {
        grid-template-columns: 1fr; /* 变为单列 */
    }
    .sidebar {
        position: static;
        margin-bottom: 40px;
    }
    .grid-4 {
        grid-template-columns: repeat(2, 1fr); /* 平板上变为2列 */
    }
}
@media (max-width: 768px) {
    /* 桌面端隐藏的展开按钮在移动端显示 */
    .toggle-btn { display: block; }
    /* 在移动端，子分类默认隐藏 */
    .subcategory-list { display: none; }
}
@media (min-width: 769px) {
    /* 在桌面端，隐藏展开按钮，直接显示子分类 */
    .toggle-btn { display: none; }
    .subcategory-list {
        display: block;
        background-color: transparent;
    }
}