/* ============================================================
   资源中心 · 全局样式
   明亮简洁风格，蓝紫渐变强调色
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #eef1f7;
  --border: #e6e9f2;
  --border-strong: #d7dce8;
  --text: #1c2433;
  --muted: #5b6472;
  --faint: #98a1b3;
  --accent: #3b82f6;
  --accent-2: #6366f1;
  --accent-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  --danger: #f43f5e;
  --ok: #10b981;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, 0.12);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1000px 460px at 8% -8%, rgba(99, 102, 241, 0.08), transparent 58%),
    radial-gradient(900px 440px at 100% 0%, rgba(59, 130, 246, 0.06), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

::selection { background: rgba(99, 102, 241, 0.2); }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  background: var(--accent-grad);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.32);
}

.nav { display: flex; gap: 4px; margin-left: 4px; }

.nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 14.5px;
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link.active { color: var(--accent); background: rgba(59, 130, 246, 0.1); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.auth-user {
  color: var(--muted);
  font-size: 13.5px;
  margin-right: 2px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease,
              border-color 0.15s ease, color 0.15s ease, filter 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-sm { padding: 7px 13px; font-size: 13px; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.28);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 24px rgba(59, 130, 246, 0.36); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-danger {
  background: rgba(244, 63, 94, 0.07);
  border-color: rgba(244, 63, 94, 0.28);
  color: #e11d48;
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.13); border-color: rgba(244, 63, 94, 0.45); }

.btn-block { width: 100%; }

/* ---------- 主体 ---------- */
.site-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: calc(100vh - 62px - 64px);
}

/* ---------- 首页头区 ---------- */
.page-head { margin-bottom: 22px; }

.page-head h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--text);
}

.page-head .lead { margin: 0; color: var(--muted); font-size: 14.5px; }

.search-filter {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1 1 280px;
  min-width: 220px;
}

.search-box svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-box input::placeholder { color: var(--faint); }
.search-box input:focus {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.select {
  height: 44px;
  padding: 0 34px 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: var(--shadow-sm);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2398a1b3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select:focus { border-color: rgba(59, 130, 246, 0.7); }

.stat { color: var(--muted); font-size: 13px; margin: 6px 2px 16px; }

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

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-3);
  overflow: hidden;
}

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

.card:hover .cover img { transform: scale(1.04); }

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(244, 63, 94, 0.94);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 15px 15px;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 9px; }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
  transition: background 0.15s;
}
.tag:hover { background: rgba(59, 130, 246, 0.18); }
.tag.tag-plain { background: var(--surface-2); color: var(--muted); }

.card-title {
  margin: 0 0 6px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
}
.card-title a:hover { color: var(--accent); }

.card-desc {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
}

.card-meta {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 9px;
  margin-top: 12px;
}
.card-actions .btn { flex: 1; }

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  padding: 60px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}
.empty .empty-icon {
  display: block;
  margin: 0 auto 14px;
  color: var(--faint);
}
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty p { margin: 0; font-size: 13.5px; }

/* ---------- 详情页 ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13.5px;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--text); }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.detail-cover { background: var(--surface-3); min-height: 260px; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }

.detail-body { padding: 26px 26px 28px; }

.detail-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.detail-title {
  margin: 0 0 12px;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text);
}

.detail-desc { color: var(--muted); font-size: 14.5px; line-height: 1.7; white-space: pre-line; }
.detail-desc:empty { display: none; }

.detail-meta {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 12.5px;
}

.detail-actions { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.detail-actions .btn { min-width: 150px; }

/* ---------- 上传 / 管理页 ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
}
@media (min-width: 900px) {
  .admin-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.panel .panel-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

.field { margin-bottom: 16px; }
.field > label { display: block; margin-bottom: 7px; font-size: 13px; color: var(--muted); }

.field input[type="text"],
.field input[type="password"],
.field input[type="file"],
.field textarea,
.field select {
  width: 100%;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  padding: 11px 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.field .hint { margin-top: 6px; color: var(--faint); font-size: 12px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.check-list { display: flex; flex-wrap: wrap; gap: 9px; }
.check-list label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.check-list label:has(input:checked) {
  border-color: rgba(59, 130, 246, 0.6);
  background: rgba(59, 130, 246, 0.1);
}
.check-list input { width: auto; accent-color: var(--accent); }

.file-input { position: relative; }
.file-input input[type="file"] { padding: 10px; color: var(--muted); cursor: pointer; }
.file-input input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-radius: 8px;
  padding: 8px 13px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

/* 管理列表 */
.manage-list { display: flex; flex-direction: column; gap: 10px; }
.manage-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}
.manage-item .thumb {
  width: 52px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-3);
  flex: 0 0 auto;
}
.manage-item .mi-main { flex: 1; min-width: 0; }
.manage-item .mi-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.manage-item .mi-meta { color: var(--faint); font-size: 12px; }
.manage-item .btn { flex: 0 0 auto; }

/* ---------- 登录 / 注册 ---------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(99, 102, 241, 0.1), transparent 58%),
    radial-gradient(800px 460px at 100% 20%, rgba(59, 130, 246, 0.08), transparent 55%),
    var(--bg);
}

.auth-page { width: min(400px, 100%); }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 26px;
  box-shadow: var(--shadow-lg);
}

.brand-center { justify-content: center; margin-bottom: 18px; }

.auth-title { margin: 0 0 6px; font-size: 20px; font-weight: 800; text-align: center; color: var(--text); }
.auth-sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; text-align: center; }

.auth-err {
  background: rgba(244, 63, 94, 0.08);
  border: 1px solid rgba(244, 63, 94, 0.25);
  color: #e11d48;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 13px;
}
.auth-links a { color: var(--accent); }
.auth-links a:hover { text-decoration: underline; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.6);
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}
.footer-muted { color: var(--faint); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .header-inner { height: auto; min-height: 58px; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .header-actions { margin-left: 0; }
  .site-main { padding: 20px 16px 40px; }
  .detail { grid-template-columns: 1fr; }
  .detail-body { padding: 20px 18px 22px; }
  .page-head h1 { font-size: 24px; }
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .search-filter .btn { flex: 1; }
  .card-actions .btn { padding-left: 8px; padding-right: 8px; }
}

/* ---------- 联系我们悬浮窗 ---------- */
.contact-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-grad);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.contact-fab:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(59, 130, 246, 0.5); }

.contact-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}

.contact-modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: var(--shadow-lg);
}

.contact-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.contact-close:hover { background: var(--surface-3); color: var(--text); }

.contact-title { margin: 0 0 6px; font-size: 19px; font-weight: 800; color: var(--text); }
.contact-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }

.contact-success { text-align: center; padding: 26px 8px; }
.contact-success p { margin: 12px 0 0; font-size: 15px; font-weight: 700; color: var(--text); }

/* ---------- 公告 ---------- */
.notice-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.notice-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.notice-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.notice-badge {
  display: inline-flex;
  align-items: center;
  background: var(--accent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
}
.notice-date { color: var(--faint); font-size: 12px; }
.notice-title { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: var(--text); }
.notice-content { color: var(--muted); font-size: 13.5px; line-height: 1.6; }
