/* R118 扫码点餐 H5 */
:root {
  --primary: #FF6600;
  --secondary: #FF9800;
  --bg: #FFFFFF;
  --text: #333333;
  --card-bg: #FAFAFA;
  --accent: #FF6600;
  --border: #EEEEEE;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --radius: 12px;
  --contact-footer-h: 72px;
  --cart-float-h: 52px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --max-w: 480px;
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: calc(var(--contact-footer-h) + var(--cart-float-h) + var(--safe-bottom) + 8px);
  -webkit-tap-highlight-color: transparent;
}
body.modal-open { overflow: hidden; }
#app, #skeleton { max-width: var(--max-w); margin: 0 auto; }
#app.hidden { display: none !important; }

/* Skeleton */
#skeleton .sk-hero { height: 200px; background: linear-gradient(90deg,#eee,#f5f5f5,#eee); animation: shimmer 1.2s infinite; }
#skeleton .sk-category { height: 48px; margin: 12px; border-radius: 8px; background: #eee; }
#skeleton .sk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
#skeleton .sk-card { height: 160px; border-radius: var(--radius); background: #eee; animation: shimmer 1.2s infinite; }
#skeleton.hidden { display: none; }
@keyframes shimmer { 0%{opacity:.6} 50%{opacity:1} 100%{opacity:.6} }

/* Hero */
#hero { position: relative; min-height: 220px; padding: 16px; color: #fff; overflow: hidden; }
#hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: brightness(.75); }
#hero-info { position: relative; z-index: 1; }
#hero-logo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; }
#restaurant-name { margin: 0 0 6px; font-size: 24px; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: rgba(255,255,255,.25); }
.badge--open { background: #4CAF50; }
.badge--closed { background: #9E9E9E; }
.badge--pending { background: #FFB300; color: #333; }
#restaurant-desc { font-size: 13px; opacity: .92; margin: 8px 0 0; line-height: 1.5; }
#table-badge {
  position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px;
  margin-top: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(0,0,0,.35); font-size: 14px;
}
#table-switch { border: none; background: rgba(255,255,255,.2); color: #fff; border-radius: 6px; padding: 4px 8px; font-size: 12px; }
#scroll-hint { position: relative; z-index: 1; text-align: center; margin-top: 16px; font-size: 12px; opacity: .85; animation: bounce 2s infinite; cursor: pointer; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

.collab-panel {
  display: flex; align-items: center; gap: 8px; margin: 8px 12px; padding: 8px 12px;
  background: var(--card-bg); border-radius: var(--radius); font-size: 12px;
}
.collab-dot { width: 10px; height: 10px; border-radius: 50%; }

/* Search */
#search-bar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
#search-input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 20px; font-size: 14px; }
#filter-toggle { padding: 8px 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--card-bg); }
#filter-panel { width: 100%; display: none; padding: 8px 0; }
#filter-panel.open { display: block; }
#filter-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.filter-tag { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 12px; }
.filter-tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }
#filter-sort { display: flex; gap: 6px; flex-wrap: wrap; }
#filter-sort button { padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 12px; }
#filter-sort button.active { background: var(--primary); color: #fff; }
.dropdown { position: absolute; left: 12px; right: 56px; top: 52px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); display: none; z-index: 30; max-height: 240px; overflow: auto; }
.dropdown.open { display: block; }
.dropdown button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: none; background: none; border-bottom: 1px solid var(--border); font-size: 14px; }

/* Reorder */
#reorder-bar { padding: 0 12px; }
.reorder-card {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin: 8px 0; background: linear-gradient(90deg, rgba(255,102,0,.12), rgba(255,152,0,.08));
  border-radius: var(--radius); font-size: 13px;
}
.reorder-card button { border: none; background: var(--primary); color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px; white-space: nowrap; }

/* Menu */
#menu-container { display: flex; align-items: flex-start; padding: 0 0 16px; }
#category-nav {
  position: sticky; top: 56px; width: 72px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px; padding: 8px 4px; max-height: calc(100vh - 180px); overflow-y: auto;
}
.cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; border: none; background: none; font-size: 11px; color: #888; cursor: pointer; border-radius: 8px;
}
.cat-item.active { color: var(--primary); background: rgba(255,102,0,.1); font-weight: 600; }
.cat-icon { font-size: 18px; }
#product-grid { flex: 1; min-width: 0; padding: 0 10px 0 4px; }
.cat-section-title { font-size: 15px; margin: 12px 0 8px; padding-left: 4px; }
.product-grid-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product-card {
  position: relative; background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
}
.product-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.product-card__body { padding: 8px 10px 10px; }
.product-card h4 { margin: 0 0 4px; font-size: 14px; }
.product-card p { margin: 0; font-size: 11px; color: #888; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card__meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.price { color: var(--primary); font-weight: 700; font-size: 15px; }
.btn-add {
  position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--primary); color: #fff; font-size: 18px; line-height: 1;
}
.product-card.sold-out { opacity: .5; }
.empty-menu { text-align: center; color: #999; padding: 40px 12px; }

/* Cart float */
#cart-float {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--contact-footer-h) + var(--safe-bottom) + 8px);
  z-index: 50; display: flex; align-items: center; gap: 10px; max-width: var(--max-w); width: calc(100% - 24px);
  padding: 10px 16px; border-radius: 999px; background: #2D2D2D; color: #fff; box-shadow: var(--shadow); cursor: pointer;
}
#cart-float.hidden { display: none; }
#cart-total { margin-left: auto; font-weight: 700; color: var(--secondary); }

