/* ============================================================
 * 相册集展示 · 全局样式
 * ============================================================ */
:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1f2329;
  --text-sub: #646a73;
  --text-faint: #8f959e;
  --border: #e5e7eb;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --shadow: 0 6px 20px rgba(31, 35, 41, 0.08);
  --shadow-hover: 0 14px 34px rgba(31, 35, 41, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
  --max-w: 1280px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

img { display: block; max-width: 100%; }

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

button { font-family: inherit; cursor: pointer; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- 顶部导航 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 247, 249, 0.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
}

.topbar-actions { display: flex; gap: 12px; align-items: center; }

.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #dc2626; color: #dc2626; }

/* ---------- 搜索栏 ---------- */
.search-wrap { margin: 28px 0 24px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 18px;
  height: 54px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.search-box svg { flex: none; color: var(--text-faint); }

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  background: transparent;
  color: var(--text);
}

.search-box input::placeholder { color: var(--text-faint); }

.result-meta {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-sub);
}

/* ---------- 相册网格 ---------- */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 24px;
  padding-bottom: 60px;
}

.album-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  animation: fadeUp 0.5s ease both;
}

.album-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
}

.album-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #eef0f3;
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.album-card:hover .album-cover img { transform: scale(1.06); }

.cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--text-faint);
  background: linear-gradient(135deg, #eef2ff, #fce7f3);
}

.album-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.album-info { padding: 18px 20px 20px; }

.album-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.album-date {
  font-size: 14px;
  color: var(--text-sub);
  margin-bottom: 8px;
}

.album-desc {
  font-size: 14px;
  color: var(--text-sub);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 空状态 ---------- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-sub);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ---------- 详情页 ---------- */
.detail-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 0 24px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--primary);
  width: fit-content;
}

.detail-title { font-size: 28px; font-weight: 800; }

.detail-meta { color: var(--text-sub); font-size: 14px; }

.detail-desc { color: var(--text-sub); font-size: 15px; max-width: 720px; }

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding-bottom: 60px;
}

.photo-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #eef0f3;
  cursor: zoom-in;
  animation: fadeUp 0.5s ease both;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.photo-item:hover img { transform: scale(1.05); }

/* ---------- 图片骨架屏 ---------- */
.skeleton {
  position: relative;
  overflow: hidden;
  background: #eceef1;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.4s infinite;
}

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 18, 22, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.lightbox.open { opacity: 1; visibility: visible; }

.lightbox img {
  max-width: 88vw;
  max-height: 84vh;
  border-radius: 8px;
  object-fit: contain;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-close { top: 20px; right: 24px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }

.lightbox-counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
}

/* ---------- 启动加载动画 ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash.hide { opacity: 0; visibility: hidden; }

.spinner {
  width: 52px;
  height: 52px;
  border: 4px solid rgba(59, 130, 246, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.splash-text { color: var(--text-sub); font-size: 14px; letter-spacing: 2px; }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shimmer { 100% { transform: translateX(100%); } }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 后台 ---------- */
.admin-page { max-width: var(--max-w); margin: 0 auto; padding: 32px 24px 80px; }

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-head h1 { font-size: 24px; }

.admin-table {
  width: 100%;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 14px 18px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.admin-table th { color: var(--text-sub); font-weight: 600; background: #fafbfc; }

.admin-table tr:last-child td { border-bottom: none; }

.admin-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef0f3;
}

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

/* 弹窗 */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 18, 22, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-mask.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 28px;
  transform: translateY(12px);
  transition: transform 0.25s ease;
}

.modal-mask.open .modal { transform: translateY(0); }

.modal h2 { font-size: 20px; margin-bottom: 20px; }

.form-group { margin-bottom: 18px; }

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: #fff;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.form-group textarea { resize: vertical; min-height: 72px; }

.image-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.image-row { display: flex; gap: 8px; align-items: center; }

.image-row input { flex: 1; }

.image-row .btn { padding: 8px 12px; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* 登录卡片 */
.login-card {
  max-width: 380px;
  margin: 12vh auto 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
}

.login-card h1 { font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--text-sub); font-size: 14px; margin-bottom: 22px; }

/* 提示条 */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: #1f2329;
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 300;
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .album-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
  .detail-title { font-size: 24px; }
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .album-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .album-info { padding: 14px 16px 16px; }
  .album-title { font-size: 16px; }
  .search-box { height: 48px; }
  .admin-table th:nth-child(3),
  .admin-table td:nth-child(3) { display: none; }
  .modal { padding: 22px 18px; }
  .lightbox-prev { left: 10px; }
  .lightbox-next { right: 10px; }
}

@media (max-width: 380px) {
  .album-grid, .photo-grid { grid-template-columns: 1fr; }
}
