/* ============================================================
   SystemTools团队图床 · 样式
   创建时间：2026-09-19
   浅色 / 深色主题由 CSS 变量控制
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #6366f1;
  --primary-soft: #eef2ff;
  --success: #34d399;
  --danger: #ef4444;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
  --radius: 14px;
}

html[data-theme="dark"] {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --primary-soft: #312e81;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

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

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

#app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 20px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo img { width: 40px; height: 40px; display: block; }
.brand-text h1 { font-size: 22px; font-weight: 700; }
.brand-text p { font-size: 13px; color: var(--muted); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--card-bg);
  font-size: 20px; cursor: pointer; transition: transform .2s;
}
.icon-btn:hover { transform: scale(1.06); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.section-title { font-size: 17px; font-weight: 700; }
.section-sub { font-size: 13px; color: var(--muted); margin: 4px 0 14px; }

code { background: var(--primary-soft); padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- Token 栏 ---------- */
.token-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.token-label p { font-size: 12px; color: var(--muted); }
.token-label label { font-weight: 600; }
.token-form { display: flex; gap: 8px; flex: 1; min-width: 260px; }
.token-form input {
  flex: 1; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text); outline: none;
}
.token-form input:focus { border-color: var(--primary); }
.auth-status {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--danger); color: #fff; white-space: nowrap;
}
.auth-status.ok { background: var(--success); }

/* ---------- 按钮 ---------- */
.btn {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
  min-height: 42px;
}
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--card-bg); color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 上传设置 ---------- */
.settings-head { display: flex; align-items: center; justify-content: space-between; }
.switch-wrap .switch {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.switch input { display: none; }
.switch .slider {
  width: 44px; height: 24px; background: var(--border); border-radius: 999px;
  position: relative; transition: background .25s;
}
.switch .slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; transition: transform .25s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::after { transform: translateX(20px); }
.switch-label { font-size: 14px; font-weight: 600; }

.settings-body { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.settings-body.hidden { display: none; }
.opt-row { display: flex; align-items: center; gap: 12px; }
.opt-row label { width: 120px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.opt-row input[type="range"] { flex: 1; accent-color: var(--primary); }
.opt-row output { min-width: 44px; font-size: 13px; font-weight: 600; color: var(--primary); }
.opt-row input[type="number"] {
  width: 110px; padding: 8px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg); color: var(--text);
}
.opt-unit { font-size: 13px; color: var(--muted); }
.opt-hint { font-size: 12px; color: var(--muted); background: var(--bg); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); }

/* ---------- 上传区 ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-soft); }
.dz-icon { font-size: 40px; }
.dz-main strong { display: block; font-size: 16px; }
.dz-main span { font-size: 13px; color: var(--muted); }
.dropzone input[type="file"] { display: none; }

.upload-queue { list-style: none; margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.upload-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--bg);
}
.upload-item .thumb-slot {
  width: 44px; height: 44px; border-radius: 8px; overflow: hidden; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.upload-item .thumb { width: 100%; height: 100%; object-fit: cover; }
.upload-item .thumb.hidden { display: none; }
.thumb-spin {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 1s linear infinite;
}
.thumb-spin.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.upload-item .info { flex: 1; min-width: 0; }
.upload-item .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .meta { font-size: 12px; color: var(--muted); }
.upload-item .bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.upload-item .bar-fill { height: 100%; width: 0; background: var(--primary); border-radius: 999px; transition: width .3s; }
.upload-item.success { border-color: var(--success); }
.upload-item.success .bar-fill { background: var(--success); width: 100%; }
.upload-item.fail { border-color: var(--danger); }
.upload-item .copy-btn {
  border: none; background: var(--primary); color: #fff; cursor: pointer;
  padding: 7px 12px; border-radius: 8px; font-size: 13px; flex-shrink: 0;
}
.upload-item .remove-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; flex-shrink: 0; }

/* ---------- 统计看板 ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px;
}
.stat-item {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; text-align: center;
}
.stat-num { font-size: 22px; font-weight: 800; color: var(--primary); word-break: break-all; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-sub { font-size: 11px; color: var(--muted); }

.trend-wrap { margin-top: 20px; }
.trend-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.trend-chart { display: flex; align-items: flex-end; gap: 8px; height: 120px; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend-col .count { font-size: 12px; color: var(--muted); }
.trend-bar {
  width: 100%; max-width: 46px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--primary), #818cf8);
  min-height: 4px; transition: height .5s;
}
.trend-col .date { font-size: 11px; color: var(--muted); }

/* ---------- 图库 ---------- */
.gallery-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.gallery-card-item {
  position: relative; border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; background: var(--bg); aspect-ratio: 1 / 1;
}
.gallery-card-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-card-item .hover-actions {
  position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 8px;
  justify-content: center; padding: 10px; opacity: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(15,23,42,.7));
  transition: opacity .25s;
}
.gallery-card-item:hover .hover-actions { opacity: 1; }
.hover-actions button {
  flex: 1; border: none; border-radius: 8px; padding: 8px 0;
  font-size: 13px; font-weight: 600; cursor: pointer; min-height: 36px;
}
.btn-copy { background: var(--primary); color: #fff; }
.btn-del { background: var(--danger); color: #fff; }
.gallery-empty {
  text-align: center; color: var(--muted); padding: 50px 0; font-size: 14px;
}
.gallery-more { text-align: center; margin-top: 16px; }

/* ---------- 弹窗 ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal {
  background: var(--card-bg); border-radius: var(--radius); padding: 22px;
  max-width: 380px; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,.3);
}
.modal h3 { font-size: 17px; margin-bottom: 14px; }
.modal img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 10px; background: var(--bg); margin-bottom: 12px; }
.modal p { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.modal p b { color: var(--danger); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.3);
  max-width: 90vw; text-align: center;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); color: #06341f; }

/* ---------- 加载态 ---------- */
.loading {
  text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px;
}
.skeleton { color: var(--muted); font-size: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 560px) {
  .brand-text p { display: none; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  #app { padding: 12px 12px 64px; }
  .modal-actions .btn { flex: 1; }
  .brand-text h1 { font-size: 19px; }
}