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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #fff5f5 0%, #ffebee 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
}

/* ===== 顶部栏 ===== */
.topbar {
    background: linear-gradient(135deg, #c62828, #d32f2f, #e53935);
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(211, 47, 47, 0.4);
}

.topbar-date {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 300;
}

.topbar-title {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 3px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* ===== 页头区域 ===== */
.header {
    text-align: center;
    padding: 20px 0 12px;
}

.subtitle {
    display: inline-block;
    color: #d32f2f;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 20px;
    background: linear-gradient(135deg, #fff5f5, #ffebee);
    border-radius: 20px;
    border: 1px solid #ffcdd2;
    letter-spacing: 1px;
}

/* ===== 横幅图片 ===== */
.banner-link {
    display: block;
    margin-bottom: 12px;
}

.banner-img {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* ===== 分类标签栏 ===== */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 0;
    scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    background: white;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid #ffcdd2;
    transition: all 0.2s;
    white-space: nowrap;
    user-select: none;
}

.tab:hover {
    border-color: #e53935;
    color: #d32f2f;
}

.tab.active {
    background: linear-gradient(135deg, #d32f2f, #e53935);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

/* ===== 排序栏 ===== */
.sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 16px;
}

.sort-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-right {
    display: flex;
    align-items: center;
}

#search-input {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.2s;
}

#search-input:focus {
    outline: none;
    border-color: #e53935;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
}

.sort-bar label {
    font-size: 14px;
    color: #666;
}

.sort-bar select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #ffcdd2;
    background: white;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    outline: none;
}

.sort-bar select:focus {
    border-color: #e53935;
}

/* ===== 商品列表 ===== */
.product-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

/* ===== 商品卡片 - 可点击 ===== */
.product-card {
    display: flex;
    background: #fff;
    border-radius: 8px;
    padding: 6px;
    gap: 8px;
    align-items: flex-start;
    border: 1px solid #ffcdd2;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.product-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.12);
    border-color: #e53935;
}

.product-card:active {
    transform: translateY(0);
}

/* 商品图片（左侧）*/
.product-image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: #f9f9f9;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 商品信息（右侧）*/
.product-info-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 优惠标签 - 红色 */
.badge {
    display: inline-block;
    background: linear-gradient(135deg, #d32f2f, #e53935);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 3px;
    width: fit-content;
}

/* 商品名称 */
.product-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 预约信息 */
.product-info {
    font-size: 11px;
    color: #d32f2f;
    margin-bottom: 2px;
    font-weight: 500;
}

/* 价格行 - flex布局，价格在左，赠品在右 */
.price-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 2px;
}

.price-wrapper {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

/* 价格前缀 - 灰色小字 */
.price-label {
    font-size: 11px;
    color: #999;
    font-weight: normal;
}

/* 价格数字 - 红色大字 */
.price-value {
    font-size: 15px;
    color: #d32f2f;
    font-weight: bold;
}

/* 赠品徽章 - 右下角 */
.gift-badge {
    font-size: 10px;
    color: #ff6b6b;
    background: #fff5f5;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid #ffcdd2;
    white-space: nowrap;
}

/* 加载提示 */
.loading {
    text-align: center;
    color: #d32f2f;
    padding: 30px;
    font-size: 14px;
}

/* ===== 响应式 ===== */
@media (min-width: 600px) {
    .container { padding: 20px; }
    .header { padding: 30px; margin-bottom: 24px; }
    .header h1 { font-size: 28px; }
    .subtitle { font-size: 16px; }
    .product-list { grid-template-columns: 1fr 1fr; gap: 10px; }
    .product-card { padding: 8px; gap: 10px; }
    .product-image { width: 80px; height: 80px; }
    .product-name { font-size: 14px; }
}

@media (min-width: 900px) {
    .product-list { grid-template-columns: 1fr 1fr 1fr; }
}

/* ===== 红包弹窗样式 ===== */
.redpacket-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.redpacket-container {
    position: relative;
    max-width: 60vw;
    max-height: 80vh;
    animation: zoomIn 0.4s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.redpacket-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.redpacket-image:hover {
    transform: scale(1.02);
}

.redpacket-image:active {
    transform: scale(0.98);
}

.redpacket-close {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 35px;
    height: 35px;
    background: white;
    border: none;
    border-radius: 50%;
    color: #333;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    z-index: 100001;  /* 提高 z-index，确保在最上层 */
}

.redpacket-close:hover {
    background: #f5f5f5;
    transform: rotate(90deg);
}

.redpacket-hint {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    white-space: nowrap;
}

/* 移动端适配 */
@media (max-width: 600px) {
    .redpacket-container {
        max-width: 60vw;
    }
    
    .redpacket-close {
        top: -10px;
        right: -10px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
}
