/* ============================================================
   Kelantan 管理后台 —— 暗调
   ============================================================ */
:root {
  --bg: #0c0c0f;
  --bg-soft: #121218;
  --panel: #16161d;
  --panel-2: #1c1c24;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #ece9e2;
  --text-dim: #a5a29a;
  --text-faint: #6d6b66;
  --gold: #c9a46b;
  --gold-soft: rgba(201, 164, 107, 0.14);
  --danger: #e06c5b;
  --ok: #7fbf8f;
  --serif: "Cormorant Garamond", Georgia, "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
button { font-family: inherit; }
::selection { background: var(--gold-soft); color: var(--gold); }
img { display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- 通用按钮 / 输入 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; color: var(--text);
  font-size: 13px; letter-spacing: 0.06em;
  padding: 8px 16px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold); }
.btn-primary { background: var(--gold); border-color: var(--gold); color: #161410; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); color: #161410; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: rgba(255, 255, 255, 0.03); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 7px;
  border: 1px solid transparent; background: none;
  color: var(--text-dim); font-size: 18px; line-height: 1;
  cursor: pointer; transition: all 0.2s;
}
.icon-btn:hover { color: var(--gold); border-color: var(--line); background: var(--panel-2); }
.ipt {
  width: 100%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text);
  padding: 11px 13px; font-size: 14px;
  outline: none; transition: border-color 0.2s;
}
.ipt:focus { border-color: var(--gold); }
.ipt::placeholder { color: var(--text-faint); }
textarea.ipt { resize: vertical; min-height: 64px; }

/* ---------- 登录页 ---------- */
.auth {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(46% 38% at 50% 0%, rgba(201, 164, 107, 0.07), transparent 70%),
    var(--bg);
}
.auth-card {
  width: min(400px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 42px 38px 34px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.auth-brand { font-family: var(--serif); font-size: 19px; letter-spacing: 0.3em; text-align: center; }
.auth-brand em { font-style: normal; font-size: 11px; letter-spacing: 0.4em; color: var(--gold); margin-left: 6px; }
.auth-title { margin: 30px 0 6px; font-size: 20px; font-weight: 600; letter-spacing: 0.08em; text-align: center; }
.auth-sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 26px; }
.auth-form input { margin-bottom: 12px; }
.auth-card .ipt { margin-bottom: 14px; }
.auth-err {
  margin-top: 12px; color: var(--danger); font-size: 13px; text-align: center;
}
.auth-tip {
  margin-top: 18px; padding: 12px 14px;
  border: 1px dashed var(--line-strong); border-radius: 8px;
  color: var(--text-dim); font-size: 12.5px; line-height: 1.7;
}

/* ---------- 主界面布局 ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.adm-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  position: sticky; top: 0; z-index: 40;
}
.adm-brand { font-family: var(--serif); font-size: 18px; letter-spacing: 0.3em; }
.adm-brand em { font-style: normal; font-size: 10.5px; letter-spacing: 0.4em; color: var(--gold); margin-left: 6px; }
.adm-actions { display: flex; gap: 8px; }

.layout { flex: 1; display: flex; min-height: 0; }
.side {
  width: 236px; flex: none;
  border-right: 1px solid var(--line);
  background: var(--bg-soft);
  display: flex; flex-direction: column;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 8px 18px;
  color: var(--text-dim); font-size: 12px; letter-spacing: 0.24em;
}
.cat-nav { flex: 1; overflow-y: auto; padding: 4px 10px 18px; }
.cat-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 10px 10px;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--text-dim);
  cursor: pointer; text-align: left;
  margin-bottom: 2px;
  transition: all 0.18s;
}
.cat-item:hover { color: var(--text); background: var(--panel); }
.cat-item.active { color: var(--gold); background: var(--gold-soft); border-color: rgba(201, 164, 107, 0.3); }
.cat-item .ci-name { flex: 1; font-size: 14px; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .ci-count { font-size: 11px; color: var(--text-faint); }
.cat-item .ci-ops { display: none; gap: 2px; }
.cat-item:hover .ci-ops, .cat-item.active .ci-ops { display: inline-flex; }
.ci-ops .icon-btn { width: 24px; height: 24px; font-size: 13px; }
.side-foot { padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-faint); text-align: center; }

.workspace {
  flex: 1; min-width: 0;
  padding: 22px 26px 60px;
  position: relative;
  background:
    radial-gradient(60% 30% at 60% 0%, rgba(255, 255, 255, 0.015), transparent 70%);
}
.workspace.is-dragover { outline: 2px dashed var(--gold); outline-offset: -10px; border-radius: 12px; }
.ws-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.ws-title { font-size: 22px; font-weight: 600; letter-spacing: 0.06em; }
.ws-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; letter-spacing: 0.1em; }
.drop-tip {
  position: fixed; inset: 0; z-index: 90; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(12, 12, 15, 0.72);
  color: var(--gold); font-size: 22px; letter-spacing: 0.4em;
  border: 3px dashed var(--gold);
}

/* ---------- 上传队列 ---------- */
.up-queue {
  margin-bottom: 18px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel);
  padding: 14px 16px;
}
.up-queue h4 { font-size: 12px; letter-spacing: 0.2em; color: var(--text-dim); margin-bottom: 10px; }
.uq-item { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 13px; }
.uq-item .uqi-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); }
.uq-item .uqi-state { font-size: 12px; }
.uq-item.done .uqi-state { color: var(--ok); }
.uq-item.fail .uqi-state { color: var(--danger); }

