/* ============================================================
   style.css —— 校园失物招领「寻迹」全部样式
   蓝白科技简约风 · 响应式 · 移动端风格 PC 居中
   ============================================================ */

:root {
  --primary: #2563eb;        /* 科技蓝 */
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --cyan: #0891b2;           /* 青色点缀（招领标签） */
  --cyan-light: #ecfeff;
  --danger: #e05b5b;
  --danger-light: #fef2f2;
  --warn: #d97706;
  --text: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(15, 40, 80, 0.05), 0 1px 2px rgba(15, 40, 80, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 40, 80, 0.14);
  --tabbar-h: 60px;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  background: linear-gradient(165deg, #e6edf7 0%, #f4f6f9 50%, #eef2f8 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 应用容器（PC 居中模拟手机，移动端全宽） ---------- */
#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  box-shadow: 0 0 40px rgba(15, 40, 80, 0.10);
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--tabbar-h);
}

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(120deg, #1e3a8a 0%, #2563eb 70%, #3b82f6 100%);
  color: #fff;
  padding: 14px 18px;
}
.topbar-inner { display: flex; align-items: baseline; gap: 10px; }
.logo {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 3px;
  background: rgba(255, 255, 255, 0.16);
  padding: 3px 10px;
  border-radius: 7px;
}
.page-title { font-size: 15px; opacity: 0.92; font-weight: 500; }

/* ---------- 内容区 ---------- */
.view-wrap { flex: 1; }
.view { display: none; padding: 14px 14px 20px; }
.view:first-child { display: block; }

/* ---------- 统计条 ---------- */
.stats-bar {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
}
.stat {
  flex: 1;
  text-align: center;
  padding: 12px 4px;
  position: relative;
}
.stat + .stat::before {
  content: '';
  position: absolute;
  left: 0; top: 22%; bottom: 22%;
  width: 1px;
  background: var(--border);
}
.stat b { display: block; font-size: 20px; color: var(--text); font-weight: 700; }
.stat span { font-size: 12px; color: var(--text-3); }
.stat-active b { color: var(--primary); }
.stat-resolved b { color: var(--cyan); }
.stat-rate b { color: var(--warn); }

/* ---------- 搜索框 ---------- */
.search-box {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0 10px;
  margin-bottom: 8px;
}
.search-icon { font-size: 14px; opacity: 0.6; margin-right: 6px; }
#search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 4px;
  font-size: 14px;
  background: transparent;
  color: var(--text);
}
#search-input::placeholder { color: var(--text-3); }
.search-clear {
  border: none;
  background: var(--bg);
  color: var(--text-3);
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
}
.search-clear:hover { background: var(--border); color: var(--text-2); }

/* ---------- 搜索历史 ---------- */
.search-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 10px;
  min-height: 0;
}
.search-tools .chip-label { font-size: 12px; color: var(--text-3); }
.link-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- 类型 Tab ---------- */
.tabs {
  display: flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  gap: 4px;
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 0;
  font-size: 14px;
  color: var(--text-2);
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.15s;
}
.tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ---------- 筛选区 ---------- */
.filter-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px 8px;
  margin-bottom: 12px;
}
.chip-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.chip-row:last-child { margin-bottom: 4px; }
.chip-label {
  font-size: 12px;
  color: var(--text-3);
  flex-shrink: 0;
  width: 34px;
}
.chip {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-2);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.filter-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 2px;
}
.result-count { font-size: 12px; color: var(--text-3); }
#reset-btn { display: none; }

