/* 产品中心页面样式 - 使用CSS变量 */

/* 页面标题 */
.page-header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--border-light) 100%);
    padding: 120px 0 60px;
    text-align: center;
    position: relative;
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="%23d4af37" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="%23d4af37" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="%23d4af37" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.page-header h1 {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    position: relative;
    z-index: 2;
}

.page-header p {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

/* 产品筛选 */
.filter-section {
    background: var(--bg-primary);
    padding: var(--spacing-xl) 0;
    border-bottom: 1px solid var(--border-color);
}

.filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    justify-content: center;
}

.filter-tab {
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    font-size: var(--font-size-md);
}

.filter-tab:hover,
.filter-tab.active {
    background: var(--primary-color);
    color: var(--text-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 产品展示 */
.products-section {
    padding: var(--spacing-xxl) 0;
    background: var(--bg-primary);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.product-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    cursor: pointer;
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.product-image {
    height: 280px;
    overflow: hidden;
    position: relative;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.product-card:hover .product-image img {
    transform: scale(1.1);
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    opacity: 0;
    transition: var(--transition-normal);
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.quick-view-btn,
.add-to-cart-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary-color);
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: var(--font-size-sm);
    font-weight: 600;
}

.quick-view-btn:hover,
.add-to-cart-btn:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.product-info {
    padding: var(--spacing-lg);
}

.product-info h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.product-info p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

.price-info {
    margin-bottom: var(--spacing-md);
}

.price {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: var(--primary-color);
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--font-size-sm);
}

.category {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.rating {
    color: var(--accent-color);
}

/* 购物车图标 */
.cart-icon {
    position: fixed;
    bottom: var(--spacing-xl);
    right: var(--spacing-xl);
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    color: var(--text-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-fast);
    z-index: 1000;
}

.cart-icon:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger-color);
    color: var(--text-light);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: bold;
}

/* 购物车模态框 */
.cart-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--spacing-md);
}

.cart-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.cart-header h3 {
    color: var(--text-primary);
    font-size: var(--font-size-xl);
}

.cart-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.cart-close:hover {
    color: var(--danger-color);
}

.cart-items {
    padding: var(--spacing-lg);
}

.cart-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-light);
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.item-info {
    flex: 1;
}

.item-info h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.item-info p {
    color: var(--primary-color);
    font-weight: bold;
}

.item-actions button {
    background: var(--danger-color);
    color: var(--text-light);
    border: none;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.item-actions button:hover {
    background: #c82333;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    font-weight: bold;
    font-size: var(--font-size-lg);
}

.checkout-btn {
    background: var(--success-color);
    color: var(--text-light);
    border: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
}

.checkout-btn:hover {
    background: #218838;
}

.cart-empty {
    padding: var(--spacing-xl);
    text-align: center;
    color: var(--text-secondary);
}

/* 产品详情模态框 */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

.product-gallery .main-image img {
    width: 100%;
    border-radius: var(--radius-md);
}

.product-attributes {
    margin: var(--spacing-lg) 0;
}

.attribute {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.attribute .label {
    color: var(--text-secondary);
    font-weight: 500;
}

.attribute .value {
    color: var(--text-primary);
}

.product-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page-header {
        padding: 100px 0 40px;
    }

    .page-header h1 {
        font-size: var(--font-size-xl);
    }

    .page-header p {
        font-size: var(--font-size-md);
    }

    .filter-tabs {
        flex-direction: column;
        align-items: center;
    }

    .filter-tab {
        width: 200px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image {
        height: 200px;
    }

    .product-detail {
        grid-template-columns: 1fr;
    }

    .cart-icon {
        bottom: var(--spacing-lg);
        right: var(--spacing-lg);
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: var(--font-size-lg);
    }

    .filter-tabs {
        gap: var(--spacing-sm);
    }

    .filter-tab {
        width: 150px;
        font-size: var(--font-size-sm);
    }

    .products-grid {
        gap: var(--spacing-lg);
    }

    .product-card {
        margin-bottom: var(--spacing-lg);
    }

    .product-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }
}

/* 动画效果 */
.product-card {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(30px);
}

.product-card:nth-child(1) { animation-delay: 0.1s; }
.product-card:nth-child(2) { animation-delay: 0.2s; }
.product-card:nth-child(3) { animation-delay: 0.3s; }
.product-card:nth-child(4) { animation-delay: 0.4s; }
.product-card:nth-child(5) { animation-delay: 0.5s; }
.product-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}