/* 广府鲜骨渔粉 H5点餐端（模拟微信小程序） */
:root {
  --brand: #C8402F;
  --brand-dark: #A93323;
  --gold: #F5A623;
  --bg: #F5F5F7;
  --card: #fff;
  --text: #22242A;
  --muted: #8A8E99;
  --line: #EEF0F3;
  --green: #07C160;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #E9EAEE; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--text); }

/* 桌面端手机壳 */
#phone {
  max-width: 428px; height: 100vh; margin: 0 auto; background: var(--bg);
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
@media (min-width: 500px) {
  body { display: flex; align-items: center; justify-content: center; }
  #phone { height: min(880px, 94vh); border-radius: 28px; box-shadow: 0 24px 60px rgba(0,0,0,.25); border: 6px solid #1b1d22; }
}
#app { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.hidden { display: none !important; }
button { font-family: inherit; border: none; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------- 顶部品牌栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand), #E05A3F); color: #fff;
  padding: 14px 16px 12px; flex-shrink: 0; position: relative;
}
.topbar .brand-line { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .92; }
.topbar .brand-line .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.topbar h1 { font-size: 17px; margin-top: 4px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.table-chip {
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.4);
  padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.topbar .actions { position: absolute; right: 14px; top: 34px; display: flex; gap: 8px; }
.topbar .actions button {
  background: rgba(255,255,255,.25); color: #fff; font-size: 13px;
  padding: 7px 15px; border-radius: 18px; min-height: 32px; line-height: 1;
}

/* ---------- 二级页顶栏（标题绝对居中） ---------- */
.back-header {
  display: flex; align-items: center; justify-content: center; position: relative;
  padding: 14px; background: #fff; border-bottom: 1px solid var(--line);
  font-size: 17px; font-weight: 600; flex-shrink: 0; min-height: 56px;
}
.back-header button {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  background: none; font-size: 20px; color: #333; padding: 0 12px;
  min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center;
}

/* ---------- 门店定位页 ---------- */
.view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.locate-wrap { padding: 16px; }
.demo-banner {
  background: linear-gradient(120deg, #FFF7E8, #FFF1F0); border: 1px dashed var(--gold);
  border-radius: 12px; padding: 12px; font-size: 12.5px; color: #7A5A1E; line-height: 1.7; margin-bottom: 14px;
}
.demo-banner b { color: var(--brand); }
.scan-btn {
  width: 100%; margin-top: 8px; background: var(--brand); color: #fff; border-radius: 10px;
  padding: 11px; font-size: 14px; font-weight: 600;
}
.section-title { font-size: 13px; color: var(--muted); margin: 16px 2px 10px; display: flex; align-items: center; gap: 6px; }
.store-card {
  background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); cursor: pointer;
}
.store-card.active { outline: 2px solid var(--brand); }
.store-card h3 { font-size: 15px; margin-bottom: 4px; }
.store-card .addr { font-size: 12px; color: var(--muted); line-height: 1.5; }
.store-card .dist { font-size: 12px; color: var(--brand); white-space: nowrap; font-weight: 600; }
.store-card .go { background: var(--brand); color: #fff; border-radius: 16px; padding: 6px 14px; font-size: 13px; flex-shrink: 0; }
.store-card .status-tag { font-size: 11px; padding: 1px 8px; border-radius: 10px; background: #E8F8EE; color: var(--green); margin-left: 6px; }
.store-card .status-tag.closed { background: #F5F5F7; color: var(--muted); }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 菜单页 ---------- */
.menu-wrap { flex: 1; display: flex; overflow: hidden; }
.cats { width: 92px; overflow-y: auto; background: #F0F1F4; flex-shrink: 0; }
.cats .cat {
  padding: 14px 8px; font-size: 13px; color: #555963; text-align: center; position: relative;
  border-left: 3px solid transparent; cursor: pointer;
}
.cats .cat.active { background: #fff; color: var(--brand); font-weight: 600; border-left-color: var(--brand); }
.dishes { flex: 1; overflow-y: auto; padding: 12px; }
.dishes .group-title { font-size: 14px; font-weight: 700; margin: 4px 0 10px; color: #33353C; }
.dish-card { background: #fff; border-radius: 12px; padding: 10px; margin-bottom: 10px; display: flex; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.dish-emoji {
  width: 64px; height: 64px; border-radius: 10px; background: linear-gradient(135deg, #FDF3EC, #FBE9D7);
  display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0;
}
.dish-photo {
  width: 76px; height: 76px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: #F2F3F6;
}
.dish-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-info .name { font-size: 15px; font-weight: 600; }
.dish-info .desc { font-size: 11.5px; color: var(--muted); margin: 4px 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dish-info .spec-row { font-size: 11px; color: #B0742E; background: #FBF4E7; border-radius: 4px; display: inline-block; padding: 1px 6px; margin-bottom: 4px; width: fit-content; }
.dish-bottom { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.price { color: var(--brand); font-weight: 700; font-size: 16px; }
.price::before { content: '¥'; font-size: 11px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper .btn {
  width: 24px; height: 24px; border-radius: 50%; font-size: 17px; line-height: 1;
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.stepper .add { background: var(--brand); color: #fff; }
.stepper .dec { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.stepper .qty { font-size: 14px; font-weight: 600; min-width: 16px; text-align: center; }
.qty-badge { position: relative; }
.qty-badge::after {
  content: attr(data-n); position: absolute; top: -5px; right: -7px; background: var(--brand); color: #fff;
  border-radius: 16px; font-size: 10px; padding: 0 4px; min-width: 14px; text-align: center; line-height: 14px;
}

/* ---------- 底部购物车栏 ---------- */
.cart-bar { flex-shrink: 0; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,.06); }
.cart-inner { display: flex; align-items: center; gap: 12px; }
.cart-icon {
  width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #E0684B);
  color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center; position: relative;
}
.cart-count { position: absolute; top: -4px; right: -4px; background: var(--gold); color: #fff; font-size: 11px; border-radius: 16px; padding: 0 5px; line-height: 16px; }
.cart-total { flex: 1; font-weight: 700; color: var(--brand); font-size: 18px; }
.cart-total small { font-size: 11px; color: var(--muted); font-weight: 400; display: block; }
.cart-go {
  background: linear-gradient(135deg, var(--gold), #FFB93C); color: #5B3A00; font-weight: 700;
  border-radius: 24px; padding: 12px 24px; font-size: 15px; min-height: 48px;
}
.cart-go:disabled { background: #D9DBE0; color: #9AA0AA; }

/* ---------- 弹层 / 规格选择 / 支付 ---------- */
#sheet-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 30; }
#sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); z-index: 31; max-height: 72%; overflow-y: auto;
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
#sheet h3 { font-size: 16px; margin-bottom: 12px; }
.spec-item {
  display: inline-block; padding: 7px 16px; border-radius: 18px; margin: 0 8px 10px 0; font-size: 13px;
  background: #F2F3F6; color: #444; cursor: pointer;
}
.spec-item.sel { background: #FDECE8; color: var(--brand); font-weight: 600; outline: 1px solid var(--brand); }
.primary-btn {
  width: 100%; background: var(--brand); color: #fff; border-radius: 24px;
  padding: 13px; font-size: 15px; font-weight: 600; margin-top: 10px; min-height: 48px;
}
.ghost-btn { width: 100%; background: #F2F3F6; color: #555; border-radius: 24px; padding: 12px; font-size: 14px; margin-top: 10px; min-height: 44px; }

.cart-sheet-line { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; }
.cart-sheet-line .nm { font-size: 14px; flex: 1; }
.cart-sheet-line .nm small { color: var(--muted); display: block; font-size: 11px; }

/* 支付弹窗 */
.pay-sheet { text-align: center; }
.pay-sheet .amt { font-size: 40px; font-weight: 800; color: var(--text); margin: 10px 0 2px; }
.pay-sheet .amt::before { content: '¥'; font-size: 20px; font-weight: 600; }
.pay-sheet .pay-brand { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.pay-sheet .wx-logo { width: 44px; height: 44px; margin: 0 auto; border-radius: 10px; background: var(--green); color: #fff; font-size: 24px; display: flex; align-items: center; justify-content: center; }
.paid-ok { font-size: 52px; margin: 16px 0 6px; }

/* ---------- 确认订单 / 状态页 ---------- */
.form-card { background: #fff; border-radius: 14px; padding: 14px; margin: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.form-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: none; }
.form-row .lab { color: var(--muted); width: 76px; flex-shrink: 0; }
.form-row .val { flex: 1; text-align: right; }
.form-row input[type=text] { border: none; outline: none; text-align: right; width: 100%; font-size: 14px; }
.table-sel { display: flex; flex-wrap: wrap; gap: 8px; }
.table-sel .t {
  padding: 9px 15px; border-radius: 9px; background: #F2F3F6; font-size: 13px; cursor: pointer;
  min-height: 30px; display: inline-flex; align-items: center;
}
.table-sel .t.sel { background: var(--brand); color: #fff; font-weight: 600; }
.confirm-items .form-row .val { display: flex; align-items: center; gap: 8px; }
.total-line { display: flex; justify-content: space-between; align-items: center; margin: 12px; }
.total-line .tt { font-size: 13px; color: var(--muted); }
.total-line .num { font-size: 24px; font-weight: 800; color: var(--brand); }

.timeline { padding: 6px 4px; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 4px; }
.tl-dot { width: 12px; height: 12px; border-radius: 50%; background: #D9DBE0; margin-top: 4px; flex-shrink: 0; position: relative; z-index: 1; }
.tl-item.done .tl-dot { background: var(--brand); box-shadow: 0 0 0 4px rgba(200,64,47,.15); }
.tl-item.cur .tl-dot { background: var(--gold); box-shadow: 0 0 0 4px rgba(245,166,35,.2); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(245,166,35,.1); } }
.tl-item::before { content: ''; position: absolute; left: 5.5px; top: 14px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-txt { font-size: 14px; font-weight: 600; }
.tl-item.cur .tl-txt { color: var(--brand); }
.tl-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* 我的订单 */
.order-list { padding: 12px; }
.order-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.order-card .oh { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.order-card .oi { font-size: 13px; color: #444; line-height: 1.8; }
.order-card .of { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 13px; }
.status-pill { padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.st-paid, .st-preparing { background: #FDF1E4; color: #C57B21; }
.st-completed { background: #E8F8EE; color: var(--green); }
.st-cancelled { background: #F2F3F6; color: var(--muted); }
.st-pending_pay { background: #FDF1F1; color: var(--brand); }
.link-btn { background: none; color: var(--brand); font-size: 13px; padding: 4px 6px; }

/* toast */
#toast {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); background: rgba(0,0,0,.72);
  color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 14px; z-index: 99;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 80%; text-align: center; line-height: 1.6;
}
#toast.show { opacity: 1; }
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 13px; }
.back-header { display: flex; align-items: center; gap: 10px; padding: 13px 14px; background: #fff; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; flex-shrink: 0; }
.back-header button { background: none; font-size: 20px; color: #333; padding: 0 6px 0 0; }
