/* ============================================================
   美味餐厅 · 温暖食欲配色 (Warm Appetizing)
   赤陶橙 + 琥珀金 + 暖米底，统一圆角 / 投影 / 间距刻度
   ============================================================ */
:root {
  /* 品牌色 */
  --primary: #e0563b;        /* 赤陶橙 */
  --primary-dark: #c4452c;   /* hover 加深 */
  --primary-soft: #fce9e2;   /* 选中/柔和高亮底 */
  --accent: #f2a65a;         /* 琥珀金 */
  --accent-soft: #fbe6ce;
  --gradient: linear-gradient(135deg, #e0563b 0%, #f2a65a 100%);
  --gradient-dark: linear-gradient(135deg, #c4452c 0%, #e89042 100%);

  /* 中性色（暖调） */
  --bg: #fbf6f0;             /* 暖米背景 */
  --bg-2: #f4eadc;           /* 次级背景/分隔 */
  --card: #ffffff;
  --text: #2a201a;           /* 墨棕主文字 */
  --text-sub: #8c7b6e;       /* 次级文字 */
  --text-faint: #b6a89a;     /* 占位/最弱 */
  --line: #efe4d5;           /* 主分隔线 */
  --line-soft: #f6eee2;      /* 轻分隔 */

  /* 圆角刻度 */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* 投影刻度（暖棕基调，比纯黑更柔暖） */
  --shadow-xs: 0 1px 2px rgba(74, 40, 20, 0.06);
  --shadow-sm: 0 2px 10px rgba(74, 40, 20, 0.07);
  --shadow: 0 8px 24px rgba(120, 60, 30, 0.09);
  --shadow-lg: 0 18px 50px rgba(74, 40, 20, 0.24);
  --shadow-warm: 0 10px 22px rgba(224, 86, 59, 0.28);

  --topbar-h: 76px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: 0.2px; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 滚动条美化（暖调） */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #e2d4c2; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #d4c2ac; }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  font-size: 23px;
  background: var(--gradient);
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-warm);
}
.brand h1 { font-size: 19px; line-height: 1.2; color: var(--text); }
.brand-sub { margin: 2px 0 0; font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: 0.3px; }
.topnav { display: flex; gap: 6px; }
.topnav a {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-sub);
  font-size: 14px;
  font-weight: 500;
  transition: 0.15s;
}
.topnav a.active { background: var(--gradient); color: #fff; box-shadow: var(--shadow-warm); }
.topnav a:hover:not(.active) { background: var(--primary-soft); color: var(--primary); }

/* ---------- 布局 ---------- */
.layout {
  max-width: 1180px;
  margin: 18px auto 96px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 348px;
  gap: 22px;
  align-items: start;
}

/* ---------- 桌号 ---------- */
.tableno-bar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  border: 1px solid var(--line-soft);
}
.tableno-bar label { color: var(--text-sub); white-space: nowrap; font-weight: 500; }
.tableno-bar input {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  width: 96px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  transition: 0.15s;
}
.tableno-bar input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px var(--primary-soft); }
.tableno-bar .hint { color: var(--text-faint); font-size: 12px; }

/* ---------- 分类 ---------- */
.category-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: var(--card);
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
}
.category-bar::-webkit-scrollbar { height: 0; }
.cat-btn {
  flex: 0 0 auto;
  border: none;
  background: var(--bg-2);
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-sub);
  cursor: pointer;
  font-weight: 500;
  transition: 0.15s;
}
.cat-btn:hover { color: var(--primary); }
.cat-btn.active { background: var(--gradient); color: #fff; box-shadow: var(--shadow-warm); }

/* ---------- 菜品列表 ---------- */
.dish-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 14px;
}
.loading, .empty { color: var(--text-sub); padding: 28px; text-align: center; }

