/* ===== 小雫的后台 - 管理页样式 ===== */
:root {
  --pink: #ec6f9e;
  --pink-light: #f9c6d8;
  --pink-bg: #fdf2f7;
  --blue: #7ec3e8;
  --blue-light: #d6ecfa;
  --text: #5a4a52;
  --text-light: #a08d96;
  --border: #f0dfe7;
  --shadow: 0 6px 20px rgba(236, 111, 158, 0.12);
  --shadow-lg: 0 16px 48px rgba(236, 111, 158, 0.22);
  --radius: 14px;
  --sidebar-w: 230px;
}

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

/* 共用 SVG 图标尺寸 */
.ico { width: 1.05em; height: 1.05em; vertical-align: -0.18em; fill: currentColor; display: inline-block; }
.ico-lg { width: 1.3em; height: 1.3em; vertical-align: -0.22em; fill: currentColor; display: inline-block; }
.ico-sm { width: 0.9em; height: 0.9em; vertical-align: -0.12em; fill: currentColor; display: inline-block; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  background: linear-gradient(160deg, #fdf2f7 0%, #fef8fb 45%, #f3f8fc 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  animation: popIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.login-logo {
  width: 60px;
  height: 60px;
  color: var(--pink);
  margin: 0 auto;
  animation: bounce 3s ease-in-out infinite;
  display: block;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-top: 8px;
  background: linear-gradient(120deg, var(--pink), #f09bc0);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub { color: var(--text-light); font-size: 13px; margin: 4px 0 24px; }
.login-form { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.login-error {
  margin-top: 14px;
  color: #e0486b;
  font-size: 13px;
  background: #fdeef2;
  padding: 10px;
  border-radius: 10px;
}
.login-back {
  display: inline-block;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-light);
}
.login-back:hover { color: var(--pink); }

/* ===== 后台布局 ===== */
.admin-wrap { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .logo-icon { width: 32px; height: 32px; color: var(--pink); flex-shrink: 0; }
.sidebar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.sidebar-sub { font-size: 11px; color: var(--text-light); }
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px;
}
.side-link {
  display: block;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.side-link:hover { background: var(--pink-bg); color: var(--pink); }
.side-link.active {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 4px 12px rgba(236,111,158,0.3);
}
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.side-gohome { color: var(--blue); }
.side-logout { color: #d95f6b; }

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 24px 28px 40px;
}
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.admin-topbar h2 { font-size: 22px; font-weight: 700; }
.topbar-user { font-size: 14px; color: var(--text-light); }

.view-panel { animation: fadeIn 0.25s; }

/* ===== 面板头 ===== */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

/* ===== 按钮 ===== */
.btn {
  padding: 9px 18px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-primary { background: var(--pink); color: #fff; box-shadow: 0 4px 12px rgba(236,111,158,0.3); }
.btn-primary:hover { background: #d95f8c; }
.btn-ghost { background: #f0e4ea; color: var(--text); }
.btn-ghost:hover { background: #e3d3db; }
.btn-danger { background: #fdeef2; color: #e0486b; }
.btn-danger:hover { background: #e0486b; color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ===== 表格 ===== */
.table-wrap {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  padding: 13px 16px;
  background: #faf4f7;
  color: var(--text-light);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f7eef2;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fdfafb; }
.td-url {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--blue);
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.td-cat {
  display: inline-block;
  font-size: 12px;
  color: var(--pink);
  background: var(--pink-bg);
  padding: 2px 10px;
  border-radius: 999px;
}
.td-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ===== 表单 ===== */
.field-label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 5px;
  font-weight: 600;
}
.input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s;
  outline: none;
}
.input:focus { border-color: var(--pink); }
.textarea { resize: vertical; min-height: 60px; }

/* ===== 上传区 ===== */
.upload-zone {
  background: #fff;
  border: 2px dashed var(--pink-light);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--pink);
  background: var(--pink-bg);
}
.upload-icon { font-size: 42px; }
.upload-text { font-size: 15px; color: var(--text); margin-top: 8px; }
.upload-sub { font-size: 12px; color: var(--text-light); margin-top: 4px; }

/* ===== 图床画廊（后台） ===== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .img-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-item:hover .img-overlay { opacity: 1; }
.img-overlay button {
  border: none;
  background: #fff;
  color: var(--text);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}
.img-overlay button:hover { background: var(--pink); color: #fff; }
.img-overlay button.btn-del:hover { background: #e0486b; }

/* ===== 弹窗 ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 200; }
.modal.open { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(60, 40, 52, 0.45);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s;
}
.modal-card {
  position: relative;
  width: min(460px, 92vw);
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  animation: popIn 0.25s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-card form { display: flex; flex-direction: column; gap: 8px; }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(60, 40, 52, 0.9);
  color: #fff;
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 网站设置面板 ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}
.settings-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
}
.settings-card-wide { grid-column: 1 / -1; }
.settings-card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.settings-card-desc { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }
.settings-preview {
  height: 150px;
  border-radius: 10px;
  border: 1.5px dashed var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #faf7f9;
  margin-bottom: 14px;
}
.settings-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.settings-preview-icon { height: 100px; }
.settings-preview-icon img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 12px;
}
.settings-preview-empty { color: #c4b6be; font-size: 13px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-actions .btn { display: inline-flex; align-items: center; }

/* ===== 动画 ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.94) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar .sidebar-title, .sidebar .sidebar-sub, .sidebar .side-link span,
  .sidebar .logo-icon ~ div { display: none; }
  .sidebar .side-link { text-align: center; padding: 12px 0; font-size: 18px; }
  .admin-main { margin-left: 60px; padding: 16px; }
}
