/* ==========================================================
   山野集 — 移动端 App 风格样式
   ========================================================== */

:root {
  --primary: #2e9e64;
  --primary-dark: #22804f;
  --primary-soft: #e9f7ef;
  --gold: #f0a020;
  --gold-soft: #fff7e6;

  --text: #1c1c1e;
  --text-2: #6b6b70;
  --text-3: #a3a3ab;
  --line: #efeff3;
  --bg: #f4f5f7;
  --card: #fff;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(20, 20, 30, .06);
  --shadow-lg: 0 8px 28px rgba(20, 20, 30, .12);

  --header-h: 48px;
  --filter-h: 48px;
  --tabbar-h: 56px;
  --app-w: 430px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: #e6e7eb;
  display: flex;
  justify-content: center;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- 手机外壳 ---------- */
.app {
  position: relative;
  width: 100%;
  max-width: var(--app-w);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  box-shadow: 0 0 60px rgba(0, 0, 0, .1);
  overflow-x: hidden;
}

/* ---------- 顶部标题栏 ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--card);
  padding-top: env(safe-area-inset-top);
}

.navbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
}

.navbar-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .3px;
}

.navbar-title.center { text-align: center; }

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--text);
  border-radius: 50%;
  transition: background .15s;
}
.icon-btn:active { background: var(--line); }
.icon-btn svg { width: 22px; height: 22px; }

/* 首页顶部：定位 + 搜索 + 消息 */
.home-top {
  background: linear-gradient(135deg, #46b878, var(--primary) 55%, #1f7a4d);
  padding: 8px 14px 18px;
  color: #fff;
}
.home-top .top-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
}
.location {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.location svg { width: 16px; height: 16px; }

.searchbar {
  flex: 1;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  background: rgba(255, 255, 255, .95);
  border-radius: 17px;
  color: var(--text-3);
  font-size: 13px;
}
.searchbar svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }

.home-top .icon-btn { color: #fff; }
.home-top .icon-btn:active { background: rgba(255, 255, 255, .18); }

/* ---------- 主体 ---------- */
.app-main {
  padding-bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom));
}

.section {
  margin: 12px 12px 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--gold));
}
.section-more {
  font-size: 12.5px;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 2px;
}
.section-more svg { width: 14px; height: 14px; }

/* ---------- 轮播 ---------- */
.banner {
  margin: 12px 12px 0;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--radius);
}
.banner::-webkit-scrollbar { display: none; }

.banner-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
  height: 150px;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.banner-item h3 { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.banner-item p { font-size: 12.5px; opacity: .9; margin-top: 4px; }
.banner-item .banner-tag {
  align-self: flex-start;
  margin-top: 12px;
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .25);
  border: 1px solid rgba(255, 255, 255, .5);
  backdrop-filter: blur(4px);
}
.banner-emoji {
  position: absolute;
  right: -6px;
  bottom: -14px;
  font-size: 100px;
  opacity: .35;
  transform: rotate(-12deg);
  pointer-events: none;
}
.banner-dots {
  display: flex;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}
.banner-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #d5d5dc;
  transition: all .25s;
}
.banner-dots i.on { width: 14px; background: var(--primary); }

