/* ============================================================
   商城中心前台样式（/mall.html）
   简约风格 · 移动优先 + PC 自适应
   复用站点变量（--c-*），暗黑模式随 html[data-theme="dark"] 自动生效
   ============================================================ */

body { background: var(--c-bg); }

.mall-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 12px 12px 96px;
}

@media (min-width: 769px) {
    .mall-wrap { max-width: 1280px; padding: 28px 24px 60px; }
}

/* ============================================================
   资产概览条（余额 / 积分）—— 横幅式合并卡片
   ============================================================ */
.m-assets {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}
@media (min-width: 769px) {
    .m-assets { gap: 16px; margin-bottom: 28px; }
}

.m-asset {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    border: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04),
                0 4px 14px rgba(15, 23, 42, 0.04);
    transition: box-shadow .2s;
    position: relative;
    overflow: hidden;
}
html[data-theme="dark"] .m-asset {
    background: var(--c-surface);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), 0 4px 14px rgba(0,0,0,0.15);
}
.m-asset:hover {
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06),
                0 8px 24px rgba(15, 23, 42, 0.06);
}

.m-asset-icon {
    width: 38px; height: 38px; flex-shrink: 0;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
}
.m-asset-icon.m-ic-green { background: #ecfdf5; color: #059669; }
.m-asset-icon.m-ic-amber { background: #fffbeb; color: #d97706; }
html[data-theme="dark"] .m-asset-icon.m-ic-green { background: rgba(5,150,105,0.15); color: #34d399; }
html[data-theme="dark"] .m-asset-icon.m-ic-amber { background: rgba(217,119,6,0.15); color: #fbbf24; }

.m-asset-meta { min-width: 0; flex: 1; }
.m-asset-num {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .m-asset-num { color: #f1f5f9; }
.m-asset-label {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 3px;
    font-weight: 500;
}
html[data-theme="dark"] .m-asset-label { color: #64748b; }

.m-asset-act {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--c-primary);
    background: var(--c-primary-light);
    border-radius: 6px;
    padding: 6px 14px;
    text-decoration: none;
    transition: all .15s;
    letter-spacing: 0.02em;
}
.m-asset-act:hover { background: var(--c-primary); color: #fff; }

/* ============================================================
   商品宫格 —— 简约卡片风
   ============================================================ */
.m-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
@media (min-width: 769px) {
    .m-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 1200px) {
    .m-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; }
}

/* ---------- 商品卡片 ---------- */
.m-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform .25s cubic-bezier(.2,.8,.2,1),
                box-shadow .25s cubic-bezier(.2,.8,.2,1);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
html[data-theme="dark"] .m-card { background: var(--c-surface); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.m-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(15,23,42,0.08),
                0 12px 32px rgba(15,23,42,0.06);
}
html[data-theme="dark"] .m-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.3), 0 12px 32px rgba(0,0,0,0.2);
}
.m-card.m-soldout { opacity: .65; }
.m-card.m-soldout:hover { transform: none; box-shadow: 0 1px 2px rgba(15,23,42,0.04); }

/* ---------- 封面 ---------- */
.m-card-cover {
    position: relative;
    height: 0;
    padding-top: 100%; /* 1:1 方形 */
    overflow: hidden;
    background: #f1f5f9;
}
html[data-theme="dark"] .m-card-cover { background: #1e293b; }

.m-card-cover img {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.m-card:hover .m-card-cover img { transform: scale(1.03); }

.m-card-letter {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 800;
    color: #cbd5e1;
    letter-spacing: -0.03em;
}
html[data-theme="dark"] .m-card-letter { color: #334155; }

.m-card-soldout {
    position: absolute;
    top: 8px; left: 8px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(4px);
}
html[data-theme="dark"] .m-card-soldout { background: rgba(15,23,42,0.9); color: #94a3b8; }

/* ---------- 内容区 ---------- */
.m-card-body {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}
@media (min-width: 769px) {
    .m-card-body { padding: 12px 14px 14px; }
}

.m-card-name {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}
@media (min-width: 769px) {
    .m-card-name { font-size: 14px; }
}
html[data-theme="dark"] .m-card-name { color: #f1f5f9; }

/* 店铺名称（归属管理员设置，留空不渲染） */
.m-card-shop {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 4px;
    font-size: 11px;
    color: var(--c-primary);
    overflow: hidden;
    white-space: nowrap;
}
.m-card-shop i { font-size: 10px; flex: none; }
.m-card-shop span { overflow: hidden; text-overflow: ellipsis; }

.m-card-desc {
    font-size: 11px;
    color: #94a3b8;
    margin: 0 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 0;
    line-height: 1.4;
}
@media (min-width: 769px) {
    .m-card-desc { font-size: 12px; -webkit-line-clamp: 2; line-clamp: 2; min-height: 32px; }
}
html[data-theme="dark"] .m-card-desc { color: #64748b; }

.m-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
    min-height: 0;
}
.m-card-meta:empty { margin-bottom: 0; }

.m-card-chip {
    font-size: 10px;
    font-weight: 500;
    color: #64748b;
    background: #f1f5f9;
    border-radius: 4px;
    padding: 2px 6px;
    line-height: 1.4;
}
html[data-theme="dark"] .m-card-chip { background: #1e293b; color: #94a3b8; }

/* ---------- 底部价格栏 ---------- */
.m-card-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.m-card-price {
    display: flex;
    align-items: baseline;
    gap: 1px;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}
html[data-theme="dark"] .m-card-price { color: #f1f5f9; }
.m-card-price .cur { font-size: 12px; color: #ef4444; }
@media (min-width: 769px) {
    .m-card-price .cur { font-size: 13px; }
}
.m-card-price .num { font-size: 18px; color: #ef4444; letter-spacing: -0.02em; }
@media (min-width: 769px) {
    .m-card-price .num { font-size: 20px; }
}

.m-card-sold {
    font-size: 10px;
    color: #94a3b8;
    white-space: nowrap;
}
@media (min-width: 769px) {
    .m-card-sold { font-size: 11px; }
}

/* ---------- 空状态 ---------- */
.m-empty {
    text-align: center;
    padding: 64px 20px;
    color: #94a3b8;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
html[data-theme="dark"] .m-empty { background: var(--c-surface); color: #64748b; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.m-empty i {
    font-size: 32px;
    color: #cbd5e1;
    margin-bottom: 12px;
    display: block;
}
html[data-theme="dark"] .m-empty i { color: #334155; }
.m-empty p { margin: 0; font-weight: 500; }

/* ============================================================
   商城专属顶栏覆盖（更简约扁平）
   ============================================================ */
.ast-topbar {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 12px 16px;
}
html[data-theme="dark"] .ast-topbar {
    background: var(--c-surface);
    border-bottom-color: #1e293b;
}
.ast-topbar-inner { max-width: 720px; }
@media (min-width: 769px) {
    .ast-topbar-inner { max-width: 1280px; }
}
.ast-topbar-action {
    width: 40px; height: 40px; border-radius: 50%;
    background: #f8fafc; color: #64748b;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none; flex-shrink: 0;
    transition: background .15s, color .15s;
}
.ast-topbar-action:hover { background: var(--c-primary-light); color: var(--c-primary); }
