/* =========================================================
   成都七中初中学校（锦城校区）失物招领系统
   风格：Apple 系轻量风（参考智慧班级/ClassHub）
   浅灰底 × 白卡片 × 浅蓝强调 × 大圆角
   ========================================================= */

:root {
  /* 色彩 */
  --bg: #f2f3f7;                 /* 页面底：浅灰 */
  --card: #ffffff;               /* 卡片：纯白 */
  --ink: #1d1d1f;                /* 主文字 */
  --muted: #6b6b70;              /* 次要文字 */
  --blue: #0a7cff;               /* 主色：浅蓝 */
  --blue-deep: #0067d6;          /* 深蓝 hover */
  --blue-soft: #e8f2ff;          /* 浅蓝底（选中/公告/标签） */
  --line: rgba(60, 60, 67, .09); /* 分隔线 */
  --chip: rgba(120, 120, 128, .1);
  --ok: #34c759;                 /* 成功绿 */
  --ok-soft: #e4f8ea;
  --danger: #ff3b30;             /* 危险红 */

  /* 字体：系统黑体栈 */
  --display: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;

  /* 圆角 */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;

  /* 阴影：极淡 */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .03), 0 12px 32px rgba(0, 0, 0, .06);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .04), 0 16px 40px rgba(0, 0, 0, .10);
  --shadow-3: 0 8px 24px rgba(0, 0, 0, .10), 0 28px 72px rgba(0, 0, 0, .14);

  /* 动效 */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.65;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

::selection { background: var(--blue); color: #fff; }

a { color: inherit; text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- 顶部公告条：浅蓝 ---------- */
.notice-bar {
  background: var(--blue-soft);
  color: #0b5cb8;
  font-size: 14px;
  padding: 9px 20px;
  text-align: center;
  letter-spacing: .02em;
}
.notice-bar b { font-weight: 600; }
.notice-bar .dot { margin: 0 10px; opacity: .4; }

/* ---------- 页头 ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.site-header img.logo { height: 42px; width: auto; display: block; }
.header-spacer { flex: 1; }
.admin-link {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 16px;
  border: none;
  border-radius: var(--r-pill, 999px);
  background: var(--chip);
  transition: color .18s, background .18s;
}
.admin-link:hover { color: var(--blue); background: var(--blue-soft); }

/* ---------- 主区 ---------- */
main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px 96px; }

.hero { padding: 64px 0 36px; position: relative; }
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(42px, 7.6vw, 76px);
  line-height: 1.08;
  letter-spacing: -.015em;
}
.hero h1 .red { color: var(--blue); }
.hero .rule {
  margin-top: 30px;
  height: 1px;
  background: var(--line);
}

/* ---------- 区块标题 ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 40px 0 20px;
}
.section-head h2 {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: -.01em;
}
.section-head .count { color: var(--muted); font-size: 14px; }
.section-head .line { flex: 1; height: 1px; background: var(--line); }

/* ---------- 物品卡片栅格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  transition: transform .28s var(--ease-out), box-shadow .28s var(--ease-out);
  opacity: 0;
  transform: translateY(16px);
  animation: rise .6s var(--ease-out) forwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes rise { to { opacity: 1; transform: none; } }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); }

.card .photo {
  aspect-ratio: 4 / 3;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
.card .photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card .photo .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #c2c7cf;
  font-size: 40px;
  font-weight: 700;
}
.card .photo .placeholder small {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .2em;
  margin-top: 4px;
}

.card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta { font-size: 13.5px; color: var(--muted); display: grid; gap: 3px; }
.card .meta b { color: var(--ink); font-weight: 500; }
.card .remark {
  font-size: 13.5px;
  color: var(--muted);
  border-left: 2px solid var(--line);
  padding-left: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: flex-end; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 15px;
  text-decoration: none;
  transition: background .18s, transform .12s, box-shadow .18s;
}
.btn:active { transform: scale(.97); }
.btn-red { background: var(--blue); color: #fff; }
.btn-red:hover { background: var(--blue-deep); }
.btn-ghost { background: var(--chip); color: var(--ink); }
.btn-ghost:hover { background: rgba(120, 120, 128, .16); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 13.5px; border-radius: var(--r-sm); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(255, 59, 48, .07); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 空状态 ---------- */
.empty {
  background: var(--card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 64px 24px;
  text-align: center;
  color: var(--muted);
}
.empty .art {
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .38);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  opacity: 0;
  animation: fadeIn .2s ease forwards;
}
.modal-mask.closing { animation: fadeOut .18s ease forwards; }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.modal {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 420px;
  padding: 30px 30px 26px;
  transform: translateY(14px) scale(.98);
  animation: pop .3s var(--ease-out) forwards;
}
@keyframes pop { to { transform: none; } }
.modal h3 {
  font-weight: 700;
  font-size: 21px;
  margin-bottom: 4px;
}
.modal .modal-sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.modal .item-name { color: var(--blue); font-weight: 600; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 15px; }
.field label {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink);
}
.field label .req { color: var(--danger); margin-left: 2px; }
.field label .opt { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.field input[type="text"], .field input[type="tel"], .field input[type="password"],
.field input[type="datetime-local"], .field input[type="date"], .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--chip);
  transition: background .15s, box-shadow .15s;
}
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 2px var(--blue);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.modal .actions { display: flex; gap: 10px; margin-top: 22px; }
.modal .actions .btn { flex: 1; }

