:root {
    --primary-color: #ff6b6b;
    --primary-hover: #ee5253;
    --bg-color: #f5f6fa;
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-sub: #636e72;
    --border-color: #dfe6e9;
    --info-box-bg: #fafafa;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.1);
    --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
}

a { text-decoration: none; color: inherit; }

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 导航栏 */
.navbar {
    background: var(--card-bg);
    height: 60px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}
.logo span { color: var(--primary-color); }
.logo i { margin-right: 6px; color: var(--primary-color); }

.search-wrapper { flex: 1; max-width: 450px; margin: 0 30px; }
.search-form { display: flex; background: #f1f2f6; border-radius: 30px; padding: 3px; }
.search-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 15px;
    font-size: 13px;
    outline: none;
}
.search-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 今天吃什么按钮 */
.btn-random {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.3);
}

.btn-random:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.5);
}

/* 筛选区域 */
.filter-section {
    background: var(--card-bg);
    padding: 15px 0;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.filter-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
}
.filter-group:last-child { margin-bottom: 0; }

.group-title {
    width: 50px;
    color: var(--text-sub);
    flex-shrink: 0;
    font-weight: 500;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}
.tags.scrollable {
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}
.tags.scrollable::-webkit-scrollbar { display: none; }

.tag {
    padding: 4px 12px;
    background: #f1f2f6;
    color: var(--text-sub);
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
}
.tag:hover { background: #ffeaa7; color: var(--text-main); }
.tag.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.clear-filters {
    margin-top: 10px;
    text-align: right;
    font-size: 12px;
}
.clear-filters a { color: var(--primary-color); }

/* 主内容 */
.main-content { padding-bottom: 40px; }

.result-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-top: 10px;
}
.result-info h2 { font-size: 18px; font-weight: 700; }
.result-info h2 span { color: var(--primary-color); }
.count-badge {
    background: #dfe6e9;
    color: var(--text-sub);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* ========== 商品网格 - 桌面端 4 个 ========== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

/* 商品卡片 */
.product-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* 图片区域 */
.card-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: #f8f9fa;
    overflow: hidden;
}

.card-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

/* 评分飘带 */
.score-ribbon {
    position: absolute;
    top: 8px;
    right: 0;
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: white;
    padding: 3px 10px 3px 6px;
    font-size: 11px;
    font-weight: 700;
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* 信息框 */
.card-info-box {
    background: var(--info-box-bg);
    border-top: 1px solid var(--border-color);
    padding: 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
}

.brand-row {
    background: #fff3cd;
    color: #856404;
}

.origin-row {
    background: #d1ecf1;
    color: #0c5460;
}

.info-label {
    font-weight: 600;
    opacity: 0.8;
}

.info-value {
    font-weight: 700;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
    height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 4px 0;
}

.specs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 10px;
    color: var(--text-sub);
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 3px;
    background: #f1f2f6;
    padding: 2px 5px;
    border-radius: 3px;
}

.spec-item i { font-size: 9px; }

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.price-tag {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.currency {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

.price-value {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 800;
}

.btn-detail {
    background: var(--text-main);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    transition: 0.2s;
}
.btn-detail:hover { background: var(--primary-color); }

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--text-sub);
}
.empty-state i { font-size: 40px; margin-bottom: 15px; color: #dfe6e9; }
.empty-state p { font-size: 16px; margin-bottom: 15px; }
.btn-reset {
    background: var(--primary-color);
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 30px;
}
.page-link {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    background: white;
    font-size: 12px;
}
.page-link:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #fff0f0;
}
.page-info-text { font-size: 13px; color: var(--text-sub); }

/* 页脚 */
footer {
    text-align: center;
    padding: 40px 0 30px;
    color: #b2bec3;
    font-size: 12px;
    border-top: 1px solid #eee;
    background: #fff;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.beian-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: #95a5a6;
}

.beian-info a {
    color: #95a5a6;
    transition: 0.2s;
}

.beian-info a:hover {
    color: var(--primary-color);
}

