/* 产品列表页样式 */

/* 页面头部 */
.page-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--textile-blue) 100%);
    color: var(--light);
    padding: 60px 0 40px;
    position: relative;
    overflow: hidden;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--textile-pattern);
    opacity: 0.1;
}

.page-header .container {
    position: relative;
    z-index: 2;
}

.breadcrumb {
    margin-bottom: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.breadcrumb a {
    color: var(--light);
    text-decoration: none;
    transition: var(--transition);
}

.breadcrumb a:hover {
    color: var(--secondary);
}

.separator {
    margin: 0 10px;
    opacity: 0.6;
}

.current {
    opacity: 0.8;
}

.page-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.page-description {
    font-size: 18px;
    opacity: 0.9;
    max-width: 600px;
    line-height: 1.6;
}

/* 产品区域布局 */
.products-section {
    padding: 60px 0;
    background: var(--light);
}

.products-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 40px;
}

/* 侧边栏样式 */
.products-sidebar {
    background: var(--light);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 0;
    height: fit-content;
    position: sticky;
    top: 100px;
}

.filter-group {
    border-bottom: 1px solid var(--border-light);
    padding: 25px;
}

.filter-group:last-child {
    border-bottom: none;
}

.filter-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 20px;
    position: relative;
}

.filter-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--primary);
    border-radius: 1px;
}

/* 分类列表 */
.category-list {
    list-style: none;
}

.category-list > li {
    margin-bottom: 8px;
    /* display: flex;
    align-items: center;
    gap: 8px; */
}

.category-list a {
    display: block;
    /* align-items: center; */
    padding: 10px 0;
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap;
}

.category-list a:hover,
.category-list a.active {
    color: var(--primary);
    padding-left: 15px;
}

.category-list a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 3px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
    transform: translateY(-50%);
}

.subcategory-list {
    list-style: none;
    margin-left: 20px;
}



.subcategory-list a {
    font-size: 14px;
    padding: 6px 0;
    font-weight: 400;
    /* display: inline-block;
    white-space: nowrap;  */
}

/* hide scrollbar for modern browsers while keeping scrollable */
.subcategory-list {
    scrollbar-width: none; /* Firefox */
}
.subcategory-list::-webkit-scrollbar { /* WebKit */
    height: 6px;
}
.subcategory-list::-webkit-scrollbar-track { background: transparent; }
.subcategory-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); border-radius: 3px; }
.subcategory-list::-webkit-scrollbar { display: none; }

/* 筛选选项 */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-gray);
    transition: var(--transition);
}

.filter-option:hover {
    color: var(--primary);
}

.filter-option input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 3px;
    position: relative;
    transition: var(--transition);
}

.filter-option input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-option input:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--light);
    font-size: 12px;
    font-weight: bold;
}

/* 侧边栏联系信息 */
.sidebar-contact {
    background: var(--accent);
    border-radius: 0 0 12px 12px;
    padding: 25px;
    text-align: center;
}

.sidebar-contact h3 {
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 10px;
}

.sidebar-contact p {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-gray);
}

.contact-item i {
    color: var(--primary);
    width: 16px;
}

.btn-small {
    padding: 10px 20px;
    font-size: 14px;
}

/* 主内容区域 */
.products-main {
    min-height: 600px;
}

/* 工具栏 */
.products-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.results-count {
    font-size: 14px;
    color: var(--text-gray);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.view-mode {
    display: flex;
    gap: 5px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    overflow: hidden;
}

.view-btn {
    background: var(--light);
    border: none;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-gray);
    transition: var(--transition);
}

.view-btn.active,
.view-btn:hover {
    background: var(--primary);
    color: var(--light);
}

.sort-dropdown select {
    padding: 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--light);
    color: var(--text-gray);
    font-size: 14px;
    cursor: pointer;
}

/* 产品网格 */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

