/* ============================================================
   黄梅雅韵网 · 后台样式
   ============================================================ */
:root {
  --ink: #2b3a42; --ink-2: #55636b; --paper: #f4f2ec;
  --cinnabar: #9a3b3b; --gold: #b08d57; --line: #e2ddd0; --side: #243440;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--paper); color: var(--ink); font-size: 14px; }
a { text-decoration: none; color: inherit; }

.admin-body { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: var(--side); color: #b8c0c4; flex: none; }
.admin-brand { padding: 22px 18px; color: #fff; font-size: 15px; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand .mark { width: 32px; height: 32px; background: var(--cinnabar); color: #fff; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.admin-side nav { display: flex; flex-direction: column; padding: 12px 0; }
.admin-side nav a { padding: 11px 22px; font-size: 14px; border-left: 3px solid transparent; }
.admin-side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-side nav a.on { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--cinnabar); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 26px; display: flex; justify-content: space-between; align-items: center; }
.admin-top a { color: var(--cinnabar); }
.admin-content { padding: 26px; max-width: 1100px; }

.dash-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.dash-head h2 { font-size: 19px; letter-spacing: 1px; }
.dash-head h2 small { color: var(--ink-2); font-size: 13px; font-weight: normal; margin-left: 8px; }
.dash-head .btn { margin-left: auto; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 26px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 12px; text-align: center; transition: .2s; }
.stat-card:hover { border-color: var(--cinnabar); box-shadow: 0 6px 18px rgba(0,0,0,.06); transform: translateY(-2px); }
.stat-icon { display: inline-block; width: 40px; height: 40px; line-height: 40px; border-radius: 50%; background: var(--paper); color: var(--cinnabar); font-size: 19px; margin-bottom: 8px; }
.stat-card b { display: block; font-size: 24px; }
.stat-label { font-size: 12px; color: var(--ink-2); letter-spacing: 2px; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.dash-box h3 { font-size: 15px; margin-bottom: 10px; padding-left: 10px; border-left: 3px solid var(--cinnabar); }

/* 表格 */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table td, .admin-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table thead th { background: #faf8f3; font-weight: normal; color: var(--ink-2); }
.admin-table-lg { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.admin-table .muted { color: var(--ink-2); font-size: 12px; }
.admin-table .ops a { color: var(--ink-2); margin-right: 10px; }
.admin-table .ops a:hover { color: var(--cinnabar); }
.admin-table .ops a.del { color: #b3563b; }
.tag-yes { background: var(--gold); color: #fff; border-radius: 4px; padding: 1px 8px; font-size: 12px; }

/* 按钮 */
.btn { display: inline-block; padding: 9px 22px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--cinnabar); color: #fff; }
.btn-primary:hover { background: #7d2f2f; }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: var(--cinnabar); color: var(--cinnabar); }

/* 表单 */
.admin-form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 22px 26px; }
.form-row { display: flex; margin-bottom: 16px; }
.form-label { width: 110px; flex: none; padding-top: 8px; color: var(--ink-2); }
.form-label em { color: var(--cinnabar); font-style: normal; }
.form-ctl { flex: 1; }
.form-ctl input[type=text], .form-ctl input[type=password], .form-ctl input[type=date],
.form-ctl input[type=datetime-local], .form-ctl select, .form-ctl textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; outline: none; font-family: inherit;
}
.form-ctl input:focus, .form-ctl textarea:focus, .form-ctl select:focus { border-color: var(--cinnabar); }
.form-ctl textarea { resize: vertical; }
.form-ctl .ck { display: inline-flex; align-items: center; gap: 8px; padding-top: 8px; cursor: pointer; }
.hint { font-size: 12px; color: #a9a294; margin-top: 4px; }
.img-field .img-preview { display: block; width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px; }

/* 提示 */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: #e8f3e8; color: #2f6b2f; border: 1px solid #cde3cd; }
.alert-err { background: #f9e9e6; color: #9a3b2f; border: 1px solid #eccfca; }

/* 分页 */
.pager { text-align: center; padding: 18px 0 4px; }
.pager a, .pager .cur { display: inline-block; min-width: 32px; padding: 5px 9px; margin: 0 3px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.pager .cur { background: var(--cinnabar); color: #fff; border-color: var(--cinnabar); }

/* 登录页 */
.login-body { background: linear-gradient(150deg, #243440, #38464f); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 36px 34px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-mark { width: 56px; height: 56px; background: var(--cinnabar); color: #fff; font-size: 30px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.login-card h1 { font-size: 17px; text-align: center; letter-spacing: 2px; margin-bottom: 22px; }
.login-form label { display: block; margin-bottom: 14px; color: var(--ink-2); font-size: 13px; }
.login-form input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; outline: none; }
.login-form input:focus { border-color: var(--cinnabar); }
.login-form .btn { width: 100%; margin-top: 8px; background: var(--cinnabar); color: #fff; }

/* ---------- 通用 Markdown 编辑器 ---------- */
.na-md {
	width: 100%; max-width: 1000px;
	border: 1px solid #d1d5db; border-radius: 8px; background: #fff; overflow: hidden;
}
.na-md:focus-within { border-color: #9a3b3b; box-shadow: 0 0 0 2px rgba(154,59,59,.12); }
.na-md-bar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 3px;
	padding: 6px 8px; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
}
.na-md-btn {
	flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid transparent; border-radius: 5px; background: transparent;
	color: #475569; cursor: pointer;
}
.na-md-btn svg { width: 16px; height: 16px; display: block; }
.na-md-btn:hover { background: #f1f5f9; border-color: #e2e8f0; color: var(--c, #9a3b3b); }
.na-md-btn:disabled { opacity: .55; cursor: default; }
.na-md-btn.na-md-uploading {
	width: auto; padding: 0 8px; font-size: 12px; color: #0d9488;
}
/* 标题/正文 自定义下拉（点击不失焦，光标不跳） */
.na-md-dd { flex: 0 0 auto; position: relative; }
.na-md-dd-btn {
	height: 28px; padding: 0 8px; gap: 5px;
	display: inline-flex; align-items: center;
	font-size: 12px; border: 1px solid #cbd5e1; border-radius: 5px;
	background: #fff; color: #334155; cursor: pointer;
}
.na-md-dd-btn svg { width: 13px; height: 13px; }
.na-md-dd-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.na-md-dd.open .na-md-dd-btn { border-color: #9a3b3b; color: #9a3b3b; }
.na-md-menu {
	display: none; position: absolute; top: 31px; left: 0; z-index: 30;
	min-width: 118px; padding: 4px; background: #fff;
	border: 1px solid #e2e8f0; border-radius: 7px;
	box-shadow: 0 8px 24px rgba(15,23,42,.16);
}
.na-md-dd.open .na-md-menu { display: block; }
.na-md-menu button {
	width: 100%; height: 30px; padding: 0 9px; gap: 8px;
	display: flex; align-items: center; text-align: left;
	border: none; border-radius: 5px; background: transparent;
	font-size: 13px; color: #334155; cursor: pointer;
}
.na-md-menu button:hover { background: #eff6ff; color: #9a3b3b; }
.na-md-menu button.on { background: #f1f5f9; font-weight: 600; }
.na-md-menu button .na-md-hmark {
	flex: 0 0 38px; font-family: Consolas, Monaco, monospace;
	font-size: 12px; color: #94a3b8;
}
.na-md-menu button.on .na-md-hmark,
.na-md-menu button:hover .na-md-hmark { color: inherit; }
.na-md-sep { flex: 0 0 auto; width: 1px; height: 18px; margin: 0 4px; background: #cbd5e1; }

.na-md-main { display: flex; height: 380px; }
.na-md-mid .na-md-main { height: 220px; }
/* 选择器写成 .na-md textarea.na-md-input 提高优先级，压住全局 textarea.tall/.mid 的固定高度 */
.na-md textarea.na-md-input {
	flex: 1 1 50%; min-width: 0; width: auto; max-width: none;
	height: 100%; min-height: 0; margin: 0; padding: 12px 14px;
	border: none; border-radius: 0; resize: none; overflow-y: auto;
	font-family: Consolas, Monaco, "Courier New", monospace; font-size: 14px; line-height: 1.8;
	color: #1e293b; background: #fff; outline: none; word-break: break-word;
}
.na-md-split-line { flex: 0 0 1px; background: #e5e7eb; }
/* 选择器写成 .na-md .na-md-preview 提高优先级，压住旧 .md-preview 的 height:56vh/边框/圆角，让预览区撑满容器 */
.na-md .na-md-preview {
	flex: 1 1 50%; height: 100%; margin: 0; padding: 12px 18px; overflow-y: auto;
	border: none; border-radius: 0; background: #fff; font-size: 14px;
}

/* 模式切换按钮组 */
.na-md-modes {
	flex: 0 0 auto; margin-left: auto; display: inline-flex;
	border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden;
}
.na-md-modes button {
	height: 28px; padding: 0 12px; font-size: 12.5px;
	border: none; border-right: 1px solid #cbd5e1;
	background: #fff; color: #475569; cursor: pointer;
}
.na-md-modes button:last-child { border-right: none; }
.na-md-modes button:hover { background: #f1f5f9; }
.na-md-modes button.on { background: #9a3b3b; color: #fff; }

/* 编辑模式：只留输入框 */
.na-md.mode-edit .na-md-preview,
.na-md.mode-edit .na-md-split-line { display: none; }
.na-md.mode-edit .na-md-input { flex-basis: 100%; }
/* 预览模式：只留预览区 */
.na-md.mode-preview .na-md-input,
.na-md.mode-preview .na-md-split-line { display: none; }
.na-md.mode-preview .na-md-preview { flex-basis: 100%; }

/* 底部状态栏：用法提示 + 字数统计 */
.na-md-status {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 5px 10px; border-top: 1px solid #e5e7eb; background: #fafafa;
	font-size: 12px; color: #64748b; line-height: 1.6;
}
.na-md-tip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.na-md-tip.is-err { color: #dc2626; font-weight: 600; }
.na-md-count { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: #94a3b8; }

/* 全屏按钮 */
.na-md-full-btn {
	flex: 0 0 auto; margin-left: 6px; height: 28px; padding: 0 9px;
	border: 1px solid #cbd5e1; border-radius: 6px; background: #fff;
	color: #475569; font-size: 15px; line-height: 1; cursor: pointer;
}
.na-md-full-btn:hover { background: #f1f5f9; color: #9a3b3b; border-color: #9a3b3b; }

/* 全屏模式：铺满视口，编辑区占满剩余高度 */
.na-md.na-md-full {
	position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 9999;
	max-width: none; width: auto; border: none; border-radius: 0;
	display: flex; flex-direction: column; box-shadow: none;
}
.na-md.na-md-full .na-md-main { flex: 1 1 auto; height: auto; min-height: 0; }
.na-md.na-md-full .na-md-status { flex: 0 0 auto; }
body.na-md-body-lock { overflow: hidden; }

/* 拖入图片时的落区提示 */
.na-md.na-md-dragover { outline: 2px dashed #9a3b3b; outline-offset: -3px; }
.na-md.na-md-dragover .na-md-preview { background: #fdf6f2; }


/* 后台列表：搜索与分类筛选 */
.admin-filter { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.admin-filter .filter-form { display: flex; gap: 8px; margin: 0 0 10px; align-items: center; }
.admin-filter .filter-form input { padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; outline: none; min-width: 240px; }
.admin-filter .filter-form .btn { border-radius: 6px; padding: 7px 16px; letter-spacing: 0; }
.admin-filter .filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-sm { padding: 5px 12px; font-size: 13px; letter-spacing: 0; }
.chip { display: inline-block; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink-2); }
.chip:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.chip.on { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff; }