/* ---------- 照片网格 ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.adm-photo {
  position: relative;
  border-radius: 10px; overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
}
.adm-photo img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(0.9);
  transition: filter 0.2s, transform 0.6s;
}
.adm-photo:hover img { filter: brightness(0.55); transform: scale(1.05); }

/* 拖拽排序反馈 */
.adm-photo[draggable="true"] { cursor: grab; }
.adm-photo.dragging { opacity: 0.3; cursor: grabbing; }
.adm-photo.drop-target { outline: 2px dashed var(--gold); outline-offset: -2px; }
.adm-photo.drop-target img { filter: brightness(1.05); transform: scale(1.05); }
.adm-photo .ap-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 10px 8px;
  font-size: 12px; color: rgba(236, 233, 226, 0.94);
  background: linear-gradient(to top, rgba(5,5,7,0.85), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity 0.2s;
}
.adm-photo:hover .ap-title { opacity: 1; }
.ap-badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; letter-spacing: 0.2em;
  background: var(--gold); color: #161410;
  padding: 3px 8px; border-radius: 999px;
}
.ap-ops {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  opacity: 0; transition: opacity 0.2s;
}
.adm-photo:hover .ap-ops { opacity: 1; }
.ap-ops .btn { padding: 6px 10px; font-size: 12px; background: rgba(10, 10, 13, 0.82); backdrop-filter: blur(4px); }

.ws-empty {
  text-align: center; padding: 90px 20px;
  border: 1px dashed var(--line-strong); border-radius: 14px;
  color: var(--text-dim);
}
.ws-empty-big {
  font-size: 44px; color: var(--text-faint); line-height: 1;
  margin-bottom: 16px;
}
.ws-empty .dim { margin-top: 8px; font-size: 12.5px; color: var(--text-faint); }
.ws-hint {
  margin-top: 34px; padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px; color: var(--text-faint); letter-spacing: 0.04em;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 5, 7, 0.72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  width: min(440px, 94vw);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 24px 24px 20px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  animation: pop 0.22s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-title { font-size: 17px; letter-spacing: 0.06em; margin-bottom: 18px; }
.modal-body .ipt { margin-bottom: 12px; }
.modal-body .field-label { display: block; font-size: 12px; color: var(--text-dim); margin: 4px 0 6px; letter-spacing: 0.1em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-msg { font-size: 13px; color: var(--text-dim); line-height: 1.8; }
.modal-msg b { color: var(--gold); }
.modal-msg .warn { color: var(--danger); }

/* ---------- 分享链接 ---------- */
.pub-line { margin-bottom: 12px; }
.pub-badge { font-size: 12px; letter-spacing: 0.08em; }
.pub-badge.pub-on { color: var(--ok); }
.pub-badge.pub-off { color: var(--danger); }
.pub-row { display: flex; gap: 8px; align-items: stretch; }
.pub-row .ipt { flex: 1; min-width: 0; margin-bottom: 12px; font-size: 12.5px; }
.pub-row .btn { white-space: nowrap; margin-bottom: 12px; }
.pub-url { color: var(--gold); }

/* ---------- Toast ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-left: 3px solid var(--gold);
  color: var(--text); font-size: 13px;
  padding: 11px 18px; border-radius: 9px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.4);
  animation: slideIn 0.25s ease;
  max-width: 340px;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .side { width: 100%; max-height: 190px; border-right: none; border-bottom: 1px solid var(--line); }
  .cat-nav { flex-wrap: wrap; display: flex; }
  .cat-item { width: auto; }
  .adm-actions .btn { padding: 6px 10px; font-size: 12px; }
  .ws-head { flex-wrap: wrap; }
}
