/* ========== 长盛烟花 · 用户端 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #FFB800;
  --primary-deep: #FF9500;
  --primary-dark: #E68A00;
  --price: #FF5339;
  --bg: #F5F5F5;
  --card: #FFFFFF;
  --text: #333333;
  --text-sub: #999999;
  --line: #F0F0F0;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  min-height: 100vh;
}
.hidden { display: none !important; }

#app { padding-bottom: 70px; }
.page { display: none; }
.page.active { display: block; }

/* ---------- 首页头部 ---------- */
.home-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  padding: 14px 16px 50px;
  border-radius: 0 0 24px 24px;
  position: relative;
}
.location-row { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.loc-icon { font-size: 16px; }
.loc-text { font-size: 17px; font-weight: 700; color: #fff; }
.loc-arrow { color: rgba(255,255,255,.9); font-size: 12px; }
.open-tag {
  margin-left: auto; font-size: 11px; color: #fff;
  background: rgba(255,255,255,.22); padding: 2px 8px; border-radius: 20px;
}
.search-box {
  background: #fff; border-radius: 22px; padding: 9px 14px;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.search-icon { font-size: 14px; }
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; color: var(--text); }
.search-box input::placeholder { color: #BBB; }
.search-clear { color: #999; font-size: 14px; padding: 2px 4px; cursor: pointer; }

/* ---------- 优惠横幅 ---------- */
.banner {
  margin: -32px 16px 0; background: linear-gradient(120deg, #FFF7E6, #FFF1CC);
  border-radius: 14px; padding: 14px 18px; display: flex;
  justify-content: space-between; align-items: center;
  border: 1px solid #FFE7A8; position: relative; z-index: 2;
}
.banner-title { font-size: 15px; font-weight: 700; color: #8A5A00; }
.banner-sub { font-size: 12px; color: #B07C22; margin-top: 3px; }
.banner-emoji { font-size: 30px; }

/* ---------- 分类栏 ---------- */
.category-bar {
  display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px; background: #fff;
  font-size: 13px; color: #555; cursor: pointer; border: 1px solid var(--line);
  transition: all .2s;
}
.cat-chip.active {
  background: var(--primary); color: #fff; font-weight: 600; border-color: var(--primary);
  box-shadow: 0 3px 8px rgba(255,149,0,.35);
}

/* ---------- 菜品列表 ---------- */
.dish-list { padding: 8px 16px 20px; }
.dish-card {
  background: var(--card); border-radius: 14px; margin-bottom: 12px;
  display: flex; padding: 12px; gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.dish-img-box {
  width: 92px; height: 92px; border-radius: 10px; overflow: hidden; flex-shrink: 0;
  background: #F7F7F7; position: relative; cursor: pointer;
}
.dish-img-box img, .dish-img-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-video-tag {
  position: absolute; right: 4px; bottom: 4px; background: rgba(0,0,0,.55);
  color: #fff; font-size: 10px; padding: 2px 5px; border-radius: 4px;
}
.dish-info { flex: 1; display: flex; flex-direction: column; min-width: 0; cursor: pointer; }
.dish-name { font-size: 15px; font-weight: 600; line-height: 1.3; }
.dish-desc {
  font-size: 12px; color: var(--text-sub); margin: 5px 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dish-sales { font-size: 11px; color: #BBB; }
.dish-bottom { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; }
.dish-price-box .cur { color: var(--price); font-size: 18px; font-weight: 700; }
.dish-price-box .cur::before { content: '¥'; font-size: 12px; }
.dish-price-box .origin { color: #BBB; font-size: 11px; text-decoration: line-through; margin-left: 5px; }
.add-btn {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary);
  color: #fff; font-size: 20px; line-height: 28px; text-align: center;
  cursor: pointer; border: none; box-shadow: 0 2px 6px rgba(255,149,0,.4);
}
.sold-out-tag {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; border-radius: 10px;
}

/* ---------- 购物车栏 ---------- */
.cart-bar {
  position: fixed; bottom: 64px; left: 50%; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 448px; background: #3A3A3A; color: #fff;
  border-radius: 30px; padding: 6px 6px 6px 16px; display: flex;
  align-items: center; justify-content: space-between; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.cart-left { display: flex; align-items: center; gap: 12px; cursor: pointer; flex: 1; }
.cart-icon { font-size: 26px; position: relative; }
.cart-badge {
  position: absolute; top: -6px; right: -8px; background: var(--price);
  color: #fff; font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; text-align: center; padding: 0 4px;
}
.cart-total .cart-price { font-size: 18px; font-weight: 700; }
.cart-total .cart-price span { font-size: 22px; }
.cart-total .cart-desc { font-size: 10px; color: #AAA; }
.checkout-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border: none; color: #fff; font-size: 16px; font-weight: 600;
  padding: 12px 28px; border-radius: 24px; cursor: pointer;
}
.checkout-btn.disabled { background: #CCC; pointer-events: none; }

/* ---------- 底部导航 ---------- */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; background: #fff; display: flex;
  border-top: 1px solid var(--line); z-index: 60; padding-bottom: env(safe-area-inset-bottom);
}
.tab-item { flex: 1; text-align: center; padding: 8px 0 6px; cursor: pointer; color: #999; }
.tab-item span { font-size: 22px; display: block; }
.tab-item p { font-size: 11px; margin-top: 2px; }
.tab-item.active { color: var(--primary-dark); }

/* ---------- 子页头 ---------- */
.sub-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  padding: 16px; color: #fff; border-radius: 0 0 20px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.sub-header h2 { font-size: 18px; }
.phone-tip { font-size: 11px; opacity: .85; }

/* ---------- 订单页 ---------- */
.phone-input-row { display: flex; gap: 10px; padding: 14px 16px 0; }
.phone-input-row input {
  flex: 1; border: none; border-radius: 10px; padding: 11px 14px;
  font-size: 14px; background: #fff; outline: none;
}
.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  border: none; color: #fff; border-radius: 10px; padding: 0 22px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.order-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: none; }
.order-tabs::-webkit-scrollbar { display: none; }
.order-list { padding: 12px 16px 20px; }
.order-card {
  background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.order-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.order-no { font-size: 12px; color: var(--text-sub); }
.status-tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; }
.status-pending { background: #FFF3E0; color: #E68A00; }
.status-confirmed { background: #E8F4FD; color: #1976D2; }
.status-preparing { background: #FFF8E1; color: #B8860B; }
.status-delivering { background: #E8F5E9; color: #2E7D32; }
.status-completed { background: #EEEEEE; color: #666; }
.status-cancelled { background: #FFEBEE; color: #D32F2F; }
.order-card-items { font-size: 13px; color: #555; margin-bottom: 8px; line-height: 1.7; }
.order-card-bottom { display: flex; justify-content: space-between; align-items: center; }
.order-total { font-size: 13px; color: var(--text-sub); }
.order-total b { color: var(--price); font-size: 16px; }
.order-detail-btn {
  background: #fff; border: 1px solid #DDD; border-radius: 16px;
  padding: 5px 14px; font-size: 12px; color: #666; cursor: pointer;
}

/* ---------- 我的页 ---------- */
.profile-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  padding: 30px 20px; display: flex; align-items: center; gap: 16px;
  border-radius: 0 0 24px 24px; color: #fff;
}
.avatar {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
}
.profile-name { font-size: 19px; font-weight: 700; }
.profile-sub { font-size: 12px; opacity: .85; margin-top: 4px; }
.profile-menu { padding: 16px; }
.menu-item {
  background: #fff; border-radius: 12px; padding: 15px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; font-size: 15px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
}
.profile-footer { text-align: center; color: #BBB; font-size: 12px; margin-top: 40px; }

/* ---------- 弹层通用 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.cart-panel-mask { align-items: flex-end; }
.cart-panel {
  background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  max-height: 60vh; display: flex; flex-direction: column; animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cart-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.clear-cart-btn { border: none; background: none; color: var(--text-sub); font-size: 13px; cursor: pointer; }
.cart-items { overflow-y: auto; flex: 1; padding: 0 16px; }
.cart-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item-img { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #F5F5F5; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; }
.cart-item-spec { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.cart-item-price { color: var(--price); font-weight: 700; font-size: 15px; }
.cart-panel-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.cart-panel-total b { color: var(--price); font-size: 18px; }

/* 数量控制 */
.qty-ctrl { display: flex; align-items: center; gap: 10px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center;
}
.qty-btn.plus { background: var(--primary); color: #fff; }
.qty-btn.minus { background: #F0F0F0; color: #666; }
.qty-ctrl span { min-width: 18px; text-align: center; font-size: 15px; font-weight: 600; }

/* ---------- 菜品详情 ---------- */
.dish-modal {
  background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  overflow: hidden; animation: slideUp .25s ease; max-height: 88vh; overflow-y: auto;
}
.dish-modal-media { position: relative; height: 240px; background: #F0F0F0; }
.dish-modal-media img, .dish-modal-media video { width: 100%; height: 100%; object-fit: cover; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  background: rgba(0,0,0,.45); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px;
}
.dish-modal-body { padding: 18px 16px 24px; }
.dish-modal-top { display: flex; align-items: baseline; gap: 10px; }
.dish-modal-top h3 { font-size: 19px; }
.sales { font-size: 12px; color: var(--text-sub); }
.dish-modal-desc { font-size: 13px; color: #777; margin: 8px 0 14px; line-height: 1.6; }
.modal-specs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.spec-chip {
  padding: 7px 14px; border-radius: 18px; border: 1px solid #DDD; font-size: 13px;
  cursor: pointer; color: #555;
}
.spec-chip.active { border-color: var(--primary); background: #FFF8E6; color: var(--primary-dark); font-weight: 600; }
.modal-price-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.price-box .cur { color: var(--price); font-size: 22px; font-weight: 700; }
.price-box .origin { color: #BBB; font-size: 13px; text-decoration: line-through; margin-left: 6px; }
.add-cart-btn {
  width: 100%; border: none; border-radius: 24px; padding: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer;
}

/* ---------- 结算页 ---------- */
.checkout-page {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  max-width: 480px; margin: 0 auto; display: flex; flex-direction: column;
}
.checkout-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: #fff;
}
.back-btn { font-size: 26px; color: #333; cursor: pointer; line-height: 1; }
.checkout-header h2 { font-size: 16px; }
.checkout-body { flex: 1; overflow-y: auto; padding: 14px 16px 90px; }
.checkout-form, .checkout-summary { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.form-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.checkout-form input, .checkout-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 14px; margin-bottom: 10px; outline: none;
  font-family: inherit; resize: none;
}
.checkout-form input:focus, .checkout-form textarea:focus { border-color: var(--primary); }
.co-items { margin-bottom: 10px; }
.co-item { display: flex; justify-content: space-between; font-size: 13px; color: #555; padding: 4px 0; }
.co-item span:first-child { max-width: 70%; }
.co-fee-row { display: flex; justify-content: space-between; font-size: 13px; color: #555; padding: 4px 0; }
.co-fee-row.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; font-weight: 600; color: var(--text); }
.co-fee-row.total b { color: var(--price); font-size: 16px; }
.checkout-footer {
  position: absolute; bottom: 0; left: 0; right: 0; background: #fff;
  padding: 12px 16px; display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--line);
}
.checkout-amount b { color: var(--price); font-size: 20px; }

/* ---------- 订单详情弹层 ---------- */
.order-detail-panel {
  background: #fff; width: 100%; max-width: 480px; border-radius: 20px 20px 0 0;
  max-height: 80vh; overflow-y: auto; animation: slideUp .25s ease;
}
.od-header { display: flex; justify-content: space-between; align-items: center; padding: 16px; border-bottom: 1px solid var(--line); }
.od-header h3 { font-size: 16px; }
.od-body { padding: 16px; }
.od-status-big { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.od-items { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.od-item { display: flex; justify-content: space-between; font-size: 13px; color: #555; padding: 5px 0; }
.od-fee { display: flex; justify-content: space-between; font-size: 13px; color: #555; padding: 5px 0; }
.od-total { display: flex; justify-content: space-between; font-size: 14px; font-weight: 700; padding: 8px 0 0; border-top: 1px solid var(--line); margin-top: 6px; }
.od-total b { color: var(--price); font-size: 18px; }
.od-info { margin-top: 14px; padding: 12px; background: #FAFAFA; border-radius: 10px; font-size: 12px; color: #777; line-height: 1.8; }
.od-info b { color: var(--text); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 45%; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px;
  border-radius: 20px; font-size: 14px; z-index: 200; animation: fadeIn .2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.list-empty { text-align: center; color: #BBB; font-size: 14px; padding: 50px 0; }

/* ---------- 订单打印小票按钮 ---------- */
.od-print-btn {
  display: block; width: 100%;
  margin-top: 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--primary-dark);
  cursor: pointer;
}
.od-print-btn:hover { background: #FFF8E6; border-color: var(--primary); }

/* ========== 打印小票样式 ========== */
.print-area { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area {
    display: block;
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    padding: 20px 24px;
    box-sizing: border-box;
    background: #fff;
    color: #000;
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
  }
  .print-area h2 { text-align: center; font-size: 20px; margin: 0 0 4px; color: #000; }
  .print-area .p-sub { text-align: center; font-size: 12px; color: #555; margin: 0 0 8px; }
  .print-area .p-divider { border-top: 1px dashed #999; margin: 8px 0; }
  .print-area .p-row { display: flex; justify-content: space-between; font-size: 13px; margin: 4px 0; }
  .print-area .p-row span:first-child { color: #555; }
  .print-area .p-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
  .print-area .p-table th, .print-area .p-table td { border: 1px solid #333; padding: 5px 8px; font-size: 13px; text-align: left; }
  .print-area .p-table th { background: #f2f2f2; }
  .print-area .p-total { text-align: right; font-size: 16px; font-weight: 700; margin: 8px 0; }
  .print-area .p-foot { text-align: center; font-size: 12px; color: #555; margin: 10px 0 0; }
}