/* ---------- 信息卡片 ---------- */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 13px 15px;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s;
  border-left: 4px solid var(--primary);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-done {
  border-left-color: #cbd5e1;
  background: #f8fafc;
  opacity: 0.8;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.card-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-3);
}
.tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
}
.tag-lost { background: var(--primary-light); color: var(--primary); }
.tag-found { background: var(--cyan-light); color: var(--cyan); }
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.badge-green { background: var(--primary-light); color: var(--primary); }
.badge-gray { background: #f1f5f9; color: var(--text-2); }
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-all;
  color: var(--text);
}
.card-meta {
  font-size: 13px;
  color: var(--text-2);
  word-break: break-all;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.mine-tag {
  font-size: 11px;
  color: var(--cyan);
  background: var(--cyan-light);
  padding: 2px 8px;
  border-radius: 6px;
}
.contact-btn {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: all 0.15s;
}
.contact-btn:hover { background: var(--primary); color: #fff; }

/* ---------- 我的发布卡片 ---------- */
.card-mypost { cursor: default; }
.card-mypost .card-title { cursor: pointer; }
.card-mypost .card-title:hover { color: var(--primary); }
.card-ops { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { border-color: var(--text-3); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-back {
  border: none;
  background: none;
  color: var(--text-2);
  padding: 4px 0;
  margin-bottom: 10px;
  font-size: 14px;
}
.btn-back:hover { color: var(--primary); }

/* ---------- 详情页 ---------- */
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}
.detail-title { font-size: 20px; margin: 10px 0 12px; word-break: break-all; }
.detail-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.detail-table td {
  padding: 7px 0;
  font-size: 14px;
  vertical-align: top;
  border-bottom: 1px dashed var(--border);
  word-break: break-all;
}
.detail-table tr:last-child td { border-bottom: none; }
.dt-label { width: 92px; color: var(--text-3); font-size: 13px; }
.dt-desc { line-height: 1.6; }
.muted { color: var(--text-3); }

.contact-box {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 14px;
}
.contact-label { font-size: 12px; color: var(--primary); margin-bottom: 4px; }
.contact-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  word-break: break-all;
}

.detail-ops { display: flex; gap: 10px; margin-bottom: 14px; }

.detail-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.block-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.timeline-item {
  position: relative;
  padding-left: 20px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}
.timeline-item:last-child { margin-bottom: 0; }
.tl-dot {
  position: absolute;
  left: 2px; top: 5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--primary);
}
.tl-done { background: var(--cyan); }

/* 相似线索推荐 */
.related-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.related-item:hover { border-color: var(--primary); background: var(--primary-light); }
.related-item:last-child { margin-bottom: 0; }
.related-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.related-reasons { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.reason-chip {
  font-size: 11px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 5px;
}
.related-meta { font-size: 12px; color: var(--text-3); }

/* ---------- 发布表单 ---------- */
.form-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.type-switch {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.type-option {
  flex: 1;
  text-align: center;
  cursor: pointer;
}
.type-option input { display: none; }
.type-option span {
  display: block;
  padding: 11px 0;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text-2);
  background: #f8fafc;
  transition: all 0.15s;
}
.type-option.active span {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.form-item { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.form-label em { color: var(--danger); font-style: normal; }
.form-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: #f8fafc;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.form-input:focus { border-color: var(--primary); background: #fff; }
.form-input.invalid { border-color: var(--danger); background: #fffafa; }
textarea.form-input { resize: vertical; min-height: 76px; }
select.form-input { appearance: auto; }
.field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
  margin-top: 3px;
}
.form-tip {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin-top: 10px;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 44px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-icon { font-size: 38px; margin-bottom: 10px; }
.empty-text { font-size: 14px; color: var(--text-2); margin-bottom: 14px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--tabbar-h);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 30;
  max-width: 520px;
  margin: 0 auto;
}
.tabbar-item {
  flex: 1;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  color: var(--text-2);
  cursor: pointer;
  transition: color 0.15s;
}
.tabbar-icon { font-size: 20px; line-height: 1; }
.tabbar-item.active { color: var(--primary); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.modal-root {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 35, 70, 0.45);
  animation: fadeIn 0.15s;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.18s;
}
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.modal-body { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.modal-list { margin-top: 12px; max-height: 220px; overflow-y: auto; }
.modal-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 13px;
}
.modal-list-item:hover { border-color: var(--primary); }
.modal-list-title { flex: 1; font-weight: 600; color: var(--text); }
.modal-list-meta { font-size: 12px; color: var(--text-3); }

/* 联系弹窗 */
.contact-body { text-align: center; padding: 6px 0 2px; }
.contact-line {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding: 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  word-break: break-all;
}
.contact-tip { font-size: 12px; color: var(--text-3); margin-top: 10px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  bottom: calc(var(--tabbar-h) + 20px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 60;
}
.toast {
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 999px;
  max-width: 88%;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.25s;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: rgba(22, 163, 74, 0.95); }
.toast.error { background: rgba(224, 91, 91, 0.95); }
.toast.warn { background: rgba(217, 119, 6, 0.95); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- 滚动条（Webkit） ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 响应式 ---------- */
@media (min-width: 640px) {
  body { padding: 24px 0; }
  #app { border-radius: 22px; min-height: calc(100vh - 48px); overflow: hidden; }
  .tabbar { border-radius: 0 0 22px 22px; }
}
