/* 餐饮朝前看 后台管理样式：炭黑 + 品牌红 */
:root {
  --red: #E60012;
  --red-dark: #C50010;
  --ink: #232323;
  --ink-2: #4A4A4A;
  --gray: #8A8A8A;
  --line: #E8E8E8;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* 顶部栏 */
.topbar {
  background: linear-gradient(135deg, #262626, #101010);
  color: #fff;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1px;
}

.logo-mark {
  width: 22px;
  height: 22px;
  background: var(--red);
  border-radius: 5px;
  transform: rotate(45deg);
  display: inline-block;
  flex-shrink: 0;
}

#nav {
  display: flex;
  gap: 4px;
  padding-bottom: 0;
  overflow-x: auto;
}

#nav button {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  padding: 12px 18px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

#nav button:hover { color: #fff; }

#nav button.active {
  color: #fff;
  border-bottom-color: var(--red);
  font-weight: 600;
}

/* 主区域 */
main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.loading, .empty {
  text-align: center;
  color: var(--gray);
  padding: 60px 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  padding-left: 12px;
  border-left: 5px solid var(--red);
  line-height: 1.3;
}

.page-sub { color: var(--gray); font-size: 13px; margin-top: 6px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 10px;
  border-left: 4px solid var(--red);
}

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.stat-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--red);
}

.stat-label { color: var(--gray); font-size: 13px; margin-top: 2px; }

/* 列表 */
.list-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child { border-bottom: none; }

.thumb {
  width: 128px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: #1A1A1A;
  flex-shrink: 0;
}

.thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.list-main { flex: 1; min-width: 0; }

.list-title {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-sub {
  color: var(--gray);
  font-size: 12px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-ops { flex-shrink: 0; display: flex; gap: 8px; }

/* 按钮 */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 22px;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover { opacity: 0.85; }

.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.ghost { background: #fff; border-color: #DDD; color: var(--ink-2); }
.btn.danger { background: #fff; border-color: #F3C2C6; color: var(--red); }
.btn.small { padding: 5px 14px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.form-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field label .req { color: var(--red); margin-left: 2px; }

.field input[type='text'],
.field input[type='date'],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #FBFBFB;
  outline: none;
}

.field textarea { resize: vertical; min-height: 90px; }

.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--red);
  background: #fff;
}

.hint { font-size: 12px; color: var(--gray); margin-top: 5px; }

/* 上传区 */
.uploader {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.uploader input[type='file'] { display: none; }

.uploader .upload-btn {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
}

.uploader .upload-btn:hover { background: #000; }

.upload-progress { color: var(--red); font-size: 13px; font-weight: 600; }

.preview-cover {
  width: 200px;
  border-radius: 8px;
  display: block;
  background: #1A1A1A;
}

.preview-video {
  width: 100%;
  max-width: 480px;
  border-radius: 8px;
  background: #000;
  display: block;
}

/* 文章正文块编辑器 */
.block-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.block-row select {
  width: 90px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #FBFBFB;
  font-size: 13px;
}

.block-row textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  min-height: 44px;
  resize: vertical;
  background: #FBFBFB;
}

.block-row .blk-ops { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

.block-row .blk-ops button {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1;
}

.block-row .blk-ops button:hover { border-color: var(--red); color: var(--red); }

/* 设置页动态行 */
.dyn-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.4fr auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.dyn-row.way { grid-template-columns: 70px 1fr 1.6fr auto; }

.dyn-row input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  background: #FBFBFB;
  width: 100%;
}

/* 导出 */
.export-text {
  width: 100%;
  height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12px;
  background: #FBFBFB;
  resize: vertical;
}

/* 登录 */
.login-box {
  max-width: 380px;
  margin: 80px auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.login-box h2 { margin-bottom: 18px; font-size: 18px; }

.login-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
  outline: none;
}

.login-box input:focus { border-color: var(--red); }

/* 提示条 */
.notice {
  background: #FFF7F7;
  border: 1px solid #F6C9CD;
  color: #A33;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 18px;
}

code {
  background: #F0F0F0;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  padding: 10px 26px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 999;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 响应式 */
@media (max-width: 720px) {
  main { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .dyn-row, .dyn-row.way { grid-template-columns: 1fr; gap: 6px; }
  .dyn-row button { width: 100%; }
  .list-item { align-items: flex-start; }
  .thumb { width: 96px; height: 54px; }
  .list-title { white-space: normal; }
  .userbox { display: none; }
}

/* 顶栏用户区 */
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  white-space: nowrap;
}

.userbox button {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 999px;
  padding: 5px 16px;
  font-size: 12px;
  cursor: pointer;
}

.userbox button:hover {
  background: var(--red);
  border-color: var(--red);
}
