:root {
  --bg: #f5f6fa;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #eceef2;
  --primary: #3b6ef6;
  --primary-dark: #2b57cf;
  --danger: #e5484d;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(31, 35, 41, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; gap: 24px;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: 0.5px; }
.main-nav { display: flex; gap: 4px; }
.main-nav a {
  padding: 8px 14px; border-radius: 10px; color: var(--muted); font-size: 15px;
}
.main-nav a.active, .main-nav a:hover { color: var(--primary); background: #eef3ff; }
.header-inner .spacer { margin-left: auto; }

/* ---------- 布局 ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 28px 20px 60px; }

/* ---------- 主页搜索 ---------- */
.home-toolbar { display: flex; align-items: center; gap: 14px; margin: 8px 0 26px; }
.search-box {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
}
.search-box input { border: 0; outline: 0; flex: 1; font-size: 15px; background: transparent; }
.result-count { color: var(--muted); font-size: 14px; margin-left: auto; }

/* ---------- 相册封面网格：手机竖屏 9:16 ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px;
}
.album-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: var(--card); box-shadow: var(--shadow); cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.album-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(31, 35, 41, 0.14); }
.album-cover {
  aspect-ratio: 9 / 16; width: 100%; overflow: hidden; background: linear-gradient(160deg, #dfe6f2, #f2f4f8);
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-cover .cover-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #c3cad6;
}
.album-meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 14px 12px;
  background: linear-gradient(to top, rgba(15, 20, 30, 0.72), transparent);
  color: #fff;
}
.album-meta h3 { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-meta .sub { display: flex; gap: 10px; margin-top: 4px; font-size: 12px; opacity: 0.85; }
.badge-pin {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  background: var(--primary); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px;
}

.empty-state { text-align: center; color: var(--muted); padding: 80px 20px; }
.empty-state .icon { font-size: 44px; margin-bottom: 10px; }

/* ---------- 详情页 ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin-bottom: 18px; }
.detail-head { margin-bottom: 18px; }
.detail-head h1 { font-size: 28px; margin-bottom: 10px; }
.detail-meta { display: flex; gap: 18px; color: var(--muted); font-size: 14px; }
.detail-desc {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 26px; white-space: pre-wrap; color: #444b54;
}
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo-item {
  aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--card); cursor: zoom-in;
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.25s ease; }
.photo-item:hover img { transform: scale(1.05); }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(10, 14, 20, 0.92);
  display: none; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 88vw; max-height: 86vh; border-radius: 10px; }
.lightbox .close, .lightbox .nav-btn {
  position: absolute; background: rgba(255, 255, 255, 0.12); color: #fff; border: 0;
  width: 44px; height: 44px; border-radius: 50%; font-size: 20px;
}
.lightbox .close { top: 22px; right: 24px; }
.lightbox .nav-btn.prev { left: 24px; }
.lightbox .nav-btn.next { right: 24px; }
.lightbox .lb-count { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; }

/* ---------- 关于页 ---------- */
.about-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; white-space: pre-wrap; }

/* ---------- 页脚 ---------- */
.site-footer { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 20px 40px; }

/* ---------- 通用表单 ---------- */
.form-grid { display: grid; gap: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 15px; background: #fff; outline: 0;
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; font-size: 15px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-danger { background: #fdecee; color: var(--danger); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }

/* ---------- 后台 ---------- */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-side { background: #1f2733; color: #c8d0db; padding: 22px 0; }
.admin-side .brand { color: #fff; padding: 0 22px 18px; display: block; }
.admin-side nav button {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; color: #c8d0db;
  padding: 12px 22px; font-size: 15px;
}
.admin-side nav button.active, .admin-side nav button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.admin-main { padding: 28px 30px; }
.admin-main h2 { margin-bottom: 20px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.panel + .panel { margin-top: 20px; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; }
.admin-table th { color: var(--muted); font-weight: 600; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 图片选择器 */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; margin-top: 12px; }
.pick-item { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; border: 2px solid transparent; cursor: pointer; }
.pick-item.selected { border-color: var(--primary); }
.pick-item img { width: 100%; height: 100%; object-fit: cover; }
.pick-item .check {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px;
}

.tag { display: inline-block; background: #eef3ff; color: var(--primary); border-radius: 8px; padding: 2px 10px; font-size: 12px; }
.switch { display: inline-flex; align-items: center; gap: 8px; }

/* 登录页 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px; }
.login-card h1 { font-size: 22px; margin-bottom: 20px; text-align: center; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 200;
  background: rgba(20, 24, 30, 0.9); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { display: flex; overflow-x: auto; padding: 10px; }
  .admin-side .brand { display: none; }
  .admin-side nav { display: flex; }
  .detail-head h1 { font-size: 22px; }
}
