/* 便民信息发布系统 - 前台 H5 样式（移动优先，PC 居中） */
:root {
  --primary: #3b5bdb;
  --primary-light: #edf0ff;
  --danger: #e03131;
  --success: #2f9e44;
  --warning: #f08c00;
  --text: #1f2937;
  --text-sub: #6b7280;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
  --gap: 12px;
  --tabbar-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text); background: var(--bg);
  font-size: 14px; line-height: 1.5;
}
body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.page { max-width: 720px; margin: 0 auto; }

/* PC 居中 */
@media (min-width: 640px) {
  body { background: #eceef3; }
  .page { max-width: 720px; background: var(--bg); min-height: 100vh; box-shadow: 0 0 24px rgba(0,0,0,.06); }
}

/* ============ 顶部搜索 ============ */
.top-bar {
  position: sticky; top: 0; z-index: 20;
  background: var(--primary); padding: 10px 12px;
}
.top-bar .site-name { color: #fff; font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.search-box {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border-radius: 20px; padding: 8px 14px; color: var(--text-sub);
}
.search-box i { font-size: 18px; }
.search-box input {
  border: none; outline: none; flex: 1; font-size: 14px; background: transparent; color: var(--text);
}

/* ============ 轮播图 ============ */
.banner { position: relative; margin: 10px 12px 0; border-radius: var(--radius); overflow: hidden; background: #e9ebf0; }
.banner-track { display: flex; transition: transform .35s ease; }
.banner-slide { min-width: 100%; }
.banner-slide img { width: 100%; height: auto; display: block; }
.banner-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 5px;
}
.banner-dots span { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.5); transition: .3s; }
.banner-dots span.on { width: 16px; background: #fff; }
.banner-empty { padding: 40px 0; text-align: center; color: #b6bac4; }

/* ============ 金刚区 ============ */
.grid-nav {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px 0; padding: 14px 6px; margin: 10px 12px 0;
  background: var(--card); border-radius: var(--radius);
}
.grid-nav a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 0; }
.grid-nav .ico {
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.grid-nav .txt { font-size: 12px; color: var(--text); }
@media (min-width: 640px) {
  .grid-nav { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}

/* ============ 公告 ============ */
.notice-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 12px 0; padding: 9px 12px;
  background: #fff7e6; border-radius: var(--radius); color: #996a12;
  overflow: hidden;
}
.notice-bar > i { font-size: 18px; color: var(--warning); flex: none; }
.notice-swiper { flex: 1; height: 20px; overflow: hidden; position: relative; }
.notice-swiper .n-item {
  position: absolute; left: 0; right: 0; top: 20px; opacity: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px;
  transition: top .4s ease, opacity .4s ease;
}
.notice-swiper .n-item.on { top: 0; opacity: 1; }

/* ============ 区块标题 ============ */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 12px 8px;
}
.section-head .t { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.section-head .t i { color: var(--primary); }

/* ============ 动态卡片 ============ */
.post-list { padding: 0 12px; display: flex; flex-direction: column; gap: 10px; }
.post-card { background: var(--card); border-radius: var(--radius); padding: 12px; }
.post-card .p-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.post-card .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); object-fit: cover; flex: none; }
.avatar-placeholder {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.post-card .p-name { font-size: 13px; font-weight: 500; }
.post-card .p-time { font-size: 12px; color: var(--text-sub); }
.post-card .p-tag {
  margin-left: auto; font-size: 11px; color: var(--primary);
  background: var(--primary-light); padding: 2px 8px; border-radius: 10px; flex: none;
}
.post-card .p-top { color: var(--danger); background: #ffe3e3; margin-left: 6px; }
.post-card .p-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.post-card .p-summary { font-size: 13px; color: var(--text-sub); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-card .p-imgs { display: grid; gap: 4px; margin-bottom: 8px; }
.post-card .p-imgs.c1 { grid-template-columns: 1fr; max-width: 60%; }
.post-card .p-imgs.c2 { grid-template-columns: 1fr 1fr; max-width: 80%; }
.post-card .p-imgs.c3 { grid-template-columns: 1fr 1fr 1fr; }
.post-card .p-imgs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 6px; background: #eef0f4; }
.post-card .p-foot { display: flex; align-items: center; gap: 16px; color: var(--text-sub); font-size: 12px; }
.post-card .p-foot i { font-size: 15px; vertical-align: -2px; }

/* 状态徽标 */
.status-tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.st-0 { background: #fff3bf; color: #996a12; }
.st-1 { background: #d3f9d8; color: #2b8a3e; }
.st-2 { background: #ffe3e3; color: #c92a2a; }
.st-3 { background: #e9ecef; color: #495057; }

/* ============ 空状态 / 加载更多 ============ */
.empty { text-align: center; color: #adb5bd; padding: 60px 20px; }
.empty i { font-size: 48px; display: block; margin-bottom: 10px; }
.load-more { text-align: center; padding: 14px; color: var(--text-sub); font-size: 13px; }
.load-more .btn { color: var(--primary); }

/* ============ 底部 Tab ============ */
.bm-tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--border);
  display: flex; z-index: 30;
}
.bm-tab-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; color: var(--text-sub); font-size: 11px;
}
.bm-tab-item i { font-size: 22px; }
.bm-tab-item.on { color: var(--primary); }
.bm-tab-item.center i {
  font-size: 40px; color: var(--primary); margin-top: -14px;
}
.bm-tab-item.center span { color: var(--primary); }

/* ============ 表单 ============ */
.form-card { background: var(--card); margin: 10px 12px; border-radius: var(--radius); padding: 4px 14px; }
.form-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.form-row:last-child { border-bottom: none; }
.form-row label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 6px; }
.form-row input[type=text], .form-row textarea, .form-row input[type=tel] {
  width: 100%; border: none; outline: none; font-size: 15px; color: var(--text);
  background: transparent; font-family: inherit; resize: none;
}
.form-row textarea { min-height: 90px; line-height: 1.6; }
.form-row .counter { text-align: right; font-size: 11px; color: #adb5bd; margin-top: 4px; }
.cat-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 6px 0 12px; }
.cat-picker .c-item { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 0;
  border-radius: 10px; border: 1px solid transparent; }
.cat-picker .c-item .ico { width: 42px; height: 42px; border-radius: 12px; background: var(--bg);
  color: var(--text-sub); display: flex; align-items: center; justify-content: center; font-size: 22px; }
.cat-picker .c-item.on { border-color: var(--primary); background: var(--primary-light); }
.cat-picker .c-item.on .ico { background: #fff; color: var(--primary); }
.cat-picker .c-item.on .txt { color: var(--primary); font-weight: 500; }
.cat-picker .c-item .txt { font-size: 12px; }

/* 图片上传九宫格 */
.img-uploader { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 0 12px; }
.img-uploader .cell { position: relative; aspect-ratio: 1/1; border-radius: 8px; overflow: hidden; background: var(--bg); }
.img-uploader .cell img { width: 100%; height: 100%; object-fit: cover; }
.img-uploader .cell .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: 14px;
}
.img-uploader .add {
  aspect-ratio: 1/1; border: 1px dashed #cdd2dc; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: #adb5bd; gap: 4px; font-size: 12px; cursor: pointer;
}
.img-uploader .add i { font-size: 26px; }

/* ============ 按钮 ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; font-size: 15px; cursor: pointer; font-family: inherit;
  transition: transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary[disabled] { background: #a5b0e0; cursor: not-allowed; }
.btn-block { width: 100%; height: 46px; }
.btn-ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.footer-action { padding: 12px; }

/* ============ 详情页 ============ */
.detail-head { background: var(--card); padding: 16px 14px; }
.detail-head .d-title { font-size: 19px; font-weight: 700; line-height: 1.4; margin-bottom: 10px; }
.detail-head .d-meta { display: flex; align-items: center; gap: 10px; color: var(--text-sub); font-size: 12px; }
.detail-body { background: var(--card); padding: 0 14px 16px; margin-top: 1px; }
.detail-body .d-content { font-size: 15px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.detail-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.detail-imgs img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border-radius: 8px; background: #eef0f4; }
.contact-card { margin: 10px 12px; background: var(--card); border-radius: var(--radius); padding: 14px;
  display: flex; align-items: center; gap: 10px; }
.contact-card i { font-size: 22px; color: var(--primary); }
.detail-actionbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 720px; background: #fff; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); z-index: 30;
}
.detail-actionbar .act { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-sub); font-size: 11px; }
.detail-actionbar .act i { font-size: 22px; }
.detail-actionbar .act.on { color: var(--danger); }
.detail-actionbar .spacer { flex: 1; }

/* 返回头 */
.nav-head { position: sticky; top: 0; z-index: 20; background: #fff; height: 46px;
  display: flex; align-items: center; padding: 0 8px; border-bottom: 1px solid var(--border); }
.nav-head .back { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text); }
.nav-head .title { flex: 1; text-align: center; font-size: 16px; font-weight: 600; margin-right: 38px; }

/* ============ 我的 ============ */
.my-header { background: linear-gradient(135deg, var(--primary), #5c7cfa); padding: 24px 16px 40px; color: #fff; }
.my-header .u-row { display: flex; align-items: center; gap: 12px; }
.my-header .avatar { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.25); object-fit: cover; }
.my-header .avatar-ph { width: 58px; height: 58px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 30px; }
.my-header .u-name { font-size: 18px; font-weight: 600; }
.my-header .u-edit { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 3px; }
.my-stats { margin: -26px 12px 0; background: #fff; border-radius: var(--radius); padding: 16px 0;
  display: flex; position: relative; z-index: 5; box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.my-stats .s-item { flex: 1; text-align: center; }
.my-stats .s-num { font-size: 20px; font-weight: 700; color: var(--primary); }
.my-stats .s-label { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.my-menu { background: #fff; margin: 10px 12px; border-radius: var(--radius); overflow: hidden; }
.my-menu a { display: flex; align-items: center; gap: 12px; padding: 15px 14px; border-bottom: 1px solid var(--border); }
.my-menu a:last-child { border-bottom: none; }
.my-menu a i.lead { font-size: 20px; color: var(--primary); }
.my-menu a .txt { flex: 1; font-size: 15px; }
.my-menu a i.arrow { color: #cdd2dc; font-size: 18px; }

/* 我的动态筛选 tab */
.filter-tabs { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: var(--bg);
  position: sticky; top: 0; z-index: 10; }
.filter-tabs .tab { flex: none; padding: 6px 14px; border-radius: 16px; background: #fff; color: var(--text-sub); font-size: 13px; }
.filter-tabs .tab.on { background: var(--primary); color: #fff; }

/* ============ Toast / Loading / Dialog ============ */
.bm-toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -10px);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; display: flex; align-items: center; gap: 7px; z-index: 9999;
  opacity: 0; transition: .25s; max-width: 80%;
}
.bm-toast.show { opacity: 1; transform: translate(-50%, 0); }
.bm-toast-success i { color: #51cf66; } .bm-toast-error i { color: #ff6b6b; }
.bm-loading { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 9998;
  display: flex; align-items: center; justify-content: center; }
.bm-loading-box { background: rgba(0,0,0,.75); color: #fff; border-radius: 10px; padding: 20px 24px; text-align: center; }
.bm-loading-box p { margin: 10px 0 0; font-size: 13px; }
.bm-spinner { width: 30px; height: 30px; margin: 0 auto; border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.bm-dialog { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9997;
  display: flex; align-items: center; justify-content: center; padding: 30px; }
.bm-dialog-box { background: #fff; border-radius: 14px; width: 100%; max-width: 300px; overflow: hidden; }
.bm-dialog-msg { padding: 24px 20px; text-align: center; font-size: 15px; color: var(--text); }
.bm-dialog-btns { display: flex; border-top: 1px solid var(--border); }
.bm-dialog-btns button { flex: 1; height: 46px; border: none; background: #fff; font-size: 15px; cursor: pointer; }
.bm-dialog-btns button:first-child { border-right: 1px solid var(--border); color: var(--text-sub); }
.bm-btn-primary { color: var(--primary); font-weight: 600; }
.bm-btn-primary.danger { color: var(--danger); }

/* 图片查看器 */
.viewer { position: fixed; inset: 0; background: #000; z-index: 9996; display: flex;
  align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; }
.viewer .v-close { position: absolute; top: 16px; right: 16px; color: #fff; font-size: 30px; }
