/* 龙慧云空中超市 H5 平台 - 全局样式 */
/* 品牌主色: #C42528 | 辅助: 白/灰 | 字体: 系统黑体 */

:root {
  --primary: #C42528;
  --primary-dark: #A01E21;
  --primary-light: #FDE8E9;
  --bg: #F5F5F5;
  --bg-white: #FFFFFF;
  --text: #1A1A1A;
  --text-secondary: #666666;
  --text-light: #999999;
  --border: #E5E5E5;
  --border-light: #F0F0F0;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 20px rgba(0,0,0,0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
  --header-h: 48px;
  --tab-h: 56px;
  --max-w: 480px;
}

* { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: var(--max-w);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 8px);
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
input, textarea, select, button { font-family: inherit; font-size: inherit; outline: none; }
button { cursor: pointer; border: none; -webkit-tap-highlight-color: transparent; }

/* ── 通用组件 ── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-white);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--border-light);
}
.header-title { font-size: 17px; font-weight: 600; color: var(--text); }
.header-back {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; font-size: 20px; color: var(--text);
}
.header-action {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--primary); background: none; padding: 4px 8px;
}

.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-w);
  height: var(--tab-h);
  background: var(--bg-white);
  border-top: 1px solid var(--border-light);
  display: flex; z-index: 200;
  padding-bottom: var(--safe-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-light);
  background: none; gap: 2px;
}
.tab-item.active { color: var(--primary); }
.tab-icon { font-size: 22px; line-height: 1; }

.page { display: none; padding: 0 12px 20px; }
.page.active { display: block; }
.page-title {
  font-size: 18px; font-weight: 700; color: var(--text);
  padding: 16px 0 12px;
}

/* ── 卡片 ── */
.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.card-row { display: flex; gap: 12px; }
.card-clickable { cursor: pointer; transition: transform .15s; }
.card-clickable:active { transform: scale(.98); }

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 500;
  transition: all .2s; white-space: nowrap;
}
.btn:active { transform: scale(.97); opacity: .85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; font-weight: 600; }
.btn-block { display: flex; width: 100%; }
.btn-disabled { background: #ccc; color: #999; pointer-events: none; }

/* ── 表单 ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-label .required { color: var(--primary); margin-left: 2px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 15px; color: var(--text); background: var(--bg-white);
  transition: border .2s;
}
.form-input:focus, .form-textarea:focus { border-color: var(--primary); }
.form-textarea { min-height: 80px; resize: vertical; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23999' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-tip { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ── 搜索栏 ── */
.search-bar {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--bg-white); position: sticky; top: 0; z-index: 99;
}
.search-bar input {
  flex: 1; padding: 8px 14px; border: 1px solid var(--border); border-radius: 20px;
  font-size: 14px; background: var(--bg);
}
.search-bar .btn-search {
  padding: 8px 16px; border-radius: 20px;
  background: var(--primary); color: #fff; font-size: 14px;
}

/* ── 分类网格 ── */
.cat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 0; }
.cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; background: var(--bg-white); border-radius: var(--radius-sm);
  cursor: pointer; transition: all .15s;
}
.cat-item:active { background: var(--primary-light); }
.cat-item .cat-icon { font-size: 28px; }
.cat-item .cat-name { font-size: 11px; color: var(--text-secondary); text-align: center; }