/* Modal / Drawer */
.modal, .drawer { position: fixed; inset: 0; z-index: 200; display: none; }
.modal.open, .drawer.open { display: block; }
.modal-backdrop, .drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.modal-sheet, .drawer-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-width: var(--max-w); margin: 0 auto;
  background: #fff; border-radius: 16px 16px 0 0; padding: 16px; padding-bottom: calc(16px + var(--safe-bottom));
  max-height: 90vh; overflow-y: auto; animation: slideUp .28s ease;
}
@keyframes slideUp { from{transform:translateY(100%)} to{transform:translateY(0)} }
.modal-close { position: absolute; right: 12px; top: 12px; width: 32px; height: 32px; border: none; border-radius: 50%; background: rgba(0,0,0,.06); }
#detail-images img { width: 100%; border-radius: var(--radius); aspect-ratio: 4/3; object-fit: cover; }
#detail-info h2 { margin: 12px 0 6px; font-size: 20px; }
#detail-desc { color: #666; font-size: 14px; margin: 0 0 8px; }
#detail-tags .tag { display: inline-block; margin-right: 6px; padding: 2px 8px; border-radius: 6px; background: #FFF3E0; font-size: 11px; color: var(--primary); }
#detail-price { font-size: 22px; font-weight: 800; color: var(--primary); }
.spec-group { margin: 12px 0; }
.spec-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.spec-options { display: flex; flex-wrap: wrap; gap: 8px; }
.spec-opt { padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 13px; }
.spec-opt.active { border-color: var(--primary); color: var(--primary); background: rgba(255,102,0,.08); }
#detail-stepper { display: inline-flex; align-items: center; gap: 12px; margin: 16px 0; }
#detail-stepper button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); background: #fff; font-size: 18px; }
#detail-add-cart { width: 100%; padding: 14px; border: none; border-radius: var(--radius); background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; }
#detail-add-cart:disabled { background: #ccc; }

