/* ===== 全局重置 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #f5f5f5; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; font-size: 14px; color: #333; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
input, textarea, select { outline: none; border: none; background: transparent; font-family: inherit; font-size: inherit; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ===== 颜色变量 ===== */
:root {
    --primary: #e84135;
    --primary-light: #ff6b5b;
    --primary-dark: #c0392b;
    --orange: #ff6b00;
    --gold: #f5a623;
    --green: #19c37d;
    --gray: #999;
    --gray-light: #f7f7f7;
    --border: #eee;
    --text: #333;
    --text-sub: #666;
    --white: #fff;
    --tabbar-h: 56px;
    --header-h: 50px;
}

/* ===== 布局 ===== */
.page { min-height: 100vh; padding-bottom: var(--tabbar-h); background: #f5f5f5; }
.page-full { min-height: 100vh; background: #f5f5f5; }
.page-white { background: #fff; }

/* ===== 顶部导航 ===== */
.header {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--header-h); padding: 0 15px;
    background: var(--primary);
    color: #fff;
}
.header-title { font-size: 17px; font-weight: 600; }
.header-back { width: 32px; display: flex; align-items: center; }
.header-back svg { width: 22px; height: 22px; }
.header-right { width: 32px; display: flex; align-items: center; justify-content: flex-end; }
.header-plain { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.header-plain .header-title { color: var(--text); }
.header-plain .header-back svg { color: var(--text); }

/* ===== 底部TabBar ===== */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
    display: flex; height: var(--tabbar-h);
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.tabbar-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; color: var(--gray); font-size: 10px; padding: 4px 0;
    transition: color .2s;
}
.tabbar-item.active { color: var(--primary); }
.tabbar-item svg { width: 24px; height: 24px; }
.tabbar-badge {
    position: absolute; top: 4px; right: 8px;
    background: var(--primary); color: #fff;
    font-size: 10px; min-width: 16px; height: 16px;
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
}
.tabbar-item { position: relative; }

/* ===== 轮播图 ===== */
.banner-wrap { overflow: hidden; position: relative; }
.banner-slider { display: flex; transition: transform .4s ease; }
.banner-slider img { width: 100%; height: 160px; object-fit: cover; flex-shrink: 0; }
.banner-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.banner-dot { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.6); transition: all .3s; }
.banner-dot.active { width: 16px; background: #fff; }

/* ===== 首页快捷入口 ===== */
.quick-entry { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; background: #fff; padding: 10px 0; margin-bottom: 10px; }
.quick-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; }
.quick-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.quick-icon.red { background: #fff0ee; }
.quick-icon.orange { background: #fff4e6; }
.quick-icon.blue { background: #e6f0ff; }
.quick-icon.green { background: #e6faf2; }
.quick-label { font-size: 12px; color: var(--text-sub); }

/* ===== 区块标题 ===== */
.section-title {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 15px 10px;
    font-size: 16px; font-weight: 600; color: var(--text);
}
.section-title-more { font-size: 12px; color: var(--gray); font-weight: 400; display: flex; align-items: center; gap: 2px; }
.section-title-badge {
    font-size: 11px; background: var(--primary); color: #fff;
    border-radius: 10px; padding: 1px 8px; margin-left: 6px; font-weight: 400;
}

/* ===== 商品卡片 ===== */
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 10px 10px; }
.product-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.product-card-img { width: 100%; height: 140px; object-fit: cover; background: #f0f0f0; }
.product-card-img-placeholder { width: 100%; height: 140px; background: linear-gradient(135deg, #ffeee9, #ffcfc8); display: flex; align-items: center; justify-content: center; font-size: 40px; }
.product-card-body { padding: 10px; }
.product-card-name { font-size: 13px; font-weight: 500; line-height: 1.4; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card-spec { font-size: 11px; color: var(--gray); margin-bottom: 6px; }
.product-card-price { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.price-now { font-size: 17px; font-weight: 700; color: var(--primary); }
.price-old { font-size: 11px; color: var(--gray); text-decoration: line-through; }
.price-tag { font-size: 11px; background: #fff0ee; color: var(--primary); border-radius: 4px; padding: 1px 5px; }
.product-card-btn { width: 100%; height: 32px; background: var(--primary); color: #fff; border-radius: 16px; font-size: 13px; font-weight: 500; }

/* ===== 商品列表行 ===== */
.product-list { padding: 0 10px; }
.product-row { display: flex; gap: 12px; background: #fff; border-radius: 10px; padding: 12px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.product-row-img { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; background: #f0f0f0; flex-shrink: 0; }
.product-row-img-placeholder { width: 80px; height: 80px; border-radius: 8px; background: linear-gradient(135deg, #ffeee9, #ffcfc8); display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0; }
.product-row-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.product-row-name { font-size: 14px; font-weight: 500; line-height: 1.4; }
.product-row-spec { font-size: 12px; color: var(--gray); margin-top: 4px; }
.product-row-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-row-btn { height: 30px; padding: 0 16px; background: var(--primary); color: #fff; border-radius: 15px; font-size: 12px; }

/* ===== 套餐卡片 ===== */
.package-list { padding: 0 10px; display: flex; flex-direction: column; gap: 10px; }
.package-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.package-card-header { padding: 14px 15px; background: linear-gradient(135deg, var(--primary), #ff6b5b); color: #fff; }
.package-card-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.package-card-desc { font-size: 12px; opacity: .85; }
.package-card-body { padding: 12px 15px; }
.package-card-items { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.package-item-tag { font-size: 11px; background: #fff0ee; color: var(--primary); border-radius: 4px; padding: 3px 8px; }
.package-card-footer { display: flex; align-items: center; justify-content: space-between; }
.package-price-wrap { display: flex; align-items: baseline; gap: 8px; }
.package-price { font-size: 22px; font-weight: 700; color: var(--primary); }
.package-price::before { content: '¥'; font-size: 14px; }
.package-old-price { font-size: 12px; color: var(--gray); text-decoration: line-through; }
.package-buy-btn { height: 36px; padding: 0 22px; background: var(--primary); color: #fff; border-radius: 18px; font-size: 14px; font-weight: 500; }

/* ===== 购物车 ===== */
.cart-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.cart-item { background: #fff; border-radius: 10px; padding: 12px; display: flex; gap: 12px; align-items: center; }
.cart-item-img { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; background: #f0f0f0; flex-shrink: 0; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.cart-item-spec { font-size: 12px; color: var(--gray); margin-bottom: 8px; }
.cart-item-bottom { display: flex; align-items: center; justify-content: space-between; }
.cart-item-price { font-size: 16px; font-weight: 700; color: var(--primary); }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn { width: 26px; height: 26px; border-radius: 13px; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text); }
.qty-num { width: 30px; text-align: center; font-size: 14px; font-weight: 500; }
.cart-delete-btn { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--gray); flex-shrink: 0; }
.cart-footer { position: fixed; bottom: var(--tabbar-h); left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; z-index: 100; }
.cart-total { font-size: 13px; color: var(--text); }
.cart-total span { font-size: 20px; font-weight: 700; color: var(--primary); }
.cart-checkout-btn { height: 42px; padding: 0 24px; background: var(--primary); color: #fff; border-radius: 21px; font-size: 15px; font-weight: 600; }
.cart-empty { display: flex; flex-direction: column; align-items: center; padding: 80px 0; gap: 16px; }
.cart-empty-icon { font-size: 60px; }
.cart-empty-text { color: var(--gray); font-size: 14px; }
.cart-go-shop { height: 42px; padding: 0 32px; background: var(--primary); color: #fff; border-radius: 21px; font-size: 15px; margin-top: 8px; }

/* ===== 订单 ===== */
.order-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.order-tab { flex: 1; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--gray); border-bottom: 2px solid transparent; transition: all .2s; }
.order-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.order-list { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.order-card { background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.order-card-header { padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.order-no { font-size: 12px; color: var(--gray); }
.status-pending { color: var(--orange); font-size: 12px; font-weight: 500; }
.status-processing { color: #1890ff; font-size: 12px; font-weight: 500; }
.status-completed { color: var(--green); font-size: 12px; font-weight: 500; }
.status-cancelled { color: var(--gray); font-size: 12px; font-weight: 500; }
.order-card-body { padding: 12px 15px; display: flex; gap: 12px; align-items: center; }
.order-card-img { width: 60px; height: 60px; border-radius: 6px; object-fit: cover; background: #f0f0f0; flex-shrink: 0; }
.order-card-info { flex: 1; }
.order-card-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.order-card-spec { font-size: 12px; color: var(--gray); }
.order-card-footer { padding: 10px 15px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.order-card-price { font-size: 16px; font-weight: 700; color: var(--primary); }
.order-card-time { font-size: 11px; color: var(--gray); }

/* ===== 回收 ===== */
.recycle-card { background: #fff; border-radius: 10px; padding: 14px 15px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.recycle-card-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.recycle-card-name { font-size: 14px; font-weight: 500; }
.recycle-card-body { display: flex; gap: 10px; font-size: 13px; color: var(--text-sub); flex-direction: column; }
.recycle-info-row { display: flex; justify-content: space-between; }
.recycle-info-label { color: var(--gray); }
.recycle-info-val { font-weight: 500; color: var(--text); }

/* ===== 个人中心 ===== */
.mine-header { background: linear-gradient(135deg, var(--primary), #ff6b5b); padding: 30px 20px 20px; color: #fff; }
.mine-avatar { width: 60px; height: 60px; border-radius: 30px; background: rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 10px; }
.mine-name { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.mine-sub { font-size: 13px; opacity: .85; }
.mine-balance-card { margin: -20px 15px 15px; background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.1); display: flex; justify-content: space-around; }
.mine-balance-item { text-align: center; }
.mine-balance-num { font-size: 22px; font-weight: 700; color: var(--text); }
.mine-balance-label { font-size: 12px; color: var(--gray); margin-top: 4px; }
.mine-menu { background: #fff; border-radius: 12px; margin: 0 10px 10px; overflow: hidden; }
.mine-menu-item { display: flex; align-items: center; padding: 15px; border-bottom: 1px solid var(--border); gap: 12px; }
.mine-menu-item:last-child { border-bottom: none; }
.mine-menu-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.mine-menu-text { flex: 1; font-size: 15px; }
.mine-menu-arrow { color: var(--gray); font-size: 18px; }

/* ===== 充值 ===== */
.recharge-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 15px; }
.amount-btn { height: 44px; border-radius: 8px; border: 1.5px solid var(--border); font-size: 15px; font-weight: 500; color: var(--text); background: #fff; transition: all .2s; }
.amount-btn.active { border-color: var(--primary); color: var(--primary); background: #fff0ee; }
.recharge-input-wrap { margin: 0 15px 15px; }
.recharge-input { width: 100%; height: 50px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 15px; font-size: 16px; background: #fff; transition: border-color .2s; }
.recharge-input:focus { border-color: var(--primary); }

/* ===== 表单 ===== */
.form-group { padding: 0 15px 15px; }
.form-label { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; display: block; }
.form-input { width: 100%; height: 46px; border: 1.5px solid var(--border); border-radius: 10px; padding: 0 15px; font-size: 15px; background: #fff; transition: border-color .2s; }
.form-input:focus { border-color: var(--primary); }
.form-textarea { width: 100%; height: 80px; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 15px; font-size: 14px; background: #fff; resize: none; transition: border-color .2s; }
.form-textarea:focus { border-color: var(--primary); }
.form-submit { display: block; width: calc(100% - 30px); margin: 0 15px 20px; height: 48px; background: var(--primary); color: #fff; border-radius: 24px; font-size: 16px; font-weight: 600; }
.form-tip { font-size: 12px; color: var(--gray); margin-top: 6px; line-height: 1.6; }

/* ===== 通用 ===== */
.divider { height: 10px; background: #f5f5f5; }
.cell-group { background: #fff; border-radius: 12px; margin: 0 10px 10px; overflow: hidden; }
.cell { display: flex; align-items: center; padding: 14px 15px; border-bottom: 1px solid var(--border); gap: 10px; }
.cell:last-child { border-bottom: none; }
.cell-icon { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.cell-label { flex: 1; font-size: 15px; }
.cell-value { font-size: 14px; color: var(--gray); }
.cell-arrow { color: var(--gray); margin-left: 4px; }
.badge-red { background: var(--primary); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; margin-left: 6px; }
.tag-discount { display: inline-block; background: var(--primary); color: #fff; font-size: 11px; border-radius: 4px; padding: 1px 6px; margin-right: 4px; }
.tag-hot { background: var(--orange); }

/* ===== Toast ===== */
.toast-msg {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: rgba(0,0,0,.75); color: #fff; border-radius: 20px;
    padding: 10px 20px; font-size: 14px; z-index: 9999;
    opacity: 0; transition: all .3s; white-space: nowrap; max-width: 80%;
    white-space: normal; text-align: center;
}
.toast-msg.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: rgba(25, 195, 125, .9); }
.toast-error { background: rgba(232, 65, 53, .9); }

/* ===== Loading ===== */
.global-loading {
    position: fixed; inset: 0; background: rgba(0,0,0,.3);
    display: flex; align-items: center; justify-content: center; z-index: 9998;
}
.loading-spinner {
    width: 40px; height: 40px; border: 3px solid rgba(255,255,255,.3);
    border-top-color: #fff; border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 ===== */
.empty-state { display: flex; flex-direction: column; align-items: center; padding: 60px 20px; gap: 12px; color: var(--gray); }
.empty-icon { font-size: 60px; }
.empty-text { font-size: 14px; }

/* ===== 搜索框 ===== */
.search-bar { padding: 10px 15px; background: #fff; }
.search-input-wrap { display: flex; align-items: center; background: var(--gray-light); border-radius: 20px; padding: 0 15px; height: 38px; gap: 8px; }
.search-input-wrap svg { width: 16px; height: 16px; color: var(--gray); flex-shrink: 0; }
.search-input-wrap input { flex: 1; background: transparent; font-size: 14px; color: var(--text); }
.search-input-wrap input::placeholder { color: var(--gray); }

/* ===== 分类标签 ===== */
.cat-tabs { display: flex; overflow-x: auto; padding: 10px 10px 0; gap: 8px; background: #fff; scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex-shrink: 0; height: 32px; padding: 0 14px; border-radius: 16px; font-size: 13px; border: 1px solid var(--border); color: var(--text-sub); white-space: nowrap; transition: all .2s; }
.cat-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== 登录注册 ===== */
.auth-page { min-height: 100vh; background: #fff; }
.auth-logo { text-align: center; padding: 50px 0 30px; }
.auth-logo-icon { font-size: 56px; margin-bottom: 10px; }
.auth-logo-name { font-size: 22px; font-weight: 700; color: var(--primary); }
.auth-logo-sub { font-size: 13px; color: var(--gray); margin-top: 4px; }
.auth-form { padding: 0 24px; }
.auth-input-group { margin-bottom: 16px; }
.auth-input { width: 100%; height: 50px; border: 1.5px solid var(--border); border-radius: 12px; padding: 0 16px; font-size: 16px; transition: border-color .2s; }
.auth-input:focus { border-color: var(--primary); }
.auth-btn { width: 100%; height: 50px; background: var(--primary); color: #fff; border-radius: 25px; font-size: 16px; font-weight: 600; margin-top: 8px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--gray); }
.auth-switch a { color: var(--primary); font-weight: 500; }

/* ===== 详情页 ===== */
.detail-img { width: 100%; height: 250px; object-fit: cover; background: #f0f0f0; }
.detail-img-placeholder { width: 100%; height: 250px; background: linear-gradient(135deg, #ffeee9, #ffcfc8); display: flex; align-items: center; justify-content: center; font-size: 80px; }
.detail-info { background: #fff; padding: 15px; margin-bottom: 10px; }
.detail-name { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.detail-price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.detail-price { font-size: 26px; font-weight: 700; color: var(--primary); }
.detail-price::before { content: '¥'; font-size: 16px; }
.detail-old-price { font-size: 14px; color: var(--gray); text-decoration: line-through; }
.detail-discount-tag { background: var(--primary); color: #fff; font-size: 12px; border-radius: 4px; padding: 2px 8px; }
.detail-spec { font-size: 13px; color: var(--text-sub); }
.detail-footer { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--border); padding: 10px 15px; display: flex; gap: 10px; }
.detail-cart-btn { flex: 1; height: 46px; border: 2px solid var(--primary); color: var(--primary); border-radius: 23px; font-size: 15px; font-weight: 600; background: #fff; }
.detail-buy-btn { flex: 2; height: 46px; background: var(--primary); color: #fff; border-radius: 23px; font-size: 15px; font-weight: 600; }

/* ===== 公告 ===== */
.notice-bar { background: #fffbe6; padding: 8px 15px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: #8a6d00; overflow: hidden; }
.notice-bar-icon { font-size: 16px; flex-shrink: 0; }
.notice-bar-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 折扣倒计时 ===== */
.countdown { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.countdown-label { color: var(--gray); }
.countdown-num { background: var(--text); color: #fff; border-radius: 3px; padding: 1px 5px; font-size: 12px; font-family: monospace; }
.countdown-sep { color: var(--text); font-weight: 700; }

/* ===== 响应式 ===== */
@media (min-width: 480px) {
    .page, .page-full { max-width: 480px; margin: 0 auto; }
    .tabbar { max-width: 480px; left: 50%; transform: translateX(-50%); }
    .cart-footer { max-width: 480px; left: 50%; transform: translateX(-50%); }
    .detail-footer { max-width: 480px; left: 50%; transform: translateX(-50%); }
    .toast-msg { max-width: 380px; }
}
