/* 茶仙慢慢 H5 点餐 - 手机端样式 */
:root {
  --primary: #4a7c59;
  --primary-dark: #3a6347;
  --accent: #d55b5b;
  --bg: #f8f6f0;
  --card-bg: #fff;
  --text: #333;
  --text-light: #888;
  --border: #e8e3d8;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 80px;
  -webkit-tap-highlight-color: transparent;
}

/* ── 顶部 ── */
.header {
  position: sticky; top:0; z-index:100;
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 { font-size:18px; font-weight:600; }

/* ── 底部购物车栏 ── */
.bottom-cart-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 150;
  background: #fff;
  display: flex; align-items: center;
  padding: 8px 12px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.cart-bar-left {
  margin-right: 10px;
}
.cart-icon-wrap {
  position: relative; width: 44px; height: 44px;
  background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.cart-icon-big { font-size: 22px; }
.cart-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--accent); color: #fff;
  font-size: 11px; min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.cart-bar-center {
  flex: 1;
}
.cart-bar-text {
  font-size: 14px; color: var(--text);
}
.cart-bar-text span {
  font-size: 18px; font-weight: 700; color: var(--accent);
}
.cart-bar-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none;
  padding: 12px 24px; border-radius: 25px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.cart-bar-btn:active { opacity: 0.85; }

/* ── 分类标签（左侧纵向） ── */
#category-nav {
  position: fixed; left: 0; top: 48px; bottom: 70px; z-index: 99;
  width: 80px;
  background: #f5f2eb;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
#category-nav::-webkit-scrollbar { display:none; }

.tabs-vertical {
  display: flex; flex-direction: column;
  padding: 8px 0;
  gap: 2px;
}

.tab-btn {
  white-space: nowrap;
  padding: 10px 8px;
  border: none; border-radius: 0;
  background: transparent;
  font-size: 13px; color: var(--text-light);
  cursor: pointer; transition: all 0.15s;
  text-align: center;
  line-height: 1.3;
}
.tab-btn.active {
  background: #fff;
  color: var(--primary); font-weight: 600;
  border-left: 3px solid var(--primary);
}
.tab-btn:active { background: rgba(74,124,89,0.08); }

/* ── 产品网格 ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 12px;
  margin-left: 80px;
}

.product-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.product-card:active { transform: scale(0.97); }

.product-img {
  width: 100%; aspect-ratio: 1;
  object-fit: contain; background: #fff;
  display: block;
}
.product-info { padding: 10px; }
.product-name {
  font-size: 14px; font-weight: 500;
  line-height: 1.3; margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
/* ── 产品卡片底部 ── */
/* ── 产品卡片底部 ── */
/* ── 产品卡片底部 ── */
.product-bottom {
  display: flex; align-items: center;
  justify-content: space-between;
}

/* 操作区容器 */
.product-actions {
  position: relative;
  min-width: 90px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* + 按钮（数量为0时显示） */
.btn-add {
  width: 30px; height: 30px;
  border-radius: 50%; border: none;
  background: var(--primary); color: #fff;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
  position: absolute;
  right: 0;
}
.btn-add.hidden { display: none !important; }
.btn-add:active { background: var(--primary-dark); }
.product-price {
  color: var(--accent); font-weight: 700; font-size: 16px;
}
.product-price::before { content: '¥'; font-size: 12px; }

/* ── 数量控制（产品卡片） ── */
.qty-control {
  display: flex; align-items: center; gap: 6px;
  position: absolute;
  right: 0;
}
.qty-control.hidden { display: none !important; }
.qty-btn-sm {
  width: 28px; height: 28px;
  border-radius: 50%; border: 1px solid var(--border);
  background: #fff; font-size: 16px;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  color: var(--text);
  flex-shrink: 0;
}
.qty-btn-sm:active { background: #f0ede5; }
.qty-num-sm {
  min-width: 24px; text-align: center;
  font-size: 14px; font-weight: 600;
  flex-shrink: 0;
}

/* ── 购物车面板 ── */
.cart-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: none;
}
.cart-overlay.show { display: block; }

.cart-panel {
  position: fixed; right: 0; top: 0; bottom: 0; z-index: 201;
  width: 85%; max-width: 360px;
  background: #fff; transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.cart-panel.show { transform: translateX(0); }

.cart-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.cart-header h3 { font-size: 16px; }

.btn-close { background: none; border: none; font-size: 20px; color: var(--text-light); cursor: pointer; }

.cart-items {
  flex: 1; overflow-y: auto; padding: 12px;
}
.cart-empty { text-align: center; color: var(--text-light); padding: 40px 0; font-size: 14px; }

.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid #f0ede5;
}
.cart-item-img {
  width: 48px; height: 48px; border-radius: 8px;
  object-fit: cover; background: #f0ede5; flex-shrink: 0;
}
.cart-item-info { flex:1; min-width:0; }
.cart-item-name { font-size: 13px; line-height: 1.3; }
.cart-item-price { font-size: 12px; color: var(--accent); margin-top: 2px; }
.cart-item-qty {
  display: flex; align-items: center; gap: 6px;
}
.qty-btn {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: #fff;
  font-size: 14px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.qty-num { font-size: 14px; min-width: 20px; text-align: center; }

.cart-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.cart-total { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.cart-total span { color: var(--accent); font-size: 20px; }

.btn-order {
  width: 100%; padding: 12px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 10px;
  font-size: 16px; font-weight: 600; cursor: pointer;
}

/* ── 订单表单弹窗 ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.4);
  display: none;
}
.modal-overlay.show { display: block; }

.modal {
  position: fixed; left: 12px; right: 12px; bottom: 20px; z-index: 301;
  background: #fff; border-radius: 16px;
  max-height: 80vh; overflow-y: auto;
  display: none;
}
.modal.show { display: block; }

.modal-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; }

.modal-body { padding: 16px; }
.modal-body label {
  display: block; font-size: 13px; color: var(--text-light);
  margin-bottom: 4px; margin-top: 12px;
}
.modal-body label:first-of-type { margin-top: 0; }
.modal-body input, .modal-body textarea {
  width: 100%; padding: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; outline: none;
  font-family: inherit;
}
.modal-body input:focus, .modal-body textarea:focus {
  border-color: var(--primary);
}

.order-summary {
  background: var(--bg); border-radius: 8px; padding: 10px;
  font-size: 13px; margin-bottom: 12px;
}
.order-summary-item { display: flex; justify-content: space-between; padding: 2px 0; }
.order-summary-total {
  border-top: 1px dashed var(--border);
  padding-top: 6px; margin-top: 6px;
  font-weight: 700; display: flex; justify-content: space-between;
}

.modal-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

.btn-cancel {
  padding: 10px 20px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff;
  font-size: 14px; cursor: pointer;
}
.btn-submit {
  padding: 10px 20px; border-radius: 8px;
  border: none; background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ── Toast ── */
.toast {
  position: fixed; top: 80px; left: 50%; z-index: 999;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75); color: #fff;
  padding: 10px 24px; border-radius: 20px;
  font-size: 14px; pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
