/**
 * 产品页面样式
 * 适用于 products.php 和 product.php
 */

/* ========== 产品列表页基础样式 (products.php) ========== */

/* 页面横幅 */
.page-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 40px;
}

.page-banner h1 {
    font-size: 36px;
    margin-bottom: 10px;
    font-weight: 600;
}

.page-banner p {
    font-size: 16px;
    opacity: 0.9;
}

/* 分类筛选标签 */
.category-filter {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.category-filter a {
    padding: 10px 25px;
    background: #f5f5f5;
    color: #333;
    text-decoration: none;
    border-radius: 25px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.category-filter a:hover,
.category-filter a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

/* 无数据提示 */
.products-grid .no-data {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 16px;
}

/* 产品网格 - 默认3列（桌面端） */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    padding: 20px 0;
}

/* 产品卡片样式优化 */
.products-grid .item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #f0f0f0;
}

.products-grid .item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
}

.products-grid .pic {
    height: 220px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.products-grid .pic img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.products-grid .item:hover .pic img {
    transform: scale(1.05);
}

.products-grid .text {
    padding: 15px 20px 20px;
}

.products-grid .text h3 {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 10px;
    color: #2c3e50;
    font-weight: 500;
}

.products-grid .text h3 a {
    color: inherit;
    text-decoration: none;
}

.products-grid .text h3 a:hover {
    color: #667eea;
}

.products-grid .text .btn {
    display: inline-block;
    padding: 8px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.3s;
}

.products-grid .text .btn:hover {
    opacity: 0.9;
}

/* 平板端 - 2列 */
@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .products-grid .pic {
        height: 180px;
    }
}

/* 手机端 - 1列 + 横向布局 */
@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px 0;
    }
    
    .products-grid .item {
        display: flex;
        flex-direction: row;
        border-radius: 10px;
    }
    
    .products-grid .pic {
        width: 120px;
        height: 120px;
        flex-shrink: 0;
        padding: 10px;
        border-radius: 10px 0 0 10px;
    }
    
    .products-grid .text {
        flex: 1;
        padding: 12px 15px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .products-grid .text h3 {
        font-size: 15px;
        margin-bottom: 8px;
    }
    
    .products-grid .text .btn {
        padding: 6px 15px;
        font-size: 13px;
        align-self: flex-start;
    }
}

/* 筛选栏 - 移动端优化 */
@media (max-width: 768px) {
    .category-filter {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        padding: 15px 0;
        justify-content: center;
    }
    
    .category-filter a {
        padding: 8px 18px;
        font-size: 14px;
        border-radius: 20px;
        background: #f5f5f5;
        color: #333;
        text-decoration: none;
        transition: all 0.3s;
    }
    
    .category-filter a.active,
    .category-filter a:hover {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: #fff;
    }
}

/* ========== 产品详情页 (product.php) ========== */

/* 产品详情布局 */
@media (max-width: 992px) {
    .products-detail {
        flex-direction: column;
    }
    
    .product-gallery,
    .product-info {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .product-gallery {
        margin-bottom: 20px;
    }
    
    .product-main-img {
        height: 250px;
        overflow: hidden;
        border-radius: 10px;
        background: #f8f9fa;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
    }
    
    .product-main-img img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    
    .product-thumbs {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 10px;
        margin-top: 10px;
    }
    
    .product-thumbs img {
        width: 60px;
        height: 60px;
        object-fit: cover;
        flex-shrink: 0;
        border-radius: 6px;
        border: 2px solid transparent;
        cursor: pointer;
    }
    
    .product-thumbs img.active {
        border-color: #667eea;
    }
    
    .product-info h1 {
        font-size: 20px;
        line-height: 1.4;
        margin-bottom: 15px;
    }
    
    .product-info .price {
        font-size: 24px;
        color: #e74c3c;
        font-weight: 600;
        margin-bottom: 15px;
    }
    
    .product-info .description {
        font-size: 14px;
        line-height: 1.8;
        color: #555;
    }
    
    /* 规格参数表格 - 横向滚动 */
    .product-specs table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 13px;
        width: 100%;
    }
    
    .product-specs table th,
    .product-specs table td {
        padding: 8px 10px;
        white-space: nowrap;
    }
    
    /* 操作按钮 */
    .product-actions {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    .product-actions button,
    .product-actions a {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
        border-radius: 8px;
    }
}

/* 产品描述中的图片自适应 */
@media (max-width: 768px) {
    .product-description img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .product-description table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