/* ---------- 分类九宫格 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 8px;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.cat-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--primary-soft);
  transition: transform .15s;
}
.cat-item:active .cat-icon { transform: scale(.92); }

/* ---------- 限时抢购 ---------- */
.flash {
  background: linear-gradient(160deg, #f1fbf5, #fff);
  border: 1px solid #d7efe0;
}
.flash .countdown {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
}
.countdown b {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--text);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.flash-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.flash-row::-webkit-scrollbar { display: none; }
.flash-item { flex: 0 0 96px; }
.flash-item .thumb {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 40px;
}
.flash-item .name {
  font-size: 12.5px;
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flash-item .now { color: var(--primary); font-weight: 700; font-size: 13.5px; }
.flash-item .was { color: var(--text-3); font-size: 11px; text-decoration: line-through; margin-left: 3px; }

/* ---------- 商品卡片（双列） ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 12px 12px 0;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform .15s;
}
.product-card:active { transform: scale(.98); }

.product-thumb {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  font-size: 52px;
  position: relative;
}
.product-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(46, 158, 100, .92);
  color: #fff;
  font-weight: 500;
}
.product-info { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.product-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.tag-chip {
  font-size: 10.5px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 4px;
  padding: 1px 5px;
}
.product-bottom {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.price { color: var(--primary); font-weight: 700; font-size: 17px; }
.price i { font-style: normal; font-size: 11.5px; margin-right: 1px; }
.price .unit { font-size: 11px; font-weight: 400; color: var(--text-3); }
.sold { font-size: 11px; color: var(--text-3); }

/* ---------- 列表项（通用） ---------- */
.list {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-height: 56px;
  transition: background .15s;
}
.list-item:active { background: var(--bg); }
.list-item + .list-item { border-top: 1px solid var(--line); }
.list-icon {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--primary-soft);
}
.list-label { flex: 1; font-size: 14.5px; }
.list-value { font-size: 13px; color: var(--text-3); }
.list-arrow { width: 16px; height: 16px; color: #c8c8d0; flex: none; }

.list-group-title {
  font-size: 12.5px;
  color: var(--text-3);
  margin: 18px 18px 8px;
}

/* ---------- 标签页 ---------- */
.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--card);
  position: sticky;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  z-index: 30;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  transition: all .2s;
}
.tab.on {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 订单卡片 ---------- */
.order-card {
  margin: 12px 12px 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.order-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px;
  font-size: 13px;
}
.order-shop { font-weight: 600; flex: 1; display: flex; align-items: center; gap: 5px; }
.order-shop svg { width: 15px; height: 15px; color: var(--primary); }
.order-status { font-size: 12.5px; color: var(--primary); font-weight: 500; }
.order-status.gray { color: var(--text-3); }

.order-goods {
  display: flex;
  gap: 11px;
  padding: 0 14px 12px;
}
.order-thumb {
  width: 76px;
  height: 76px;
  flex: none;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 36px;
}
.order-goods-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.order-goods-name {
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-goods-spec { font-size: 12px; color: var(--text-3); }
.order-goods-price {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.order-goods-price .qty { font-size: 12.5px; color: var(--text-3); }

.order-total {
  padding: 0 14px 12px;
  text-align: right;
  font-size: 12.5px;
  color: var(--text-2);
}
.order-total b { color: var(--primary); font-size: 16px; margin-left: 3px; }

.order-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
.btn {
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--text-2);
  display: inline-grid;
  place-items: center;
  transition: transform .15s;
}
.btn:active { transform: scale(.95); }
.btn.primary {
  background: linear-gradient(135deg, #46b878, var(--primary));
  color: #fff;
  border-color: transparent;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(46, 158, 100, .28);
}

/* ---------- 我的：头部 ---------- */
.profile-hero {
  background: linear-gradient(135deg, #4dc086, var(--primary) 50%, #1c6f47);
  padding: calc(8px + env(safe-area-inset-top)) 18px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-bar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
}
.hero-bar h1 {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
  opacity: .92;
}
.hero-bar .icon-btn:active { background: rgba(255, 255, 255, .18); }
.profile-hero::after {
  content: "";
  position: absolute;
  right: -50px;
  top: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}
.profile-user { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.avatar {
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  display: grid;
  place-items: center;
  font-size: 32px;
  border: 2px solid rgba(255, 255, 255, .6);
}
.profile-name { display: flex; align-items: center; gap: 7px; font-size: 18px; font-weight: 600; }
.level-badge {
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe08a, #f0a020);
  color: #7a4a00;
}
.profile-desc { font-size: 12.5px; opacity: .85; margin-top: 4px; }

.profile-stats {
  display: flex;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}
.profile-stats div {
  flex: 1;
  text-align: center;
}
.profile-stats b { display: block; font-size: 17px; font-weight: 700; }
.profile-stats span { font-size: 11.5px; opacity: .82; }

/* ---------- 卡片右上角"全部" ---------- */
.card {
  margin: 12px 12px 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.order-shortcut {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 14px;
}
.order-shortcut a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-2);
  position: relative;
}
.order-shortcut .ico { font-size: 22px; line-height: 1; }
.badge-dot {
  position: absolute;
  top: -4px;
  right: 50%;
  margin-right: -22px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  display: grid;
  place-items: center;
  font-weight: 500;
}

/* 服务九宫格 */
.service-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px 6px;
  margin-top: 4px;
}
.service-grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--text-2);
}
.service-grid .ico {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: var(--bg);
}

/* ---------- 分类页：筛选 ---------- */
.filter-bar {
  height: var(--filter-h);
  padding: 0 14px 8px;
  background: var(--card);
  display: flex;
  align-items: center;
}
.segmented {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg);
  border-radius: 999px;
}
.segmented button {
  flex: 1;
  height: 30px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--text-2);
  transition: all .2s;
}
.segmented button.on {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 6px rgba(20, 20, 30, .1);
}

.chips {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: calc(var(--header-h) + var(--filter-h) + env(safe-area-inset-top));
  z-index: 30;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  background: var(--bg);
  white-space: nowrap;
  transition: all .2s;
}
.chip.on {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* ---------- 分类页：商品行 ---------- */
.result-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.product-list {
  padding: 12px 12px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.product-row {
  display: flex;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.product-row:active { transform: scale(.985); }
.row-thumb {
  width: 96px;
  height: 96px;
  flex: none;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 42px;
  position: relative;
}
.row-region {
  position: absolute;
  left: 6px;
  bottom: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  color: var(--text-2);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(4px);
}
.row-info { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.row-name {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-desc { font-size: 12px; color: var(--text-3); }
.row-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.add-btn {
  height: 28px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, #46b878, var(--primary));
  box-shadow: 0 3px 10px rgba(46, 158, 100, .3);
  transition: transform .15s;
}
.add-btn:active { transform: scale(.94); }

/* ---------- 空状态 ---------- */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty .emoji { font-size: 54px; opacity: .55; }
.empty p { margin-top: 12px; font-size: 13.5px; }
.empty .btn { margin-top: 18px; }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--app-w);
  z-index: 50;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  color: var(--text-3);
  transition: color .18s;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--primary); font-weight: 500; }
.tabbar a:active svg { transform: scale(.9); }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translate(-50%, 10px);
  background: rgba(28, 28, 30, .88);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 桌面端：更像手机 ---------- */
@media (min-width: 700px) {
  body { padding: 0; }
  .app { min-height: 100dvh; }
}
