/* ===== 顾客端 / 商家端 通用样式 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f5f5f5;
  color: #222;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
input, select, textarea {
  font: inherit;
}

/* ===== 顾客端（手机/平板）===== */
#app { min-height: 100%; }

.header {
  background: #ff6b35;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.header h1 { font-size: 18px; font-weight: 600; }
.header .table-no { font-size: 14px; opacity: 0.95; }

.page { padding: 16px; padding-bottom: 80px; }

.category-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  position: sticky;
  top: 50px;
  z-index: 9;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
}
.category-tab {
  padding: 6px 14px;
  border-radius: 20px;
  background: #f0f0f0;
  font-size: 14px;
  white-space: nowrap;
  transition: all 0.2s;
}
.category-tab.active {
  background: #ff6b35;
  color: #fff;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px;
}
.menu-item {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.15s;
}
.menu-item:active { transform: scale(0.97); }
.menu-item .emoji {
  font-size: 48px;
  text-align: center;
  padding: 16px 0 8px;
  background: #fafafa;
}
.menu-item .item-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #fafafa;
  display: block;
}
.menu-item .info { padding: 8px 10px; }
.menu-item .name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.menu-item .price { color: #ff6b35; font-weight: 700; font-size: 15px; }

.cart-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #2c2c2c;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 20;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
}
.cart-bar .count {
  background: #ff6b35;
  border-radius: 50%;
  min-width: 22px;
  height: 22px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
}
.cart-bar .total { font-size: 18px; font-weight: 700; }
.cart-bar .checkout {
  background: #ff6b35;
  padding: 10px 22px;
  border-radius: 24px;
  font-weight: 600;
}
.cart-bar .checkout:disabled {
  background: #666;
  cursor: not-allowed;
}

/* ===== 购物车 / 订单详情 ===== */
.cart-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.cart-item .emoji { font-size: 32px; }
.cart-item .item-img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.cart-item .info { flex: 1; }
.cart-item .name { font-size: 15px; font-weight: 600; }
.cart-item .price { color: #ff6b35; font-size: 14px; }
.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-control button {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #f0f0f0;
  font-size: 16px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qty-control .qty { min-width: 24px; text-align: center; }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}
.empty .big-emoji { font-size: 64px; margin-bottom: 12px; }

.btn-primary {
  background: #ff6b35;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  width: 100%;
  font-size: 16px;
}
.btn-primary:disabled { background: #ccc; }
.btn-secondary {
  background: #f0f0f0;
  color: #333;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
}

.summary {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.summary .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}
.summary .total {
  border-top: 1px dashed #ddd;
  margin-top: 6px;
  padding-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #ff6b35;
}

/* ===== 欢迎页（选桌号）===== */
.welcome {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
  color: #fff;
}
.welcome h1 { font-size: 32px; margin-bottom: 12px; }
.welcome p { opacity: 0.9; margin-bottom: 36px; }
.table-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 360px;
}
.table-btn {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.2);
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 16px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.table-btn:hover, .table-btn:active {
  background: rgba(255,255,255,0.35);
  transform: scale(0.97);
}
.welcome .admin-link {
  margin-top: 32px;
  font-size: 14px;
  opacity: 0.8;
  text-decoration: underline;
}

/* ===== 商家端 ===== */
.admin-layout {
  min-height: 100vh;
  background: #f5f5f5;
}
.admin-nav {
  background: #2c2c2c;
  color: #fff;
  padding: 0 16px;
  display: flex;
  gap: 4px;
}
.admin-nav a {
  color: #fff;
  text-decoration: none;
  padding: 14px 16px;
  font-size: 15px;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}
.admin-nav a.active { border-bottom-color: #ff6b35; }
.admin-nav a:hover { background: rgba(255,255,255,0.05); }

.admin-content { padding: 20px; max-width: 1000px; margin: 0 auto; }

.login-box {
  max-width: 360px;
  margin: 80px auto;
  background: #fff;
  padding: 32px 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.login-box h2 { margin-bottom: 20px; text-align: center; }
.login-box input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 15px;
}
.login-box .hint {
  font-size: 12px;
  color: #999;
  text-align: center;
  margin-top: 8px;
}

.order-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.order-card.new {
  border-left: 4px solid #ff6b35;
  animation: pulse 1.5s ease-in-out 2;
}
@keyframes pulse {
  0%, 100% { background: #fff; }
  50% { background: #fff5f0; }
}
.order-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px dashed #eee;
}
.order-no { font-weight: 700; font-size: 16px; }
.order-meta { font-size: 12px; color: #999; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-new { background: #ff6b35; color: #fff; }
.badge-done { background: #4caf50; color: #fff; }
.badge-old { background: #e0e0e0; color: #666; }

.order-items { margin-bottom: 12px; }
.order-items .row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 14px;
}
.order-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.order-actions button {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
}
.btn-print { background: #ff6b35; color: #fff; }
.btn-done { background: #4caf50; color: #fff; }
.btn-reset { background: #f0f0f0; color: #333; }

/* ===== 菜单管理 ===== */
.menu-edit-list {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.menu-edit-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}
.menu-edit-item:last-child { border-bottom: none; }
.menu-edit-item .emoji-input {
  width: 50px;
  text-align: center;
  font-size: 24px;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px;
}
.menu-edit-item .name-input { flex: 1; }
.menu-edit-item .price-input { width: 80px; }
.menu-edit-item input {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 14px;
}
.menu-edit-item .del-btn {
  background: #ff4444;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
}

/* 菜品图片 (管理端缩略图 + 上传按钮) */
.item-img-upload {
  position: relative;
  cursor: pointer;
  display: block;
  flex-shrink: 0;
}
.item-img-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.item-edit-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
}
.item-edit-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-edit-empty {
  color: #999;
  background: #fafafa;
}

.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  max-width: 360px;
  margin: 0 auto;
}
.qr-box h3 { margin-bottom: 16px; }
#qrcode { display: inline-block; margin: 16px 0; }
.qr-hint { font-size: 13px; color: #666; margin-top: 12px; }

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #ddd;
}
.tabs button {
  padding: 10px 16px;
  font-size: 14px;
  color: #666;
  border-bottom: 2px solid transparent;
}
.tabs button.active { color: #ff6b35; border-bottom-color: #ff6b35; font-weight: 600; }

.empty-orders {
  text-align: center;
  padding: 80px 20px;
  color: #999;
}
.empty-orders .big-emoji { font-size: 64px; margin-bottom: 16px; }
