/* =============================================================
   越南校园海淘 PWA · 基础样式
   设计取向：移动优先、单手可达、弱网友好（无外部字体/图标库依赖）
   主色 #e2483c —— 中越两国都偏好的喜庆红
   ============================================================= */

:root {
  --c-main:      #e2483c;
  --c-main-dark: #c93a2f;
  --c-main-soft: #fdeceb;
  --c-gold:      #f0a020;
  --c-green:     #3aa76d;
  --c-text:      #2c3345;
  --c-sub:       #6b7488;
  --c-light:     #9aa4b8;
  --c-line:      #eef1f5;
  --c-bg:        #f4f6f9;
  --r:           12px;
  --safe-b:      env(safe-area-inset-bottom, 0px);
  --tabbar-h:    56px;
}

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

html, body {
  height: 100%;
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; border: 0; }
input, button, select, textarea { font-family: inherit; font-size: inherit; outline: none; border: 0; background: none; color: inherit; }
button { cursor: pointer; }
ul, ol { list-style: none; }

/* ---------- 应用骨架 ---------- */
#app {
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
}

.page { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- 顶部栏 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 90;
  height: 48px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--c-main); color: #fff;
  box-shadow: 0 1px 6px rgba(226, 72, 60, .25);
}
.navbar .title { font-size: 16px; font-weight: 600; flex: 1; text-align: center; }
.navbar .back, .navbar .act { width: 30px; font-size: 19px; text-align: center; }

/* 搜索型顶部栏 */
.navbar.search-bar { background: var(--c-main); }
.navbar .search {
  flex: 1; height: 32px; border-radius: 16px;
  background: rgba(255,255,255,.92); color: var(--c-light);
  display: flex; align-items: center; padding: 0 13px; font-size: 13px; gap: 6px;
}

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: #fff;
  border-top: 1px solid var(--c-line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--c-light); font-size: 10.5px; position: relative;
}
.tabbar a .ic { font-size: 20px; line-height: 1; }
.tabbar a.on { color: var(--c-main); font-weight: 600; }
.tabbar a .dot {
  position: absolute; top: 6px; left: 50%; margin-left: 6px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--c-main); color: #fff; font-size: 10px; line-height: 15px; text-align: center;
}

/* ---------- 通用块 ---------- */
.sec { margin: 10px; background: #fff; border-radius: var(--r); overflow: hidden; }
.sec-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 9px; font-size: 15px; font-weight: 600;
}
.sec-hd .more { font-size: 12px; color: var(--c-light); font-weight: 400; }
.sec-bd { padding: 0 14px 14px; }
.sec-bd.tight { padding: 0; }

.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.muted { color: var(--c-sub); }
.light { color: var(--c-light); }
.small { font-size: 12px; }
.tiny  { font-size: 11px; }
.bold  { font-weight: 600; }
.center{ text-align: center; }

/* ---------- 价格 ---------- */
.price { color: var(--c-main); font-weight: 700; }
.price .cur { font-size: 11px; margin-right: 1px; }
.price .int { font-size: 17px; }
.price-vnd { color: var(--c-sub); font-size: 11px; }
.price-old { color: var(--c-light); font-size: 11.5px; text-decoration: line-through; margin-left: 5px; }