/* ---------- 提示 toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(28, 28, 30, .92);
  color: #fff;
  font-size: 14.5px;
  padding: 12px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow-2);
  opacity: 0;
  transition: opacity .25s, transform .25s var(--ease-out);
  z-index: 200;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: rgba(255, 59, 48, .95); }
.toast.ok { background: rgba(52, 199, 89, .95); }

/* ---------- 管理后台 ---------- */
.admin-wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px 96px; width: 100%; }

.login-hero { max-width: 400px; margin: 80px auto 0; }
.login-hero .panel-card { padding: 36px 32px; }
.login-hero h1 {
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 6px;
}
.login-hero .sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-top: 30px;
  overflow-x: auto;
}
.admin-tabs button {
  background: transparent;
  border: none;
  padding: 9px 16px;
  font-size: 15px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.admin-tabs button:hover { color: var(--ink); }
.admin-tabs button.active {
  color: var(--blue);
  font-weight: 600;
  background: var(--blue-soft);
}
.tab-panel { display: none; padding-top: 24px; }
.tab-panel.active { display: block; animation: rise .4s var(--ease-out); }

.admin-grid { display: grid; grid-template-columns: 380px 1fr; gap: 30px; align-items: start; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.panel-card {
  background: var(--card);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-1);
}
.panel-card h3 {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 18px;
}

/* 照片上传 */
.photo-drop {
  border: 1.5px dashed #c9ccd4;
  border-radius: var(--r-md);
  background: var(--bg);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
  padding: 14px;
  transition: border-color .15s, background .15s;
  position: relative;
  overflow: hidden;
}
.photo-drop:hover { border-color: var(--blue); background: var(--blue-soft); }
.photo-drop.has-img { padding: 0; border-style: solid; }
.photo-drop img { width: 100%; height: 200px; object-fit: cover; display: block; }
.photo-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* 管理端物品列表 */
.admin-item {
  background: var(--card);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-1);
}
.admin-item .row-main {
  display: flex;
  gap: 16px;
  padding: 14px 18px;
  align-items: center;
}
.admin-item .thumb {
  width: 88px; height: 66px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--bg);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c2c7cf;
  font-weight: 700;
  font-size: 22px;
}
.admin-item .info { flex: 1; min-width: 0; }
.admin-item .info h4 {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-item .info .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.status-tag {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.status-tag.pending { background: var(--blue-soft); color: var(--blue); }
.status-tag.claimed { background: var(--ok-soft); color: #1e9e46; }

.admin-item .row-sub {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  background: rgba(120, 120, 128, .04);
  font-size: 13.5px;
}
.admin-item .row-sub .book-title { font-weight: 600; margin-bottom: 8px; }
.book-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.book-row:last-child { border-bottom: none; }
.book-row .who { font-weight: 500; }
.book-row .cls { color: var(--muted); }
.book-row .tel { color: var(--muted); font-size: 12.5px; }
.book-row .spacer { flex: 1; }
.no-booking { color: var(--muted); padding: 4px 0; }

/* 设置页 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }

/* 认领人选择弹窗列表 */
.claim-list { max-height: 300px; overflow-y: auto; margin: 6px 0 4px; }
.claim-list .claim-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  cursor: pointer;
  background: var(--chip);
  transition: background .15s, box-shadow .15s;
}
.claim-list .claim-option:hover { background: var(--blue-soft); }
.claim-list .claim-option.selected {
  background: var(--blue-soft);
  box-shadow: 0 0 0 1.5px var(--blue);
}

/* 操作说明 */
.notes { color: var(--muted); }
.notes p + p { margin-top: 9px; }

/* ---------- 降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0ms !important;
    transition-duration: .01ms !important;
  }
  .card { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .hero { padding: 40px 0 26px; }
  .site-header img.logo { height: 34px; }
  main { padding: 0 16px 64px; }
  .notice-bar { font-size: 12.5px; padding: 8px 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
  .card h3 { font-size: 16px; }
  .card .meta { font-size: 12.5px; }
}
