/* =====================
   商品列表页样式
===================== */

/* 列表容器 */
.list-container {
    display: flex;
    margin-top: 24px;
    gap: 24px;
}

/* 左侧分类导航 */
.category-sidebar {
    width: 200px;
    flex-shrink: 0;
}

.category-sidebar h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: #212121;
    position: relative;
    padding-bottom: 8px;
}

.category-sidebar h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: #1B5E20;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 8px;
}

.category-list a {
    display: block;
    padding: 10px 16px;
    color: #212121;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.3s;
}

.category-list a:hover {
    background-color: #f5f5f5;
    color: #1B5E20;
}

.category-list a.active {
    background-color: #1B5E20;
    color: white;
}

/* 右侧商品列表 */
.product-container {
    flex: 1;
}

/* 排序栏 */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-options select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.view-btn:hover {
    background-color: #f5f5f5;
}

.view-btn.active {
    background-color: #1B5E20;
    color: white;
    border-color: #1B5E20;
}

/* 商品网格 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.product-card {
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.product-image {
    height: 180px;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 48px;
}

.product-info {
    padding: 16px;
}

.product-name {
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 40px;
}

.product-price {
    color: #e53935;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 8px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #757575;
    margin-bottom: 8px;
}

.product-status {
    background-color: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.product-location {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.product-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #757575;
}

/* 列表视图 */
.product-grid.list-view {
    grid-template-columns: 1fr;
}

.product-grid.list-view .product-card {
    display: flex;
    align-items: center;
}

.product-grid.list-view .product-image {
    width: 180px;
    height: 180px;
    flex-shrink: 0;
}

.product-grid.list-view .product-info {
    flex: 1;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.page-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.page-btn:hover:not(:disabled) {
    background-color: #f5f5f5;
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-num {
    font-size: 14px;
    color: #757575;
}

/* 无结果提示 */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #757575;
    font-size: 16px;
    grid-column: 1 / -1;
}

.no-results a {
    color: #1B5E20;
    text-decoration: none;
    font-weight: 500;
    margin-top: 16px;
    display: inline-block;
}

.no-results a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .list-container {
        flex-direction: column;
    }
    
    .category-sidebar {
        width: 100%;
        margin-bottom: 24px;
    }
    
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .category-list li {
        margin-bottom: 0;
    }
    
    .category-list a {
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .sort-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .product-image {
        height: 120px;
        font-size: 36px;
    }
    
    .product-info {
        padding: 12px;
    }
    
    .product-name {
        font-size: 14px;
        height: 36px;
    }
    
    .product-price {
        font-size: 16px;
    }
    
    .product-grid.list-view .product-card {
        flex-direction: column;
    }
    
    .product-grid.list-view .product-image {
        width: 100%;
        height: 180px;
    }
}
