/* ============================================================
   弘度生活 V5.1 — 8pt栅格页面标准样式
   遵循移动端8pt栅格系统：
   - 全局安全边距: 16px
   - 卡片内边距: 12-16px  
   - 模块垂直间距: 12px
   - 圆角: 卡片12px / 小按钮8px / 搜索框20px
   - 阴影: Y:4 Blur:12 Opacity:8%
   - 字体: 标题18-20px / 正文14-16px / 辅助12px
   ============================================================ */

/* ========== 页面级品牌色 ========== */
:root {
    /* 首页 — 公益红 */
    --page-home-primary: #E53935;
    --page-home-primary-light: #FFEBEE;
    --page-home-gradient: linear-gradient(135deg, #E53935, #FF6B6B);
    
    /* 集市 — 天蓝色 */
    --page-market-primary: #1976D2;
    --page-market-primary-light: #E3F2FD;
    --page-market-gradient: linear-gradient(135deg, #1976D2, #42A5F5);
    
    /* 号外/公告 — 青蓝色 */
    --page-bulletin-primary: #00ACC1;
    --page-bulletin-primary-light: #E0F7FA;
    
    /* 公益 — 暖橙色 */
    --page-charity-primary: #FF8F00;
    --page-charity-primary-light: #FFF8E1;
    
    /* 功能色 */
    --color-wx-green: #07C160;
    --color-promo-red: #FF5722;
    --color-price-orange: #FF6B35;
}

/* ========== 页面标准容器 ========== */
.page-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--safe-margin, 16px);
}

/* ========== 标准区块 ========== */
.page-section {
    margin-bottom: var(--section-spacing, 12px);
}

/* ========== 标准区块标题 ========== */
.page-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text, #1A1A1A);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}
.page-section-title .title-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-section-title .title-more {
    font-size: 12px;
    color: var(--text-light, #999);
    display: flex;
    align-items: center;
    gap: 2px;
    text-decoration: none;
}

/* ========== 标准卡片 (白底+12px圆角+微阴影) ========== */
.page-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 12px;
}
.page-card-sm {
    padding: 12px;
}
.page-card-flush {
    padding: 0;
    overflow: hidden;
}

/* ========== 金刚区标准 (京东风格线性图标) ========== */
.page-kingkong {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px 8px;
    background: #FFFFFF;
    border-radius: var(--jd-radius-lg);
    padding: 16px 12px 8px;
    box-shadow: var(--jd-shadow);
    margin-bottom: 12px;
}
.page-kingkong-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px 0;
    margin-bottom: 0;
}
.page-kingkong-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 4px;
    border-radius: var(--jd-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: var(--jd-text-primary);
}
.page-kingkong-item:active {
    background: #F7F7F7;
    transform: scale(0.96);
}
.page-kingkong-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--jd-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #333333;
}
.page-kingkong-label {
    font-size: 13px;
    font-weight: 400;
    color: var(--jd-text-primary);
    text-align: center;
    line-height: 1.3;
}

/* ========== 双列商品卡片网格 ========== */
.page-goods-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* ========== 标准商品卡片 ========== */
.page-goods-card {
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}
.page-goods-card:active {
    transform: scale(0.98);
}
.page-goods-img {
    width: 100%;
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 56px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
}
.page-goods-img img,
.goods-card-img-wrap img,
.goods-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    image-rendering: auto;
    -webkit-optimize-contrast: auto;
}
.page-goods-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #E53935, #FF5252);
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 600;
    z-index: 2;
}
.page-goods-info {
    padding: 10px 12px 12px;
}
.page-goods-name {
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    line-height: 1.4;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 36px;
}
.page-goods-price-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}
.page-goods-price {
    color: var(--color-price-orange, #FF6B35);
    font-size: 18px;
    font-weight: 700;
}
.page-goods-price small {
    font-size: 11px;
    font-weight: 500;
}
.page-goods-original {
    font-size: 11px;
    color: #bbb;
    text-decoration: line-through;
    margin-left: 4px;
}
.page-goods-sold {
    font-size: 11px;
    color: #999;
}

/* ========== 善人榜/排行卡片 ========== */
.page-rank-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}
.page-rank-item {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    gap: 12px;
    border-bottom: 1px solid #F5F5F5;
    cursor: pointer;
    transition: background 0.15s;
}
.page-rank-item:last-child { border-bottom: none; }
.page-rank-item:active { background: #F8F9FA; }

/* ========== 公告滚动区 ========== */
.page-notice-card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}
.page-notice-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    gap: 10px;
    border-bottom: 1px solid #F5F5F5;
    cursor: pointer;
}
.page-notice-item:last-child { border-bottom: none; }

/* ========== 集市页面专用 ========== */
.market-entry-row {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 12px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 12px;
    display: flex;
    gap: 4px;
}
.market-entry-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.market-entry-item:active { background: #F5F5F5; transform: scale(0.95); }
.market-entry-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}
.market-entry-label {
    font-size: 11px;
    color: #666;
    font-weight: 500;
    text-align: center;
}

