/* ============================================================
   LoveGirl 管理后台样式
   ============================================================ */

:root {
  --primary: #ff7fa4;
  --primary-deep: #f45b86;
  --ink: #4a3540;
  --ink-soft: #9a838c;
  --bg: #f7f2f4;
  --card: #ffffff;
  --line: #f0dfe5;
  --danger: #e05656;
  --radius: 14px;
  --side-w: 220px;
}

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  min-height: 100vh;
}

.hidden { display: none !important; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ---------------- 按钮 ---------------- */

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13.5px;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary { background: linear-gradient(135deg, var(--primary), #ff9ab8); color: #fff; box-shadow: 0 4px 12px rgba(255, 127, 164, 0.35); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-deep); }
.btn-danger { background: #fff1f1; color: var(--danger); border: 1px solid #ffd9d9; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.link-btn { border: none; background: none; color: var(--ink-soft); font-size: 13px; }
.link-btn:hover { color: var(--primary-deep); }

/* ---------------- 登录 ---------------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(900px 400px at 15% 15%, #ffe4ee 0%, transparent 55%),
    radial-gradient(800px 500px at 90% 85%, #ffd6e4 0%, transparent 55%),
    linear-gradient(160deg, #fff6f9, #ffe9f1);
  padding: 20px;
}

.login-card {
  width: min(380px, 92vw);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid #ffd3e0;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(244, 91, 134, 0.22);
  padding: 40px 34px;
  text-align: center;
}

.login-logo { font-size: 42px; animation: heartbeat 1.6s ease-in-out infinite; display: inline-block; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.22); }
  24% { transform: scale(1); }
}

.login-card h1 { font-size: 20px; margin: 10px 0 4px; }
.login-tip { color: var(--ink-soft); font-size: 13px; margin-bottom: 24px; }

.login-card input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  outline: none;
  margin-bottom: 14px;
  text-align: center;
  letter-spacing: 1px;
}

.login-card input:focus { border-color: var(--primary); }
.login-err { margin-top: 12px; color: var(--danger); font-size: 13px; }

/* ---------------- 布局 ---------------- */

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w);
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 20px 18px;
  font-weight: 800;
  font-size: 16px;
  color: var(--primary-deep);
  border-bottom: 1px solid var(--line);
}

.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.side-nav a {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--ink-soft);
  margin-bottom: 2px;
  transition: all 0.15s;
}

.side-nav a:hover { background: #fff0f5; color: var(--primary-deep); }
.side-nav a.active { background: linear-gradient(135deg, var(--primary), #ff9ab8); color: #fff; }

.side-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.side-foot a { color: var(--ink-soft); font-size: 13px; }
.side-foot a:hover { color: var(--primary-deep); }

.page { flex: 1; padding: 26px clamp(16px, 3vw, 44px) 60px; width: 100%; min-width: 0; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h2 { font-size: 20px; }
.page-head .sub { color: var(--ink-soft); font-size: 13px; margin-top: 4px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------- 卡片与表单 ---------------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(180, 120, 140, 0.08);
}

.panel { padding: 22px 24px; margin-bottom: 18px; }
.panel h3 { font-size: 15.5px; margin-bottom: 16px; color: var(--ink); }
.panel h3 .hint { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin-left: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field.span2 { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--ink-soft); }

.field input[type="text"], .field input[type="password"], .field input[type="date"],
.field input[type="number"], .field textarea, .field select {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: none;
  transition: border 0.2s;
  background: #fff;
  color: var(--ink);
  width: 100%;
}

.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 70px; }

.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #e8ccd6; transition: background 0.2s; cursor: pointer;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.2s; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(20px); }

.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 42px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }

.form-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* 头像/背景预览 */
.preview-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.preview-ava { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); background: #fff; }
.preview-bg { width: 160px; height: 88px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line); background: #fff; }

/* 纪念日编辑 */
.anniv-row { display: grid; grid-template-columns: 1.4fr 1fr auto auto; gap: 10px; align-items: center; margin-bottom: 10px; }
.anniv-row input[type="text"] { border: 1.5px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; outline: none; }
.anniv-row input[type="date"] { border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; outline: none; }

/* ---------------- 概览 ---------------- */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }

.stat-card { padding: 20px 22px; display: flex; align-items: center; gap: 16px; }
.stat-card .icon {
  width: 50px; height: 50px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, #ffe8f0, #ffd6e4);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.stat-card .num { font-size: 26px; font-weight: 800; color: var(--primary-deep); line-height: 1.1; }
.stat-card .lbl { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.stat-card .num small { font-size: 13px; color: var(--ink-soft); font-weight: 400; }

/* ---------------- 列表 ---------------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }

.toolbar input[type="text"], .toolbar select, .toolbar input[type="search"] {
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  background: #fff;
}

.toolbar input[type="search"] { flex: 1; min-width: 220px; }
.toolbar .spacer { flex: 1; }

.toolbar input:focus { border-color: var(--primary); }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #fdf5f8; color: var(--ink-soft); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fffafc; }

.td-content { max-width: 460px; }

.ev-title-link {
  border: none;
  background: none;
  padding: 0;
  font-size: 13.5px;
  color: var(--ink);
  text-align: left;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

.ev-title-link:hover { color: var(--primary-deep); text-decoration: underline; }

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }

.badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.badge.on { background: #e8f8ee; color: #2e9e5b; }
.badge.off { background: #fdecec; color: var(--danger); }
.badge.pink { background: #fff0f5; color: var(--primary-deep); }

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

.thumb-sm { width: 52px; height: 40px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff0f5; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; color: var(--ink-soft); font-size: 13px; }

.empty { text-align: center; padding: 44px 16px; color: var(--ink-soft); }
.empty .big { font-size: 36px; display: block; margin-bottom: 10px; }

/* ---------------- 相册管理 ---------------- */

.album-admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }

.album-admin-card { overflow: hidden; display: flex; flex-direction: column; }

.album-admin-card .imgbox { position: relative; aspect-ratio: 4 / 3; background: #fff0f5; }
.album-admin-card .imgbox img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-admin-card .imgbox .cover-badge {
  position: absolute; left: 8px; top: 8px;
  background: rgba(255, 127, 164, 0.92); color: #fff;
  font-size: 11px; border-radius: 999px; padding: 2px 10px;
}

.album-admin-card .meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.album-admin-card .meta .t { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.album-admin-card .meta .d {
  font-size: 12.5px; color: var(--ink-soft); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 20px;
}
.album-admin-card .meta .ops { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; }
.album-admin-card .meta .ops .btn { flex: 1; }

/* 相册编辑器里的照片选择(封面) */
.ab-imgs-pick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.ab-imgs-pick .ph { position: relative; width: 92px; height: 72px; border-radius: 10px; overflow: hidden; border: 2px solid var(--line); }
.ab-imgs-pick .ph img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.ab-imgs-pick .ph.cover { border-color: var(--primary); box-shadow: 0 0 0 3px #ffd6e4; }
.ab-imgs-pick .ph .tag {
  position: absolute; left: 0; right: 0; bottom: 0; text-align: center;
  background: rgba(255, 127, 164, 0.9); color: #fff; font-size: 10.5px; padding: 1px 0;
}
.ab-imgs-pick .ph .rm {
  position: absolute; right: 2px; top: 2px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(255,255,255,0.92); color: var(--danger); font-size: 11px; line-height: 1;
}

/* ---------------- 上传组件 ---------------- */

.up-zone {
  border: 2px dashed #ffc3d4;
  border-radius: 14px;
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
  background: #fffafc;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.up-zone:hover, .up-zone.drag { border-color: var(--primary); background: #fff0f5; color: var(--primary-deep); }
.up-zone .big { font-size: 30px; display: block; margin-bottom: 6px; }
.up-zone .sub { font-size: 12px; margin-top: 4px; }

.up-list { display: flex; flex-direction: column; gap: 10px; }

.up-item { background: #fdf5f8; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.up-item .row1 { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 6px; }
.up-item .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .st { color: var(--ink-soft); flex: none; }
.up-item .st.ok { color: #2e9e5b; }
.up-item .st.err { color: var(--danger); }

.up-bar { height: 8px; background: #f3dce4; border-radius: 999px; overflow: hidden; }
.up-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, #ffb1c8, var(--primary-deep)); transition: width 0.25s; }

/* ---------------- 弹窗 ---------------- */

.modal-mask {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(60, 20, 35, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff;
  border-radius: 18px;
  width: min(680px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  animation: modalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-x { border: none; background: none; font-size: 18px; color: var(--ink-soft); }
.modal-x:hover { color: var(--danger); }

.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.modal.confirm { width: min(400px, 92vw); }
.modal.confirm .modal-body { text-align: center; font-size: 14.5px; line-height: 1.8; }

/* 编辑器配图选择 */
.cover-pick { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cover-pick label {
  position: relative; width: 84px; height: 66px; border-radius: 10px; overflow: hidden;
  cursor: pointer; border: 2px solid var(--line);
}
.cover-pick label img { width: 100%; height: 100%; object-fit: cover; }
.cover-pick input { position: absolute; opacity: 0; }
.cover-pick label:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px #ffd6e4; }
.cover-pick label .no {
  position: absolute; right: 3px; top: 3px; background: var(--primary); color: #fff;
  width: 18px; height: 18px; border-radius: 50%; font-size: 11px;
  display: flex; align-items: center; justify-content: center; opacity: 0;
}
.cover-pick label:has(input:checked) .no { opacity: 1; }

.char-tip { font-size: 12px; color: var(--ink-soft); text-align: right; margin-top: 4px; }
.char-tip.over { color: var(--danger); }

/* ---------------- Toast ---------------- */

.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  z-index: 400; background: rgba(70, 25, 40, 0.92); color: #fff;
  padding: 11px 24px; border-radius: 999px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toastIn 0.3s; max-width: 86vw; text-align: center;
}

@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- 响应式 ---------------- */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side-brand { border-bottom: none; padding: 14px 16px; }
  .side-nav { display: flex; flex-wrap: wrap; padding: 8px; }
  .side-nav a { padding: 7px 11px; font-size: 13px; }
  .side-foot { border-top: none; padding: 8px 12px; margin-left: auto; }
  .anniv-row { grid-template-columns: 1fr 1fr; }
  .page { padding: 18px 14px 50px; }
}
