* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #faf6f0;
  color: #333;
  min-height: 100vh;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, #c0392b 0%, #922b21 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-logo { font-size: 1.5rem; font-weight: 700; letter-spacing: 2px; }
.header-info { flex: 1; font-size: .8rem; opacity: .9; line-height: 1.6; }
.cart-btn {
  background: #fff; color: #c0392b; border: none;
  border-radius: 24px; padding: 8px 18px;
  font-size: .95rem; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; transition: transform .15s;
}
.cart-btn:active { transform: scale(.95); }
.cart-count {
  background: #c0392b; color: #fff; border-radius: 50%;
  width: 20px; height: 20px; font-size: .75rem;
  display: flex; align-items: center; justify-content: center;
}

/* ── Shop banner ── */
.shop-banner { max-width: 900px; margin: 0 auto; padding: 16px; }
.shop-banner img {
  width: 100%; max-height: 200px; object-fit: cover;
  border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

/* ── Category tabs ── */
.category-tabs {
  max-width: 900px; margin: 0 auto;
  padding: 0 16px 12px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.cat-tab {
  padding: 5px 14px; border-radius: 20px;
  border: 1.5px solid #c0392b; background: #fff;
  color: #c0392b; font-size: .85rem; cursor: pointer; transition: all .2s;
}
.cat-tab.active, .cat-tab:hover { background: #c0392b; color: #fff; }

/* ── Products ── */
.products-wrap { max-width: 900px; margin: 0 auto; padding: 0 16px 120px; }
.category-section { margin-bottom: 24px; }
.category-title {
  font-size: 1.05rem; font-weight: 700; color: #922b21;
  padding: 8px 0 10px; border-bottom: 2px solid #f5c6c0; margin-bottom: 12px;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.product-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
  overflow: hidden; display: flex; flex-direction: column;
  transition: box-shadow .2s;
}
.product-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.13); }

/* Product image */
.product-img-wrap {
  position: relative; cursor: pointer; flex-shrink: 0;
  height: 140px; overflow: hidden;
}
.product-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .3s;
}
.product-img-wrap:hover .product-img { transform: scale(1.06); }
.img-badge {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,.55); color: #fff;
  border-radius: 10px; padding: 2px 7px; font-size: .72rem;
}

