/* 龙翌农业官网 - 后台管理样式 */
:root {
  --green-900: #14401c;
  --green-700: #2e7d32;
  --green-100: #e8f3e6;
  --wheat: #d4a24a;
  --ink: #2b2f2a;
  --ink-light: #5c655b;
  --line: #e6e1d6;
  --bg: #f5f4ef;
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; }

/* ---- 登录 ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, #123a19, #1b5e20 60%, #2e7d32);
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 44px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-card h1 { font-size: 22px; color: var(--green-900); margin-bottom: 6px; }
.login-card p { font-size: 13.5px; color: var(--ink-light); margin-bottom: 26px; }
.login-card input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 16px;
  font-family: inherit;
}
.login-card input:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(46,125,50,0.12); }
.login-card button {
  width: 100%;
  padding: 13px;
  background: var(--green-700);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.25s;
}
.login-card button:hover { background: var(--green-900); }
.login-error { color: #c0392b; font-size: 13px; margin-top: 12px; display: none; }
.login-tip { margin-top: 18px; font-size: 12.5px; color: var(--ink-light); text-align: center; }

/* ---- 后台框架 ---- */
.admin-shell { display: none; min-height: 100vh; }
.admin-topbar {
  background: var(--green-900);
  color: #fff;
  padding: 0 28px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.admin-topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.admin-topbar .brand span { font-weight: 400; font-size: 13px; opacity: 0.7; margin-left: 10px; }
.topbar-actions { display: flex; gap: 10px; }
.topbar-actions a, .topbar-actions button {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.12);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.25s;
}
.topbar-actions a:hover, .topbar-actions button:hover { background: rgba(255,255,255,0.22); }

.admin-main { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }

.tabs { display: flex; gap: 10px; margin-bottom: 26px; }
.tabs button {
  padding: 10px 22px;
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 24px;
  font-size: 14px;
  color: var(--ink);
  transition: all 0.25s;
}
.tabs button.active {
  background: var(--green-700);
  border-color: var(--green-700);
  color: #fff;
  font-weight: 600;
}
.tabs .badge {
  display: inline-block;
  background: #c0392b;
  color: #fff;
  font-size: 11px;
  border-radius: 10px;
  padding: 1px 7px;
  margin-left: 6px;
  vertical-align: 2px;
}

.panel { display: none; }
.panel.active { display: block; }

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.panel-head h2 { font-size: 19px; color: var(--green-900); }
.btn-add {
  background: var(--green-700);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.25s;
}
.btn-add:hover { background: var(--green-900); }

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(27,60,30,0.06);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; text-align: left; font-size: 14px; border-bottom: 1px solid var(--line); }
th { background: #faf8f3; color: var(--ink-light); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}
.tag.pub { background: var(--green-100); color: var(--green-700); }
.tag.draft { background: #f5e9cf; color: #8a6a1f; }
.tag.unread { background: #fdecea; color: #c0392b; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12.5px;
  color: var(--ink);
  transition: all 0.2s;
}
.row-actions button:hover { border-color: var(--green-700); color: var(--green-700); }
.row-actions button.danger:hover { border-color: #c0392b; color: #c0392b; }
.empty { padding: 56px; text-align: center; color: var(--ink-light); font-size: 14px; }

/* ---- 编辑弹窗 ---- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 40, 22, 0.45);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  padding: 32px;
}
.modal h3 { font-size: 18px; color: var(--green-900); margin-bottom: 20px; }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-group { margin-bottom: 16px; }
.f-group label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.f-group input, .f-group select, .f-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fbfaf7;
}
.f-group input:focus, .f-group select:focus, .f-group textarea:focus {
  outline: none; border-color: var(--green-700); background: #fff;
}
.f-group textarea { resize: vertical; min-height: 110px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.modal-actions button { padding: 10px 24px; border-radius: 10px; font-size: 14px; border: none; }
.btn-save { background: var(--green-700); color: #fff; font-weight: 600; }
.btn-save:hover { background: var(--green-900); }
.btn-cancel { background: #efede6; color: var(--ink); }

.toast {
  position: fixed;
  bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green-900);
  color: #fff;
  padding: 12px 26px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.msg-detail { font-size: 13.5px; color: var(--ink-light); max-width: 320px; }
.msg-detail b { color: var(--ink); }

@media (max-width: 768px) {
  .f-row { grid-template-columns: 1fr; }
  th:nth-child(3), td:nth-child(3) { display: none; }
  .admin-main { padding: 24px 14px 48px; }
}

/* ---- 自定义封面上传 ---- */
.cover-ctrl { display: flex; gap: 14px; align-items: flex-start; }
.cover-preview {
  width: 190px; height: 104px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cover-preview span { font-size: 12px; color: var(--ink-light); padding: 0 12px; text-align: center; }
.cover-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-btns { display: flex; flex-direction: column; gap: 8px; }
.btn-upload {
  border: 1.5px solid var(--green-700);
  color: var(--green-700);
  background: #fff;
  border-radius: 9px;
  padding: 8px 18px;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-upload:hover { background: var(--green-100); }
.btn-cancel-sm {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-light);
  border-radius: 9px;
  padding: 8px 18px;
  font-size: 13px;
}
.btn-cancel-sm:hover { border-color: #c0392b; color: #c0392b; }

/* ---- 富文本编辑器 ---- */
.editor-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap;
  border: 1.5px solid var(--line);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  padding: 8px 10px;
  background: #fbfaf7;
}
.editor-toolbar button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--ink);
  transition: all 0.2s;
}
.editor-toolbar button:hover { border-color: var(--green-700); color: var(--green-700); }
.editor-area {
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  border: 1.5px solid var(--line);
  border-radius: 0 0 9px 9px;
  padding: 14px 16px;
  font-size: 14.5px;
  line-height: 1.9;
  background: #fff;
  outline: none;
}
.editor-area:focus { border-color: var(--green-700); }
.editor-area:empty::before {
  content: attr(data-placeholder);
  color: #a8aca5;
  pointer-events: none;
}
.editor-area p { margin: 0 0 10px; }
.editor-area h2 { font-size: 19px; color: var(--green-900); margin: 14px 0 8px; }
.editor-area h3 { font-size: 16.5px; color: var(--green-900); margin: 12px 0 6px; }
.editor-area ul { padding-left: 22px; margin: 0 0 10px; }
.editor-area img { max-width: 100%; border-radius: 8px; margin: 8px 0; display: block; }
