﻿.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-top:100px;
}
/* =========================================
           Page Title Header (页面标题)
           ========================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

h1 {
    font-size: 28px;
    font-weight: bold;
    color: var(--text-main);
}

/* Search Bar Styles */
.search-box {
    position: relative;
    width: 300px;
    max-width: 100%;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    padding-right: 40px;
    background-color: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 999px; /* Pill shape */
    outline: none;
    transition: border-color 0.3s;
    font-size: 14px;
}

    .search-input:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
    }

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

/* =========================================
           Filter Section (筛选区域)
           ========================================= */
.filter-section {
    background: var(--bg-card);
    padding: 20px 20px 0 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.filter-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    overflow: hidden;
}

    .filter-row:last-child {
        margin-bottom: 0;
    }

.filter-label {
    font-weight: bold;
    color: var(--text-secondary);
    margin-right: 15px;
    font-size: 14px;
    white-space: nowrap;
}

.filter-options {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px; /* For scrollbar space if needed */
}

    .filter-options::-webkit-scrollbar {
        display: none;
    }

.filter-btn {
    background: transparent;
    border: 1px solid transparent;
    padding: 5px 15px;
    border-radius: 999px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.3s;
    white-space: nowrap;
}

    .filter-btn:hover {
        color: var(--primary-color);
        border-color: var(--primary-color);
    }

    .filter-btn.active {
        background-color: var(--primary-color);
        color: white;
        box-shadow: var(--shadow-md);
    }

/* =========================================
           Product Grid (商品列表网格)
           ========================================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.product-card {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-md);
        border-color: rgba(245, 158, 11, 0.3);
    }

/* 4:3 Aspect Ratio */
.product-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 75%;
    background-color: var(--bg-body);
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #ef4444; /* Red */
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.add-cart-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transform: translateY(50px); /* Initially hidden */
    transition: transform 0.3s, background-color 0.2s;
    box-shadow: var(--shadow-md);
}

.product-card:hover .add-cart-btn {
    transform: translateY(0);
}

.add-cart-btn:hover {
    background-color: var(--primary-hover);
}

.product-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Tags */
.tags {
    display: flex;
    gap: 5px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 99px;
    color: white;
    font-weight: bold;
}
    /* Tag Colors */
    .tag.bg-slate-700 {
        background-color: #334155;
    }

    .tag.bg-amber-600 {
        background-color: #d97706;
    }

    .tag.bg-yellow-600 {
        background-color: #ca8a04;
    }

    .tag.bg-red-700 {
        background-color: #b91c1c;
    }

    .tag.bg-rose-500 {
        background-color: #f43f5e;
    }

    .tag.bg-orange-700 {
        background-color: #c2410c;
    }

    .tag.bg-pink-500 {
        background-color: #ec4899;
    }

    .tag.bg-purple-600 {
        background-color: #9333ea;
    }

.product-name {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-main);
}

.price-row {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.current-price {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: bold;
}

.old-price {
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: line-through;
}

/* =========================================
           Pagination (分页)
           ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
    margin-bottom: 40px;
}

.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
}

    .page-btn:hover:not(:disabled) {
        background-color: var(--border-color);
        color: var(--text-main);
    }

    .page-btn.active {
        background-color: var(--primary-color);
        color: white;
        border-color: var(--primary-color);
        font-weight: bold;
    }

    .page-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* =========================================
           States & Utilities (状态与工具)
           ========================================= */
.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-secondary);
    grid-column: 1 / -1;
    font-size: 16px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    display: none;
}

body.dark .loading-overlay {
    background: rgba(0,0,0,0.7);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-box {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-image-wrapper {
        padding-top: 100%; /* Square on mobile */
    }

    .product-name {
        font-size: 13px;
    }

    .current-price {
        font-size: 16px;
    }

    .add-cart-btn {
        display: none;
    }
}
