/* ===== 微信商城样式 ===== */
:root {
  --primary: #c45a3c;
  --primary-light: #e8744f;
  --primary-dark: #a3442a;
  --bg: #f5f5f5;
  --white: #fff;
  --text: #333;
  --text-light: #999;
  --border: #eee;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
/* Header */
.header { background: var(--primary); color: white; padding: 12px 16px; position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; }
.header h1 { font-size: 17px; font-weight: 600; }
.header .back { font-size: 22px; cursor: pointer; padding: 0 8px; }
/* Tab Bar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; border-top: 1px solid var(--border); padding-bottom: var(--safe-bottom); z-index: 100; }
.tabbar .tab-item { flex: 1; text-align: center; padding: 8px 0 4px; font-size: 11px; color: var(--text-light); cursor: pointer; }
.tabbar .tab-item.active { color: var(--primary); }
.tabbar .tab-item .icon { font-size: 22px; display: block; margin-bottom: 2px; }
.tabbar .tab-item .badge { background: #ff4444; color: white; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px; border-radius: 8px; display: inline-block; position: absolute; top: 2px; margin-left: 4px; }
.page { padding-bottom: 60px; min-height: 100vh; }
/* Banner / Swiper */
.swiper { width: 100%; overflow: hidden; position: relative; aspect-ratio: 16/6; min-height: 260px; max-height: 480px; }
.swiper .swiper-track { display: flex; height: 100%; transition: transform 0.4s ease; }
.swiper .swiper-slide { height: 100%; flex-shrink: 0; overflow: hidden; }
.swiper .swiper-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swiper .swiper-dots { position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 5; }
.swiper .swiper-dots .dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.5); cursor: pointer; transition: all 0.3s; }
.swiper .swiper-dots .dot.active { background: white; width: 16px; border-radius: 3px; }
/* Category */
.category-bar { background: white; padding: 12px 0; display: flex; overflow-x: auto; white-space: nowrap; gap: 0; }
.category-bar .cat-item { flex: 0 0 auto; padding: 6px 16px; margin: 0 4px; border-radius: 16px; font-size: 13px; color: var(--text-light); cursor: pointer; }
.category-bar .cat-item.active { background: var(--primary); color: white; }
/* Products Grid */
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px; }
.product-card { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.product-card .img-wrap { width: 100%; aspect-ratio: 1; overflow: hidden; background: #f9f9f9; }
.product-card .img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-card .info { padding: 8px 10px 10px; }
.product-card .name { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; min-height: 36px; }
.product-card .price { color: var(--primary); font-size: 16px; font-weight: 600; margin-top: 4px; }
.product-card .price .original { color: var(--text-light); font-size: 12px; text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.product-card .sales { color: var(--text-light); font-size: 11px; margin-top: 2px; }
/* Product Detail */
.detail-page .swiper { aspect-ratio: 16/8; min-height: 320px; max-height: 560px; }
.detail-info { background: white; padding: 16px; }
.detail-info .name { font-size: 18px; font-weight: 600; }
.detail-info .desc { color: var(--text-light); font-size: 13px; margin-top: 8px; line-height: 1.6; }
.detail-info .price-row { display: flex; align-items: baseline; gap: 8px; margin-top: 12px; }
.detail-info .price { color: var(--primary); font-size: 24px; font-weight: 700; }
.detail-info .original { color: var(--text-light); font-size: 14px; text-decoration: line-through; }
.detail-info .stock { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.detail-info .qty-selector { display:flex; align-items:center; margin-top:8px; }
.detail-info .qty-selector .qty-btn { width:28px; height:28px; border:1px solid #ddd; border-radius:50%; text-align:center; line-height:28px; cursor:pointer; font-size:16px; user-select:none; }
.detail-spec { background: white; margin-top: 10px; padding: 16px; }
.detail-spec h3 { font-size: 14px; margin-bottom: 8px; }
.detail-spec .spec-options { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-spec .spec-option { padding: 6px 14px; border: 1px solid var(--border); border-radius: 4px; font-size: 13px; cursor: pointer; }
.detail-spec .spec-option.active { border-color: var(--primary); color: var(--primary); background: #fff5f0; }
.detail-buy { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; padding: 10px 16px; padding-bottom: calc(10px + var(--safe-bottom)); border-top: 1px solid var(--border); gap: 10px; z-index: 100; }
.detail-buy .btn { flex: 1; padding: 12px; text-align: center; border-radius: 6px; font-size: 15px; font-weight: 500; cursor: pointer; border: none; }
.detail-buy .btn-cart { background: #ff8c00; color: white; }
.detail-buy .btn-buy { background: var(--primary); color: white; }
/* Cart */
.cart-page .cart-item { display: flex; background: white; padding: 12px 16px; margin-bottom: 1px; align-items: center; gap: 12px; }
.cart-page .cart-item .checkbox { width: 20px; height: 20px; border: 2px solid #ddd; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.cart-page .cart-item .checkbox.checked { background: var(--primary); border-color: var(--primary); color: white; font-size: 12px; }
.cart-page .cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.cart-page .cart-item .item-info { flex: 1; }
.cart-page .cart-item .item-name { font-size: 13px; font-weight: 500; }
.cart-page .cart-item .item-spec { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.cart-page .cart-item .item-price { color: var(--primary); font-size: 15px; font-weight: 600; margin-top: 4px; }
.cart-page .cart-item .qty-control { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.cart-page .cart-item .qty-btn { width: 24px; height: 24px; border: 1px solid #ddd; border-radius: 50%; text-align: center; line-height: 24px; cursor: pointer; font-size: 14px; }
.cart-page .cart-item .del-btn { font-size: 18px; cursor: pointer; padding: 8px 4px; flex-shrink: 0; opacity: 0.6; }
.cart-page .cart-item .del-btn:hover { opacity: 1; }
.cart-footer { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; align-items: center; padding: 10px 16px; padding-bottom: calc(10px + var(--safe-bottom)); border-top: 1px solid var(--border); z-index: 100; }
.cart-footer .total { flex: 1; font-size: 14px; }
.cart-footer .total .price { color: var(--primary); font-size: 20px; font-weight: 700; }
.cart-footer .btn-checkout { background: var(--primary); color: white; padding: 10px 24px; border-radius: 6px; border: none; font-size: 15px; cursor: pointer; }
/* Order */
.order-card { background: white; margin: 10px; border-radius: 8px; overflow: hidden; }
.order-card .order-header { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--text-light); }
.order-card .order-status { color: var(--primary); font-weight: 500; }
.order-card .order-body { padding: 10px 14px; }
.order-card .order-item { display: flex; gap: 10px; margin-bottom: 8px; }
.order-card .order-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.order-card .order-item .item-info { flex: 1; }
.order-card .order-item .item-name { font-size: 13px; }
.order-card .order-item .item-price { color: var(--primary); font-size: 13px; }
.order-card .order-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; }
.order-card .order-actions { display: flex; gap: 8px; }
.order-card .order-actions button { padding: 6px 14px; border-radius: 4px; border: 1px solid var(--border); background: white; font-size: 12px; cursor: pointer; }
.order-card .order-actions .btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 4px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; outline: none; }
.form-group textarea { resize: vertical; min-height: 80px; }
.btn-submit { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 6px; font-size: 16px; font-weight: 500; cursor: pointer; }
/* Admin */
.admin-body { padding: 10px; }
.admin-sidebar { width: 60px; background: #2c2c2c; color: white; position: fixed; left: 0; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; padding-top: 20px; z-index: 100; }
.admin-sidebar .nav-item { padding: 12px 0; cursor: pointer; text-align: center; font-size: 11px; width: 100%; }
.admin-sidebar .nav-item.active { background: var(--primary); }
.admin-content { margin-left: 60px; padding: 16px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-header h2 { font-size: 18px; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: white; padding: 14px; border-radius: 8px; text-align: center; }
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.admin-table { width: 100%; background: white; border-radius: 8px; overflow: hidden; }
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.admin-table th { background: #fafafa; font-weight: 500; color: var(--text-light); }
.admin-form { background: white; padding: 20px; border-radius: 8px; max-width: 600px; }
/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 200; }
.modal.show { display: flex; }
.modal-content { background: white; border-radius: 12px; padding: 20px; width: 90%; max-width: 400px; max-height: 80vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }
/* Toast */
.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.75); color: white; padding: 10px 20px; border-radius: 6px; font-size: 14px; z-index: 300; display: none; }
/* Contact page */
.contact-card { background: white; margin: 16px; padding: 20px; border-radius: 8px; text-align: center; }
.contact-card .phone { font-size: 20px; color: var(--primary); font-weight: 600; margin: 10px 0; }
.contact-card .qrcode { width: 160px; height: 160px; margin: 12px auto; background: #f5f5f5; display: flex; align-items: center; justify-content: center; color: var(--text-light); font-size: 12px; border-radius: 8px; overflow: hidden; }
.contact-card .qrcode img { width: 100%; height: 100%; object-fit: contain; }
