/* =========================================================
   展信包装 · 网站管理后台
   项目管理（导航树）/ 分类管理（分类树）/ 内容编辑器多图 补充样式
   —— 由 index.html 全局引入，依赖 app.css 中的设计变量与公共类
   ========================================================= */

/* ---------- 1. 树形列表（导航 / 分类共用） ---------- */
.tree-card { overflow: hidden; }
.tree-table-head,
.tree-row {
  display: grid;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
}
.nav-tree-head,
.nav-row {
  grid-template-columns: minmax(0, 1.7fr) 92px minmax(130px, 1.3fr) 56px 88px 236px;
}
.cat-tree-head,
.cat-row {
  grid-template-columns: minmax(0, 1.8fr) minmax(120px, 1.2fr) 84px 88px 236px;
}
.tree-table-head {
  min-height: 40px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}
.tree-table-head > span { display: flex; align-items: center; min-width: 0; }
.tree-row {
  min-height: 54px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-top: 1px solid #F0F2F3;
  transition: background .12s ease;
}
.tree-rows .tree-row:first-child { border-top: 0; }
.tree-row:hover { background: #FAFBFC; }
.tree-cell { min-width: 0; display: flex; align-items: center; gap: 6px; }
.tree-title-cell { gap: 8px; }
.tree-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-node-icon { display: inline-flex; flex: none; color: var(--muted-2); }
.tree-subcount {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: #F1F2F4;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
}
.tree-link-cell { overflow: hidden; color: var(--muted); font-size: 12px; }
.tree-link-cell .mono { max-width: 100%; }
.tree-link-cell .ellipsis { min-width: 0; }
.tree-target { display: inline-flex; flex: none; color: var(--muted-2); }
.tree-center { justify-content: center; }
.tree-right { justify-content: flex-end; }
.tree-actions { justify-content: flex-end; gap: 6px; }
.tree-table-head .tree-center { justify-content: center; }
.tree-table-head .tree-right { justify-content: flex-end; }

/* 小图标按钮（排序） */
.icon-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: #EEF0F2; color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }

/* 内容数胶囊 */
.count-pill {
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.count-pill.zero { background: #F1F2F4; color: var(--muted-2); }

/* ---------- 2. 显示开关 ---------- */
.switch {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 20px;
  flex: none;
  cursor: pointer;
}
.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}
.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #D8DCE0;
  transition: background .16s ease;
}
.switch-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 20, 25, .22);
  transition: transform .16s ease;
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid rgba(189, 17, 43, .45); outline-offset: 2px; }

/* ---------- 3. 表单小元素 ---------- */
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.check-inline input { width: 15px; height: 15px; accent-color: var(--brand); }
.nav-dyn .span-2 { grid-column: 1 / -1; }
.form-grid > .nav-dyn { grid-column: 1 / -1; }
.form-grid > .nav-dyn .field { margin-bottom: 14px; }

/* ---------- 4. 分类删除方式选项 ---------- */
.del-options { display: flex; flex-direction: column; gap: 10px; }
.del-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.del-option:hover { border-color: #C6CBD0; }
.del-option input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--brand); flex: none; }
.del-option:has(input:checked) {
  border-color: var(--brand);
  background: #FDF4F5;
  box-shadow: 0 0 0 3px rgba(189, 17, 43, .07);
}
.del-option-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.del-option-title { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.del-option-desc { font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ---------- 5. 内容「新增」类型选择弹窗 ---------- */
.type-pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.type-pick {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.type-pick:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(189, 17, 43, .08);
}
.type-pick-icon {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 9px;
  display: grid;
  place-items: center;
}
.type-pick-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.type-pick-label { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.type-pick-desc { font-size: 11.5px; color: var(--muted-2); }

/* ---------- 6. 内容编辑器：多图排序 ---------- */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 11px;
}
.image-tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #F2F3F5;
}
.image-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
.image-tile.dragging { opacity: .4; }
.image-tile.drop-target { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(189, 17, 43, .14); }
.image-tile-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 18px 6px 5px;
  background: linear-gradient(to top, rgba(15, 20, 25, .72), rgba(15, 20, 25, 0));
}
.image-tile-index {
  width: 17px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.image-tile-acts { margin-left: auto; display: flex; gap: 3px; }
.img-btn {
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink-2);
}
.img-btn:hover:not(:disabled) { background: #fff; color: var(--brand); }
.img-btn:disabled { opacity: .4; cursor: not-allowed; }
.images-empty {
  grid-column: 1 / -1;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: #FAFBFC;
  color: var(--muted-2);
  font-size: 12.5px;
}
.images-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.images-actions .hint { margin-left: auto; }

/* ---------- 7. 媒体库多选弹窗 ---------- */
.picker-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.picker-item { position: relative; }
.picker-item.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(189, 17, 43, .14);
}
.picker-item.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(15, 20, 25, .3);
}

/* ---------- 8. 响应式 ---------- */
@media (max-width: 1100px) {
  .nav-tree-head,
  .nav-row { grid-template-columns: minmax(0, 1.6fr) 90px 56px 84px 220px; }
  .nav-tree-head > span:nth-child(3),
  .nav-row > .tree-cell:nth-child(3) { display: none; }
  .cat-tree-head,
  .cat-row { grid-template-columns: minmax(0, 1.7fr) minmax(100px, 1fr) 76px 84px 220px; }
}
@media (max-width: 900px) {
  .nav-tree-head,
  .nav-row { grid-template-columns: minmax(0, 1.5fr) 84px 56px 78px 196px; }
  .tree-table-head,
  .tree-row { padding: 0 10px; gap: 8px; }
  .cat-tree-head,
  .cat-row { grid-template-columns: minmax(0, 1.6fr) 72px 78px 196px; }
  .cat-tree-head > span:nth-child(2),
  .cat-row > .tree-cell:nth-child(2) { display: none; }
  .tree-actions .btn { padding: 0 8px; }
}
@media (max-width: 768px) {
  .type-pick-grid { grid-template-columns: 1fr; }
  .images-actions .hint { margin-left: 0; width: 100%; }
}
@media (max-width: 680px) {
  .nav-tree-head,
  .nav-row { grid-template-columns: minmax(0, 1.6fr) 64px 70px 150px; }
  .nav-tree-head > span:nth-child(3),
  .nav-row > .tree-cell:nth-child(3),
  .nav-tree-head > span:nth-child(4),
  .nav-row > .tree-cell:nth-child(4) { display: none; }
  .cat-tree-head,
  .cat-row { grid-template-columns: minmax(0, 1.6fr) 66px 70px 150px; }
  .cat-tree-head > span:nth-child(3),
  .cat-row > .tree-cell:nth-child(3) { display: none; }
  .tree-row { min-height: 48px; }
  .tree-actions { gap: 4px; }
  .tree-actions .btn { font-size: 0; gap: 0; width: 30px; padding: 0; }
  .tree-actions .btn .icon { margin: 0; }
}