/* ---------- 标签 ---------- */
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  font-size: 10.5px; line-height: 16px; vertical-align: middle;
}
.tag-main  { background: var(--c-main-soft); color: var(--c-main); }
.tag-gold  { background: #fef4e4; color: #b57a10; }
.tag-green { background: #e8f6ee; color: var(--c-green); }
.tag-gray  { background: #f1f3f6; color: var(--c-sub); }
.tag-solid { background: var(--c-main); color: #fff; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 42px; padding: 0 20px; border-radius: 21px;
  background: var(--c-main); color: #fff; font-size: 15px; font-weight: 600;
  transition: .15s;
}
.btn:active { background: var(--c-main-dark); transform: scale(.985); }
.btn.block { display: flex; width: 100%; }
.btn.line  { background: #fff; color: var(--c-main); border: 1px solid var(--c-main); }
.btn.gray  { background: #f1f3f6; color: var(--c-sub); }
.btn.sm    { height: 30px; padding: 0 13px; font-size: 12.5px; border-radius: 15px; font-weight: 500; }
.btn.gold  { background: linear-gradient(96deg, #f7c86a, var(--c-gold)); }
.btn[disabled] { background: #d3d8e0; color: #fff; pointer-events: none; }

/* ---------- 商品网格 ---------- */
.goods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 0 10px; }
.goods {
  background: #fff; border-radius: var(--r); overflow: hidden;
}
.goods .pic { width: 100%; aspect-ratio: 1; background: #f1f3f6 center/cover no-repeat; position: relative; }
.goods .pic .corner {
  position: absolute; left: 0; top: 0;
  background: var(--c-main); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 0 0 8px 0;
}
.goods .info { padding: 8px 9px 10px; }
.goods .nm { font-size: 13px; line-height: 1.4; height: 36px; margin-bottom: 5px; }
.goods .earn {
  margin-top: 5px; font-size: 11px; color: #b57a10;
  background: #fef4e4; border-radius: 4px; padding: 2px 6px; display: inline-block;
}

/* 横向商品条目 */
.goods-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--c-line); background: #fff; }
.goods-row:last-child { border-bottom: 0; }
.goods-row .pic { width: 78px; height: 78px; border-radius: 8px; background: #f1f3f6 center/cover no-repeat; flex: none; }
.goods-row .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 分类横滑 ---------- */
.cat-scroll { display: flex; gap: 16px; overflow-x: auto; padding: 14px; scrollbar-width: none; }
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-scroll .item { flex: none; text-align: center; width: 52px; font-size: 11.5px; color: var(--c-sub); }
.cat-scroll .item .ic {
  width: 46px; height: 46px; margin: 0 auto 5px; border-radius: 50%;
  background: var(--c-main-soft); display: flex; align-items: center; justify-content: center; font-size: 21px;
}

/* ---------- 合伙人横幅 ---------- */
.partner-banner {
  margin: 10px; padding: 15px 16px; border-radius: var(--r);
  background: linear-gradient(102deg, #3a3f52, #23283a);
  color: #f0d9a8; position: relative; overflow: hidden;
}
.partner-banner::after {
  content: ''; position: absolute; right: -28px; top: -28px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(240,160,32,.28), transparent 70%);
}
.partner-banner .t { font-size: 15.5px; font-weight: 700; color: #f7dfae; }
.partner-banner .d { font-size: 12px; margin-top: 3px; color: #bcb098; }
.partner-banner .price-line { margin-top: 9px; display: flex; align-items: baseline; gap: 7px; }
.partner-banner .now { font-size: 23px; font-weight: 700; color: var(--c-gold); }
.partner-banner .was { font-size: 12px; text-decoration: line-through; color: #857b6c; }
.partner-banner .btn { position: absolute; right: 15px; bottom: 15px; height: 32px; font-size: 13px; }

/* ---------- 表单 ---------- */
.field { display: flex; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--c-line); background: #fff; gap: 12px; }
.field:last-child { border-bottom: 0; }
.field label { width: 78px; flex: none; color: var(--c-sub); font-size: 13.5px; }
.field input, .field select, .field textarea { flex: 1; font-size: 14px; }
.field .unit { color: var(--c-light); font-size: 13px; }

/* ---------- 单元格列表 ---------- */
.cells { background: #fff; }
.cell { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid var(--c-line); }
.cell:last-child { border-bottom: 0; }
.cell .ic { width: 22px; text-align: center; font-size: 17px; }
.cell .tx { flex: 1; font-size: 14.5px; }
.cell .val { color: var(--c-light); font-size: 13px; }
.cell .arrow { color: #cdd3dd; font-size: 15px; }

/* ---------- 九宫格 ---------- */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; }
.grid4 .item { padding: 15px 4px; text-align: center; font-size: 11.5px; color: var(--c-sub); }
.grid4 .item .ic { font-size: 21px; margin-bottom: 5px; }
.grid4 .item .n { font-size: 16px; font-weight: 700; color: var(--c-text); }

/* ---------- 数据条 ---------- */
.stat-row { display: flex; background: #fff; }
.stat-row .it { flex: 1; text-align: center; padding: 14px 4px; }
.stat-row .it .n { font-size: 18px; font-weight: 700; }
.stat-row .it .l { font-size: 11.5px; color: var(--c-light); margin-top: 2px; }

/* ---------- 空态 / 加载 ---------- */
.empty { padding: 60px 20px; text-align: center; color: var(--c-light); }
.empty .ic { font-size: 46px; opacity: .35; margin-bottom: 12px; }
.empty .tx { font-size: 13.5px; }

.loading { padding: 40px; text-align: center; color: var(--c-light); font-size: 13px; }
.spinner {
  width: 22px; height: 22px; margin: 0 auto 10px;
  border: 2px solid var(--c-line); border-top-color: var(--c-main);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, #f0f2f5 25%, #e6e9ee 37%, #f0f2f5 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 6px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%);
  background: rgba(30, 34, 44, .9); color: #fff;
  padding: 11px 20px; border-radius: 8px; font-size: 13.5px; z-index: 9999;
  max-width: 78%; text-align: center; animation: fade .2s;
}

/* ---------- 底部操作条 ---------- */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 96;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: #fff; border-top: 1px solid var(--c-line);
  display: flex; align-items: center; gap: 10px;
}

/* ---------- 离线提示 ---------- */
.offline-bar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 200;
  background: #4a5062; color: #fff; text-align: center;
  font-size: 12px; padding: 6px;
}

/* ---------- 语言切换 ---------- */
.lang-switch { display: flex; gap: 4px; font-size: 11px; }
.lang-switch button { padding: 2px 7px; border-radius: 9px; background: rgba(255,255,255,.22); color: #fff; }
.lang-switch button.on { background: #fff; color: var(--c-main); font-weight: 600; }

/* ---------- 建设中 ---------- */
.wip { padding: 50px 24px; text-align: center; }
.wip .ic { font-size: 44px; margin-bottom: 14px; }
.wip .t { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.wip .d { font-size: 13px; color: var(--c-light); line-height: 1.8; }

/* =============================================================
   首页新版 · 参考 Bách Phái 风格
   ============================================================= */

:root {
  --c-orange: #ff6a00;
  --c-orange-soft: #fff0e6;
  --c-pink: #ff7b8a;
  --c-purple: #9b6cff;
}

.home-header {
  position: sticky; top: 0; z-index: 95;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: #fff;
}
.home-header .menu,
.home-header .action {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #1f2937;
}
.home-header .logo { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.home-header .logo img { height: 34px; width: auto; }
.home-header .logo .slogan { margin-top: 2px; font-size: 11px; line-height: 1.25; color: #6b7280; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.home-header .actions { display: flex; align-items: center; gap: 4px; }
.home-header .action { position: relative; }
.home-header .action .dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px;
  background: var(--c-main); color: #fff; font-size: 10px; line-height: 15px; text-align: center;
}

.home-search {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px 10px;
  background: #fff;
}
.home-search .search-box {
  flex: 1; height: 38px; border-radius: 19px;
  background: #f4f6f9; color: var(--c-sub);
  display: flex; align-items: center; padding: 0 13px; font-size: 13.5px; gap: 8px;
}
.home-search .lang { display: flex; align-items: center; gap: 5px; }
.home-search .lang button {
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 12px; font-weight: 600; color: var(--c-sub); background: #f4f6f9;
}
.home-search .lang button.on { background: var(--c-main); color: #fff; }

.home-page { background: #f6f7f9; padding-bottom: 10px; }
.home-sec { margin: 10px 12px; background: #fff; border-radius: 14px; overflow: hidden; }

.banner-carousel { margin: 0 12px 10px; border-radius: 14px; overflow: hidden; position: relative; }
.banner-carousel .track { display: flex; transition: transform .3s ease; touch-action: pan-y; }
.banner-carousel .track > a { flex: 0 0 100%; width: 100%; min-width: 100%; display: block; }
.banner-carousel .track img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.banner-carousel .dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.banner-carousel .dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); }
.banner-carousel .dots span.on { background: #fff; width: 12px; border-radius: 3px; }

.cat-row {
  display: flex; justify-content: space-around; align-items: flex-start;
  padding: 14px 8px;
}
.cat-row .item { text-align: center; width: 58px; flex: none; }
.cat-row .item .ic {
  width: 52px; height: 52px; margin: 0 auto 7px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; overflow: hidden; background: #f4f6f9;
}
.cat-row .item .ic img { width: 100%; height: 100%; object-fit: cover; }
.cat-row .item .n { font-size: 11.5px; color: #444; }

.promo-banner {
  margin: 10px 12px; border-radius: 14px;
  background: linear-gradient(100deg, #ffe3e6, #ffd1d7 60%, #ffb8c1);
  padding: 14px 16px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between;
}
.promo-banner .txt .t { font-size: 15.5px; font-weight: 800; color: #b00020; line-height: 1.35; }
.promo-banner .txt .d { font-size: 11px; color: #6b1a2a; margin-top: 5px; }
.promo-banner .badge {
  background: #ff4d62; color: #fff; border-radius: 12px;
  padding: 10px 16px; text-align: center; font-weight: 800;
}
.promo-banner .badge .big { font-size: 24px; line-height: 1; }
.promo-banner .badge .small { font-size: 10px; opacity: .95; }

.trend-row { display: flex; gap: 10px; margin: 10px 12px; }
.trend-row .card {
  flex: 1; border-radius: 14px; padding: 13px 12px; min-height: 110px;
  position: relative; overflow: hidden; color: #fff;
}
.trend-row .card.hot { background: linear-gradient(135deg, #ff9a3d, #ff6a00); }
.trend-row .card.fashion { background: linear-gradient(135deg, #c084fc, #9b6cff); }
.trend-row .card .t { font-size: 15px; font-weight: 800; }
.trend-row .card .d { font-size: 11px; opacity: .9; margin-top: 3px; }
.trend-row .card .arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.trend-row .card .pics {
  position: absolute; right: 10px; bottom: 8px;
  display: flex; gap: 4px;
}
.trend-row .card .pics img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: rgba(255,255,255,.3); }

.rec-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 12px 8px;
}
.rec-header .l { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; color: #1f2937; }
.rec-header .l .fire { font-size: 18px; }
.rec-header .more { font-size: 12px; color: var(--c-sub); }

.rec-scroll { display: flex; gap: 10px; overflow-x: auto; padding: 0 12px 14px; scrollbar-width: none; }
.rec-scroll::-webkit-scrollbar { display: none; }
.rec-card {
  flex: none; width: 140px; background: #fff; border-radius: 12px; overflow: hidden;
  position: relative;
}
.rec-card .pic { width: 140px; height: 140px; background: #f1f3f6 center/cover no-repeat; position: relative; }
.rec-card .heart {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 50%; background: rgba(255,255,255,.9); color: var(--c-light);
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.rec-card .info { padding: 8px; }
.rec-card .nm { font-size: 12.5px; line-height: 1.35; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rec-card .price { margin-top: 5px; color: var(--c-main); font-weight: 700; font-size: 13px; }
.rec-card .price .cur { font-size: 10px; margin-right: 1px; }

.tabbar { box-shadow: 0 -1px 8px rgba(0,0,0,.05); }
