/* 全局基础重置与变量 */
:root {
  --primary-color: #ea580c; /* 活力食欲橙红 */
  --primary-hover: #c2410c;
  --primary-light: #fff7ed;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --success-color: #16a34a;
  --price-color: #dc2626;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 540px; /* 移动端最佳容器宽度，在Pad或PC端自适应居中 */
  margin: 0 auto;
  width: 100%;
  background: #fff;
  position: relative;
  box-shadow: var(--shadow-md);
}

/* 顶部信息栏 */
.shop-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 14px 8px;
  flex-shrink: 0;
  z-index: 10;
}

.shop-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-title-wrap h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.table-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid #fed7aa;
}

.table-badge .edit-hint {
  font-size: 0.75rem;
  opacity: 0.7;
}

.my-order-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-size: 0.8rem;
  padding: 6px 10px;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  font-weight: 500;
}

.my-order-btn .badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--price-color);
  color: #fff;
  font-size: 0.65rem;
  border-radius: 10px;
  padding: 1px 5px;
  font-weight: bold;
}

.notice-bar {
  margin-top: 8px;
  background: #fffbeb;
  border: 1px solid #fef3c7;
  color: #b45309;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 主菜单区域双列布局 */
.menu-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* 左侧分类侧边栏 */
.category-sidebar {
  width: 88px;
  background: #f8fafc;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  flex-shrink: 0;
  padding-bottom: 70px;
  -webkit-overflow-scrolling: touch;
}

.category-item {
  padding: 14px 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  word-break: break-all;
  user-select: none;
}

.category-item.active {
  background: #ffffff;
  color: var(--primary-color);
  font-weight: 600;
  border-left-color: var(--primary-color);
}

.category-item .cat-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--primary-color);
  color: #fff;
  font-size: 0.6rem;
  border-radius: 8px;
  padding: 0 4px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
}

/* 右侧菜品滚动区域 */
.dish-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 80px 10px;
  background: #ffffff;
  -webkit-overflow-scrolling: touch;
}

.search-box {
  margin-bottom: 8px;
}

.search-box input {
  width: 100%;
  padding: 7px 12px;
  border-radius: 18px;
  border: 1px solid var(--border-color);
  font-size: 0.82rem;
  outline: none;
  background: #f8fafc;
}

.search-box input:focus {
  border-color: var(--primary-color);
  background: #fff;
}

.category-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 8px 0 6px;
  border-bottom: 1px dashed #f1f5f9;
  margin-bottom: 6px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}

/* 菜品单品卡片 */
.dish-card {
  display: flex;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 10px;
  position: relative;
}

.dish-card.sold-out {
  opacity: 0.55;
}

.dish-thumb {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.dish-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sold-out-badge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 0.75rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dish-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dish-header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.dish-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
}

.dish-tag {
  font-size: 0.65rem;
  color: #fff;
  background: #ef4444;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 500;
}

.dish-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dish-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 6px;
}

.dish-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.currency {
  font-size: 0.8rem;
  color: var(--price-color);
  font-weight: 700;
}

.price {
  font-size: 1.1rem;
  color: var(--price-color);
  font-weight: 700;
}

.unit {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.origin-price {
  font-size: 0.7rem;
  color: #94a3b8;
  text-decoration: line-through;
}

/* 加减数量控件 */
.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.step-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.1s active;
}

.step-btn.minus {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.step-btn.plus {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 2px 4px rgba(234, 88, 12, 0.3);
}

.step-btn:active {
  transform: scale(0.9);
}

.step-count {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 18px;
  text-align: center;
}

/* 底部悬浮购物车栏 */
.cart-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  z-index: 50;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.15);
}

.cart-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  flex: 1;
}

.cart-icon-wrap {
  position: relative;
  width: 46px;
  height: 46px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  margin-top: -16px;
  box-shadow: 0 4px 10px rgba(234, 88, 12, 0.4);
  border: 3px solid #1e293b;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--price-color);
  color: #fff;
  font-size: 0.7rem;
  font-weight: bold;
  border-radius: 10px;
  padding: 1px 6px;
  border: 1px solid #fff;
}

.cart-price-info .total-price {
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 700;
}

.cart-price-info .price-tip {
  color: #94a3b8;
  font-size: 0.7rem;
}

.checkout-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.checkout-btn:disabled {
  background: #475569;
  color: #94a3b8;
  cursor: not-allowed;
}

/* 抽屉与弹窗遮罩 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-overlay.active {
  display: flex;
}

.cart-drawer {
  background: #fff;
  width: 100%;
  max-width: 540px;
  border-radius: 16px 16px 0 0;
  padding: 16px 16px 20px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.drawer-title {
  font-size: 1rem;
  font-weight: 700;
}

.drawer-title .selected-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 6px;
}

.clear-cart-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.cart-items-list {
  overflow-y: auto;
  max-height: 38vh;
  padding: 8px 0;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed #f1f5f9;
}

.cart-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
}

.cart-item-price {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--price-color);
  margin: 0 16px;
}

/* 备注偏好区 */
.order-notes-section {
  padding: 12px 0;
  border-top: 1px solid var(--border-color);
}

.notes-title {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-chip {
  font-size: 0.75rem;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}

.tag-chip.selected {
  background: var(--primary-light);
  color: var(--primary-color);
  border-color: var(--primary-color);
  font-weight: 500;
}

.note-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
}

.note-input:focus {
  border-color: var(--primary-color);
}

.drawer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.footer-summary .sum-price {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--price-color);
  margin-left: 4px;
}

.confirm-order-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 11px 26px;
  border-radius: 22px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

/* 桌号选择弹窗 */
.modal-dialog {
  background: #fff;
  width: 90%;
  max-width: 440px;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: auto;
  margin-top: auto;
  animation: popIn 0.2s ease-out;
}

@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.dialog-header h3 {
  font-size: 1.05rem;
  text-align: center;
  margin-bottom: 6px;
}

.dialog-tip {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 14px;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}

.table-cell-btn {
  padding: 12px 6px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.table-cell-btn.active {
  background: var(--primary-light);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.dialog-footer {
  margin-top: 16px;
  text-align: center;
}

.dialog-close-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 8px 30px;
  border-radius: 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

/* 订单进度追踪 Sheet */
.order-sheet {
  background: #fff;
  width: 100%;
  max-width: 540px;
  border-radius: 16px 16px 0 0;
  padding: 18px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease-out;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.sheet-close-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.sheet-body {
  overflow-y: auto;
  padding: 14px 0;
}

.order-progress-stepper {
  display: flex;
  justify-content: space-between;
  margin: 10px 0 20px;
  position: relative;
}

.step-node {
  text-align: center;
  flex: 1;
  font-size: 0.75rem;
  color: #94a3b8;
  position: relative;
}

.step-node .node-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  font-size: 0.7rem;
  font-weight: bold;
}

.step-node.done {
  color: var(--text-main);
}

.step-node.done .node-dot {
  background: var(--success-color);
}

.step-node.current {
  color: var(--primary-color);
  font-weight: 700;
}

.step-node.current .node-dot {
  background: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.add-dish-btn {
  display: block;
  width: 100%;
  background: var(--primary-light);
  color: var(--primary-color);
  border: 1px dashed var(--primary-color);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 14px;
  cursor: pointer;
  text-align: center;
}

.loading-state {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
