/**
 * Products Page Styles
 * 产品列表和详情页样式
 */

/* ========== Page Header ========== */
.page-header {
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.7)), url('../img/AirSS.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: white;
    padding: 120px 0 60px;
    text-align: center;
    margin-top: 70px;
}

.page-header h1 {
    font-family: 'ArchivoBlack', Arial, sans-serif;
    font-size: 3rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* ========== Products Page ========== */
.products-page {
    padding: 60px 0;
    background-color: #f8f9fa;
    min-height: 60vh;
}

/* Filters */
.products-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    padding: 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.filter-group {
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-black);
    font-size: 0.9rem;
}

.filter-select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.filter-select:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* 关键词搜索区：独占一行 */
.filter-group-search {
    flex-basis: 100%;
}

/* 搜索输入框样式 */
.filter-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    transition: border-color 0.3s;
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

/* 顶部 header 行：右对齐 */
.filters-header {
    flex-basis: 100%;
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
}

/* 重置按钮样式 */
.filters-reset-btn {
    border: none;
    background: none;
    color: #888;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background-color 0.2s;
}

.filters-reset-btn:hover {
    color: var(--primary-blue);
    background-color: #f3f6fb;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.product-card {
    cursor: pointer;
}

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

.product-image-wrapper {
    position: relative;
    height: 260px;
    overflow: hidden;
    background: #f0f0f0;
}

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

.product-card:hover .product-image-wrapper img {
    transform: scale(1.05);
}

/* Badges */
.badge {
    position: absolute;
    top: 12px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-new {
    left: 12px;
    background: #28a745;
    color: white;
}

.badge-featured {
    right: 12px;
    background: var(--primary-blue);
    color: white;
}

/* Product Image Link */
.product-image-link {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

/* Product Info */
.product-info {
    padding: 16px 20px 18px;
    text-align: left;
}

.product-category {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.product-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-black);
    margin-bottom: 8px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: left;
}

.product-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s;
}

.product-name a:hover {
    color: var(--primary-blue);
}

.product-sku {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0;
}

.product-oe {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 12px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 15px 35px;
    font-size: 1.1rem;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--hover-blue);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #2c6fab;
    color: white;
}

.btn-secondary:hover {
    background: #0f4d85;
}

/* States */
.loading-state,
.error-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-state p,
.empty-state p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

#pageInfo {
    font-weight: 600;
    color: var(--primary-black);
}

/* ========== Product Detail Page ========== */
.product-detail-page {
    padding: 100px 0 60px;
    background-color: #f8f9fa;
    min-height: 80vh;
}

/* Breadcrumb */
.breadcrumb {
    margin-bottom: 30px;
    font-size: 0.9rem;
}

.breadcrumb a {
    color: var(--primary-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: #666;
    margin: 0 8px;
}

/* Product Detail Grid */
.product-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Product Gallery */
.product-gallery {
    position: sticky;
    top: 100px;
    min-width: 0;
    overflow: hidden;
}

.product-swiper {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 15px;
}

.product-swiper .swiper-button-prev,
.product-swiper .swiper-button-next {
    display: none;
}

.product-swiper .swiper-slide img {
    width: 100%;
    height: 500px;
    object-fit: contain;
    background: #ffffff;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.product-swiper .swiper-slide:hover img {
    transform: scale(1.02);
}

.product-swiper .swiper-slide a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
}

.product-thumbs {
    height: 120px;
}

.product-thumbs .swiper-slide {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.product-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border: 1px solid #ddd;
}

.product-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Product Info Detail */
.product-info-detail {
    padding: 20px 0;
}

.product-badges {
    margin-bottom: 15px;
}

.product-badges .badge {
    position: static;
    margin-right: 10px;
}

.product-info-detail h1 {
    font-family: 'ArchivoBlack', Arial, sans-serif;
    font-size: 2rem;
    color: var(--primary-black);
    margin-bottom: 10px;
    line-height: 1.3;
}

.product-sku-detail {
    font-size: 1rem;
    color: #666;
    margin-bottom: 20px;
}

/* Price Section */
.product-price-section {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.product-price-label {
    font-size: 1rem;
    color: #666;
}

.product-price-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
}

/* Stock Status */
.product-stock {
    margin-bottom: 20px;
}

.stock-status {
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.stock-status.in-stock {
    background: #d4edda;
    color: #155724;
}

.stock-status.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

#stockQty {
    color: #666;
    font-size: 0.9rem;
    margin-left: 10px;
}

/* Short Description */
.product-description-short {
    font-size: 1rem;
    line-height: 1.7;
    color: #555;
    margin-bottom: 25px;
}

/* Actions */
.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    margin-bottom: 30px;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector label {
    font-weight: 600;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #ddd;
    background: white;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.qty-btn:hover {
    border-color: var(--primary-blue);
    color: var(--primary-blue);
}

.quantity-selector input {
    width: 60px;
    height: 36px;
    text-align: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}

/* OE Section */
.product-oe-section,
.product-vehicles-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #eee;
}

.product-oe-section h3,
.product-vehicles-section h3 {
    font-size: 1.1rem;
    color: var(--primary-black);
    margin-bottom: 15px;
}

.oe-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.oe-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f4f8;
    padding: 8px 15px;
    border-radius: 6px;
}

.oe-code {
    font-weight: 600;
    color: var(--primary-black);
}

.oe-brand {
    font-size: 0.85rem;
    color: #666;
}

/* Vehicles List */
.vehicles-list {
    list-style: none;
    padding: 0;
}

.vehicles-list li {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.vehicles-list li:last-child {
    border-bottom: none;
}

.vehicles-list .years {
    color: #666;
    font-size: 0.9rem;
}

/* Full Description */
.product-full-description {
    background: white;
    padding: 40px;
    border-radius: 12px;
    margin-top: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.product-full-description h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--primary-black);
}

.description-content {
    line-height: 1.8;
    color: #444;
}

.description-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

/* Related Products */
.related-products {
    margin-top: 60px;
}

.related-products h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--primary-black);
    text-align: center;
}

/* ========== Responsive ========== */
@media (max-width: 992px) {
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .product-gallery {
        position: static;
    }

    .product-swiper .swiper-slide img {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .page-header {
        padding: 100px 0 40px;
    }

    .page-header h1 {
        font-size: 2rem;
    }

    .products-filters {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-detail-grid {
        padding: 20px;
    }

    .product-info-detail h1 {
        font-size: 1.5rem;
    }

    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .product-full-description {
        padding: 20px;
    }
}