.dish-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  display: flex;
  gap: 13px;
  position: relative;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.dish-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--accent-soft);
}
.dish-img {
  position: relative;
  width: 88px;
  height: 88px;
  flex: 0 0 88px;
  background: var(--primary-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  box-shadow: inset 0 0 0 1px rgba(224, 86, 59, 0.08);
}
/* emoji 兜底图标在下层；真实照片 .dish-photo 覆盖在上层，加载失败隐藏后露出 emoji */
.dish-emoji { line-height: 1; }
.dish-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dish-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-name {
  font-size: 15.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
}
.dish-tags { display: inline-flex; gap: 4px; }
.tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag.signature { background: linear-gradient(135deg, #f2a65a, #f6c084); }
.dish-desc {
  font-size: 12.5px;
  color: var(--text-sub);
  margin: 5px 0 10px;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dish-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.dish-price { color: var(--primary); font-weight: 800; font-size: 17px; }

/* 数量步进器 */
.stepper { display: flex; align-items: center; gap: 9px; }
.step-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--gradient);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(224, 86, 59, 0.3);
  transition: 0.15s;
}
.step-btn:disabled { background: #d8cfc4; cursor: not-allowed; box-shadow: none; }
.step-btn:hover:not(:disabled) { filter: brightness(1.07); transform: scale(1.06); }
.step-btn.minus {
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  box-shadow: none;
}
.step-btn.minus:hover:not(:disabled) { background: var(--primary-soft); }
.step-qty { min-width: 18px; text-align: center; font-weight: 700; color: var(--text); }

/* ---------- 购物车面板 ---------- */
.cart-panel {
  position: sticky;
  top: var(--topbar-h);
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 24px);
}
.cart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--card), var(--card)) padding-box;
  position: relative;
}
.cart-head::after {
  content: "";
  position: absolute;
  left: 18px;
  bottom: -1px;
  width: 38px;
  height: 3px;
  border-radius: 3px;
  background: var(--gradient);
}
.cart-head h2 { font-size: 17px; display: flex; align-items: center; gap: 7px; }
.link-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 13px;
  transition: 0.15s;
}
.link-btn:hover { color: var(--primary); }

