/* ============================================
   顾客点餐端 - 重制版 UI
   深海蓝 · 海洋色系
   ============================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --o50: #e0f2fe;
  --o100: #bae6fd;
  --o500: #0ea5e9;
  --o600: #0284c7;
  --o700: #0369a1;
  --a500: #38bdf8;
  --r50: #fef2f2;
  --r500: #ef4444;
  --sl50: #f8fafc;
  --sl100: #f1f5f9;
  --sl200: #e2e8f0;
  --sl300: #cbd5e1;
  --sl400: #94a3b8;
  --sl500: #64748b;
  --sl600: #475569;
  --sl700: #334155;
  --sl800: #1e293b;
  --sl900: #0f172a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f0f4f8;
  color: var(--sl800);
  min-height: 100vh;
  max-width: 500px;
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  display: flex; flex-direction: column; min-height: 100vh;
  background: white;
  box-shadow: 0 0 40px rgba(0,0,0,0.08);
}

/* 顶部 */
.header {
  background: linear-gradient(135deg, #0369a1 0%, #0284c7 40%, #0ea5e9 100%);
  color: white; padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
.header::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 1px; background: rgba(255,255,255,0.1);
}
.header h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; }
.table-info {
  font-size: 13px; background: rgba(255,255,255,0.15);
  padding: 6px 14px; border-radius: 20px;
  font-weight: 600; letter-spacing: 0.5px;
}

/* 分类导航 */
.category-nav {
  display: flex; overflow-x: auto;
  background: white; border-bottom: 1px solid var(--sl100);
  padding: 12px 16px; gap: 8px;
  position: sticky; top: 60px; z-index: 9;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }

.category-item {
  white-space: nowrap; padding: 8px 18px;
  background: var(--sl100); border-radius: 20px;
  font-size: 13px; color: var(--sl500); font-weight: 500;
  cursor: pointer; transition: all 0.25s;
  border: 1.5px solid transparent;
}
.category-item.active {
  background: linear-gradient(135deg, var(--o600), var(--o500));
  color: white; font-weight: 600;
  box-shadow: 0 2px 8px rgba(249,115,22,0.25);
}

/* 主内容区 */
.main-content {
  flex: 1; padding: 16px; overflow-y: auto;
  padding-bottom: 90px; background: #fafafa;
}

.dishes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
}

.dish-card { cursor: pointer;
  background: white; border-radius: 16px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.2s;
  border: 1px solid rgba(0,0,0,0.04);
}
.dish-card:active { transform: scale(0.98); }

.dish-image {
  width: 100%; height: 130px; overflow: hidden;
  background: linear-gradient(135deg, var(--sl100), var(--sl200));
  position: relative;
}
.dish-image::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 30px; background: linear-gradient(transparent, rgba(0,0,0,0.03));
}
.dish-image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.3s;
}
.dish-card:hover .dish-image img { transform: scale(1.05); }

.dish-info { padding: 12px 14px; }

.dish-name {
  font-size: 14px; font-weight: 700; color: var(--sl900);
  margin-bottom: 4px; line-height: 1.3;
}

.dish-description {
  font-size: 11px; color: var(--sl400);
  margin-bottom: 10px; overflow: hidden;
  text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.5; min-height: 33px;
}

.dish-bottom {
  display: flex; justify-content: space-between; align-items: center;
}

.dish-price {
  font-size: 17px; font-weight: 800; color: var(--o600);
}
/* 添加按钮 */
.add-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--o600), var(--o500));
  color: white; border: none; font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; box-shadow: 0 2px 6px rgba(249,115,22,0.25);
}
.add-btn:active { transform: scale(0.9); background: var(--o700); }

/* 数量控制 */
.quantity-controls {
  display: flex; align-items: center; gap: 6px;
}
.quantity-controls button {
  width: 26px; height: 26px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.quantity-controls .minus {
  background: var(--sl100); color: var(--sl500);
  font-weight: 700;
}
.quantity-controls .minus:active { background: var(--sl200); }
.quantity-controls .plus {
  background: linear-gradient(135deg, var(--o600), var(--o500));
  color: white; font-weight: 700;
}
.quantity-controls .plus:active { background: var(--o700); }
.quantity-controls span {
  min-width: 22px; text-align: center;
  font-weight: 700; font-size: 15px; color: var(--sl800);
}

/* 购物车底部栏 */
.cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: white; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.06);
  max-width: 500px; margin: 0 auto;
  z-index: 20;
}

