/* 新沙互助 H5 公共样式 - 移动优先响应式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --primary: #4a90e2;
  --primary-dark: #3a7bc8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #888;
  --border: #ececec;
  --danger: #e74c3c;
  --success: #27ae60;
  --warning: #f39c12;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: 15px; outline: none; }

/* 顶部导航栏 */
.navbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 14px;
  background: var(--primary); color: #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,.12);
}
.navbar .nav-title { font-size: 17px; font-weight: 600; }
.navbar .nav-left, .navbar .nav-right { min-width: 40px; display: flex; align-items: center; gap: 6px; color: #fff; font-size: 14px; }
.navbar .nav-right { justify-content: flex-end; }
.navbar .nav-btn { color: #fff; font-size: 14px; padding: 4px 2px; }
.navbar .nav-btn:active { opacity: .7; }

/* 页面容器 */
.page { max-width: 640px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.container { padding: 12px 14px 24px; }

/* 搜索框 */
.search-bar {
  position: sticky; top: 48px; z-index: 90;
  padding: 8px 14px; background: var(--card);
  display: flex; gap: 8px; align-items: center;
  border-bottom: 1px solid var(--border);
}
.search-bar input {
  flex: 1; height: 36px; border-radius: 18px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 0 14px; font-size: 14px;
}
.search-bar .search-btn {
  height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--primary); color: #fff; font-size: 14px;
}

/* 分类标签栏 */
.category-bar {
  position: sticky; top: 96px; z-index: 80;
  display: flex; overflow-x: auto; gap: 6px;
  padding: 10px 14px; background: var(--card);
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
}
.category-bar::-webkit-scrollbar { display: none; }
.category-bar .cat-item {
  flex-shrink: 0; padding: 6px 14px; border-radius: 16px;
  background: var(--bg); color: var(--text-sub); font-size: 13px;
  border: 1px solid transparent;
}
.category-bar .cat-item.active { background: var(--primary); color: #fff; }

/* 需求卡片 */
.demand-list { padding: 10px 14px 80px; }
.demand-card {
  background: var(--card); border-radius: 12px; padding: 14px;
  margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: transform .12s;
}
.demand-card:active { transform: scale(.99); }
.demand-card .dc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.demand-card .dc-title { font-size: 16px; font-weight: 600; flex: 1; word-break: break-all; }
.demand-card .dc-reward { color: var(--danger); font-weight: 600; font-size: 14px; white-space: nowrap; }
.demand-card .dc-reward.free { color: var(--success); font-weight: 400; font-size: 12px; }
.demand-card .dc-desc { color: var(--text-sub); font-size: 13px; margin-top: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.demand-card .dc-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-sub); }
.demand-card .dc-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #eee; }
.demand-card .dc-time { margin-left: auto; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; line-height: 1.6; }
.tag-pickup { background: #e8f4fd; color: #1a73e8; }
.tag-cleaning { background: #fef0e6; color: #e8730a; }
.tag-shopping { background: #eaf7ee; color: #27ae60; }
.tag-other { background: #eef0f2; color: #5f6368; }
.tag-open { background: #e8f8ef; color: var(--success); }
.tag-taken { background: #fff6e6; color: var(--warning); }
.tag-done { background: #eef0f3; color: #5f6368; }
.tag-cancelled { background: #fdecea; color: var(--danger); }

/* 底部操作栏 */
.bottom-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--border); max-width: 640px; margin: 0 auto;
}

/* 底部导航栏（Tab） */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; max-width: 640px; margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 7px 0 5px; color: var(--text-sub); font-size: 11px; gap: 2px;
  text-decoration: none;
}
.tabbar .tab-item .tab-icon { font-size: 20px; line-height: 1; }
.tabbar .tab-item.active { color: var(--primary); }
.has-tabbar { padding-bottom: 60px; }

/* 按钮 */
.btn { height: 44px; border-radius: 8px; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-disabled, .btn[disabled] { background: #ccc; color: #fff; cursor: not-allowed; }
.btn-flex { flex: 1; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; color: var(--text-sub); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }
.form-input, .form-textarea, .form-select {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px; font-size: 15px; color: var(--text);
}
.form-textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: var(--primary); }
.form-hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.input-counter { text-align: right; font-size: 11px; color: var(--text-sub); }

/* 详情页 */
.detail-wrap { padding: 14px 14px 80px; }
.detail-card { background: var(--card); border-radius: 12px; padding: 18px; }
.detail-title { font-size: 20px; font-weight: 600; line-height: 1.4; }
.detail-tags { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.detail-reward { font-size: 22px; color: var(--danger); font-weight: 700; margin: 14px 0; }
.detail-reward .free { font-size: 14px; color: var(--success); font-weight: 400; }
.detail-section { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.detail-section .ds-label { font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.detail-section .ds-text { font-size: 15px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }
.publisher-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border); }
.publisher-row .p-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.publisher-row .p-name { font-size: 14px; font-weight: 500; }
.publisher-row .p-time { font-size: 12px; color: var(--text-sub); }
.contact-row { display: flex; align-items: center; gap: 8px; }
.contact-row .call-btn { color: var(--primary); font-size: 14px; }

/* 个人中心 */
.profile-header { background: var(--primary); color: #fff; padding: 24px 20px; }
.profile-header .p-avatar { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); object-fit: cover; }
.profile-header .p-name { font-size: 18px; font-weight: 600; margin-top: 8px; }
.profile-header .p-tag { font-size: 12px; background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 4px; margin-top: 6px; display: inline-block; }
.menu-list { background: var(--card); margin-top: 10px; }
.menu-item { display: flex; align-items: center; padding: 16px 16px; border-bottom: 1px solid var(--border); }
.menu-item:last-child { border-bottom: none; }
.menu-item .mi-icon { width: 24px; text-align: center; font-size: 18px; }
.menu-item .mi-text { flex: 1; margin-left: 10px; font-size: 15px; }
.menu-item .mi-arrow { color: var(--text-sub); font-size: 14px; }

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

/* 加载/下拉刷新 */
.load-more { text-align: center; padding: 16px; color: var(--text-sub); font-size: 13px; }
.refresh-hint { text-align: center; padding: 12px; color: var(--text-sub); font-size: 12px; }

/* Toast */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 9999; max-width: 80%; text-align: center;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal-box { background: var(--card); border-radius: 12px; width: 100%; max-width: 320px; overflow: hidden; }
.modal-title { font-size: 16px; font-weight: 600; text-align: center; padding: 20px 16px 8px; }
.modal-body { font-size: 14px; color: var(--text-sub); text-align: center; padding: 4px 16px 20px; }
.modal-footer { display: flex; border-top: 1px solid var(--border); }
.modal-footer button { flex: 1; height: 46px; font-size: 15px; }
.modal-footer .mf-cancel { color: var(--text-sub); border-right: 1px solid var(--border); }
.modal-footer .mf-confirm { color: var(--primary); font-weight: 500; }

/* 头像上传 */
.avatar-picker { display: flex; align-items: center; gap: 14px; }
.avatar-picker .ap-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-picker .ap-btn { color: var(--primary); font-size: 14px; }

/* 响应式：桌面端 */
@media (min-width: 768px) {
  body { background: #e9edf2; }
  .page { box-shadow: 0 0 16px rgba(0,0,0,.06); }
  .navbar { max-width: 640px; margin: 0 auto; left: 0; right: 0; }
}

/* 状态徽章 */
.status-badge { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
