﻿/* ============ 时光图床 全局样式 ============ */
:root {
  --bg: #f4f6fb;
  --bg-deep: #eef1f8;
  --card: rgba(255, 255, 255, 0.82);
  --card-solid: #ffffff;
  --border: rgba(99, 116, 158, 0.16);
  --text: #1e2433;
  --text-2: #5b6478;
  --text-3: #97a0b3;
  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --primary-3: #22d3ee;
  --primary-soft: rgba(99, 102, 241, 0.12);
  --danger: #ef4444;
  --ok: #10b981;
  --shadow: 0 10px 34px rgba(58, 72, 138, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --topbar-h: 60px;
}
html[data-theme="dark"] {
  --bg: #0f1220;
  --bg-deep: #0b0e19;
  --card: rgba(28, 33, 56, 0.78);
  --card-solid: #1c2138;
  --border: rgba(148, 163, 217, 0.14);
  --text: #e7e9f5;
  --text-2: #a7aec9;
  --text-3: #6d7597;
  --primary-soft: rgba(129, 140, 248, 0.16);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg-deep));
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* 背景装饰 */
.bg-decor { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-1 { width: 420px; height: 420px; background: #818cf8; top: -120px; left: -80px; }
.orb-2 { width: 380px; height: 380px; background: #22d3ee; bottom: -140px; right: -60px; opacity: 0.35; }
.orb-3 { width: 260px; height: 260px; background: #f472b6; top: 40%; left: 70%; opacity: 0.22; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--card);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; }
.brand-logo { font-size: 22px; }
.nav-links { display: flex; align-items: center; gap: 14px; }
.nav-link { color: var(--text-2); font-size: 14px; transition: color 0.2s; }
.nav-link:hover { color: var(--primary); }
.chip { font-size: 13px; padding: 5px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.icon-btn {
  border: 1px solid var(--border); background: var(--card-solid); color: var(--text);
  width: 34px; height: 34px; border-radius: 10px; font-size: 16px; transition: 0.2s;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--primary); }

/* 容器 */
.container { max-width: 1080px; margin: 0 auto; padding: 40px 20px 60px; position: relative; z-index: 1; }

.hero { text-align: center; margin-bottom: 28px; }
.hero-title { font-size: 40px; font-weight: 800; letter-spacing: 1px; }
.hero-title::before { content: "🖼️"; margin-right: 6px; }
.hero-sub { color: var(--text-2); margin-top: 10px; font-size: 15px; }

.announce {
  max-width: 760px; margin: 0 auto 24px; text-align: center;
  padding: 12px 18px; border-radius: 12px; font-size: 14px;
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--border);
}

/* 玻璃卡片 */
.glass {
  background: var(--card); backdrop-filter: blur(16px);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 上传区 */
.upload-card { padding: 20px; margin-bottom: 24px; }
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-sm);
  min-height: 220px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; transition: 0.25s; padding: 16px;
}
.upload-area.dragover, .upload-area:focus {
  border-color: var(--primary); background: var(--primary-soft); outline: none;
}
.upload-preview { width: 100%; }
.upload-placeholder { text-align: center; padding: 40px 10px; color: var(--text-2); }
.ph-icon { font-size: 52px; margin-bottom: 12px; }
.ph-title { font-size: 17px; font-weight: 600; color: var(--text); }
.ph-sub { font-size: 13px; margin-top: 8px; color: var(--text-3); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.preview-item {
  position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1;
  border: 1px solid var(--border); background: var(--card-solid);
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-item .pv-name {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 4px 6px;
  font-size: 11px; background: rgba(0,0,0,0.55); color: #fff; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.preview-item .pv-rm {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 12px; line-height: 1;
}
.upload-actions { display: flex; gap: 12px; margin-top: 16px; }
.btn {
  padding: 10px 22px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; transition: 0.2s; color: var(--text);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(99,102,241,0.45); }
.btn-ghost { background: var(--card-solid); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #ef4444); color: #fff; }
.btn-ok { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }

.progress-wrap { margin-top: 14px; width: 100%; max-width: 480px; display: flex; align-items: center; gap: 12px; }
.progress-bar-wrap { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--primary-3)); transition: width 0.2s; }
.progress-text { font-size: 12px; color: var(--text-2); min-width: 42px; text-align: right; }

/* 结果区 */
.result-card { padding: 22px; margin-bottom: 24px; }
.result-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.result-head h2 { font-size: 19px; }
.result-info { font-size: 13px; color: var(--text-2); }
.thumb-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.thumb-row img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab {
  padding: 9px 18px; background: none; border: none; color: var(--text-2);
  font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.code-box {
  width: 100%; min-height: 120px; padding: 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card-solid); color: var(--text);
  font-family: "Cascadia Code", Consolas, monospace; font-size: 13px; resize: vertical;
}
.tab-actions { display: flex; gap: 10px; margin-top: 12px; justify-content: flex-end; }

/* 页脚 */
.footer { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 40px; line-height: 2; }
.footer a { color: var(--text-3); }
.footer a:hover { color: var(--primary); }

/* Toast */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) translateY(12px);
  background: var(--card-solid); color: var(--text); padding: 13px 26px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 14px; border: 1px solid var(--border);
  opacity: 0; pointer-events: none; transition: 0.25s; z-index: 9999; max-width: 90%;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%); }
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