.product-info { padding: 12px 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.product-name { font-size: .95rem; font-weight: 600; line-height: 1.4; }
.product-unit { font-size: .78rem; color: #888; }
.product-price { font-size: 1.05rem; font-weight: 700; color: #c0392b; }
.product-price span { font-size: .75rem; }
.product-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid #c0392b; background: #fff; color: #c0392b;
  font-size: 1.1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.qty-btn:hover { background: #c0392b; color: #fff; }
.qty-display { min-width: 24px; text-align: center; font-weight: 600; font-size: .95rem; }
.add-btn {
  flex: 1; background: #c0392b; color: #fff; border: none;
  border-radius: 6px; padding: 6px 10px; font-size: .85rem;
  cursor: pointer; transition: background .15s;
}
.add-btn:hover { background: #922b21; }

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
}
.lb-img-wrap { position: relative; max-width: 90vw; }
.lb-img { max-width: 90vw; max-height: 82vh; object-fit: contain; display: block; border-radius: 4px; }
.lb-counter { text-align: center; color: rgba(255,255,255,.65); font-size: .85rem; margin-top: 8px; }
.lb-close {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,.2); border: none; border-radius: 50%;
  width: 36px; height: 36px; color: #fff; font-size: 1.1rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lb-prev, .lb-next {
  background: rgba(255,255,255,.15); border: none; border-radius: 50%;
  width: 44px; height: 44px; color: #fff; font-size: 1.8rem; line-height: 1;
  cursor: pointer; margin: 0 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,.3); }

/* ── Cart drawer ── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; display: none; opacity: 0; transition: opacity .3s;
}
.overlay.show { display: block; opacity: 1; }
.drawer {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-radius: 18px 18px 0 0;
  z-index: 201; transform: translateY(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  max-height: 80vh; display: flex; flex-direction: column;
}
.drawer.show { transform: translateY(0); }
.drawer-header {
  padding: 16px 20px 12px; border-bottom: 1px solid #f0e8e8;
  display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;
}
.drawer-title { font-size: 1.05rem; font-weight: 700; }
.close-btn { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #888; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f5f0f0;
}
.cart-item-name { flex: 1; font-size: .92rem; font-weight: 600; }
.cart-item-unit { font-size: .75rem; color: #888; }
.cart-item-price { color: #c0392b; font-weight: 600; font-size: .9rem; min-width: 60px; text-align: right; }
.cart-footer { padding: 14px 20px 20px; border-top: 1px solid #f0e8e8; flex-shrink: 0; }
.cart-total { display: flex; justify-content: space-between; font-size: 1rem; font-weight: 700; margin-bottom: 12px; }
.cart-total-price { color: #c0392b; font-size: 1.2rem; }
.checkout-btn {
  width: 100%; background: #c0392b; color: #fff; border: none;
  border-radius: 10px; padding: 13px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.checkout-btn:hover { background: #922b21; }
.empty-cart { text-align: center; color: #aaa; padding: 40px 0; font-size: .95rem; }

/* ── Order modal ── */
.modal {
  position: fixed; inset: 0; z-index: 300;
  display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal.show { display: flex; }
.modal-box {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  padding: 24px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 8px 40px rgba(0,0,0,.2);
}
.modal-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 18px; color: #922b21; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .85rem; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-label .required { color: #c0392b; }
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1.5px solid #ddd; border-radius: 8px;
  padding: 10px 12px; font-size: .95rem; font-family: inherit;
  transition: border-color .2s; background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #c0392b; }
.form-textarea { resize: vertical; min-height: 72px; }
.radio-group { display: flex; gap: 12px; }
.radio-label {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: .9rem; padding: 8px 14px; border: 1.5px solid #ddd;
  border-radius: 8px; transition: all .2s; flex: 1; justify-content: center;
}
.radio-label:has(input:checked) { border-color: #c0392b; background: #fdf0ef; color: #c0392b; font-weight: 600; }
.radio-label input { display: none; }
.order-summary { background: #fdf6f5; border-radius: 8px; padding: 12px; margin-bottom: 14px; font-size: .85rem; }
.order-summary-row { display: flex; justify-content: space-between; padding: 3px 0; color: #555; }
.order-summary-total {
  display: flex; justify-content: space-between; font-weight: 700;
  font-size: .95rem; border-top: 1px solid #f0e0e0;
  margin-top: 6px; padding-top: 6px; color: #922b21;
}
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn-cancel { flex: 1; background: #f5f5f5; border: none; border-radius: 8px; padding: 12px; font-size: .95rem; cursor: pointer; }
.btn-submit { flex: 2; background: #c0392b; color: #fff; border: none; border-radius: 8px; padding: 12px; font-size: .95rem; font-weight: 700; cursor: pointer; }
.btn-submit:hover { background: #922b21; }

/* ── Success modal ── */
.success-box { text-align: center; padding: 10px 0; }
.success-icon { font-size: 3rem; margin-bottom: 12px; }
.success-title { font-size: 1.2rem; font-weight: 700; color: #27ae60; margin-bottom: 8px; }
.success-msg { color: #666; font-size: .9rem; line-height: 1.6; }
.success-order-no { font-weight: 700; color: #c0392b; }
.success-key { font-weight: 700; color: #2980b9; font-size: 1.1rem; }

/* ── Toast ── */
.toast {
  position: fixed; top: 70px; left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #333; color: #fff; padding: 10px 20px;
  border-radius: 8px; font-size: .9rem; z-index: 999;
  opacity: 0; transition: all .3s; pointer-events: none; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loading { text-align: center; padding: 60px 0; color: #aaa; font-size: .95rem; }

@media (max-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
  .header-logo { font-size: 1.2rem; }
}