.cart-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 18px;
  min-height: 120px;
}
.cart-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.cart-item:last-child { border-bottom: none; }
.ci-img {
  font-size: 24px;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 10px;
}
.ci-info { flex: 1; min-width: 0; }
.ci-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-price { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

.cart-foot {
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.cart-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.cart-total .label { color: var(--text-sub); font-size: 14px; }
.cart-total .price {
  color: var(--primary);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.remark-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.remark-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 13px;
  outline: none;
  background: var(--card);
  transition: 0.15s;
}
.remark-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------- 按钮 ---------- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: 0.18s;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.btn-block { display: block; width: 100%; }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-warm);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.06); transform: translateY(-1px); }
.btn-primary:active:not(:disabled) { transform: translateY(0); filter: brightness(0.98); }
.btn-primary:disabled { background: #d8cfc4; color: #fff; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: var(--bg-2); color: var(--text); }
.btn-ghost:hover { background: #ebe0cf; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
/* hidden 属性必须能盖住上面的 display:flex，否则弹窗会一直常显 */
.modal[hidden] { display: none !important; }
.modal-mask { position: absolute; inset: 0; background: rgba(42, 32, 26, 0.5); backdrop-filter: blur(2px); }
.modal-box {
  position: relative;
  background: var(--card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes pop { from { transform: scale(0.94) translateY(6px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border: none;
  background: var(--bg-2);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: var(--text-sub);
  cursor: pointer;
  transition: 0.15s;
}
.modal-close:hover { background: var(--primary-soft); color: var(--primary); }
.modal-title { font-size: 18px; text-align: center; margin-bottom: 18px; }

.pay-summary {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  max-height: 150px;
  overflow-y: auto;
}
.ps-row { display: flex; justify-content: space-between; padding: 3px 0; color: var(--text-sub); }
.ps-meta { font-size: 12px; color: var(--text-sub); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ps-meta b { color: var(--text); }

.pay-methods { display: flex; gap: 8px; margin-bottom: 16px; }
.pay-method {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-sub);
  transition: 0.15s;
  background: var(--card);
}
.pay-method .pm-icon { font-size: 22px; }
.pay-method:hover { border-color: var(--accent-soft); }
.pay-method:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.pay-method input { display: none; }

.qr-area { text-align: center; margin: 4px 0 18px; }
.qr-code {
  width: 156px;
  height: 156px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  padding: 9px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.qr-code span { background: var(--text); }
.qr-tip { font-size: 12px; color: var(--text-sub); margin: 0 0 6px; }
.pay-amount { font-size: 28px; font-weight: 800; color: var(--primary); margin: 0; letter-spacing: 0.3px; }

.cancel-order-btn { margin-top: 10px; }

/* ---------- 支付成功 ---------- */
.success-box { text-align: center; }
.success-icon {
  font-size: 56px;
  margin-bottom: 6px;
  display: inline-block;
  width: 84px;
  height: 84px;
  line-height: 84px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e7f3ea, #fbe6ce);
}
.success-order-no { font-size: 13px; color: var(--text-sub); margin: 12px 0 4px; }
.success-sub { font-size: 14px; color: var(--text); margin: 0 0 22px; }
.success-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(42, 32, 26, 0.94);
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  z-index: 100;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.2s ease;
}
@keyframes toastIn { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- 订单页 ---------- */
.orders-wrap { max-width: 820px; margin: 22px auto 70px; padding: 0 20px; }
.orders-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.orders-head h2 { font-size: 22px; }
.filter-bar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.filter-btn {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-sub);
  cursor: pointer;
  font-weight: 500;
  transition: 0.15s;
}
.filter-btn:hover:not(.active) { color: var(--primary); border-color: var(--accent-soft); }
.filter-btn.active { background: var(--gradient); color: #fff; border-color: transparent; box-shadow: var(--shadow-warm); }

.orders-list { display: flex; flex-direction: column; gap: 14px; }
.order-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  transition: box-shadow 0.18s;
}
.order-card:hover { box-shadow: var(--shadow); }
.order-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.order-no { font-size: 13px; color: var(--text-sub); }
.order-no b { color: var(--text); font-weight: 600; }
.status-badge {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  letter-spacing: 0.2px;
}
.status-paid { background: #e7f3ea; color: #2f8f5b; }
.status-unpaid { background: #fff1e0; color: #c4782b; }
.status-cancelled { background: #f1ece4; color: var(--text-sub); }

.order-items { padding: 10px 18px; }
.oi-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.oi-row .oi-qty { color: var(--text-sub); font-size: 12px; margin-left: 6px; }
.order-remark {
  font-size: 12px;
  color: var(--text-sub);
  padding: 0 18px 10px;
}
.order-remark::before { content: "📝 "; }

.order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}
.order-time { font-size: 12px; color: var(--text-sub); }
.order-amount { font-size: 19px; font-weight: 800; color: var(--primary); margin-top: 2px; }
.order-actions { display: flex; gap: 8px; }
.btn-sm { padding: 8px 15px; font-size: 13px; border-radius: var(--radius-sm); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  :root { --topbar-h: 64px; }
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .cart-panel { position: sticky; top: auto; }
  .topnav a { padding: 7px 12px; font-size: 13px; }
  .brand h1 { font-size: 18px; }
}
@media (max-width: 520px) {
  :root { --topbar-h: 116px; }
  .topbar-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .topbar { background: var(--card); }
  .layout { padding: 0 12px; margin-bottom: 60px; }
  /* 移动端取消分类吸附，避免与变高的顶栏重叠错位 */
  .category-bar { position: static; }
  .dish-list { grid-template-columns: 1fr; }
  .orders-wrap { padding: 0 12px; }
  .modal-box { padding: 24px 18px 18px; }
}