.drawer-handle { width: 40px; height: 4px; background: #ddd; border-radius: 2px; margin: 0 auto 12px; }
.drawer-sheet h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }
#cart-clear { border: none; background: none; color: #999; font-size: 13px; }
.cart-line { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-line img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.cart-spec { display: block; font-size: 11px; color: #999; }
.cart-stepper { display: flex; align-items: center; gap: 8px; }
.cart-stepper button { width: 28px; height: 28px; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.cart-empty { text-align: center; padding: 24px; color: #999; }
.cart-rec-title { font-size: 12px; color: #888; margin: 8px 0 4px; }
.cart-rec-item { display: block; width: 100%; text-align: left; padding: 8px; margin-bottom: 6px; border: 1px dashed var(--border); border-radius: 8px; background: #fff; }
.drawer-footer { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
#cart-checkout { grid-column: 1 / -1; padding: 12px; border: none; border-radius: var(--radius); background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; }

.form-group { margin: 12px 0; }
.form-group label { display: block; font-size: 13px; margin-bottom: 6px; }
.form-group select, .form-group input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.preset-chip { margin: 4px 6px 0 0; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 12px; }
.order-line { display: flex; justify-content: space-between; font-size: 13px; padding: 4px 0; }
.order-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 18px; margin: 12px 0; color: var(--primary); }
#order-submit { width: 100%; padding: 14px; border: none; border-radius: var(--radius); background: var(--primary); color: #fff; font-size: 16px; }

/* Success */
.page-overlay {
  position: fixed; inset: 0; z-index: 300; background: var(--bg); display: none;
  flex-direction: column; align-items: center; padding: 40px 20px; text-align: center;
  padding-bottom: calc(40px + var(--contact-footer-h));
}
.page-overlay.open { display: flex; }
#success-icon { font-size: 64px; }
#order-tracking { width: 100%; max-width: 320px; margin: 20px 0; }
.track-step { padding: 10px; margin: 6px 0; border-radius: 8px; background: var(--card-bg); color: #999; font-size: 14px; }
.track-step.active { background: rgba(255,102,0,.15); color: var(--primary); font-weight: 600; }
.page-overlay button { margin: 6px 0; padding: 12px 24px; border-radius: var(--radius); border: none; background: var(--primary); color: #fff; font-size: 15px; min-width: 200px; }
.btn-outline { background: #fff !important; color: var(--primary) !important; border: 1px solid var(--primary) !important; }
.btn-text { background: none !important; color: #888 !important; }

/* Footer */
.contact-footer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: #fff; border-top: 1px solid var(--border);
  padding: 8px 12px calc(8px + var(--safe-bottom));
}
.contact-footer__btns { display: flex; gap: 8px; max-width: var(--max-w); margin: 0 auto; }
.contact-footer__cta { flex: 1; text-align: center; padding: 8px; border-radius: 8px; background: var(--primary); color: #fff; text-decoration: none; font-size: 14px; }
.contact-footer__btn { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-size: 14px; text-decoration: none; color: var(--text); text-align: center; }
.contact-footer__brand { text-align: center; font-size: 10px; color: #999; margin: 6px auto 0; max-width: var(--max-w); }

#global-toast {
  position: fixed; bottom: calc(var(--contact-footer-h) + var(--cart-float-h) + 20px); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.82); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity .25s; z-index: 400; pointer-events: none;
}
#global-toast.show { opacity: 1; }

/* P1 */
.p1-toolbar {
  display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--border); background: #fff;
}
.p1-toolbar::-webkit-scrollbar { display: none; }
.p1-tool {
  flex-shrink: 0; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card-bg); font-size: 12px; cursor: pointer;
}
.p1-tool.hidden { display: none; }
.p1-tool-link { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
.p1-modal.open { display: block; }
.p1-modal-sheet { max-height: 85vh; }
.queue-status { background: var(--card-bg); border-radius: var(--radius); padding: 12px; margin: 12px 0; font-size: 14px; }
.queue-mine { color: var(--primary); font-size: 20px; }
.order-coupon-section { margin: 12px 0; }
.order-coupon-section label { display: block; font-size: 13px; margin-bottom: 6px; }
.coupon-pick-btn {
  width: 100%; text-align: left; padding: 10px 12px; border: 1px dashed var(--primary);
  border-radius: 8px; background: rgba(255,102,0,.06); color: var(--primary); font-size: 13px;
}
.coupon-discount-line { margin-top: 6px; font-size: 13px; color: #4CAF50; }
.coupon-discount-line.hidden { display: none; }
.order-subtotal { display: flex; justify-content: space-between; font-size: 14px; color: #888; margin: 8px 0; }
.coupon-list { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 240px; overflow-y: auto; }
.coupon-row {
  display: flex; justify-content: space-between; padding: 12px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; font-size: 14px; cursor: pointer;
}
.coupon-row.active { border-color: var(--primary); background: rgba(255,102,0,.08); }
.coupon-row.disabled { opacity: .45; cursor: not-allowed; }
.coupon-none { width: 100%; padding: 10px; border: none; background: none; color: #888; font-size: 13px; }
.coupon-hint { font-size: 13px; color: #888; margin: 0 0 8px; }
.history-list { max-height: 50vh; overflow-y: auto; }
.history-order {
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.history-order__head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.history-reorder-btn {
  margin-top: 8px; padding: 6px 12px; border: 1px solid var(--primary); border-radius: 8px;
  background: #fff; color: var(--primary); font-size: 12px;
}
.history-empty, .coupon-empty { text-align: center; color: #999; padding: 20px; }
.share-qr-wrap { display: flex; justify-content: center; margin: 12px 0; }
.share-link-input {
  width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 12px; margin-bottom: 10px;
}
.btn-outline {
  width: 100%; margin: 6px 0; padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--primary); background: #fff; color: var(--primary); font-size: 15px;
}
.btn-text { background: none !important; border: none !important; color: #888 !important; box-shadow: none !important; }

/* 分享 / 邀请页 */
.share-page { padding-bottom: calc(var(--contact-footer-h) + var(--safe-bottom) + 16px); }
.share-main { max-width: var(--max-w); margin: 0 auto; padding: 16px; }
.share-landing-card {
  background: #fff; border-radius: var(--radius-lg); padding: 20px 16px;
  box-shadow: var(--shadow); text-align: center;
}
.share-eyebrow { color: var(--primary); font-size: 13px; margin: 0 0 8px; }
.share-landing-card h1 { margin: 0 0 8px; font-size: 22px; }
.share-tagline { color: #666; font-size: 14px; margin: 0 0 8px; }
.share-desc { font-size: 13px; color: #888; line-height: 1.5; margin: 0 0 16px; }
.share-table-badge {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  background: rgba(255,102,0,.1); color: var(--primary); font-size: 15px; margin-bottom: 12px;
}
.share-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0;
}
.share-stat {
  background: var(--card-bg); border-radius: 10px; padding: 10px 4px; font-size: 11px; color: #888;
}
.share-stat strong { display: block; font-size: 16px; color: var(--primary); margin-bottom: 2px; }
.share-cta {
  display: block; padding: 14px; border-radius: var(--radius); background: var(--primary);
  color: #fff; text-decoration: none; font-weight: 600; margin-bottom: 10px;
}
.share-cta-secondary {
  display: block; padding: 12px; border-radius: var(--radius); border: 1px solid var(--primary);
  color: var(--primary); text-decoration: none; margin-bottom: 16px; font-size: 14px;
}
.share-qr-block {
  margin: 16px 0; padding: 14px; background: var(--card-bg); border-radius: var(--radius);
}
.share-qr-block p { margin: 0 0 10px; font-size: 13px; color: #666; }
.btn-block { width: 100%; margin-top: 8px; }

@media (min-width: 768px) {
  .product-grid-inner { grid-template-columns: repeat(3, 1fr); }
}
