/* ============================================================
 * 山姆代购商城 - 公共样式
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif; background: #f5f5f5; color: #333; font-size: 14px; }
body { max-width: 414px; margin: 0 auto; position: relative; overflow: hidden; }

.app { display: flex; flex-direction: column; height: 100vh; max-width: 414px; margin: 0 auto; background: #f5f5f5; position: relative; }

/* ===== 顶部导航栏 ===== */
.navbar { height: 44px; background: #fff; display: flex; align-items: center; justify-content: center; position: relative; flex-shrink: 0; border-bottom: 1px solid #f0f0f0; z-index: 100; }
.navbar .title { font-size: 17px; font-weight: 600; color: #333; }
.navbar .capsule { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; background: #f7f7f7; border-radius: 16px; padding: 4px 10px; gap: 8px; border: 1px solid #e8e8e8; }
.navbar .capsule .dots { font-size: 16px; color: #333; letter-spacing: 1px; font-weight: bold; }
.navbar .capsule .divider { width: 1px; height: 14px; background: #ddd; }
.navbar .capsule .circle { width: 16px; height: 16px; border: 2px solid #333; border-radius: 50%; }

.navbar-home { background: #1a3a8a; border-bottom: none; }
.navbar-home .title { color: #fff; }
.navbar-home .capsule { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.2); }
.navbar-home .capsule .dots { color: #fff; }
.navbar-home .capsule .divider { background: rgba(255,255,255,0.3); }
.navbar-home .capsule .circle { border-color: #fff; }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }

/* ===== 底部Tab栏 ===== */
.tabbar { height: 54px; background: #fff; display: flex; border-top: 1px solid #e8e8e8; flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; color: #999; transition: color 0.2s; text-decoration: none; }
.tab-item.active { color: #1a3a8a; }
.tab-item svg { width: 24px; height: 24px; }
.tab-item .tab-label { font-size: 11px; }

/* ===== 首页 ===== */
.home-banner { background: linear-gradient(160deg, #1a3a8a 0%, #2548a0 55%, #2f5cc0 100%); padding: 14px 0 26px; position: relative; overflow: hidden; min-height: 200px; display: flex; align-items: center; justify-content: center; }
.banner-decor { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.08); }
.decor-1 { width: 220px; height: 220px; top: -80px; right: -60px; }
.decor-2 { width: 160px; height: 160px; bottom: -50px; left: -40px; background: rgba(255,255,255,0.06); }
.decor-3 { width: 60px; height: 60px; top: 30px; left: 28px; background: rgba(255,255,255,0.10); }
.banner-inner { position: relative; z-index: 2; text-align: center; width: 100%; }
.banner-top { color: rgba(255,255,255,0.85); font-size: 13px; letter-spacing: 1px; margin-bottom: 10px; }
.banner-logo { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 4px 0; }
.banner-logo .sam-icon { width: 44px; height: 44px; background: #fff; border-radius: 8px; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.banner-logo .sam-icon svg { width: 36px; height: 36px; }
.banner-logo .brand-name { color: #fff; font-size: 30px; font-weight: 800; letter-spacing: 3px; }
.banner-title { text-align: center; color: #fff; margin: 12px 0 0; position: relative; z-index: 2; }
.banner-title .line1 { font-size: 34px; font-weight: 900; line-height: 1.2; text-shadow: 2px 2px 0 rgba(0,0,0,0.12); }
.banner-title .line2 { font-size: 34px; font-weight: 900; line-height: 1.2; text-shadow: 2px 2px 0 rgba(0,0,0,0.12); position: relative; display: inline-block; }

/* 功能入口网格 - 2列x4行，对齐参考图 */
.entries { padding: 10px 12px 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 12px; background: #fff; margin-top: 0; }
.entry-card { background: #fff; border-radius: 12px; padding: 14px 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; transition: transform 0.15s; text-decoration: none; color: #333; }
.entry-card:active { transform: scale(0.96); }
.entry-icon { width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; }
.entry-icon svg { width: 100%; height: 100%; }
.entry-label { font-size: 13px; color: #333; text-align: center; line-height: 1.3; font-weight: 500; }

/* ===== 分类页（点单） ===== */
.order-header { background: #fff; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f0f0f0; }
.order-header .left { display: flex; align-items: center; gap: 8px; }
.order-header .shop-name { font-size: 16px; font-weight: 600; }
.order-header .delivery-tag { background: #1a3a8a; color: #fff; font-size: 12px; padding: 4px 12px; border-radius: 12px; }
.order-body { display: flex; flex: 1; overflow: hidden; }
.category-sidebar { width: 90px; background: #f7f7f7; overflow-y: auto; flex-shrink: 0; }
.category-item { padding: 16px 8px; font-size: 13px; color: #666; text-align: center; cursor: pointer; position: relative; line-height: 1.4; }
.category-item.active { background: #fff; color: #333; font-weight: 600; }
.category-item.active::before { content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; background: #1a3a8a; border-radius: 0 2px 2px 0; }
.product-list { flex: 1; background: #fff; overflow-y: auto; padding: 0 12px; }
.product-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid #f5f5f5; }
.product-img { width: 80px; height: 80px; background: #f9f9f9; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-img svg { width: 60px; height: 60px; }
.product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-info { flex: 1; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.product-name { font-size: 14px; color: #333; line-height: 1.4; font-weight: 500; }
.product-stock { font-size: 12px; color: #999; margin-top: 2px; }
.product-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.product-price { font-size: 16px; color: #ff4400; font-weight: 700; }
.add-btn { width: 26px; height: 26px; background: #1a3a8a; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; flex-shrink: 0; border: none; }

/* ===== 购物车 ===== */
.cart-list { flex: 1; overflow-y: auto; background: #fff; }
.cart-item { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid #f5f5f5; }
.cart-item .cart-img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: #f9f9f9; }
.cart-item .cart-name { flex: 1; font-size: 14px; color: #333; line-height: 1.4; }
.cart-item .cart-price { font-size: 16px; color: #ff4400; font-weight: 700; }
.qty-ctrl { display: flex; align-items: center; gap: 10px; }
.qty-ctrl button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #ddd; background: #fff; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-ctrl .qty { font-size: 15px; min-width: 20px; text-align: center; }
.cart-empty { text-align: center; color: #999; padding: 60px 0; font-size: 15px; }
.cart-footer { background: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #f0f0f0; flex-shrink: 0; }
.cart-total { font-size: 16px; color: #333; }
.cart-total .price { color: #ff4400; font-weight: 700; font-size: 20px; }
.checkout-btn { background: #1a3a8a; color: #fff; border: none; padding: 10px 28px; border-radius: 20px; font-size: 15px; cursor: pointer; }

/* ===== 订单页 ===== */
.order-nav { background: #fff; height: 44px; display: flex; align-items: center; justify-content: center; position: relative; border-bottom: 1px solid #f0f0f0; flex-shrink: 0; }
.order-nav .nav-title { font-size: 17px; font-weight: 600; color: #333; }
.order-status-bar { background: #fff; display: flex; border-bottom: 1px solid #f0f0f0; padding: 0 4px; flex-shrink: 0; }
.order-status-item { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; color: #666; cursor: pointer; position: relative; }
.order-status-item.active { color: #333; font-weight: 600; }
.order-status-item.active::after { content: ''; position: absolute; bottom: 0; left: 25%; right: 25%; height: 2px; background: #1a3a8a; border-radius: 1px; }
.order-list { flex: 1; overflow-y: auto; padding: 12px; }
.order-card { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.order-card .order-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.order-card .order-id { font-size: 12px; color: #999; }
.order-card .order-status { font-size: 13px; color: #1a3a8a; font-weight: 600; }
.order-card .order-items { font-size: 13px; color: #333; line-height: 1.6; margin-bottom: 10px; }
.order-card .order-total { font-size: 15px; color: #333; }
.order-card .order-total .price { color: #ff4400; font-weight: 700; }
.order-empty { text-align: center; color: #999; padding: 60px 0; font-size: 15px; }

/* ===== 我的 ===== */
.profile-content { flex: 1; overflow-y: auto; background: #f5f5f5; }
.profile-header { padding: 20px 16px; }
.user-info { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.user-left .welcome { font-size: 14px; color: #666; margin-bottom: 6px; }
.user-left .username { font-size: 20px; font-weight: 700; color: #333; margin-bottom: 10px; }
.login-btn { display: inline-block; border: 1px solid #ccc; border-radius: 4px; padding: 4px 12px; font-size: 12px; color: #666; cursor: pointer; }
.user-avatar { width: 60px; height: 60px; border-radius: 50%; background: #e8e8e8; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.user-avatar svg { width: 40px; height: 40px; color: #bbb; }
.member-card-lg { background: linear-gradient(135deg, #1a3a8a 0%, #2548a0 100%); border-radius: 12px; padding: 20px; margin-bottom: 16px; color: #fff; }
.member-card-lg .row1 { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.member-card-lg .member-name { font-size: 20px; font-weight: 700; }
.member-card-lg .member-desc { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.member-card-lg .right-side { text-align: right; font-size: 12px; opacity: 0.9; line-height: 1.8; }
.func-grid { background: #fff; border-radius: 12px; padding: 8px; }
.func-row { display: flex; }
.func-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 0; cursor: pointer; text-decoration: none; color: #333; }
.func-item svg { width: 28px; height: 28px; color: #1a3a8a; }
.func-label { font-size: 12px; color: #333; }
.admin-entry { background: #fff; border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; margin-top: 12px; cursor: pointer; text-decoration: none; color: #333; }
.admin-entry .admin-title { font-size: 15px; font-weight: 600; }
.admin-entry .admin-desc { font-size: 12px; color: #999; margin-top: 4px; }
.admin-entry .arrow { color: #ccc; font-size: 18px; }

/* ===== Toast ===== */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.75); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 9999; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }
