
/* /app/static/front/css/product-list.css */

:root {
    --primary-color: #218fce;
    --secondary-color: #6c757d;
    --text-color: #333;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --body-bg: #f5f7fa;
    --border-radius: 8px;
}

body {
    background-color: var(--body-bg);
    padding-top: 80px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Banner 样式 */
.product-banner {
    position: relative;
    height: 250px;
    background-color: var(--primary-color);
    overflow: hidden;
    margin-bottom: 40px;
}

.product-banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary-color), #1a6fb0);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.product-banner-content {
    max-width: 700px;
    padding: 0 15px;
    text-align: center;
}

.product-banner-content h1 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.product-banner-content p {
    font-size: 1.2rem;
    opacity: 0.8;
}

/* 主要布局 */
.product-list-section {
    padding: 60px 0;
    background-color: var(--body-bg);
}

/* 搜索表单样式 */
.product-search-form .input-group {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.product-search-form .form-control {
    border: none;
    padding: 12px 15px;
    background-color: white;
}

.product-search-form .btn-primary {
    background-color: var(--primary-color);
    border: none;
    padding: 12px 20px;
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

.product-search-form .input-group-append {
    margin-left: 0;
}

/* 分类筛选 */
.category-filter-row {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.category-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.filter-label {
    font-weight: 600;
    color: var(--text-color);
    margin-right: 10px;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-item {
    display: inline-block;
    padding: 8px 16px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    text-decoration: none;
    color: var(--secondary-color);
    transition: all 0.3s ease;
    font-size: 14px;
}

.category-item:hover,
.category-item.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    text-decoration: none;
}

/* 排序选择 */
#sortSelect {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

#sortSelect:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(33, 143, 206, 0.25);
}

/* 产品网格 - 调整为更小的卡片宽度 */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.product-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.product-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4/3;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.featured-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ffc107;
    color: #333;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.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;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

.product-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
}

.product-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: var(--primary-color);
}

.product-desc {
    color: var(--secondary-color);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--secondary-color);
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: auto;
}

.product-meta .category {
    background: var(--light-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.product-meta .views {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 空状态 */
.empty-state {
    background: white;
    border-radius: var(--border-radius);
    padding: 60px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.empty-state h3 {
    margin-bottom: 15px;
}

/* 分页样式 */
.pagination-container {
    display: flex;
    justify-content: center;
}

.pagination .page-link {
    border-radius: var(--border-radius);
    margin: 0 2px;
    border: 1px solid var(--border-color);
    color: var(--secondary-color);
    padding: 8px 12px;
}

.pagination .page-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 响应式调整 */
@media (max-width: 1200px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 991.98px) {
    .product-banner {
        height: 200px;
    }

    .product-banner-content h1 {
        font-size: 1.8rem;
    }

    .product-banner-content p {
        font-size: 1rem;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 767.98px) {
    body {
        padding-top: 60px;
    }

    .product-list-section {
        padding: 30px 0;
    }

    .product-banner {
        height: 180px;
        margin-bottom: 30px;
    }

    .product-banner-content h1 {
        font-size: 1.5rem;
    }

    .category-filter {
        flex-direction: column;
        align-items: flex-start;
    }

    .category-list {
        justify-content: center;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 15px;
    }

    .product-meta {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    .category-item {
        font-size: 13px;
        padding: 6px 12px;
    }

    .product-search-form .input-group {
        flex-direction: column;
    }

    .product-search-form .btn {
        border-radius: var(--border-radius);
        margin-top: 10px;
    }

    .product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* 动画效果 */
.product-card {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 按钮悬停效果 */
.btn-primary {
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(33, 143, 206, 0.3);
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
}

.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 优化搜索框样式 */
.product-search-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(33, 143, 206, 0.25);
}

/* 滚动优化 */
html {
    scroll-behavior: smooth;
}

/* 选中文本样式 */
::selection {
    background: rgba(33, 143, 206, 0.2);
    color: #333;
}

/* 加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
