/* 校园失物招领 · 全局样式
   被 index.html / detail.html / about.html 引用
   改动注意：375px 下不得出现横向滚动 */

:root {
  --ink: #1a1a1a;
  --muted: #6b7280;
  --faint: #8892a6;
  --line: #e5e9f0;
  --bg: #f7f8fa;
  --card: #ffffff;
  --primary: #1F3B63;
  --primary-soft: #e8eef7;
  --warn: #c0392b;
  --warn-soft: #fff1f0;
  --radius: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(31, 59, 99, 0.18);
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
}

.brand-text { min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 11px;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-link {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.btn-primary {
  flex: 0 0 auto;
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.btn-primary:active { opacity: 0.85; }

/* ---------- 反诈条 ---------- */
.notice {
  background: #fff4e5;
  color: #8a4b00;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 8px 16px;
  border-bottom: 1px solid #f0dcbe;
}

/* ---------- 筛选 ---------- */
.filters {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  margin: 14px 0 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid #eef1f6;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field { display: block; }

.field span {
  display: block;
  font-size: 11.5px;
  color: var(--faint);
  margin-bottom: 3px;
}

.field select {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9aa6bc 50%),
    linear-gradient(135deg, #9aa6bc 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

#fKeyword {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

#fKeyword:focus,
.field select:focus {
  outline: none;
  border-color: #9bb0cb;
  box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.08);
}

.btn-ghost {
  flex: 0 0 auto;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.btn-ghost:active { background: #f2f5f9; }

/* ---------- 结果计数 ---------- */
.count {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--faint);
  padding-left: 2px;
}

/* ---------- 卡片列表 ---------- */
.cards {
  display: grid;
  gap: 10px;
}

.card {
  position: relative;
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:active { transform: scale(0.997); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.card.is-expired { opacity: 0.72; }

.thumb {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  overflow: hidden;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.card-main { flex: 1; min-width: 0; }

.row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 58px;
}

.title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.type-chip {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: #fdf1e3;
  color: #9a5b00;
}

.type-chip.found {
  background: #e6f4ea;
  color: #1e7b45;
}

.feat {
  margin: 3px 0 5px;
  font-size: 12.5px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--faint);
}

.card-status {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.card-status.pending { background: var(--primary-soft); color: var(--primary); }
.card-status.recovered { background: #e6f4ea; color: #1e7b45; }
.card-status.expired { background: #efefef; color: #777; }

/* ---------- 空 / 错误 ---------- */
.empty {
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.empty-icon { font-size: 30px; margin-bottom: 8px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ---------- 详情页 ---------- */
.detail-card {
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.detail-hero {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}

.detail-thumb {
  flex: 0 0 88px;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  overflow: hidden;
}

.detail-thumb img { width: 100%; height: 100%; object-fit: cover; }

.detail-title { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.detail-sub { font-size: 12.5px; color: var(--faint); margin: 0; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--line);
}

.meta-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  font-size: 13.5px;
  min-width: 0;
}

.meta-item dt {
  flex: 0 0 56px;
  color: var(--faint);
  font-size: 12.5px;
  margin: 0;
}

.meta-item.wide { grid-column: 1 / -1; }

.meta-item dd {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-block {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13.5px;
  color: #3f4a5c;
  word-break: break-word;
}

.block-title {
  font-size: 13px;
  font-weight: 700;
  margin: 14px 0 6px;
}

.guide {
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 12px;
  font-size: 13.5px;
  color: #24405f;
}

.guide .privacy { display: block; margin-top: 6px; font-size: 12.5px; color: #4b6484; }

.fraud {
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #8f2a20;
  margin-top: 12px;
}

.btn-block {
  display: block;
  text-align: center;
  height: 42px;
  line-height: 42px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--primary);
  font-weight: 600;
  font-size: 14px;
  margin: 14px 0 4px;
}

/* ---------- 关于页 ---------- */
.panel {
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary);
}

.panel p {
  margin: 0 0 8px;
  font-size: 13.5px;
  color: #3f4a5c;
}

.panel p:last-child { margin-bottom: 0; }

.panel.warn { border-left: 3px solid var(--warn); }
.panel.warn h2 { color: var(--warn); }

/* ---------- 页脚 ---------- */
.footer {
  padding: 22px 0 36px;
  font-size: 12px;
  color: #8a93a5;
  text-align: center;
  line-height: 1.6;
}

.updated { margin-top: 6px; opacity: 0.8; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  max-width: 86vw;
  background: rgba(26, 26, 26, 0.9);
  color: #fff;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 10px;
  z-index: 50;
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 大屏 ---------- */
@media (min-width: 640px) {
  .filter-grid { grid-template-columns: repeat(4, 1fr); }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { font-size: 11.5px; }
  .thumb { flex-basis: 76px; width: 76px; height: 76px; font-size: 32px; }
  .title { font-size: 15.5px; }
  .detail-thumb { flex-basis: 104px; width: 104px; height: 104px; font-size: 46px; }
  .card:hover { box-shadow: 0 3px 12px rgba(31, 59, 99, 0.1); }
}

/* ---------- 登记页 ---------- */
.form-card {
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 16px;
  margin: 14px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 420px) {
  .form-row { grid-template-columns: 1fr 1fr; gap: 0 10px; }
}

.field { display: block; margin-bottom: 12px; }

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  padding: 8px 10px;
  height: 38px;
}

.field textarea {
  height: auto;
  line-height: 1.5;
  resize: vertical;
  min-height: 60px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #9bb0cb;
  box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.08);
}

.form-hint {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.55;
  margin: 2px 0 12px;
}

.form-error {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  margin: 0 0 10px;
}

.btn-submit {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.btn-submit:disabled { opacity: 0.6; }

.success-card {
  background: var(--card);
  border: 1px solid #eef1f6;
  border-radius: var(--radius);
  padding: 36px 18px;
  margin: 14px 0;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.success-icon { font-size: 36px; line-height: 1; }

.success-card h2 { margin: 10px 0 8px; font-size: 18px; }
.success-card p { margin: 0 0 8px; font-size: 13.5px; color: var(--muted); }
.success-card strong { color: var(--primary); }

/* ---------- 联系方式查看 ---------- */
.contact-block {
  margin-top: 14px;
  padding: 12px;
  background: #fafbfd;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contact-label { font-size: 13px; color: var(--faint); }

.contact-value {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.contact-value.revealed {
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: 6px;
  user-select: all;
}

.btn-reveal {
  width: 100%;
  height: 38px;
  margin-top: 10px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: #fff;
  color: var(--primary);
  font-size: 14px;
  font-weight: 600;
}

.btn-reveal:disabled { opacity: 0.6; }

.contact-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.5;
}

#tsBox { margin-top: 6px; }

/* ---------- 照片 ---------- */
.field input[type="file"] {
  height: auto;
  padding: 7px 8px;
  font-size: 13px;
  background: #fff;
}

.photo-preview {
  position: relative;
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f5f9;
}

.photo-preview img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  display: block;
}

.btn-remove-photo {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
}

.detail-photo {
  margin-bottom: 12px;
  border-radius: 10px;
  overflow: hidden;
  background: #f2f5f9;
}

.detail-photo img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

.thumb img { border-radius: 10px; }

/* ---------- 两级选择按钮 ---------- */
.field-block { margin-bottom: 16px; }

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--faint);
  margin-bottom: 7px;
}

.req { color: var(--warn); font-weight: 700; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sub-chips { margin-top: 8px; }

.chip {
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #3f4a5c;
  font-size: 13.5px;
  line-height: 1.2;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.sub-chips .chip {
  background: #fafbfd;
}

.sub-chips .chip.active {
  background: var(--primary);
}

#sCategoryCustom,
#sBuildingCustom {
  width: 100%;
  margin-top: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
}

#sCategoryCustom:focus,
#sBuildingCustom:focus {
  outline: none;
  border-color: #9bb0cb;
  box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.08);
}

/* ---------- 新版表单（field-block 结构）的输入控件 ---------- */
.field-block > input[type="text"],
.field-block > input[type="date"],
.field-block > textarea {
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--ink);
}

.field-block > textarea {
  height: auto;
  min-height: 62px;
  line-height: 1.5;
  resize: vertical;
}

.field-block > input[type="file"] {
  width: 100%;
  height: auto;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}

.field-block > input:focus,
.field-block > textarea:focus {
  outline: none;
  border-color: #9bb0cb;
  box-shadow: 0 0 0 3px rgba(31, 59, 99, 0.08);
}