/* 表单通用 */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.input, .select, textarea.input {
  width: 100%; padding: 11px 14px; border-radius: 12px; font-size: 14px;
  border: 1px solid var(--border); background: var(--card-solid); color: var(--text); transition: 0.2s;
}
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 认证页 */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--topbar-h)); }
.auth-card { width: 100%; max-width: 420px; padding: 40px 34px; text-align: center; }
.auth-card h2 { margin-bottom: 6px; font-size: 24px; }
.auth-card .auth-sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.auth-card .field { text-align: left; }
.auth-error {
  background: rgba(239, 68, 68, 0.12); color: var(--danger); border: 1px solid rgba(239,68,68,0.3);
  padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px;
}
.auth-alt { margin-top: 18px; font-size: 13px; color: var(--text-3); }

/* 后台通用 */
.admin-body { padding: 0; }
.admin-body .topbar { position: static; }
.admin-layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.admin-side {
  width: 230px; flex-shrink: 0; background: var(--card); backdrop-filter: blur(14px);
  border-right: 1px solid var(--border); padding: 24px 14px;
}
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  color: var(--text-2); font-size: 14px; font-weight: 600; margin-bottom: 6px; transition: 0.2s;
}
.side-link:hover { background: var(--primary-soft); color: var(--primary); }
.side-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,0.35); }
.admin-main { flex: 1; padding: 28px 32px; min-width: 0; }
.admin-main h1 { font-size: 24px; margin-bottom: 4px; }
.admin-main .page-sub { color: var(--text-3); font-size: 13px; margin-bottom: 24px; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { padding: 22px; border-radius: var(--radius); }
.stat-card .stat-label { font-size: 13px; color: var(--text-2); }
.stat-card .stat-value { font-size: 30px; font-weight: 800; margin-top: 6px; }
.stat-card .stat-icon { float: right; font-size: 30px; opacity: 0.8; }
.stat-card .stat-extra { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.panel { padding: 22px; margin-bottom: 22px; border-radius: var(--radius); }
.panel h3 { font-size: 16px; margin-bottom: 16px; }
.chart-wrap { position: relative; height: 300px; }

/* 表格 */
.table-card { padding: 12px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px; }
.toolbar .input { max-width: 260px; }
.toolbar .spacer { flex: 1; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-3); font-size: 12px; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--primary-soft); }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.pagination { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 16px; }
.page-btn {
  padding: 6px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--card-solid); color: var(--text-2); font-size: 13px;
}
.page-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 网格视图 */
.grid-card { padding: 16px; }
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.img-tile {
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--card-solid);
  transition: 0.2s; position: relative;
}
.img-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.img-tile img { width: 100%; height: 150px; object-fit: cover; display: block; }
.img-tile .tile-body { padding: 10px; }
.img-tile .tile-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.img-tile .tile-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.img-tile .tile-actions { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); }
.tile-actions .btn { flex: 1; padding: 6px 4px; font-size: 12px; border-radius: 8px; }
.img-tile .tile-check {
  position: absolute; top: 8px; left: 8px; width: 20px; height: 20px; accent-color: var(--primary);
}

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; border-radius: 999px; background: var(--border); transition: 0.25s; cursor: pointer; }
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  left: 3px; top: 3px; background: #fff; transition: 0.25s;
}
.switch input:checked + .slider { background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row .t-label { font-size: 14px; font-weight: 600; }
.toggle-row .t-desc { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 登录页（后台） */
.admin-login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.admin-login-card { width: 100%; max-width: 420px; padding: 40px 34px; text-align: center; }
.admin-login-card h2 { font-size: 24px; margin-bottom: 6px; }
.admin-login-card .auth-sub { color: var(--text-3); font-size: 13px; margin-bottom: 26px; }

/* 响应式 */
@media (max-width: 860px) {
  .topbar-inner { padding: 0 14px; }
  .container { padding: 26px 16px 48px; }
}

@media (max-width: 760px) {
  .topbar-inner { padding: 0 12px; gap: 8px; }
  .brand { font-size: 16px; gap: 7px; }
  .brand-logo { font-size: 19px; }
  .nav-links { gap: 10px; }
  .nav-link { font-size: 13px; }
  .chip { font-size: 12px; padding: 4px 10px; }

  .hero { margin-bottom: 20px; }
  .hero-title { font-size: 26px; }
  .hero-sub { font-size: 13px; }
  .announce { padding: 10px 12px; font-size: 13px; }

  .upload-card { padding: 14px; }
  .upload-area { min-height: 170px; }
  .ph-icon { font-size: 40px; }
  .ph-title { font-size: 14px; }
  .ph-sub { font-size: 12px; }
  .upload-actions { flex-direction: column; }
  .upload-actions .btn { width: 100%; padding: 12px; }
  .progress-wrap { max-width: 100%; }

  .result-card { padding: 16px; }
  .result-head h2 { font-size: 17px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 9px 14px; font-size: 13px; white-space: nowrap; }
  .tab-actions { justify-content: stretch; }
  .tab-actions .btn { flex: 1; }
  .thumb-row img { width: 60px; height: 60px; }
  .code-box { font-size: 12px; }

  .footer { font-size: 12px; }

  /* admin */
  .admin-side { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; -webkit-overflow-scrolling: touch; }
  .admin-layout { flex-direction: column; }
  .side-link { white-space: nowrap; margin-bottom: 0; margin-right: 6px; padding: 10px 14px; font-size: 13px; }
  .admin-main { padding: 20px 14px; }
  .admin-main h1 { font-size: 20px; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-value { font-size: 24px; }
  .chart-wrap { height: 220px; }
  .panel { padding: 16px; }

  .toolbar { flex-wrap: wrap; margin: 10px; gap: 8px; }
  .toolbar .input { max-width: 100%; width: 100%; }
  .toolbar .select { max-width: 100%; width: 100%; }
  .toolbar .spacer { display: none; }

  /* horizontal scroll for tables on small screens */
  .admin-main table { min-width: 720px; }
  .table-card, .admin-main .panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .pagination { flex-wrap: wrap; gap: 6px; }
  .page-btn { padding: 8px 12px; font-size: 13px; }

  .img-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .img-tile img { height: 120px; }

  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 100%; }
  .toggle-row { gap: 12px; }
  .toggle-row .t-label { font-size: 13px; }
}

@media (max-width: 480px) {
  .auth-card, .admin-login-card { padding: 28px 20px; }
  .terms-box { padding: 20px !important; }
  .hero-title { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr; }
  .stat-card .stat-value { font-size: 22px; }
  .thumb-row img { width: 54px; height: 54px; }
  .admin-main { padding: 16px 10px; }
  .img-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .topbar-inner { padding: 0 10px; }
}

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 14, 30, 0.55);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.22s;
  padding: 20px;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 420px;
  background: var(--card-solid);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.22s ease;
  overflow: hidden;
}
.modal-overlay.show .modal { transform: translateY(0) scale(1); }
.modal-head {
  padding: 20px 22px 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close {
  background: none; border: none; color: var(--text-3);
  font-size: 20px; line-height: 1; padding: 4px; border-radius: 8px;
  transition: 0.15s;
}
.modal-close:hover { color: var(--danger); background: rgba(239,68,68,0.1); }
.modal-body { padding: 14px 22px 6px; font-size: 14px; color: var(--text-2); line-height: 1.7; }
.modal-foot { padding: 16px 22px 22px; display: flex; gap: 10px; justify-content: flex-end; }
.modal-foot .btn { flex: 1; }

/* 弹窗内表单 */
.modal-form .field { margin-bottom: 14px; }
.modal-form .field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.modal-error {
  background: rgba(239, 68, 68, 0.1); color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.25);
  padding: 9px 13px; border-radius: 10px; font-size: 13px; margin-bottom: 12px;
  display: none;
}
.modal-error.show { display: block; }
.modal-switch { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 4px; }
.modal-switch a { cursor: pointer; font-weight: 600; }

