/* ============================================================
   Lumière CMS · Chinese-localized admin shell
   ============================================================ */

/* ---- 通用重置 ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f3ee;
  color: #2a2520;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
code {
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 0.85em;
  background: #faf8f3;
  padding: 2px 6px;
  border-radius: 4px;
  color: #b8956a;
}

/* ============================================================
   1. 登录页
   ============================================================ */
.login-body {
  background: linear-gradient(135deg, #2a2520, #1a1612);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 44px 42px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.login-brand .logo-mark {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, #d4b87a, #b8956a);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem; font-weight: 700;
}
.login-brand strong { display: block; font-size: 1.05rem; color: #2a2520; }
.login-brand small { color: #8a8275; font-size: 0.78rem; }
.login-card h1 { font-size: 1.5rem; font-weight: 700; color: #2a2520; margin-bottom: 6px; }
.login-card > p { color: #8a8275; margin-bottom: 26px; font-size: 0.92rem; }
.login-card label { display: block; margin-bottom: 16px; }
.login-card label > span { display: block; font-size: 0.82rem; color: #5a5247; font-weight: 600; margin-bottom: 6px; }
.login-card input[type=email],
.login-card input[type=password] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ece4d3;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #faf8f3;
}
.login-card input:focus { outline: none; border-color: #b8956a; background: #fff; }
.login-card .check {
  display: flex; align-items: center; gap: 8px;
  color: #5a5247; font-size: 0.85rem;
  margin-bottom: 22px;
}
.login-card .check input { width: auto; }
.btn-primary {
  width: 100%;
  padding: 13px;
  background: #2a2520;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s;
}
.btn-primary:hover { background: #b8956a; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.form-msg { margin-top: 14px; font-size: 0.85rem; min-height: 20px; color: #8a8275; }
.form-msg.err { color: #c44; }
.form-msg.ok { color: #2c7a2c; }
.login-foot {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #ece4d3;
  text-align: center;
  color: #8a8275;
  font-size: 0.82rem;
  line-height: 1.6;
}
.login-foot code { background: #faf8f3; padding: 2px 8px; border-radius: 4px; color: #b8956a; font-size: 0.8rem; }

/* ============================================================
   2. 后台主壳（侧边栏 + 顶栏 + 内容区）
   ============================================================ */
.admin-body { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: #2a2520;
  color: #fff;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar .logo-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #d4b87a, #b8956a);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem; font-weight: 700;
}
.sidebar .logo strong { font-size: 0.95rem; }
.sidebar .logo small { display: block; font-size: 0.7rem; color: #b8956a; }
.sidebar nav { padding: 20px 0; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  color: rgba(255,255,255,0.7);
  font-size: 0.92rem;
  transition: background 0.15s, color 0.15s;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(212,184,122,0.1);
  color: #d4b87a;
}
.sidebar nav a .ic { width: 18px; text-align: center; }
.sidebar-foot {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.8rem;
  color: rgba(255,255,255,0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-foot a { color: #d4b87a; cursor: pointer; }
.sidebar-foot a:hover { color: #fff; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: #fff;
  padding: 16px 32px;
  border-bottom: 1px solid #ece4d3;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 1.3rem; font-weight: 700; color: #2a2520; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar .badge-mode {
  background: #faf8f3;
  color: #b8956a;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #ece4d3;
}
.topbar button {
  background: transparent;
  border: 1px solid #ece4d3;
  padding: 6px 14px;
  border-radius: 6px;
  color: #5a5247;
  font-size: 0.85rem;
}
.topbar button:hover { border-color: #b8956a; color: #b8956a; }

.content { padding: 32px; flex: 1; }
.card { background: #fff; border-radius: 12px; padding: 24px; border: 1px solid #ece4d3; margin-bottom: 20px; }
.card h2 { font-size: 1.1rem; margin-bottom: 16px; color: #2a2520; }
.card p { color: #5a5247; line-height: 1.7; }

/* ============================================================
   3. 统计卡片
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  border: 1px solid #ece4d3;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #d4b87a, #b8956a);
}
.stat-card .num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 2.4rem;
  font-weight: 600;
  color: #b8956a;
  line-height: 1;
}
.stat-card .lbl { color: #5a5247; font-size: 0.85rem; margin-top: 6px; }
.stat-card .delta { font-size: 0.78rem; color: #8a8275; margin-top: 4px; }

/* ============================================================
   4. 工具栏 + 按钮
   ============================================================ */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select,
.toolbar textarea {
  padding: 8px 12px;
  border: 1px solid #ece4d3;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
}
.toolbar input { min-width: 240px; }
.toolbar .spacer { flex: 1; }
.btn-sm {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #ece4d3;
  background: #fff;
  color: #5a5247;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-sm:hover { border-color: #b8956a; color: #b8956a; }
.btn-sm.primary { background: #2a2520; color: #fff; border-color: #2a2520; }
.btn-sm.primary:hover { background: #b8956a; border-color: #b8956a; color: #fff; }
.btn-sm.danger { color: #c44; border-color: #f5d4d4; }
.btn-sm.danger:hover { background: #c44; color: #fff; border-color: #c44; }
.btn-sm.success { background: #2c7a2c; color: #fff; border-color: #2c7a2c; }
.btn-sm.success:hover { background: #246324; border-color: #246324; }
.btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   5. 表格
   ============================================================ */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #ece4d3;
  vertical-align: top;
}
.table th {
  background: #faf8f3;
  color: #5a5247;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table tr:hover { background: #faf8f3; }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge.pub { background: #e0f0e0; color: #2c7a2c; }
.badge.draft { background: #faf8f3; color: #8a8275; }
/* 产品线标签 */
.badge.cat-blanqueadoras { background: #f5e8d8; color: #b8956a; }
.badge.cat-antiedad      { background: #f0e0d8; color: #8a6b4a; }
.badge.cat-hidratantes   { background: #e0e8f0; color: #4a6b8a; }
.badge.cat-calmantes     { background: #e8f0e0; color: #4a7a3c; }
/* 文章分类标签 */
.badge.cat-Formulacion { background: #f5e8d8; color: #b8956a; }
.badge.cat-Tendencias  { background: #f8e0e0; color: #b86a6a; }
.badge.cat-Regulatorio { background: #e0e8f0; color: #4a6b8a; }
.badge.cat-Negocio     { background: #e8f0e0; color: #4a7a3c; }

/* ============================================================
   6. 模态弹窗
   ============================================================ */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(42,37,32,0.6);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-bg.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 14px;
  max-width: 760px;
  width: 100%;
  padding: 32px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.4);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.modal h2 { font-size: 1.4rem; margin-bottom: 20px; color: #2a2520; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.single { grid-template-columns: 1fr; }
.form-row label { display: flex; flex-direction: column; gap: 6px; }
.form-row label > span { font-size: 0.8rem; color: #5a5247; font-weight: 600; }
.form-row input,
.form-row select,
.form-row textarea {
  padding: 10px 12px;
  border: 1px solid #ece4d3;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  background: #faf8f3;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #b8956a;
  background: #fff;
}
.form-row textarea { min-height: 100px; resize: vertical; }
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #ece4d3;
}

/* ============================================================
   7. 块编辑器（文章正文）
   ============================================================ */
.blocks { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.block {
  background: #faf8f3;
  border: 1px solid #ece4d3;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.block textarea {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 60px;
  padding: 0;
}
.block textarea:focus { outline: none; }
.block select {
  padding: 4px 8px;
  border: 1px solid #ece4d3;
  border-radius: 4px;
  background: #fff;
  font-size: 0.8rem;
}
.block .x {
  background: none;
  border: none;
  color: #c44;
  font-size: 1.1rem;
  padding: 0 6px;
}

/* ============================================================
   8. Toast 提示
   ============================================================ */
.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: #2a2520;
  color: #fff;
  padding: 14px 22px;
  border-radius: 10px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.4);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  z-index: 200;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #2c7a2c; }
.toast.err { background: #c44; }

/* ============================================================
   9. 底部保存栏
   ============================================================ */
.savebar {
  position: fixed;
  bottom: 0;
  left: 240px;
  right: 0;
  background: #fff;
  border-top: 1px solid #ece4d3;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -10px 30px -10px rgba(0,0,0,0.1);
  z-index: 50;
}
.savebar .status { font-size: 0.88rem; font-weight: 600; }
.savebar .status.dirty { color: #b8956a; }
.savebar .status.saved { color: #2c7a2c; }
.savebar .spacer { flex: 1; }

/* ============================================================
   10. 仪表盘快捷区
   ============================================================ */
.shortcut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.shortcut {
  display: block;
  padding: 24px;
  background: #faf8f3;
  border-radius: 12px;
  border: 1px solid #ece4d3;
  transition: all 0.2s;
}
.shortcut:hover {
  border-color: #b8956a;
  transform: translateY(-2px);
  box-shadow: 0 10px 30px -15px rgba(184,149,106,0.3);
}
.shortcut__icon { font-size: 2rem; margin-bottom: 8px; }
.shortcut strong { display: block; color: #2a2520; margin-bottom: 4px; }
.shortcut small { color: #8a8275; font-size: 0.82rem; }

/* ============================================================
   11. JSON 面板
   ============================================================ */
.json-panel {
  background: #1a1612;
  color: #e8e0d0;
  border-radius: 10px;
  padding: 16px;
  font-family: 'JetBrains Mono', Menlo, monospace;
  font-size: 0.82rem;
  white-space: pre-wrap;
  max-height: 400px;
  overflow: auto;
  border: 1px solid #2a2520;
}

/* ============================================================
   12. 移动端
   ============================================================ */
@media (max-width: 768px) {
  .admin-body { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 14px 0;
  }
  .sidebar nav { display: flex; overflow-x: auto; padding: 12px 0; }
  .sidebar nav a { padding: 8px 16px; white-space: nowrap; }
  .sidebar-foot { flex-direction: row; flex-wrap: wrap; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .savebar { left: 0; flex-wrap: wrap; }
}