/* ── 商家/商品卡片 ── */
.merchant-card {
  background: var(--bg-white); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 10px; box-shadow: var(--shadow);
}
.merchant-cover {
  width: 100%; height: 140px; object-fit: cover; background: #eee;
}
.merchant-info { padding: 12px; }
.merchant-name {
  font-size: 16px; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.merchant-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 3px;
  background: var(--primary-light); color: var(--primary);
}
.merchant-addr { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.merchant-intro { font-size: 13px; color: var(--text-secondary); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.merchant-stats { display: flex; gap: 12px; margin-top: 8px; }
.merchant-stats span { font-size: 12px; color: var(--text-light); }

.product-card {
  background: var(--bg-white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: pointer;
}
.product-card:active { transform: scale(.98); }
.product-image {
  width: 100%; height: 160px; object-fit: cover; background: #eee;
}
.product-info { padding: 10px; }
.product-name { font-size: 14px; font-weight: 500; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-size: 17px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.product-price .original { font-size: 12px; color: var(--text-light); text-decoration: line-through; margin-left: 6px; }
.product-sales { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
}

/* ── 排序栏 ── */
.sort-bar {
  display: flex; gap: 4px; padding: 8px 0; overflow-x: auto;
}
.sort-bar::-webkit-scrollbar { display: none; }
.sort-tag {
  padding: 6px 14px; border-radius: 16px; font-size: 13px;
  background: var(--bg-white); color: var(--text-secondary);
  white-space: nowrap; border: 1px solid var(--border);
}
.sort-tag.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── 空状态 ── */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ── 标签/徽章 ── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-warning { background: #FFF3E0; color: #E65100; }
.badge-danger { background: #FFEBEE; color: #C62828; }
.badge-gray { background: #F5F5F5; color: #999; }

/* ── Toast ── */
.toast {
  position: fixed; top: 60px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 22px;
  border-radius: 20px; font-size: 14px; z-index: 9999;
  animation: toastIn .3s ease;
  pointer-events: none; max-width: 90%; text-align: center;
}
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(-10px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }

/* ── 模态框 ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 500;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-content {
  background: var(--bg-white); width: 100%; max-width: var(--max-w);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 16px calc(20px + var(--safe-bottom));
  animation: modalUp .3s ease;
}
@keyframes modalUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-title { font-size: 17px; font-weight: 600; text-align: center; margin-bottom: 16px; }

/* ── 订单状态步骤 ── */
.order-steps { display: flex; justify-content: space-between; padding: 16px 0; position: relative; }
.order-steps::before {
  content: ''; position: absolute; top: 26px; left: 10%; right: 10%; height: 2px; background: var(--border);
  z-index: 0;
}
.order-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  position: relative; z-index: 1; flex: 1;
}
.order-step .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--border);
}
.order-step.active .dot { background: var(--primary); }
.order-step .label { font-size: 11px; color: var(--text-light); }
.order-step.active .label { color: var(--primary); font-weight: 500; }

/* ── 购物车 ── */
.cart-item {
  display: flex; gap: 10px; padding: 12px; background: var(--bg-white);
  border-radius: var(--radius); margin-bottom: 8px; box-shadow: var(--shadow);
}
.cart-item-img { width: 80px; height: 80px; border-radius: var(--radius-sm); object-fit: cover; background: #eee; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 14px; font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item-price { font-size: 16px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.cart-item-qty { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.cart-item-qty button {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg); color: var(--text); font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.cart-item-qty span { font-size: 15px; min-width: 24px; text-align: center; }

/* ── 底部结算栏 ── */
.checkout-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--max-w);
  background: var(--bg-white); border-top: 1px solid var(--border-light);
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
  z-index: 200; padding-bottom: calc(10px + var(--safe-bottom));
}
.checkout-bar .total { flex: 1; }
.checkout-bar .total-label { font-size: 12px; color: var(--text-light); }
.checkout-bar .total-price { font-size: 20px; font-weight: 700; color: var(--primary); }
.checkout-bar .btn { min-width: 110px; }

/* ── 管理后台侧边 ── */
.admin-menu {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px;
  padding: 12px 0;
}
.admin-menu-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; background: var(--bg-white); border-radius: var(--radius);
  cursor: pointer; box-shadow: var(--shadow);
}
.admin-menu-item:active { background: var(--primary-light); }
.admin-menu-item .icon { font-size: 28px; }
.admin-menu-item .label { font-size: 12px; color: var(--text-secondary); }

/* ── 数字输入箭头样式 ── */
.stat-card {
  background: var(--bg-white); border-radius: var(--radius);
  padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .label { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }

/* ── 商家入驻进度 ── */
.reg-steps { display: flex; flex-direction: column; gap: 0; padding: 16px 0; }
.reg-step { display: flex; gap: 10px; align-items: flex-start; padding-bottom: 16px; position: relative; }
.reg-step::after {
  content: ''; position: absolute; left: 11px; top: 28px; bottom: 0; width: 2px;
  background: var(--border);
}
.reg-step:last-child::after { display: none; }
.reg-step .dot {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; position: relative; z-index: 1;
}
.reg-step.done .dot { background: var(--primary); }
.reg-step.active .dot { background: var(--primary); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(196,37,40,.4); } 50% { box-shadow: 0 0 0 8px rgba(196,37,40,0); } }
.reg-step-info { flex: 1; }
.reg-step-title { font-size: 14px; font-weight: 500; }
.reg-step-desc { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ── 开关 ── */
.toggle {
  width: 46px; height: 26px; border-radius: 13px; background: var(--border);
  position: relative; cursor: pointer; transition: background .2s;
}
.toggle.on { background: var(--primary); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  transition: transform .2s;
}
.toggle.on::after { transform: translateX(20px); }

/* ── 图片上传 ── */
.upload-box {
  width: 100%; min-height: 120px; border: 2px dashed var(--border);
  border-radius: var(--radius); display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 6px; cursor: pointer; color: var(--text-light);
  font-size: 13px; transition: border .2s;
}
.upload-box:hover, .upload-box:active { border-color: var(--primary); }
.upload-box .icon { font-size: 32px; }
.upload-preview { width: 100%; max-height: 200px; object-fit: cover; border-radius: var(--radius); }

/* ── 配送标签 ── */
.delivery-tags { display: flex; gap: 6px; margin-top: 6px; }
.delivery-tag { padding: 2px 8px; border-radius: 3px; font-size: 11px; background: #E3F2FD; color: #1565C0; }

/* ── 辅助工具类 ── */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-small { font-size: 12px; color: var(--text-light); }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

/* ── 信息行 ── */
.info-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--border-light); font-size: 14px;
}
.info-row:last-child { border-bottom: none; }
.info-row .label { color: var(--text-secondary); }
.info-row .value { color: var(--text); font-weight: 500; text-align: right; }

/* ── 名片预览 ── */
.card-preview {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-lg); padding: 20px; color: #fff;
  position: relative; overflow: hidden;
}
.card-preview::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.card-preview .cp-logo {
  width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 10px; overflow: hidden;
}
.cp-logo img { width: 100%; height: 100%; object-fit: cover; }
.card-preview .cp-name { font-size: 20px; font-weight: 700; }
.card-preview .cp-title { font-size: 13px; opacity: .85; margin-top: 2px; }
.card-preview .cp-intro { font-size: 12px; opacity: .7; margin-top: 6px; }
.card-preview .cp-actions { display: flex; gap: 8px; margin-top: 12px; }
.cp-action {
  padding: 6px 14px; border-radius: 20px; font-size: 12px;
  background: rgba(255,255,255,.2); color: #fff;
}

/* ── Logo/Dashboard头部 ── */
.brand-bar {
  background: var(--primary); color: #fff; padding: 16px;
  border-radius: var(--radius); margin-bottom: 12px;
}
.brand-bar .brand-name { font-size: 20px; font-weight: 700; }
.brand-bar .brand-slogan { font-size: 12px; opacity: .85; margin-top: 4px; }
.brand-bar .brand-stats { display: flex; gap: 16px; margin-top: 10px; }
.brand-stat { text-align: center; }
.brand-stat .num { font-size: 18px; font-weight: 700; }
.brand-stat .txt { font-size: 11px; opacity: .8; }

/* ── 响应式微调 ── */
@media (min-width: 481px) {
  body { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .tab-bar { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}

/* ── 隐藏项 ── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════
   物流追踪时间线
   ═══════════════════════════════════════ */
.logistics-timeline {
  position: relative;
  padding-left: 24px;
}
.logistics-step {
  position: relative;
  padding-bottom: 20px;
}
.logistics-step:last-child { padding-bottom: 0; }
.logistics-dot {
  position: absolute; left: -24px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--primary-light);
  z-index: 2;
}
.logistics-step.active .logistics-dot {
  background: #4caf50; border-color: #c8e6c9; box-shadow: 0 0 0 4px rgba(76,175,80,.2);
}
.logistics-line {
  position: absolute; left: -19px; top: 16px;
  width: 2px; height: calc(100% - 4px);
  background: var(--border);
}
.logistics-step:last-child .logistics-line { display: none; }
.logistics-step.active .logistics-line { background: #4caf50; }
.logistics-content { padding-left: 8px; }
.logistics-text { font-size: 14px; color: var(--text-primary); font-weight: 500; }
.logistics-time { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ═══════════════════════════════════════
   预约服务
   ═══════════════════════════════════════ */
.appt-service-option {
  transition: border .2s, background .2s;
}
.appt-service-option:hover { border-color: var(--primary) !important; }
.appt-slot-option {
  transition: all .2s;
}
.appt-slot-option:not(.disabled):hover { border-color: var(--primary); background: #fff5f5; }
.appt-slot-option.disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

/* ═══════════════════════════════════════
   文件上传
   ═══════════════════════════════════════ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover { border-color: var(--primary); background: #fff5f5; }
.upload-preview {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.upload-preview-item {
  width: 80px; height: 80px; border-radius: 8px; overflow: hidden;
  position: relative; border: 1px solid var(--border);
}
.upload-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-preview-item .del {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer;
}

/* ═══════════════════════════════════════
   配送骑手卡片
   ═══════════════════════════════════════ */
.delivery-card {
  text-align: center; padding: 20px;
}
.delivery-card .rider-avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--primary-light); margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.delivery-card .rider-name { font-size: 16px; font-weight: 700; margin-top: 8px; }
.delivery-card .rider-phone { font-size: 14px; color: var(--text-secondary); }
.delivery-card .rider-eta {
  margin-top: 8px; padding: 6px 12px; background: #f0f8ff;
  border-radius: 8px; font-size: 13px; color: #2196f3; display: inline-block;
}

/* ═══════════════════════════════════════
   图片上传按钮样式
   ═══════════════════════════════════════ */
.img-upload-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px dashed var(--border);
  border-radius: 8px; font-size: 13px; color: var(--text-secondary);
  cursor: pointer; transition: all .2s;
}
.img-upload-btn:hover { border-color: var(--primary); color: var(--primary); background: #fff5f5; }
.img-upload-btn input[type="file"] { display: none; }
