/* ========== 好物展示 Web · 全局样式（移动端优先，移植自小程序） ========== */
:root {
  --red: #e1251b;
  --red-deep: #b71c1c;
  --red-light: #ff5a4e;
  --grad: linear-gradient(135deg, #ff6b5e 0%, #e1251b 60%, #c4141c 100%);
  --grad-soft: linear-gradient(135deg, #fff5f4 0%, #ffe9e7 100%);
  --text: #262626;
  --text-light: #999999;
  --price: #e1251b;
  --bg: #f5f5f5;
  --card: #ffffff;
  --shadow: 0 12px 40px rgba(225, 37, 27, 0.1);
  --shadow-sm: 0 6px 20px rgba(225, 37, 27, 0.06);
  --radius-lg: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  font-size: clamp(13px, 2.2vw, 16px); /* 字号随屏宽自适应，宽屏不再过大 */
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh; /* 移动端动态视口高度，避免地址栏伸缩导致跳动 */
  overflow-x: clip; /* 用 clip 而非 hidden，避免把 body 变成滚动容器导致滚动跳动 */
  line-height: 1.5;
}

/* ===== 按压动效 ===== */
.press { transform: scale(0.95); }
[data-press] { transition: transform 0.18s ease; }

/* ===== 卡片：宽屏下居中限宽，避免过宽 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  margin: 10px auto;
  padding: 14px;
  box-shadow: var(--shadow-sm);
  max-width: 1280px;
}
.glass {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 1280px;
  margin: 10px auto;
}

/* ===== 价格 ===== */
.price { color: var(--price); font-weight: 800; }
.price::before { content: '¥'; font-size: 0.8em; margin-right: 1px; }
.price.big { font-size: clamp(20px, 6.8vw, 26px); }

/* ===== 按钮 ===== */
.btn-primary {
  display: block;
  background: var(--grad);
  color: #fff;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 0;
  text-align: center;
  box-shadow: 0 10px 26px rgba(225, 37, 27, 0.35);
  transition: transform 0.18s ease;
  cursor: pointer;
  border: none;
  width: 100%;
}
.btn-primary:active { transform: scale(0.95); }
.btn-disabled { background: #d9d9d9; box-shadow: none; }

/* ===== 空状态 ===== */
.empty { text-align: center; color: var(--text-light); padding: 60px 0; font-size: 14px; }
.empty::before { content: '🛍️'; display: block; font-size: 40px; margin-bottom: 10px; }

/* ===== 工具类 ===== */
.flex { display: flex; align-items: center; }
.flex-1 { flex: 1; }
.text-ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* ===== 顶部导航栏 ===== */
.nav-bar {
  background: var(--grad);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-logo {
  width: clamp(28px, 8vw, 34px); height: clamp(28px, 8vw, 34px); border-radius: 50%;
  overflow: hidden; flex-shrink: 0; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.nav-logo img { width: 100%; height: 100%; object-fit: cover; }
.nav-title { flex: 1; text-align: left; padding-left: 12px; font-size: clamp(15px, 4.5vw, 17px); font-weight: 800; letter-spacing: 1px; }
.nav-back { color: #fff; font-size: clamp(18px, 5vw, 20px); cursor: pointer; padding: 0 8px; text-decoration: none; }

/* ===== 底部 Tab ===== */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 1280px; margin: 0 auto;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid #eee;
  display: flex;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; text-align: center; padding: 8px 0 6px;
  color: #999; font-size: clamp(10px, 2vw, 13px); text-decoration: none;
}
.tab-item .tab-icon { font-size: clamp(18px, 4vw, 22px); display: block; margin-bottom: 2px; }
.tab-item.active { color: var(--red); font-weight: 700; }

.page-wrap { padding-bottom: 70px; }

/* ===== 弹窗 ===== */
.mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  width: 80%;
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  padding: 28px 24px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  text-align: center;
}
.modal-title { font-size: 18px; font-weight: 800; }
.modal-sub { font-size: 13px; color: var(--text-light); margin-top: 6px; margin-bottom: 18px; }
.modal-save {
  margin-top: 16px; background: var(--grad); color: #fff;
  font-size: 15px; font-weight: 700; padding: 12px 0; border-radius: 24px;
  box-shadow: 0 10px 26px rgba(225, 37, 27, 0.35); cursor: pointer;
}
.modal-save.disabled { opacity: 0.6; }
.modal-skip { margin-top: 14px; font-size: 13px; color: var(--text-light); padding: 6px; cursor: pointer; }

/* ===== 区域/学校选择列表（全局美化，首页 + 我的页共用） ===== */
.region-list, .school-list { max-height: 300px; overflow-y: auto; text-align: left; }
.region-item, .school-item {
  display: flex; justify-content: space-between; align-items: center;
  background: #f7f7f9; border: 2px solid transparent;
  border-radius: 14px; padding: 15px 18px; margin-bottom: 10px;
  font-size: 15px; font-weight: 600; color: #333;
  cursor: pointer; transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.region-item:active, .school-item:active { transform: scale(0.97); }
.region-item .region-name { display: flex; align-items: center; gap: 10px; }
.region-item .region-emoji { font-size: 18px; }
.region-arrow { color: #c0c0c0; font-size: 18px; }
.school-item.active {
  background: #fff1f0; border-color: var(--red); color: var(--red); font-weight: 800;
  box-shadow: 0 4px 14px rgba(225,37,27,0.15);
}
.school-check { color: var(--red); font-weight: 800; font-size: 18px; }
.region-back {
  display: inline-flex; align-items: center; gap: 4px;
  text-align: left; font-size: 13px; color: var(--red); font-weight: 700;
  padding: 2px 2px 12px; cursor: pointer;
}

/* ===== 表单 ===== */
.field {
  background: #f5f5f5; border-radius: 8px; padding: 0 12px;
  font-size: 14px; margin-bottom: 10px; width: 100%;
  box-sizing: border-box; height: 46px; border: none; outline: none;
}
textarea.field { height: auto; padding: 12px; line-height: 1.6; }
.area-lg { min-height: 200px; }
.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }
.picker { display: flex; align-items: center; justify-content: space-between; color: #333; cursor: pointer; }

/* ===== 列表项 ===== */
.p-item {
  display: flex; background: #fff; border-radius: 12px; padding: 10px;
  margin-bottom: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
  align-items: center; cursor: pointer;
}
.p-img { width: 60px; height: 60px; border-radius: 8px; background: #f5f5f5; flex-shrink: 0; object-fit: cover; }
.p-info { flex: 1; margin-left: 10px; min-width: 0; }
.p-name { font-weight: 700; font-size: 14px; }
.p-meta { font-size: 12px; color: #999; margin-top: 4px; }
.p-status { font-size: 11px; margin-top: 4px; }
.p-status.on { color: #1a8f4c; }
.p-status.off { color: #bbb; }
.p-actions { display: flex; flex-direction: column; gap: 6px; margin-left: 8px; }
.act {
  font-size: 11px; color: #e1251b; border: 1px solid #ffd9d5;
  border-radius: 6px; padding: 4px 10px; text-align: center; cursor: pointer;
}
.act.danger { color: #c0392b; border-color: #f0c4c0; }

/* ===== Toast ===== */
#toast {
  position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 14px; z-index: 2000;
  display: none; max-width: 70%; text-align: center;
}

/* ===== 加载 ===== */
#loading {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.6); z-index: 1500;
  display: none; align-items: center; justify-content: center;
  font-size: 14px; color: #666;
}

/* ===== 响应式：小屏（≤360px） ===== */
@media (max-width: 360px) {
  .card { margin: 8px; padding: 12px; }
  .modal { width: 88%; padding: 24px 18px 18px; }
  .field { height: 42px; }
  .nav-bar { padding: 10px 12px; }
  .p-img { width: 52px; height: 52px; }
  .act { padding: 3px 8px; font-size: 10px; }
}

/* ===== 响应式：大屏（≥480px，如平板横屏） ===== */
@media (min-width: 480px) {
  body { font-size: 15px; }
  .card { margin: 12px; padding: 16px; }
}
