/* ============================================================
   茶叶审评 - PC 管理后台样式
   布局：左侧导航 + 顶部栏 + 内容区
   ============================================================ */
:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-light: #e8f5e9;
  --accent: #ff7043;
  --text: #1f1f1f;
  --text-light: #666;
  --text-lighter: #999;
  --border: #e6e6e6;
  --bg: #f4f6f5;
  --card: #fff;
  --danger: #d32f2f;
  --sidebar-w: 220px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}
.login-box {
  background: #fff; border-radius: 16px; padding: 40px; width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.login-box .logo { text-align: center; margin-bottom: 28px; }
.login-box .logo .icon { font-size: 48px; }
.login-box .logo h1 { font-size: 22px; margin-top: 8px; color: var(--primary-dark); }
.login-box .logo p { color: var(--text-light); font-size: 13px; margin-top: 4px; }

/* ---------- 整体布局 ---------- */
.layout { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--primary-dark), #143d17);
  color: #fff;
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100;
}
#sidebar .logo {
  padding: 18px 20px; font-size: 17px; font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex; align-items: center; gap: 8px;
}
#sidebar .nav { flex: 1; padding: 12px 0; overflow-y: auto; }
#sidebar .nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; color: rgba(255, 255, 255, 0.8);
  font-size: 14px; transition: all .2s;
}
#sidebar .nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
#sidebar .nav a.active { background: rgba(255, 255, 255, 0.15); color: #fff; border-left: 3px solid var(--accent); }
#sidebar .nav a .ic { font-size: 18px; }
#sidebar .sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
#sidebar .sidebar-footer a { color: rgba(255, 255, 255, 0.6); font-size: 12px; }

/* 主区 */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}
.topbar {
  height: var(--topbar-h); background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
#userBar { display: flex; align-items: center; gap: 14px; }
#userBar .user-info { display: flex; align-items: center; gap: 8px; }
#userBar .user-name { font-weight: 500; }
.tag-role {
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; padding: 2px 8px; border-radius: 4px;
}
.btn-text { background: none; border: none; color: var(--text-light); cursor: pointer; font-size: 13px; padding: 6px 10px; }
.btn-text:hover { color: var(--danger); }

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

/* ---------- 卡片 / 表格 ---------- */
.card { background: var(--card); border-radius: 10px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
table th { background: #fafafa; font-weight: 600; color: var(--text-light); white-space: nowrap; }
table tr:hover td { background: #f9fbf9; }
table .actions a { margin-right: 10px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 12px; color: #fff; }
.tag-status-on { background: #4caf50; }
.tag-status-off { background: #9e9e9e; }

/* 工具栏 */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .left, .toolbar .right { display: flex; align-items: center; gap: 10px; }
.toolbar .right { margin-left: auto; }
input[type=text], input[type=password], input[type=number], select, textarea {
  font-size: 14px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-family: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
.search-input { min-width: 260px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  border: none; border-radius: 6px; background: var(--primary); color: #fff;
  cursor: pointer; transition: opacity .2s; font-family: inherit;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-outline { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-accent { background: var(--accent); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: none; color: var(--primary); padding: 4px 8px; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; font-size: 13px; }
.pagination button { padding: 6px 12px; }
.pagination .info { color: var(--text-light); }

/* 品类筛选 chip */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border-radius: 16px; font-size: 13px;
  background: #fff; border: 1px solid var(--border); cursor: pointer; transition: all .2s;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* 空状态 */
.empty { text-align: center; padding: 60px 20px; color: var(--text-lighter); }
.empty .icon { font-size: 48px; margin-bottom: 12px; }

/* 详情页布局 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-section { margin-bottom: 16px; }
.detail-section h4 { font-size: 14px; color: var(--primary); margin-bottom: 6px; border-left: 3px solid var(--primary); padding-left: 8px; }
.detail-section p { color: var(--text); white-space: pre-wrap; }

/* 图片网格 */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: 10px; }
.img-cell { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--bg); border: 1px solid var(--border); }
.img-cell img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.img-cell .type-badge { position: absolute; left: 4px; bottom: 4px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; }
.img-cell .del-btn { position: absolute; right: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(211, 47, 47, 0.9); color: #fff; border: none; font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.img-upload { aspect-ratio: 1; border: 2px dashed var(--border); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-lighter); cursor: pointer; }
.img-upload .plus { font-size: 28px; }

/* 表单 */
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.form-field input, .form-field textarea, .form-field select { width: 100%; }
.form-field textarea { min-height: 80px; resize: vertical; }
.form-row { display: flex; gap: 16px; }
.form-row .form-field { flex: 1; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: #fff; border-radius: 12px; width: 560px; max-width: 92vw; max-height: 88vh; display: flex; flex-direction: column; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; color: var(--text-light); cursor: pointer; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* 权限复选 */
.perm-group { margin-bottom: 14px; }
.perm-group .group-title { font-weight: 600; font-size: 13px; color: var(--text-light); margin-bottom: 6px; }
.perm-list { display: flex; flex-wrap: wrap; gap: 12px; }
.perm-item { display: flex; align-items: center; gap: 4px; font-size: 13px; }

/* toast / loading */
.__toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-20px); background: rgba(0, 0, 0, 0.85); color: #fff; padding: 10px 20px; border-radius: 6px; font-size: 14px; z-index: 9999; opacity: 0; pointer-events: none; transition: all .25s; }
.__toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.__loading { position: fixed; inset: 0; background: rgba(255, 255, 255, 0.7); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 9998; }
.__spinner { width: 36px; height: 36px; border: 3px solid var(--primary-light); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* FAQ 折叠（后台用） */
.faq-card { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 10px; }
.faq-card .q { padding: 12px 14px; font-weight: 600; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.faq-card .q .arrow { margin-left: auto; transition: transform .2s; color: var(--text-lighter); }
.faq-card.open .q .arrow { transform: rotate(90deg); }
.faq-card .a { display: none; padding: 0 14px 12px; color: var(--text-light); }
.faq-card.open .a { display: block; }

/* 设计页区块 */
.design-section { background: #fafafa; border-radius: 8px; padding: 14px; margin-bottom: 10px; }
.design-section .label { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.design-section .content { white-space: pre-wrap; font-size: 14px; }

/* 检索问答卡片 */
.qa-card { background: #fff8f5; border-left: 4px solid var(--accent); padding: 16px; border-radius: 8px; margin-bottom: 16px; }
.qa-card .qa-label { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
