/* Trang của khách (gọi món tại bàn /t, mang về /m, trang web quán /s): cùng ngôn ngữ "Ô mã QR" với trang chủ.
   Nền trắng, chữ mực, một màu nhấn là màu của quán (--brand, quán tự chọn), ô bo góc 23% lấy từ logo.
   Nạp sau base.css; menu.css và site.css chỉ xếp bố cục riêng của từng trang. */
:root {
  --bg: #ffffff;
  --tone: #f2f2f0;
  --tone-2: #e6e6e2;
  --text: #17120f;
  --muted: #6b625c;
  --line: #e9e9e5;
  --on-brand: #ffffff;
  --brand-btn: #c74d19; /* applyTheme() tính lại theo màu quán để chữ trắng luôn đọc rõ */
  --radius: 16px;
  --shadow: none;
  --float: 0 10px 30px rgba(23, 18, 15, .18);
  --display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, sans-serif; /* applyFonts() đổi theo font quán chọn */
}

html, body { background: var(--bg); font-family: var(--body); }
button, input, select, textarea { font-family: inherit; }
body { font-size: 15.5px; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; font-weight: 700; }

.btn { border-radius: 12px; min-height: 46px; padding: 0 18px; border-color: var(--line); }
.btn-primary { background: var(--brand-btn); border-color: var(--brand-btn); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ink { background: var(--text); border-color: var(--text); color: #fff; }
.btn-lg { min-height: 52px; font-size: 16px; }
.input, select.input, textarea.input { border-radius: 12px; min-height: 48px; font-size: 16px; } /* 16px: iPhone không tự phóng to khi gõ */
.input:focus { border-color: var(--text); box-shadow: 0 0 0 3px rgba(23, 18, 15, .08); }
.field label { color: var(--text); font-size: 13.5px; }
.card { box-shadow: none; border: 1px solid var(--line); }
.badge-muted { background: var(--tone); }
.toast { background: var(--text); border-radius: 14px; box-shadow: var(--float); bottom: calc(96px + env(safe-area-inset-bottom)); }
.ic { width: 20px; height: 20px; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ô vuông bo góc kiểu logo: chứa icon */
.tile-ic { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 23%; background: var(--brand-soft); color: var(--brand-dark); }
.tile-ic .ic { width: 22px; height: 22px; }

/* màn hình chờ / lỗi / kết thúc phiên */
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--muted); }
.state-box { width: 100%; max-width: 360px; }
.state-box h1, .state-box h2 { color: var(--text); font-size: 24px; margin: 0 0 8px; text-wrap: balance; }
.state-box p { margin: 0; line-height: 1.55; }
.state-box .btn { margin-top: 22px; }
.state-ic { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 23%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.state-ic svg, .state-ic .ic { width: 34px; height: 34px; }
.loading-dots { display: inline-flex; gap: 6px; margin-bottom: 14px; }
.loading-dots i { width: 12px; height: 12px; border-radius: 23%; background: var(--brand); animation: dot 1s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: .15s; }
.loading-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

/* danh mục món: dính trên cùng khi cuộn */
.cats {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 10px 16px; background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
}
.cats::-webkit-scrollbar { display: none; }
.cats a {
  flex: none; padding: 8px 14px; border-radius: 999px; background: var(--tone); color: var(--text);
  text-decoration: none; font-weight: 600; font-size: 14px; box-shadow: none; transition: background-color .15s, color .15s;
}
.cats a.active { background: var(--text); color: #fff; }
.cats > :first-child { margin-left: 0; }
.cats > :last-child { margin-right: 0; }

/* một món: ảnh vuông bo góc, tên, mô tả, giá + nút thêm */
.cat-title { font-size: 22px; margin: 26px 0 4px; scroll-margin-top: 70px; }
.cat-count { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.dish {
  position: relative; display: flex; gap: 14px; align-items: stretch; padding: 10px 0; margin: 0;
  border: 0; border-radius: 0; background: none; box-shadow: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.dish-img {
  position: relative; width: 96px; height: 96px; flex: none; border-radius: 23%; overflow: hidden;
  background: var(--tone); display: grid; place-items: center; color: #b3aaa3;
}
.dish-img img { width: 100%; height: 100%; object-fit: cover; }
.dish-img .ic { width: 30px; height: 30px; }
.dish-qty-badge {
  position: absolute; top: 6px; left: 6px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 9px;
  display: grid; place-items: center; background: var(--brand-btn); color: var(--on-brand); font-weight: 800; font-size: 13.5px;
}
.dish-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dish-name { font-weight: 700; font-size: 16px; line-height: 1.3; margin: 0; font-family: inherit; letter-spacing: 0; }
.dish-desc { margin: 3px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dish-price { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -.01em; margin: 0; white-space: nowrap; }
.dish-price small { font-family: var(--body); color: var(--muted); font-weight: 500; font-size: 12.5px; letter-spacing: 0; }
.dish.off { cursor: default; }
.dish.off .dish-img img { filter: grayscale(1); opacity: .5; }
.dish.off .dish-name, .dish.off .dish-price { color: var(--muted); }
.sold-out { display: inline-block; padding: 3px 9px; border-radius: 8px; background: var(--tone); color: var(--muted); font-size: 12.5px; font-weight: 700; }

/* nút thêm (+) và bộ tăng/giảm số lượng */
.add-btn {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 12px;
  background: var(--tone); color: var(--text); cursor: pointer; transition: background-color .15s, color .15s, transform .08s;
}
.add-btn .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.dish:hover .add-btn, .add-btn:hover { background: var(--brand-btn); color: var(--on-brand); }
.add-btn:active { transform: scale(.92); }
.stepper { display: inline-flex; align-items: center; height: 40px; border-radius: 12px; background: var(--brand-btn); color: var(--on-brand); flex: none; }
.stepper button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.stepper button .ic { width: 18px; height: 18px; stroke-width: 2.4; }
.stepper button:active { transform: scale(.9); }
.stepper span { min-width: 22px; text-align: center; font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; }
.stepper-sm { height: 34px; border-radius: 10px; }
.stepper-sm button { width: 34px; height: 34px; }

/* thanh giỏ món: nổi ở đáy, màu mực, nút chính màu quán */
.cartbar {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: calc(100% - 20px); max-width: 620px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 16px; border: 0; border-radius: 18px; background: var(--text); color: #fff; box-shadow: var(--float);
  animation: bar-in .22s cubic-bezier(.2, .8, .2, 1);
}
@keyframes bar-in { from { transform: translate(-50%, 24px); opacity: 0; } }
.cart-sum { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cart-count { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 11px; background: rgba(255, 255, 255, .14); font-weight: 800; font-variant-numeric: tabular-nums; }
.cart-total { font-family: var(--display); font-size: 21px; font-weight: 700; letter-spacing: -.01em; color: #fff; white-space: nowrap; }
.cart-label { display: block; font-size: 12px; color: rgba(255, 255, 255, .62); line-height: 1.2; }
.cartbar .btn { min-height: 48px; padding: 0 18px; font-size: 16px; border-radius: 13px; gap: 8px; box-shadow: none; }
.cartbar .btn .ic { width: 19px; height: 19px; }

/* tấm trượt từ đáy (xác nhận món, hóa đơn, đặt trước) */
.modal { background: rgba(23, 18, 15, .5); }
.modal-box { border-radius: 22px; }
.modal-box h3 { font-size: 23px; margin-bottom: 14px; }
.modal-x { background: var(--tone); }
.sheet { align-items: flex-end; padding: 0; }
.sheet .modal-box {
  max-width: 620px; border-radius: 24px 24px 0 0; padding: 26px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet .modal-box::before { content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--tone-2); }
@keyframes sheet-up { from { transform: translateY(48px); opacity: .4; } }
@media (min-width: 700px) {
  .sheet { align-items: center; padding: 16px; }
  .sheet .modal-box { border-radius: 22px; padding-bottom: 22px; }
  .sheet .modal-box::before { display: none; }
}
.modal-actions { margin-top: 14px; }
.modal-actions .btn { flex: 1 1 0; }

.lines { list-style: none; margin: 0; padding: 0; }
.lines li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.lines li > span:last-child { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.line-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.line-qty { display: grid; place-items: center; flex: none; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 9px; background: var(--tone); font-weight: 800; font-size: 13.5px; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 14px 0; font-weight: 700; font-size: 15px; }
.total-row span:last-child { font-family: var(--display); font-size: 26px; letter-spacing: -.02em; color: var(--text); }

/* khuyến mãi đang chạy */
.promo-banners { display: grid; gap: 8px; }
.promo-banner {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 12px; border-radius: 16px;
  background: var(--brand-soft); border: 0; color: var(--text);
}
.promo-banner-pct {
  flex: none; display: grid; place-items: center; min-width: 58px; height: 46px; padding: 0 8px; border-radius: 23%;
  background: var(--brand-btn); color: var(--on-brand); font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -.02em;
}
.promo-banner b { display: block; font-size: 15px; }
.promo-banner small { display: block; font-size: 13px; color: var(--muted); }

.form-err { color: var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 12px; margin: 0 0 12px; font-size: 14px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }

/* hiện dần khi cuộn tới (chỉ trang web quán gắn .reveal; thực đơn tại bàn hiện ngay cho nhanh) */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(16px); transition: opacity .55s ease, transform .55s cubic-bezier(.2, .8, .2, 1); }
  .reveal.in { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
