/* 产品页面样式
   作者：张同学
   日期：2024年3月 */

/* ========== 页面头部 ========== */
.page-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #fff;
    padding: 30px 0;
    margin-top: 50px;
}

.page-title {
    font-size: 2.4rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.page-desc {
    font-size: 1.4rem;
    opacity: 0.9;
}

/* ========== 分类标签 ========== */
.category-section {
    padding: 20px 0;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 50px;
    z-index: 100;
}

.category-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 5px 0;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    background: var(--bg-gray);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 1.3rem;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.tab-btn:active {
    transform: scale(0.95);
}

/* ========== 产品网格 ========== */
.products-grid {
    padding: 20px 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.product-item {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: all 0.3s ease;
}

.product-item:active {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.product-item a {
    display: block;
}

.product-img {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
    background: var(--bg-gray);
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-item:hover .product-img img {
    transform: scale(1.05);
}

.product-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    background: var(--accent-color);
    color: #fff;
    font-size: 1.1rem;
    border-radius: 15px;
    font-weight: 500;
}

.product-tag.new {
    background: var(--secondary-color);
}

.product-tag.hot {
    background: #FF6B6B;
}

.product-info {
    padding: 12px;
}

.product-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-brief {
    font-size: 1.2rem;
    color: var(--text-light);
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-price {
    font-size: 1.6rem;
    color: var(--accent-color);
    font-weight: bold;
}

.product-sales {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* ========== 加载更多 ========== */
.load-more {
    text-align: center;
    padding: 20px 0;
}

/* ========== 服务承诺 ========== */
.service-promise {
    background: var(--bg-gray);
    padding: 40px 0;
}

.promise-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 30px;
}

.promise-item {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow-color);
}

.promise-icon {
    font-size: 3rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.promise-title {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 5px;
}

.promise-desc {
    font-size: 1.2rem;
    color: var(--text-light);
}

/* ========== 产品详情页 ========== */
.product-detail {
    background: #fff;
}

.detail-images {
    position: relative;
    width: 100%;
    height: 300px;
    background: var(--bg-gray);
}

.detail-images img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-dots {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.image-dot {
    width: 8px;
    height: 8px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    cursor: pointer;
}

.image-dot.active {
    background: #fff;
    width: 20px;
    border-radius: 4px;
}

.detail-info {
    padding: 20px;
}

.detail-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 10px;
}

.detail-subtitle {
    font-size: 1.4rem;
    color: var(--text-light);
    margin-bottom: 20px;
}

.detail-price-box {
    background: linear-gradient(135deg, #FFE5E5, #FFF5F5);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.price-current {
    font-size: 2.4rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-right: 10px;
}

.price-original {
    font-size: 1.6rem;
    color: #999;
    text-decoration: line-through;
}

.price-discount {
    display: inline-block;
    padding: 2px 8px;
    background: var(--accent-color);
    color: #fff;
    font-size: 1.2rem;
    border-radius: 5px;
    margin-left: 10px;
}

.detail-specs {
    margin: 20px 0;
}

.spec-item {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.spec-label {
    flex-shrink: 0;
    width: 80px;
    color: var(--text-light);
    font-size: 1.4rem;
}

.spec-value {
    flex: 1;
    color: var(--text-color);
    font-size: 1.4rem;
}

.detail-actions {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    padding: 15px;
    box-shadow: 0 -2px 10px var(--shadow-color);
    display: flex;
    gap: 10px;
}

.btn-cart {
    flex: 1;
    padding: 12px;
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
}

.btn-buy {
    flex: 1;
    padding: 12px;
    background: var(--accent-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
}

.detail-tabs {
    margin-top: 30px;
}

.tab-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.tab-nav-item {
    flex: 1;
    padding: 15px;
    text-align: center;
    font-size: 1.4rem;
    color: var(--text-light);
    cursor: pointer;
    position: relative;
}

.tab-nav-item.active {
    color: var(--primary-color);
    font-weight: 500;
}

.tab-nav-item.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* ========== 响应式设计 ========== */
@media (min-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .product-img {
        height: 180px;
    }
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .promise-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .detail-images {
        height: 400px;
    }
}