/* 随机页面底部 */
.random-footer {
    text-align: center;
    padding: 30px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.beian-info-random {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.beian-info-random a {
    color: rgba(255, 255, 255, 0.5);
    transition: 0.2s;
}

.beian-info-random a:hover {
    color: rgba(255, 255, 255, 0.9);
}

/* ========== 响应式设置 ========== */
/* 桌面端：4 列 */
@media (min-width: 1025px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 平板端：3 列 */
@media (max-width: 1024px) and (min-width: 769px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========== 手机端优化：2 列 ========== */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .product-card {
        border-radius: 6px;
    }
    
    /* 图片区域优化 */
    .card-image-wrapper {
        padding-top: 100%;
    }
    
    .card-img {
        object-fit: contain;
        background: #fff;
    }
    
    /* 评分飘带缩小 */
    .score-ribbon {
        padding: 2px 6px 2px 4px;
        font-size: 9px;
        top: 5px;
        right: 5px;
    }
    
    /* 信息框优化 */
    .card-info-box {
        padding: 8px;
        gap: 4px;
    }
    
    .info-row {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .product-title {
        font-size: 11px;
        height: 30px;
        margin: 3px 0;
    }
    
    .specs-row {
        gap: 4px;
        font-size: 9px;
    }
    
    .spec-item {
        padding: 1px 3px;
        font-size: 8px;
    }
    
    .spec-item i {
        font-size: 7px;
    }
    
    .price-row {
        padding-top: 6px;
        margin-top: 3px;
    }
    
    .currency {
        font-size: 10px;
    }
    
    .price-value {
        font-size: 14px;
    }
    
    .btn-detail {
        padding: 3px 8px;
        font-size: 10px;
    }
    
    /* 导航栏优化 */
    .navbar {
        height: 50px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .logo span {
        display: none;
    }
    
    .search-wrapper {
        margin: 0 10px;
        max-width: none;
    }
    
    .search-input {
        padding: 4px 10px;
        font-size: 12px;
    }
    
    .search-btn {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }
    
    .btn-random {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .btn-random i {
        font-size: 12px;
    }
    
    /* 筛选区域优化 */
    .filter-section {
        padding: 10px 0;
    }
    
    .filter-group {
        font-size: 11px;
    }
    
    .group-title {
        width: 40px;
        font-size: 11px;
    }
    
    .tag {
        padding: 3px 8px;
        font-size: 10px;
        border-radius: 12px;
    }
    
    /* 分页优化 */
    .pagination {
        gap: 8px;
    }
    
    .page-link {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }
    
    .page-info-text {
        font-size: 11px;
    }
    
    /* 页脚优化 */
    footer {
        padding: 20px 0 15px;
        font-size: 10px;
    }
    
    .beian-info {
        font-size: 9px;
        flex-direction: column;
        gap: 5px;
    }
}

/* 小手机：1 列 */
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .container {
        padding: 0 8px;
    }
    
    .card-info-box {
        padding: 6px;
    }
    
    .product-title {
        font-size: 10px;
        height: 28px;
    }
    
    .price-value {
        font-size: 13px;
    }
}

/* 随机页面样式 */
.random-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.random-page .navbar {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.random-page .logo { color: white; }
.random-page .logo span { color: #ffd93d; }

.btn-back {
    color: white;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: 0.3s;
}

.btn-back:hover { background: rgba(255, 255, 255, 0.3); }

.random-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
}

.random-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.random-image-section {
    background: #f8f9fa;
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 100%;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.random-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}

.image-overlay {
    position: absolute;
    top: 15px; right: 15px;
}

.score-badge-large {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(241, 196, 15, 0.4);
}

.random-info-section {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-header {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.brand-tag {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    color: #d35400;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.origin-tag {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.product-name-large {
    font-size: 28px;
    font-weight: 800;
    color: #2d3436;
    margin-bottom: 25px;
    line-height: 1.3;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.info-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.info-item i {
    font-size: 20px;
    color: #667eea;
    margin-bottom: 8px;
    display: block;
}

.info-item span {
    font-size: 11px;
    color: #636e72;
    display: block;
    margin-bottom: 4px;
}

.info-item strong {
    font-size: 14px;
    color: #2d3436;
}

.price-section {
    text-align: center;
    padding: 25px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5253 100%);
    border-radius: 16px;
    margin-bottom: 25px;
    color: white;
}

.price-display {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.currency { font-size: 24px; font-weight: 600; }
.price-number { font-size: 48px; font-weight: 800; }
.price-label { font-size: 12px; opacity: 0.9; margin-top: 5px; }

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn-refresh {
    flex: 1;
    padding: 14px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-refresh:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-browse {
    flex: 1;
    padding: 14px 20px;
    background: #f1f2f6;
    color: #2d3436;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-browse:hover { background: #dfe6e9; }

.fun-tip {
    text-align: center;
    padding: 15px;
    background: #fff3cd;
    border-radius: 12px;
    color: #856404;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.empty-random {
    text-align: center;
    padding: 80px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.empty-random i {
    font-size: 80px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
}

.empty-random h2 {
    color: white;
    font-size: 24px;
    margin-bottom: 10px;
}

.empty-random p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
}

.btn-back-home {
    background: white;
    color: #667eea;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-back-home:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@media (max-width: 900px) {
    .random-card { grid-template-columns: 1fr; }
    .random-image-section { padding: 20px; }
    .random-info-section { padding: 30px 20px; }
    .product-name-large { font-size: 22px; }
    .info-grid { grid-template-columns: 1fr; }
    .action-buttons { flex-direction: column; }
}
