/* =========================================================
 * 商品推荐组件样式 - recommend-widget.css
 * 配合 recommend-widget.js 使用
 * 设计风格: 檀香棕色主题, 与佑愿好物商城保持一致
 * 移动端适配: 375-428px
 * ========================================================= */

/* ============ 板块容器 ============ */
.rec-section {
    margin: 16px 0;
    padding: 0 12px;
}
/* 首页推荐板块外层容器(在scroll-area内, 留出左右内边距) */
.rec-section-wrap {
    margin: 18px 0 8px;
    padding: 0 20px;
}

/* ============ 板块标题 ============ */
.rec-section-header {
    text-align: center;
    margin-bottom: 12px;
    padding: 8px 0;
}
.rec-section-title {
    font-family: 'Ma Shan Zheng', 'Noto Serif SC', serif;
    font-size: 18px;
    color: #8B5A2B;
    letter-spacing: 3px;
    font-weight: 600;
}
.rec-section-sub {
    font-size: 11px;
    color: #8B7355;
    margin-top: 2px;
    letter-spacing: 1px;
    opacity: 0.85;
}

/* ============ 加载中 ============ */
.rec-loading {
    text-align: center;
    padding: 20px;
    color: #8B7355;
    font-size: 13px;
}

/* ============ 空数据占位 ============ */
.rec-empty {
    text-align: center;
    padding: 30px 20px;
    color: #8B7355;
}
.rec-empty-icon {
    font-size: 36px;
    margin-bottom: 8px;
    opacity: 0.6;
}
.rec-empty-text {
    font-size: 13px;
    letter-spacing: 1px;
}

/* ============ 商品网格(2列) ============ */
.rec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ============ 商品卡片 ============ */
.rec-card {
    background: #FDF8F3;
    border-radius: 10px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    overflow: hidden;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
}
.rec-card:active {
    transform: scale(0.97);
}

/* 商品图片区 */
.rec-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #FFF8EC 0%, #F5E6D3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}
.rec-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rec-img-emoji {
    font-size: 48px;
    opacity: 0.85;
}

/* 角标 */
.rec-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 1px;
}
.rec-badge-new {
    background: linear-gradient(135deg, #07c160 0%, #05a347 100%);
}
.rec-badge-hot {
    background: linear-gradient(135deg, #ff6b35 0%, #c04040 100%);
}

/* 商品信息区 */
.rec-body {
    padding: 8px 10px 10px;
}
.rec-name {
    font-size: 13px;
    color: #4A3728;
    font-weight: 600;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 36px;
}
.rec-desc {
    font-size: 11px;
    color: #8B7355;
    margin-top: 4px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rec-sales {
    font-size: 10px;
    color: #B8860B;
    margin-top: 4px;
    letter-spacing: 0.5px;
}

/* 价格行 */
.rec-price-row {
    margin-top: 6px;
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}
.rec-price-label {
    font-size: 10px;
    color: #8B7355;
}
.rec-price {
    color: #C04040;
    font-weight: 700;
    font-size: 16px;
}
.rec-price .sym {
    font-size: 11px;
    margin-right: 1px;
}
.rec-price .val {
    font-size: 16px;
}
.rec-original-price {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
    margin-left: 4px;
}

/* ============ 榜单列表(单列) ============ */
.rec-ranking-list {
    background: #FDF8F3;
    border-radius: 10px;
    border: 1px solid rgba(184, 134, 11, 0.2);
    overflow: hidden;
}
.rec-ranking-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(184, 134, 11, 0.1);
    cursor: pointer;
    transition: background .2s;
}
.rec-ranking-item:last-child {
    border-bottom: none;
}
.rec-ranking-item:active {
    background: rgba(184, 134, 11, 0.08);
}

/* 排名数字 */
.rec-rank-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    margin-right: 10px;
    flex-shrink: 0;
}
.rec-rank-top {
    background: linear-gradient(135deg, #FFD700 0%, #B8860B 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(184, 134, 11, 0.3);
}
.rec-rank-normal {
    background: rgba(184, 134, 11, 0.15);
    color: #8B7355;
}

/* 榜单商品图片 */
.rec-ranking-img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: linear-gradient(135deg, #FFF8EC 0%, #F5E6D3 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.rec-ranking-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.rec-ranking-img .rec-img-emoji {
    font-size: 32px;
}

/* 榜单商品信息 */
.rec-ranking-body {
    flex: 1;
    min-width: 0;
}
.rec-ranking-body .rec-name {
    font-size: 14px;
    min-height: auto;
    -webkit-line-clamp: 1;
}
.rec-ranking-body .rec-price {
    font-size: 15px;
}

/* ============ 响应式适配 ============ */
@media (max-width: 375px) {
    .rec-section { padding: 0 10px; }
    .rec-section-title { font-size: 16px; letter-spacing: 2px; }
    .rec-grid { gap: 8px; }
    .rec-card .rec-img-emoji { font-size: 40px; }
    .rec-name { font-size: 12px; min-height: 32px; }
    .rec-price { font-size: 14px; }
    .rec-price .val { font-size: 14px; }
    .rec-ranking-img { width: 50px; height: 50px; }
    .rec-ranking-img .rec-img-emoji { font-size: 26px; }
}

@media (min-width: 429px) {
    .rec-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .rec-section {
        max-width: 600px;
        margin-left: auto;
        margin-right: auto;
    }
}
