/**
 * 文件名称：editor.css
 * 功能描述：编辑器页样式 —— 画布/工具栏/参数面板/动效面板/撤销重做/弹层（阶段 3）
 * 所属模块：前端样式
 * 作者：Software Engineer
 * 创建日期：2026-08-29
 * 说明：mobile-first（352px 基准），与 base.css 变量协同。
 */

/* ---------- 通用面板 ---------- */
.editor { padding: 0 12px 24px; }

.panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.panel h2 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.trust-inline { font-size: 11px; color: var(--muted); font-weight: normal; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.btn-primary:disabled { opacity: .45; cursor: default; }
.ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}
.ghost:disabled { opacity: .45; cursor: default; }
.ghost.small { padding: 4px 8px; font-size: 12px; border-radius: 8px; }
.danger { color: #d9534f; border-color: #d9534f; background: #fff; border-radius: 10px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.save-btn { margin-left: auto; padding: 6px 14px; }

/* ---------- 画布区 ---------- */
.canvas-wrap {
  position: relative;
  background: #0c0c12;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  overflow: hidden;
}
#editor-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  /* 双指手势由编辑器接管（pointer events），禁止浏览器默认手势干扰 */
  touch-action: none;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  background: #fff;
}
.canvas-hint {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  text-align: center;
  color: #f5f5fa;
  font-size: 12px;
  opacity: .9;
  pointer-events: none;
  background: rgba(0,0,0,.35);
  border-radius: 10px;
  padding: 4px 8px;
}
.canvas-meta {
  position: absolute;
  top: 14px;
  right: 14px;
  color: #fff;
  background: rgba(0,0,0,.5);
  border-radius: 8px;
  padding: 3px 8px;
  font-size: 11px;
  pointer-events: none;
}
.canvas-wrap.drag-over { outline: 2px dashed var(--brand); outline-offset: -4px; }

/* ---------- 画布形态 ---------- */
.shape-toggle { display: flex; gap: 8px; margin-bottom: 8px; }
.shape-toggle button {
  flex: 1;
  padding: 8px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.shape-toggle button.active { border-color: var(--brand); color: var(--brand); background: #f3f0ff; font-weight: 600; }

.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.presets button {
  padding: 5px 10px;
  border: 1px solid #e2e2ea;
  background: #fafaff;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
}
.presets button.active { border-color: var(--brand); color: var(--brand); background: #f3f0ff; }

.custom-size { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.custom-size label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.custom-size input {
  width: 74px;
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 13px;
}

/* ---------- 主图 ---------- */
.img-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.img-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }

.sliders { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.slider-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.slider-row label { width: 52px; color: var(--muted); flex-shrink: 0; }
.slider-row input[type="range"] { flex: 1; }
.slider-row span { width: 52px; text-align: right; font-size: 12px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 动效 ---------- */
.fx-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.fx-types button {
  padding: 7px 2px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 9px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.fx-types button.active { border-color: var(--brand); color: var(--brand); background: #f3f0ff; font-weight: 600; }

.fx-params { display: flex; flex-direction: column; gap: 8px; }
.fx-params .slider-row input[type="range"] { flex: 1; }
.fx-color-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-color-row .swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #ccc;
  cursor: pointer;
  padding: 0;
}
.swatch.active { box-shadow: 0 0 0 2px var(--brand); }
.fx-color-row input[type="color"] { width: 34px; height: 28px; border: 1px solid #ddd; border-radius: 8px; padding: 1px; background: #fff; }
.fx-params .empty { color: var(--muted); font-size: 12px; }
.fx-status { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ---------- 撤销重做 ---------- */
.history-panel { display: flex; align-items: center; gap: 8px; }
.history-panel button {
  padding: 8px 16px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.history-panel button:disabled { opacity: .4; cursor: default; }
.history-status { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ---------- toast / 弹层 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 36px;
  transform: translateX(-50%);
  max-width: 86vw;
  background: rgba(20,20,28,.92);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  z-index: 99;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
  text-align: center;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

.dialog-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.dialog-mask.hidden { display: none; }
.dialog {
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  max-width: 340px;
  width: 100%;
}
.dialog h3 { font-size: 16px; margin-bottom: 8px; }
.dialog p { font-size: 13px; color: #444; line-height: 1.6; margin-bottom: 8px; }
.dialog .dialog-note { font-size: 12px; color: var(--muted); }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.dialog-desc { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.feedback-textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  background: #fafafa;
  box-sizing: border-box;
}
.feedback-textarea:focus { border-color: var(--brand); background: #fff; }
.feedback-counter {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin: 4px 0 8px;
}

.hidden { display: none !important; }

/* ---------- 阶段 4：导出与分享 ---------- */
.export-btn { margin-left: 6px; padding: 6px 12px; }

.export-dialog { max-width: 380px; }
.export-dialog h3 { display: flex; align-items: center; justify-content: space-between; }

.export-quota {
  font-size: 13px;
  color: var(--brand);
  background: #f3f0ff;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.export-quota.quota-empty { color: #c0392b; background: #fdf0ee; }

.export-field { margin-bottom: 10px; }
.export-field > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 5px;
}
.export-field input[type="range"] { width: 100%; }
.export-duration-val { font-size: 12px; color: var(--brand); font-variant-numeric: tabular-nums; }

/* 分段按钮组（格式/档位/帧率/背景） */
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button {
  flex: 1;
  min-width: 64px;
  padding: 7px 4px;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 9px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}
.seg button.active { border-color: var(--brand); color: var(--brand); background: #f3f0ff; font-weight: 600; }

.export-warn {
  font-size: 12px;
  color: #b7791f;
  background: #fdf6e7;
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
  border: 1px solid #f0e0bd;
}
.export-warn.warn-big { color: #c0392b; background: #fdf0ee; border-color: #f0cfc8; }

.export-bg-field input[type="color"] { width: 44px; height: 28px; margin-top: 6px; border: 1px solid #ddd; border-radius: 8px; padding: 1px; background: #fff; }

.export-actions { display: flex; gap: 8px; margin-top: 6px; }
.export-actions .btn-primary { flex: 1.4; }
.export-actions .ghost { flex: 1; }
.export-actions button:disabled { opacity: .45; cursor: default; }

.export-note { margin-top: 8px; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* 进行中遮罩 */
.exporting-dialog { text-align: center; }
.exporting-dialog p { color: var(--muted); }
.export-progress {
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
#export-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width .15s linear;
}

/* 结果视图 */
.result-dialog { max-width: 360px; text-align: center; }
.result-img-wrap {
  background: #0c0c12;
  border-radius: 10px;
  padding: 8px;
  margin: 8px 0;
  max-height: 52vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-tip { color: #555; }
.result-dialog .dialog-actions { justify-content: center; }
/* 示例图选择弹层（阶段 5：SAMPLES 全部可选用） */
.sample-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 10px;
  max-height: 50vh;
  overflow: auto;
}
.sample-card {
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
}
.sample-card img {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  background: #f2f2f6;
}
.sample-card-label {
  display: block;
  font-size: 12px;
  color: #444;
  text-align: center;
  padding: 6px 4px;
}
.sample-card:active { opacity: 0.75; }