/* ========== 集市搜索栏 ========== */
.market-search-bar {
    margin-bottom: 12px;
}
.market-search-inner {
    display: flex;
    align-items: center;
    background: #FFFFFF;
    border-radius: 20px;
    padding: 8px 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    gap: 8px;
    height: 40px;
}
.market-search-inner i {
    font-size: 14px;
    color: #999;
    flex-shrink: 0;
}
.market-search-inner input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    color: #333;
    background: transparent;
}
.market-search-inner input::placeholder { color: #999; }

/* ========== 集市分类横向滚动 ========== */
.market-cat-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 12px;
    scrollbar-width: none;
}
.market-cat-scroll::-webkit-scrollbar { display: none; }
.market-cat-tab {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: #FFFFFF;
    color: #666;
    border: 1px solid #EEEEEE;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}
.market-cat-tab.active {
    background: var(--page-market-primary, #1976D2);
    color: #FFFFFF;
    border-color: var(--page-market-primary, #1976D2);
}

/* ========== 集市排序栏 ========== */
.market-sort-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}
.market-sort-count {
    font-size: 13px;
    color: #666;
}
.market-sort-btns {
    display: flex;
    gap: 4px;
}
.market-sort-btn {
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    color: #666;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.market-sort-btn.active {
    background: var(--page-market-primary, #1976D2);
    color: #FFFFFF;
}

/* ========== 号外/公益列表卡片 ========== */
.page-list-card {
    background: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.page-list-card:active { transform: scale(0.99); }
.page-list-card-img {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    background: #F8F9FA;
}
.page-list-card-body {
    padding: 12px 16px;
}
.page-list-card-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}
.page-list-card-title {
    font-size: 16px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 6px;
    line-height: 1.4;
}
.page-list-card-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.page-list-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid #F5F5F5;
    font-size: 12px;
    color: #999;
}

/* ========== 筛选弹窗 ========== */
.filter-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.filter-modal-overlay.show { display: flex; }
.filter-modal-sheet {
    width: 100%;
    max-width: 480px;
    max-height: 70vh;
    background: #FFFFFF;
    border-radius: 16px 16px 0 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.filter-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #F0F0F0;
}
.filter-modal-title { font-size: 16px; font-weight: 600; }
.filter-modal-close {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: #F5F5F5;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.filter-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}
.filter-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    margin-bottom: 10px;
    margin-top: 16px;
}
.filter-section-title:first-child { margin-top: 0; }
.filter-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.filter-chip {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    background: #F5F5F5;
    color: #666;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.filter-chip.active {
    background: var(--page-market-primary, #1976D2);
    color: #FFFFFF;
}
.filter-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px;
    border-top: 1px solid #F0F0F0;
}
.filter-reset-btn, .filter-apply-btn {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.filter-reset-btn { background: #F5F5F5; color: #666; }
.filter-apply-btn {
    background: var(--page-market-primary, #1976D2);
    color: #FFFFFF;
}

/* ========== 京东风格按钮系统 ========== */
.jd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    text-align: center;
    gap: 6px;
}

.jd-btn-primary {
    background: var(--jd-primary);
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(226,35,26,0.25);
}
.jd-btn-primary:active {
    background: var(--jd-primary-dark);
    transform: scale(0.98);
}

.jd-btn-default {
    background: #F5F5F5;
    color: #333333;
}
.jd-btn-default:active {
    background: #E8E8E8;
    transform: scale(0.98);
}

.jd-btn-outline {
    background: #FFFFFF;
    color: var(--jd-primary);
    border: 1px solid var(--jd-primary);
}
.jd-btn-outline:active {
    background: var(--jd-primary-light);
    transform: scale(0.98);
}

.jd-btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.jd-btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.jd-btn-block {
    width: 100%;
}

/* ========== 京东风格商品图片规范 ========== */
/* 商品主图：800x800 正方形，白底极简 */
.jd-product-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #FFFFFF;
    object-fit: cover;
    object-position: center;
}

/* 商品详情页配图：宽度750px，自适应高度 */
.jd-detail-image {
    width: 100%;
    max-width: 750px;
    height: auto;
    background: #FFFFFF;
}

/* 商品卡片容器 */
.jd-product-card {
    background: #FFFFFF;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.jd-product-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.jd-product-card-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #FFFFFF;
    overflow: hidden;
    position: relative;
}

.jd-product-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.jd-product-card-body {
    padding: 10px;
}

.jd-product-card-title {
    font-size: 14px;
    color: #333333;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.jd-product-card-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--jd-primary);
}

.jd-product-card-price small {
    font-size: 12px;
    font-weight: 400;
}

/* 图片占位符 */
.jd-image-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #F5F5F5 0%, #FAFAFA 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #CCCCCC;
    font-size: 32px;
}

/* ========== 底部安全区 ========== */
.page-safe-bottom {
    padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 30px);
}

/* ========== 弹窗通用 ========== */
.popup-sheet {
    background: #FFFFFF;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px;
    max-height: 60vh;
    overflow-y: auto;
}