/* Badge group: ensure multiple badges display inline with spacing */
.product-image { position: relative; }
.badge-group {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    z-index: 9999; /* ensure badges float above overlays/animations */
}
.product-image .product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2; /* keep overlay under badges */
}
.product-badge {
    display: inline-block;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    white-space: nowrap;
}
.product-badge.top { background: linear-gradient(90deg,#ff6b6b,#ff3b3b); }
.product-badge.recommend { background: linear-gradient(90deg,#ffaa00,#ff8c00); }
.product-badge.headline { background: linear-gradient(90deg,#5ad0ff,#2aa7e0); }

@media (max-width: 600px) {
    .badge-group { top: 8px; right: 8px; gap: 6px; }
    .product-badge { padding: 5px 7px; font-size: 11px; }
}

/* 分页样式 */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}

.pagination-left .pagination-summary {
    background: var(--primary);
    color: var(--light);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    display: inline-block;
}

.pagination-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-num, .page-numbar {
    color: var(--text-gray);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 6px;
}

.page-num:hover {
    background: rgba(43,87,151,0.08);
    color: var(--primary);
}

.page-numbar {
    padding: 6px 12px;
    background: transparent;
}

@media (max-width: 600px) {
    .pagination-wrapper { flex-direction: column; align-items: stretch; gap: 8px; }
    .pagination-right { justify-content: space-between; }
    /* on small screens, stack subcategories under parent for readability */
    .subcategory-list { display: block; margin-left: 0; }
    .subcategory-list li { display: block; margin-right: 0; }
}

@media (max-width: 768px) {
    /* ensure category list stacks on smaller screens */
    .category-list > li { display: block; }
    .subcategory-list { display: block; margin-left: 0; }
    .subcategory-list li { display: block; margin-right: 0; }
    .category-list a { display: block; padding: 10px 0; }
}

.products-grid.list-view {
    grid-template-columns: 1fr;
}

.products-grid.list-view .product-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 20px;
    align-items: start;
}

.products-grid.list-view .product-image {
    height: 150px;
}

/* 产品卡片 */
.product-card {
    background: var(--light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.product-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--accent);
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(43, 87, 151, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.overlay-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    color: var(--light);
    z-index: 2;
}

.product-badge.recommended, .product-badge.recommend {background: var(--secondary);} /* 兼容旧类名 */
.product-badge.hot, .product-badge.top {background:#ff4757;}
.product-badge.headline {background: linear-gradient(135deg,#8e44ad,#6c5ce7);} 

/* --- Overrides for multiple badges inside badge-group --- */
.badge-group { display:flex; }
.badge-group .product-badge {
    position: static; /* cancel absolute so flex can layout */
    top: auto; right: auto; left: auto; bottom: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    z-index: 1; /* container already sits above overlay */
}
.badge-group .product-badge + .product-badge { margin-left: 6px; }

.product-content {
    padding: 20px;
}

.product-title {
    margin-bottom: 10px;
}

.product-title a {
    color: var(--dark);
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    transition: var(--transition);
}

.product-title a:hover {
    color: var(--primary);
}

.product-description {
    color: var(--text-gray);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.product-specs {
    margin-bottom: 15px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-label {
    color: var(--text-gray);
    font-weight: 500;
}

.spec-value {
    color: var(--dark);
    font-weight: 600;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.product-meta {
    display: flex;
    gap: 15px;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-gray);
}

.meta-item i {
    font-size: 11px;
}

.product-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    border-radius: 50%;
    background: var(--light);
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.action-btn:hover {
    background: var(--primary);
    color: var(--light);
    border-color: var(--primary);
}

/* 分页样式 */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--text-gray);
    text-decoration: none;
    border-radius: 6px;
    transition: var(--transition);
    font-weight: 500;
}

.pagination a:hover,
.pagination .current {
    background: var(--primary);
    color: var(--light);
}

/* 改进的分页样式（更明显的上一页/下一页与禁用状态） */
.pagination-wrapper nav, .pagination-wrapper {
    text-align: center;
}
.pagination-wrapper .page-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5px;
    height: 36px;
    padding: 0 5px;
    margin: 0 5px;
    border-radius: 6px;
    color: var(--text-gray);
    text-decoration: none;
    border: 1px solid transparent;
}
.pagination-wrapper .page-first, .pagination-wrapper .page-last {
    font-weight: 600;
}
.pagination-wrapper .page-prev:empty,
.pagination-wrapper .page-next:empty {
    opacity: 0.5;
    pointer-events: none;
}
.pagination-wrapper .page-numbar {
    display: inline-block;
    margin: 0 8px;
}

/* 相关推荐 */
.related-products {
    padding: 60px 0;
    background: var(--cream);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.related-card {
    background: var(--light);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.related-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: var(--accent);
}

.related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.related-card:hover .related-image img {
    transform: scale(1.05);
}

.related-content {
    padding: 15px;
}

.related-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
}

.related-content p {
    font-size: 13px;
    color: var(--text-gray);
    line-height: 1.5;
    margin-bottom: 10px;
}

.related-link {
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}

.related-link:hover {
    color: var(--textile-blue);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .products-layout {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 40px 0 30px;
        text-align: center;
    }
    
    .page-title {
        font-size: 28px;
    }
    
    .page-description {
        font-size: 16px;
    }
    
    .products-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .products-sidebar {
        position: static;
        order: 2;
    }
    
    .products-main {
        order: 1;
    }
    
    .products-toolbar {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .toolbar-right {
        justify-content: space-between;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .products-grid.list-view .product-card {
        grid-template-columns: 1fr;
    }
    
    .related-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .product-card {
        margin: 0 10px;
    }
    
    .filter-group {
        padding: 20px 15px;
    }
    
    .sidebar-contact {
        padding: 20px 15px;
    }
}

/* 筛选激活状态 */
.filter-option.active {
    color: var(--primary);
}

.filter-option.active .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

/* 加载状态 */
.products-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-gray);
}

.products-loading .loading-spinner {
    margin: 0 auto 20px;
}

/* 空状态 */
.products-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-gray);
}

.products-empty i {
    font-size: 48px;
    color: var(--border-light);
    margin-bottom: 20px;
}

.products-empty h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--dark);
}

.products-empty p {
    font-size: 14px;
    line-height: 1.6;
}
