/* 贴片编辑器样式（只服务 views/sticker-editor.js，与 demo 视觉语言一致但独立成文件） */

/* 返回列表+保存那一行：编辑器不需要 1240 的标准留白，撑宽一点给贴片 */
.ed-head .sub { display: flex; align-items: center; gap: 2px; }

.editor {
  display: grid;
  /* ★ 两列，不是三列 —— DOM 里 .editor 只有**两个**子元素（左＝商品清单、右＝.edit-main）。
     第三列（296px）是「控件在右侧独立一列」时代的遗物：v0.27 需求9 把控件挪进了
     .edit-main 里（贴片画面固定、控件在下方滚动），那一列就此常年空着 ——
     白白吃掉 296px，贴片只能画到 728px 宽（高 219px）。
     9/17 用户反馈「宽度撑满，让画布可以大一点，看清楚点」→ 收成两列。 */
  grid-template-columns: 226px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}
@media (max-width: 1320px) {
  .editor { grid-template-columns: 190px minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .editor { grid-template-columns: 1fr; }
  .prod-list { max-height: 220px; }
}

/* ---------------- 左：商品清单 ---------------- */
.prod-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  position: sticky;
  top: 14px;
}
.prod-list .pi {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: .12s;
}
.prod-list .pi:hover { background: #f4f6f9; }
.prod-list .pi.active { background: var(--accent-soft); }
.prod-list .pi.warn .seq {
  background: var(--warn-soft); color: var(--warn);
  box-shadow: inset 0 0 0 1px var(--warn-border);
}
.prod-list .seq {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 26px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: #eef1f5; color: var(--text-2);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.prod-list .nm {
  font-size: 12.5px; line-height: 1.4; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.prod-list .pi.active .nm { color: var(--text); font-weight: 500; }

/* ---------------- 中：贴片预览 ---------------- */
.edit-main { min-width: 0; }
.stage-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 2px 8px;
}
.sticker-stage {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
/* 棋盘格底：提醒这是透明背景（v11.71 起贴片不再画白底） */
.sticker-host {
  border-radius: 6px;
  background-color: #fbfcfd;
  background-image:
    linear-gradient(45deg, #eceff3 25%, transparent 25%, transparent 75%, #eceff3 75%),
    linear-gradient(45deg, #eceff3 25%, transparent 25%, transparent 75%, #eceff3 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  overflow: hidden;
}
.sticker-host svg.frame { display: block; width: 100%; height: auto; }

/* ---------------- 右：控件 ---------------- */
.edit-side {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 14px 12px;
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}
.ctrl {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.ctrl:last-child { border-bottom: none; }
.ctrl .lab { font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.ctrl .lab-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ctrl .dim { color: var(--text-3); font-weight: 400; font-size: 12px; }
.ctrl input.input + input.input { margin-top: 7px; }
.ctrl textarea.input { resize: vertical; margin-top: 2px; }
.ctrl.note-block { font-size: 12px; line-height: 1.7; }

/* 开关 */
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #d7dce4; border-radius: 22px; transition: .16s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 2px; top: 2px; background: #fff; border-radius: 50%;
  transition: .16s; box-shadow: 0 1px 2px rgba(16,24,40,.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(16px); }

/* ---------------- 色卡 ---------------- */
.swatch-row { display: flex; flex-wrap: wrap; gap: 7px; }
.swatch {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 6px;
  border: 1.5px solid rgba(0,0,0,.12);
  cursor: pointer;
  background-clip: padding-box;
}
.swatch.pattern {
  background-image: repeating-linear-gradient(45deg, #9AA1AC 0 6px, #fff 6px 14px);
}
.swatch .x {
  position: absolute; top: -6px; right: -6px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #1a1d21; color: #fff;
  font-size: 12px; line-height: 17px; text-align: center;
  opacity: 0; transition: .12s;
}
.swatch:hover .x { opacity: 1; }
.swatch-ops { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 9px; }

/* ---------------- 产品图挑选（v0.4：官网「商品特点」） ---------------- */
.shot-slots { display: flex; gap: 8px; margin-bottom: 2px; }
.shot-slot {
  position: relative; width: 64px; height: 64px; border-radius: 8px;
  border: 1.5px dashed var(--border); display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; overflow: hidden;
  background: #fafbfc; transition: .12s;
}
.shot-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot-slot .plus { font-size: 20px; color: var(--text-3); line-height: 1; }
.shot-slot .ord-hint { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.shot-slot .ord {
  position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.shot-slot .x {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 11px; line-height: 16px; text-align: center;
  opacity: 0; transition: .12s;
}
.shot-slot:hover .x { opacity: 1; }
.shot-slot.empty:hover { border-color: var(--accent); }
/* v0.9：缺素材的占位槽 —— 灰底 + “待补充” + 上传按钮 */
.shot-slot.empty {
  background: #f0f2f5; border-color: #c7ccd4; gap: 3px;
}
.shot-slot.empty .slot-ph {
  font-size: 10px; color: #8a9099; line-height: 1;
}
.shot-slot.empty .plus {
  font-size: 11px; color: var(--accent); font-weight: 700; line-height: 1;
  padding: 2px 6px; border: 1px solid var(--accent); border-radius: 5px;
}
.shot-slot.empty .ord-hint { font-size: 10px; color: #8a9099; }

.shot-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-top: 10px; max-height: 300px; overflow: auto;
}
.shot-item {
  position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
  border: 2px solid transparent; background: #f4f6f9; transition: .12s;
}
.shot-item:hover { border-color: var(--border); }
.shot-item.sel { border-color: var(--accent); }
.shot-item img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.shot-item .shot-desc {
  font-size: 11px; line-height: 1.4; padding: 4px 5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shot-item .shot-ord {
  position: absolute; top: 4px; left: 4px; width: 19px; height: 19px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* v0.7：素材库全局勾选标识（编辑器网格） */
.shot-item .shot-global {
  position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
  background: #f5a623; color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.shot-item.global { box-shadow: inset 0 0 0 1px #f5a62344; }