.cart-info { display: flex; align-items: center; gap: 8px; }
.cart-icon { font-size: 26px; }
.cart-count {
  background: var(--r500); color: white;
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  min-width: 20px; text-align: center; font-weight: 700;
  position: relative; top: -8px; left: -14px;
}
.cart-total {
  font-size: 16px; font-weight: 700; color: var(--sl900);
  margin-left: 4px;
}

.checkout-btn {
  background: linear-gradient(135deg, var(--o600), var(--o500));
  color: white; border: none; padding: 12px 28px;
  border-radius: 24px; font-size: 15px; font-weight: 700;
  cursor: pointer; transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(249,115,22,0.3);
  letter-spacing: 0.3px;
}
.checkout-btn:active { transform: scale(0.97); opacity: 0.9; }
.checkout-btn:disabled { opacity: 0.4; box-shadow: none; cursor: default; }

/* 弹窗 */
.modal {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15,23,42,0.5); z-index: 1000;
  align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal.show { display: flex; }

.modal-content {
  background: white; width: 100%; max-width: 500px;
  border-radius: 24px 24px 0 0; max-height: 85vh;
  overflow-y: auto; box-shadow: 0 -4px 30px rgba(0,0,0,0.1);
}

.modal-header {
  padding: 22px 24px; border-bottom: 1px solid var(--sl100);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: white; z-index: 5;
  border-radius: 24px 24px 0 0;
}
.modal-header h2 { font-size: 18px; font-weight: 800; color: var(--sl900); }

.close-btn {
  background: var(--sl100); border: none; font-size: 20px;
  color: var(--sl500); cursor: pointer; padding: 0;
  line-height: 1; width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.close-btn:hover { background: var(--sl200); color: var(--sl800); }

.modal-body { padding: 20px 24px; }

.cart-items { margin-bottom: 20px; }

.cart-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--sl50);
}
.cart-item:last-child { border-bottom: none; }

.cart-item-name {
  font-size: 15px; font-weight: 600; color: var(--sl800);
  flex: 1;
}

.cart-item-price {
  font-size: 15px; font-weight: 700; color: var(--o600);
  margin-left: 12px;
}

.remark-input { margin-bottom: 20px; }
.remark-input label {
  display: block; margin-bottom: 8px;
  font-size: 13px; font-weight: 700; color: var(--sl600);
}
.remark-input textarea {
  width: 100%; padding: 12px 16px;
  border: 1.5px solid var(--sl200); border-radius: 14px;
  font-size: 14px; resize: vertical; min-height: 70px;
  font-family: inherit; outline: none; transition: border-color 0.2s;
  background: var(--sl50);
}
.remark-input textarea:focus {
  border-color: var(--o500);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.1);
}

.total-section {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 14px; border-top: 2px solid var(--o500);
  font-size: 16px; font-weight: 700; color: var(--sl800);
}
.total-price { color: var(--r500); font-size: 24px; font-weight: 800; }

.modal-footer {
  padding: 16px 24px 28px;
  display: flex; gap: 12px;
}
.modal-footer .btn {
  flex: 1; padding: 14px; border-radius: 16px;
  border: none; font-size: 16px; font-weight: 700; cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary {
  background: var(--sl100); color: var(--sl600);
}
.btn-secondary:active { background: var(--sl200); }

.btn-primary {
  background: linear-gradient(135deg, var(--o600), var(--o500));
  color: white;
  box-shadow: 0 4px 12px rgba(249,115,22,0.25);
}
.btn-primary:active { opacity: 0.9; transform: scale(0.98); }

/* 提示 */
.toast {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(15,23,42,0.85); color: white;
  padding: 16px 28px; border-radius: 14px;
  font-size: 15px; font-weight: 600;
  z-index: 2000; display: none;
  backdrop-filter: blur(8px);
  letter-spacing: 0.3px;
}

/* 响应式 */
@media (min-width: 768px) {
  .dishes-grid { grid-template-columns: repeat(2, 1fr); }
}
