/* ============================================================
   发布网管理 - 后台样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px; color: #1f2329; background: #f5f6f7;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* ---------- 整体布局（两栏） ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: #fff; border-right: 1px solid #e5e6eb;
  position: fixed; top: 0; bottom: 0; left: 0; overflow-y: auto; z-index: 100;
}
.main { flex: 1; margin-left: 216px; min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 侧边栏 ---------- */
.sidebar-logo {
  height: 56px; display: flex; align-items: center; padding: 0 20px;
  font-size: 17px; font-weight: 600; color: #d92b1c;
  border-bottom: 1px solid #f2f3f5; letter-spacing: 1px;
}
.menu { padding: 12px 10px 24px; }
.menu-group { font-size: 12px; color: #165dff; font-weight: 700; padding: 14px 10px 6px; }
.menu-item {
  display: block; padding: 9px 12px; border-radius: 8px;
  color: #4e5969; font-size: 13px; margin-bottom: 2px; transition: all .12s;
}
.menu-item:hover { background: #f7f8fa; color: #d92b1c; }
.menu-item.active { background: #fef2f2; color: #d92b1c; font-weight: 500; }

/* ---------- 顶栏 ---------- */
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid #e5e6eb;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 110;
}
.page-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.admin-name { color: #4e5969; }
.logout-btn { color: #d92b1c; }
.logout-btn:hover { text-decoration: underline; }

.content { padding: 20px 24px 40px; flex: 1; }

/* ---------- 卡片 ---------- */
.card {
  background: #fff; border-radius: 14px; border: 1px solid #f2f3f5;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04); padding: 16px 20px;
}
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* ---------- 工具栏 ---------- */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.search-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 表单控件（统一紧凑样式） ---------- */
input[type="text"], input[type="password"], input[type="number"],
input[type="url"], input[type="email"], input[type="date"],
select, textarea {
  height: 32px; padding: 6px 12px; font-size: 13px;
  border: 1px solid #e5e6eb; border-radius: 8px;
  outline: none; background: #fff; color: #1f2329; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: #d92b1c; }
textarea { height: auto; min-height: 90px; resize: vertical; }
select { padding-right: 26px; }

/* ---------- 富文本编辑器（wangEditor） ---------- */
.editor-box { border: 1px solid #e5e6eb; border-radius: 8px; overflow: hidden; background: #fff; }
.editor-box .w-e-toolbar { border-bottom: 1px solid #e5e6eb; }
.editor-box .w-e-text { padding: 8px 12px; min-height: 280px; }
.editor-box .w-e-text img { max-width: 100%; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 16px; font-size: 13px; border: none;
  border-radius: 8px; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: #d92b1c; color: #fff; }
.btn-primary:hover { background: #c4231a; }
.btn-default { background: #fff; color: #4e5969; border: 1px solid #e5e6eb; }
.btn-default:hover { color: #d92b1c; border-color: #d92b1c; }
.btn-danger { background: #fff; color: #d92b1c; border: 1px solid #ffcdd2; }
.btn-danger:hover { background: #fff1f0; }
.btn-success { background: #fff; color: #1d9e5f; border: 1px solid #b7ebcf; }
.btn-success:hover { background: #eefcf5; }
.btn-warning { background: #fff; color: #e6911c; border: 1px solid #ffe2ba; }
.btn-warning:hover { background: #fff7ec; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; border-radius: 6px; }

/* ---------- 表格（紧凑间距） ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  background: #fafbfc; color: #4e5969; font-weight: 500; text-align: left;
  padding: 9px 12px; border-bottom: 1px solid #e5e6eb; white-space: nowrap;
}
.table td { padding: 9px 12px; border-bottom: 1px solid #f2f3f5; vertical-align: middle; }
.table tr:hover td { background: #fafbfc; }
.table .td-img img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; display: block; }
.text-muted { color: #86909c; }
.link { color: #1d6cff; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops { display: flex; gap: 6px; }

/* 状态标签 */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 12px;
}
.tag-red { background: #fef2f2; color: #d92b1c; }
.tag-gray { background: #f2f3f5; color: #86909c; }
.tag-green { background: #e8ffea; color: #00b42a; }
.tag-orange { background: #fff7e8; color: #ff7d00; }
.tag-blue { background: #e8f3ff; color: #1d6cff; }

/* ---------- 开关 ---------- */
.switch { position: relative; display: inline-block; width: 38px; height: 20px; cursor: pointer; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #c9cdd4; border-radius: 20px; transition: .2s; }
.switch .slider::before {
  content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; left: 2px; top: 2px; transition: .2s;
}
.switch input:checked + .slider { background: #d92b1c; }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- 分页 ---------- */
.pagination { margin-top: 16px; display: flex; justify-content: flex-end; gap: 4px; }
.pagination a, .pagination span {
  display: inline-block; min-width: 30px; height: 30px; line-height: 28px;
  text-align: center; padding: 0 8px; border: 1px solid #e5e6eb;
  border-radius: 6px; font-size: 13px; color: #4e5969; background: #fff;
}
.pagination .current { background: #d92b1c; border-color: #d92b1c; color: #fff; }
.pagination .disabled { color: #c9cdd4; cursor: not-allowed; }

/* ---------- 表单页 ---------- */
.form-card { max-width: 720px; }
.form-group { display: flex; align-items: flex-start; margin-bottom: 16px; }
.form-label {
  width: 110px; padding-top: 6px; font-size: 13px; color: #4e5969;
  text-align: right; padding-right: 14px; flex-shrink: 0;
}
.form-control { flex: 1; }
.form-control input[type="text"], .form-control input[type="password"],
.form-control input[type="number"], .form-control input[type="url"],
.form-control input[type="email"], .form-control input[type="date"],
.form-control select { width: 100%; max-width: 420px; }
.form-control textarea { width: 100%; max-width: 420px; }
.form-tip { font-size: 12px; color: #86909c; margin-top: 4px; }
.required { color: #d92b1c; margin-right: 2px; }
.radio-group, .switch-group { display: flex; align-items: center; gap: 14px; padding-top: 5px; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.form-actions { margin-left: 124px; display: flex; gap: 10px; }

/* ---------- 图片上传 ---------- */
.upload-box { display: flex; align-items: center; gap: 10px; }
.upload-preview {
  width: 80px; height: 80px; border: 1px dashed #e5e6eb; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fafbfc; cursor: pointer; flex-shrink: 0;
}
.upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upload-preview .placeholder { color: #c9cdd4; font-size: 22px; }
.upload-input { display: none; }

/* ---------- 仪表盘 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 14px; padding: 18px 20px;
  border: 1px solid #f2f3f5; box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.stat-card .label { font-size: 13px; color: #86909c; }
.stat-card .num { font-size: 26px; font-weight: 600; margin-top: 6px; }
.stat-card .num.red { color: #d92b1c; }
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 20px; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.chart-ranges { display: flex; gap: 8px; }
.chart-box { height: 300px; width: 100%; }
.dash-list { font-size: 13px; }
.dash-list li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid #f2f3f5; }
.dash-list li:last-child { border-bottom: none; }
.dash-list .name { color: #1f2329; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.dash-list .val { color: #86909c; flex-shrink: 0; }

/* ---------- 登录页 ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #f5f6f7;
}
.login-box {
  width: 380px; background: #fff; border-radius: 14px;
  border: 1px solid #f2f3f5; box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
  padding: 36px 32px 28px;
}
.login-title { text-align: center; font-size: 20px; font-weight: 600; color: #d92b1c; margin-bottom: 4px; }
.login-sub { text-align: center; color: #86909c; font-size: 12px; margin-bottom: 26px; }
.login-box .form-group { margin-bottom: 18px; }
.login-box .form-control input { width: 100%; height: 38px; font-size: 14px; }
.login-box .btn { width: 100%; height: 38px; font-size: 14px; }

/* 提示 */
.msg-bar {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-60px);
  background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  padding: 10px 20px; font-size: 13px; z-index: 9999; transition: transform .25s; opacity: 0;
}
.msg-bar.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.msg-bar.success { color: #00b42a; }
.msg-bar.error { color: #d92b1c; }

/* 空数据 */
.empty { text-align: center; color: #86909c; padding: 40px 0; }

@media (max-width: 1200px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   侧边栏折叠 / 展开（三条杠按钮）
   ============================================================ */
.topbar-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sidebar-toggle {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 36px; height: 36px; padding: 8px; border: none; border-radius: 8px;
  background: none; cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.sidebar-toggle span {
  display: block; width: 18px; height: 2px; background: #4e5969; border-radius: 2px;
  transition: background .15s;
}
.sidebar-toggle:hover { background: #f7f8fa; }
.sidebar-toggle:hover span { background: #d92b1c; }

.sidebar { transition: transform .3s ease; }
.main { transition: margin-left .3s ease; }

/* 折叠状态：侧边栏滑出隐藏，内容区自动铺满（桌面与移动端一致） */
.layout.collapsed .sidebar { transform: translateX(-100%); }
.layout.collapsed .main { margin-left: 0; }
