/* ============================================================
   恋爱日记 · 后台样式
   ============================================================ */

:root {
  --plum: #2b1630;
  --rose: #e05c7a;
  --rose-deep: #c94566;
  --blush: #fbf3f5;
  --cream: #fffafb;
  --ink: #3c2a34;
  --ink-soft: #7a6470;
  --line: #efe2e8;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --shadow: 0 20px 50px -22px rgba(60, 20, 45, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 90% -10%, rgba(224, 92, 122, 0.10), transparent 60%),
    linear-gradient(180deg, var(--blush), var(--cream));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

.hidden, [hidden] { display: none !important; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 700px at 80% -10%, rgba(224, 92, 122, 0.45), transparent 55%),
    radial-gradient(800px 600px at 10% 110%, rgba(217, 168, 126, 0.3), transparent 55%),
    linear-gradient(160deg, #1c0e22, #33162f 45%, #57243f);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 24px;
  padding: 46px 40px 40px;
  text-align: center;
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.6);
  animation: rise 0.6s var(--ease);
}
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.login-card__heart { font-size: 2rem; color: var(--rose); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1);} 50% { transform: scale(1.3);} }
.login-card__title { font-family: var(--serif); font-size: 1.7rem; color: var(--plum); margin: 10px 0 6px; }
.login-card__sub { color: var(--ink-soft); font-size: 0.9rem; margin-bottom: 26px; }
.login-card__error { color: var(--rose-deep); font-size: 0.85rem; min-height: 1.4em; margin-top: 14px; }

/* ============ 布局 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(255, 250, 251, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__brand { font-family: var(--serif); font-size: 1.15rem; color: var(--plum); display: flex; align-items: center; gap: 10px; }
.topbar__heart { color: var(--rose); }
.topbar__actions { display: flex; gap: 10px; flex-wrap: wrap; }

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 30px 24px 80px;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 26px;
  align-items: start;
}

.panel {
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
}
.panel__title { font-family: var(--serif); font-size: 1.35rem; color: var(--plum); margin-bottom: 6px; }
.panel__hint { color: var(--ink-soft); font-size: 0.88rem; margin-bottom: 22px; }

.form-panel { position: sticky; top: 90px; }

/* ============ 表单控件 ============ */
.field { display: block; margin-bottom: 18px; }
.field__label { display: block; font-size: 0.86rem; color: var(--ink); margin-bottom: 8px; font-weight: 500; }
.field__label em { color: var(--ink-soft); font-style: normal; font-weight: 400; font-size: 0.8rem; }

.input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fdfafb;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.input:focus { border-color: var(--rose); background: #fff; box-shadow: 0 0 0 4px rgba(224, 92, 122, 0.12); }
.textarea { resize: vertical; min-height: 100px; }

/* 拖拽区 */
.dropzone {
  position: relative;
  border: 2px dashed rgba(224, 92, 122, 0.4);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  background: #fdfafb;
  transition: border-color 0.25s, background 0.25s;
  margin-bottom: 18px;
}
.dropzone.is-drag { border-color: var(--rose); background: rgba(224, 92, 122, 0.06); }
.dropzone__inner { padding: 40px 20px; text-align: center; }
.dropzone__icon { font-size: 2rem; margin-bottom: 8px; }
.dropzone__text { font-size: 0.95rem; color: var(--ink); }
.dropzone__meta { font-size: 0.78rem; color: var(--ink-soft); margin-top: 4px; }
.dropzone__preview { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.dropzone__clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

/* 按钮 */
.btn {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.25s, background 0.25s, opacity 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active { transform: scale(0.97); }
.btn--primary { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; box-shadow: 0 12px 26px -10px rgba(224, 92, 122, 0.65); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 32px -10px rgba(224, 92, 122, 0.75); }
.btn--ghost { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn--ghost:hover { border-color: var(--rose); color: var(--rose); }
.btn--danger { background: #fff; color: var(--rose-deep); border: 1.5px solid rgba(201, 69, 102, 0.3); }
.btn--danger:hover { background: var(--rose-deep); color: #fff; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* ============ 列表 ============ */
.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; }
.list-head__count { font-size: 0.85rem; color: var(--ink-soft); }

.entry-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.entry-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 26px -16px rgba(60, 20, 45, 0.3);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  animation: fadeUp 0.4s var(--ease) both;
}
.entry-card:hover { transform: translateY(-4px); box-shadow: 0 22px 40px -18px rgba(60, 20, 45, 0.4); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: none;} }

.entry-card__img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #f3e9ee; }
.entry-card__body { padding: 14px 16px; }
.entry-card__date { font-family: var(--serif); font-size: 0.78rem; letter-spacing: 0.1em; color: var(--rose); margin-bottom: 4px; }
.entry-card__title { font-family: var(--serif); font-size: 1.05rem; color: var(--plum); margin-bottom: 4px; line-height: 1.4; }
.entry-card__desc {
  font-size: 0.84rem;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}
.entry-card__actions { display: flex; gap: 8px; }
.entry-card__actions .btn { flex: 1; padding: 8px 6px; font-size: 0.82rem; }

.list-empty { text-align: center; color: var(--ink-soft); padding: 60px 20px; }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(20, 10, 18, 0.55); backdrop-filter: blur(4px); }
.modal__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #fff;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 40px 90px -20px rgba(0, 0, 0, 0.5);
  animation: rise 0.35s var(--ease);
  max-height: 90vh;
  overflow-y: auto;
}
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.modal__head h3 { font-family: var(--serif); font-size: 1.3rem; color: var(--plum); }
.modal__x { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--ink-soft); }
.cfg-cover-preview { display: block; width: 100%; max-height: 180px; margin-top: 10px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--plum);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s var(--ease);
  z-index: 200;
  pointer-events: none;
}
.toast.is-show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.is-error { background: var(--rose-deep); }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .topbar { padding: 14px 18px; }
}

/* ============ 情话便签管理 ============ */
.notes-admin {
  max-width: 1200px;
  margin: 0 auto 80px;
  padding: 0 24px;
}
.note-form {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}
.note-form .textarea { min-height: 52px; resize: vertical; }
.note-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.note-item {
  background: #fff8f2;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px -14px rgba(60, 20, 45, 0.3);
  animation: fadeUp 0.35s var(--ease) both;
}
.note-item__text { font-size: 0.95rem; color: var(--ink); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.note-item__foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.note-item__author { font-size: 0.8rem; color: var(--ink-soft); }
.note-item__del {
  background: none;
  border: none;
  color: var(--rose-deep);
  cursor: pointer;
  font-size: 0.85rem;
  opacity: 0.6;
  transition: opacity 0.2s;
}
.note-item__del:hover { opacity: 1; }

@media (max-width: 700px) {
  .note-form { grid-template-columns: 1fr; }
}
