/* 商品列表布局样式 */

/* 九宫格布局：一行四个商品 */
.product-grid-four {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 640px) {
    .product-grid-four {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .product-grid-four {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .product-grid-four {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 九宫格布局的商品卡片样式 */
.product-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 确保flex子元素可以正确收缩 */
}

.product-card:hover {
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-card .card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
}

.product-card .product-image {
    position: relative;
    aspect-ratio: 1;
    background: #f9fafb;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0; /* 防止图片被压缩 */
}

.product-card .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);
}

.product-card .product-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    min-height: 0; /* 确保flex子元素可以正确收缩 */
}

.product-card .brand-name {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.product-card .product-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1; /* 让标题占据剩余空间 */
}

.product-card .product-title:hover {
    color: #dc2626;
}

.product-card .product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0; /* 防止评分被压缩 */
}

.product-card .product-rating .stars {
    display: flex;
    align-items: center;
}

.product-card .product-rating .star {
    width: 0.75rem;
    height: 0.75rem;
}

.product-card .product-rating .star.filled {
    fill: #fbbf24;
    color: #fbbf24;
}

.product-card .product-rating .star.empty {
    fill: #e5e7eb;
    color: #e5e7eb;
}

.product-card .product-shipping {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #059669;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0; /* 防止运费信息被压缩 */
}

.product-card .product-price {
    margin-bottom: 1rem;
    flex-shrink: 0; /* 防止价格被压缩 */
}

.product-card .product-price .current-price {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.product-card .product-price .original-price {
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: line-through;
    margin-left: 0.5rem;
}

.product-card .add-to-cart-btn {
    width: 100%;
    height: 2.25rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto; /* 让按钮始终在底部 */
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.product-card .add-to-cart-btn:hover {
    background: #b91c1c;
}

.product-card .badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #dc2626;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.product-card .wishlist-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    background: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-card:hover .wishlist-btn {
    opacity: 1;
}

.product-card .wishlist-btn:hover {
    background: white;
    color: #dc2626;
}

/* 列表布局：一行一个商品，横向排列 */
.product-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-card-list {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
}

.product-card-list:hover {
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.product-card-list .product-image-container {
    width: 12rem;
    height: 12rem;
    background: #f9fafb;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

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

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

.product-card-list .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.product-card-list .product-title {
    font-size: 1.125rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    cursor: pointer;
    transition: color 0.2s ease;
}

.product-card-list .product-title:hover {
    color: #dc2626;
}

.product-card-list .product-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.product-card-list .product-rating .stars {
    display: flex;
    align-items: center;
}

.product-card-list .product-rating .star {
    width: 0.75rem;
    height: 0.75rem;
}

.product-card-list .product-rating .star.filled {
    fill: #fbbf24;
    color: #fbbf24;
}

.product-card-list .product-rating .star.empty {
    fill: #e5e7eb;
    color: #e5e7eb;
}

.product-card-list .product-shipping {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: #059669;
    font-size: 0.75rem;
    margin-bottom: 0.75rem;
}

.product-card-list .product-price {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.product-card-list .price-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-card-list .product-price .current-price {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.product-card-list .product-price .original-price {
    font-size: 0.875rem;
    color: #6b7280;
    text-decoration: line-through;
}

.product-card-list .add-to-cart-btn {
    width: auto;
    min-width: 8rem;
    height: 2.25rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1rem;
    flex-shrink: 0;
}

.product-card-list .add-to-cart-btn:hover {
    background: #b91c1c;
}

.product-card-list .badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #dc2626;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.product-card-list .wishlist-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 2rem;
    height: 2rem;
    background: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-card-list:hover .wishlist-btn {
    opacity: 1;
}

.product-card-list .wishlist-btn:hover {
    background: white;
    color: #dc2626;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .product-card-list .product-image-container {
        width: 8rem;
        height: 8rem;
    }
    
    .product-card-list .product-price {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .product-card-list .add-to-cart-btn {
        width: 100%;
        min-width: auto;
    }
    
    .product-card-list .product-info {
        padding: 1rem;
    }
    
    /* 九宫格布局移动端适配 */
    .product-card .card-content {
        padding: 0.75rem;
    }
    
    .product-card .product-title {
        font-size: 0.8rem;
    }
    
    .product-card .product-price .current-price {
        font-size: 1rem;
    }
    
    .product-card .product-price .original-price {
        font-size: 0.8rem;
    }
}

/* 分页器样式 */
.pagination-container {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.pagination-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2.25rem;
    padding: 0 0.75rem;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
    cursor: pointer;
    min-width: 2.25rem;
    text-decoration: none;
}

.pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

.pagination-btn.active {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
    font-weight: 600;
}

.pagination-btn.active:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

.pagination-btn.prev,
.pagination-btn.next {
    padding: 0 0.5rem;
}

.pagination-btn.prev:disabled,
.pagination-btn.next:disabled {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #9ca3af;
}

.pagination-info {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* 分页器响应式设计 */
@media (max-width: 640px) {
    .pagination-container {
        margin-top: 2rem;
        gap: 0.75rem;
    }
    
    .pagination-nav {
        gap: 0.25rem;
    }
    
    .pagination-btn {
        height: 2rem;
        padding: 0 0.5rem;
        font-size: 0.8rem;
        min-width: 2rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
        padding: 0 1rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .pagination-nav {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 100%;
    }
    
    .pagination-btn {
        height: 1.75rem;
        padding: 0 0.4rem;
        font-size: 0.75rem;
        min-width: 1.75rem;
    }
}

/* 空状态显示样式 */
.empty-state {
    grid-column: 1 / -1; /* 在网格布局中占满整行 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.empty-state svg {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    color: #6b7280;
    max-width: 24rem;
    line-height: 1.5;
}

/* 响应式空状态 */
@media (max-width: 768px) {
    .empty-state {
        padding: 3rem 1rem;
    }
    
    .empty-state svg {
        width: 5rem;
        height: 5rem;
    }
    
    .empty-state h3 {
        font-size: 1rem;
    }
    
    .empty-state p {
        font-size: 0.8rem;
    }
}