/* 登录图标区 */
.auth-modal-icon {
  width: 56px; height: 56px; margin: 6px auto 2px;
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: linear-gradient(135deg, var(--primary-soft), rgba(34, 211, 238, 0.15));
  border: 1px solid var(--border);
}

/* 危险操作弹窗图标 */
.modal-icon-danger {
  width: 60px; height: 60px; margin: 8px auto 4px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.modal-icon-warn {
  width: 60px; height: 60px; margin: 8px auto 4px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.modal-icon-info {
  width: 60px; height: 60px; margin: 8px auto 4px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 28px; background: var(--primary-soft);
  border: 1px solid var(--border);
}


/* ?????? */
.modal-preview { max-width: 860px; width: 92vw; }
.preview-body { padding: 18px 20px 8px; }
.preview-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; word-break: break-all; }
.preview-wrap {
  display: flex; align-items: center; justify-content: center;
  max-height: 62vh; overflow: auto; border-radius: 12px;
  background: #0b1020; border: 1px solid var(--border);
}
.preview-img { max-width: 100%; max-height: 62vh; display: block; object-fit: contain; }
.preview-meta { font-size: 12px; color: var(--text-3); margin-top: 10px; word-break: break-all; }

/* ???????? */
.thumb { cursor: pointer; }
.img-tile img { cursor: zoom-in; }
