/* ===== 全局重置与变量 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ff5e3a;
    --primary-dark: #e04a2a;
    --primary-light: #ffe8e2;
    --bg-page: #f7f9fc;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-light: #7f8c8d;
    --border-light: #eef2f6;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
    --shadow-md: 0 6px 16px rgba(0,0,0,0.06);
    --radius-md: 16px;
    --radius-sm: 30px;
}

body {
    font-family: 'Segoe UI', 'PingFang SC', Roboto, system-ui, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 20px 16px;
    flex: 1;
}

/* ===== 广告横幅 ===== */
.ad-banner {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    overflow: hidden;
    position: relative;
}
.ad-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.ad-slider::-webkit-scrollbar {
    display: none;
}
.ad-slider a {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: block;
}
.ad-slider img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
    background: #f0f2f5;
}
.ad-nav {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
}
.ad-dot {
    width: 8px;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    transition: 0.2s;
    cursor: pointer;
}
.ad-dot.active {
    width: 20px;
    background: var(--primary);
}

/* ===== 热搜词 ===== */
.hot-keywords {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    background: var(--bg-card);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.hot-label {
    color: var(--primary);
    font-weight: 600;
    margin-right: 20px;
    font-size: 1rem;
}
.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
}
.keyword-item {
    cursor: pointer;
    color: var(--text-main);
    font-weight: 500;
    transition: all 0.2s;
    padding: 4px 0;
    border-bottom: 2px solid transparent;
}
.keyword-item:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ===== 搜索框 ===== */
.search-section {
    margin-bottom: 24px;
}
.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border-radius: 50px;
    padding: 4px 4px 4px 20px;
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.2s;
}
.search-box:focus-within {
    box-shadow: 0 4px 20px rgba(255,94,58,0.15);
}
.search-icon {
    color: var(--text-light);
    margin-right: 8px;
}
.search-box input {
    flex: 1;
    border: none;
    padding: 16px 0;
    font-size: 1rem;
    background: transparent;
    outline: none;
}
.search-box input::placeholder {
    color: #b0bec5;
}
.search-box button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.search-box button:hover {
    background: var(--primary-dark);
}

/* ===== 排序栏 ===== */
.sort-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.result-stats {
    color: var(--text-light);
    font-size: 0.9rem;
}
.sort-options {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sort-options label {
    color: var(--text-light);
    font-size: 0.9rem;
}
.sort-options select {
    padding: 8px 32px 8px 16px;
    border-radius: 30px;
    border: 1px solid var(--border-light);
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237f8c8d' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ===== 商品网格 ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.product-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fafbfc;
    padding: 16px;
}
.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.product-name {
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}
.product-price {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.product-price small {
    font-size: 0.9rem;
    font-weight: 400;
}
.product-stock {
    color: var(--text-light);
    font-size: 0.8rem;
}
.product-site {
    color: var(--text-light);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
}
.product-site i {
    font-size: 12px;
}

/* ===== 加载与空状态 ===== */
.loading, .no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 1.1rem;
}
.no-data i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ===== 分页 ===== */
.pagination-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}
.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.pagination button {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border-light);
    background: white;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 500;
    transition: 0.1s;
}
.pagination button:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}
.pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== 底部 ===== */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-light);
    margin-top: 40px;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
    .container { padding: 12px; }
    .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .product-info { padding: 12px; }
    .product-price { font-size: 1.2rem; }
    .search-box button { padding: 10px 20px; }
}