/* Text & logo overlay editor (public/js/editor.js). Uses tokens from app.css only. */

.modal.editor-modal { width: calc(100vw - 24px); height: calc(100vh - 24px); overflow: hidden; }
.modal-backdrop:has(.editor-modal) { padding: 12px; }
.editor-modal > .modal-body { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.ed { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ed [hidden] { display: none !important; }
.ed.is-loading .ed-left,
.ed.is-loading .ed-right,
.ed.is-loading .ed-top-actions { pointer-events: none; opacity: 0.5; }

/* ---------- top bar ---------- */

.ed-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.ed-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; min-width: 0; }
.ed-title > .icon { color: var(--accent); }
.ed-top-actions { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.ed-top-group { display: flex; align-items: center; gap: 4px; padding-left: 10px; border-left: 1px solid var(--border); }
.ed-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- three columns ---------- */

/* right column = 320px preview + padding + scrollbar gutter */
.ed-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 256px minmax(0, 1fr) 356px; }
.ed-left, .ed-right { min-height: 0; overflow-y: auto; background: var(--panel); scrollbar-gutter: stable; }
.ed-left { border-right: 1px solid var(--border); padding: 0 8px 14px 14px; }
.ed-right { border-left: 1px solid var(--border); padding: 0 12px 16px; }
.ed-center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.ed-stage {
  flex: 1; min-height: 0; position: relative; overflow: hidden; outline: none;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, var(--bg-2) 0%, var(--bg) 70%);
}
.ed-canvas { display: block; touch-action: none; user-select: none; box-shadow: var(--shadow); border-radius: 2px; }
.ed-loading {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg); color: var(--text-2);
}

.ed-status {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 7px 14px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--muted);
}
.ed-status .kbd { font-size: 11px; padding: 0 5px; }
.ed-hints { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-font-note { display: inline-flex; align-items: center; gap: 5px; color: var(--warn); white-space: nowrap; }
.ed-zoom { white-space: nowrap; }

/* ---------- sections ---------- */

.ed-section { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.ed-section:last-child { border-bottom: 0; }
.ed-section-title {
  display: flex; align-items: center; gap: 6px; min-height: 20px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted);
}
.ed-section-body { display: flex; flex-direction: column; gap: 10px; transition: opacity 0.12s; }
.ed-section-body.is-off { opacity: 0.45; }
.ed-hint { font-size: 12px; color: var(--muted); line-height: 1.45; }
.ed-note { display: flex; align-items: center; gap: 6px; padding-bottom: 4px; font-size: 12px; color: var(--warn); }

/* ---------- presets ---------- */

.ed-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ed-preset {
  display: flex; flex-direction: column; gap: 5px; padding: 5px 5px 6px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--bg-2);
  color: var(--text-2); font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.25;
  text-align: center; cursor: pointer; transition: border-color 0.12s, color 0.12s;
}
.ed-preset:hover { border-color: var(--accent); color: var(--text); }
.ed-preset:focus-visible { outline: none; box-shadow: var(--focus); }
.ed-preset-canvas { display: block; width: 100%; height: 44px; border-radius: 5px; }

/* ---------- layers ---------- */

.ed-layers { display: flex; flex-direction: column; gap: 4px; }
.ed-layer {
  display: flex; align-items: center; gap: 1px; min-width: 0;
  padding: 3px 3px 3px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--bg-2); cursor: pointer;
}
.ed-layer:hover { border-color: var(--border-2); }
.ed-layer.is-selected { border-color: var(--accent); background: var(--accent-soft); }
.ed-layer.is-hidden .ed-layer-name, .ed-layer.is-hidden .ed-layer-icon { opacity: 0.45; }
.ed-layer-icon { display: flex; margin-right: 5px; color: var(--muted); }
.ed-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; }
.btn.ed-layer-btn { width: 22px; height: 24px; padding: 0; border-radius: 6px; color: var(--muted); }
.btn.ed-layer-btn:hover { color: var(--text); }
.btn.ed-layer-btn.is-on { color: var(--accent-2); }
.btn.ed-layer-btn:disabled { opacity: 0.25; }
.ed-layer:not(:hover):not(:focus-within):not(.is-selected) .ed-layer-extra { display: none; }

/* ---------- right panel ---------- */

.ed-mini {
  position: sticky; top: 0; z-index: 2;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 0 12px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.ed-mini-canvas { display: block; width: 100%; max-width: 320px; aspect-ratio: 16 / 9; border-radius: 6px; background: #000; }

.ed-props-head { display: flex; align-items: center; gap: 4px; padding: 14px 0 6px; }
.ed-props-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; }
.ed-props-title .icon { color: var(--accent); }
.btn.ed-danger:hover { color: var(--err); background: rgba(248, 113, 113, 0.12); }

.ed-props-empty { display: flex; flex-direction: column; gap: 8px; padding: 18px 0; }
.ed-props-empty-title { font-weight: 700; font-size: 14.5px; }
.ed-shortcuts { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.ed-shortcut { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--text-2); }
.ed-shortcut-keys { display: inline-flex; gap: 3px; flex-wrap: wrap; }

/* property rows: label | control | number */
.ed-prop { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.ed-prop-wide { grid-template-columns: 86px minmax(0, 1fr); }
.ed-prop-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.ed-prop-wide > .segmented { justify-self: start; }
.ed-range { width: 100%; margin: 0; accent-color: var(--accent); cursor: pointer; }
.ed-num-wrap { display: inline-flex; align-items: center; gap: 3px; }
.input.ed-num { width: 62px; height: 30px; padding: 4px 6px; font-size: 12.5px; text-align: right; }
.ed-unit { width: 12px; font-size: 11.5px; color: var(--muted); }

.ed-prop-color { grid-template-columns: 86px auto minmax(0, 1fr); }
.ed-color {
  width: 34px; height: 28px; padding: 0; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 6px; background: none;
}
.ed-color::-webkit-color-swatch-wrapper { padding: 2px; }
.ed-color::-webkit-color-swatch { border: 0; border-radius: 4px; }
.ed-color::-moz-color-swatch { border: 0; border-radius: 4px; }
.ed-color:focus-visible { outline: none; box-shadow: var(--focus); }
.ed-swatches { display: flex; flex-wrap: wrap; gap: 3px; }
.ed-swatch {
  width: 15px; height: 15px; padding: 0; cursor: pointer;
  border: 1px solid var(--border-2); border-radius: 4px; transition: transform 0.08s;
}
.ed-swatch:hover { transform: scale(1.18); }
.ed-swatch:focus-visible { outline: none; box-shadow: var(--focus); }

.textarea.ed-textarea { min-height: 84px; font-size: 15px; font-weight: 600; }
.ed-switch { font-size: 12.5px; color: var(--text-2); text-transform: none; letter-spacing: 0; font-weight: 500; }
.ed-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- smaller screens ---------- */

@media (max-width: 1280px) {
  .ed-main { grid-template-columns: 232px minmax(0, 1fr) 356px; }
  .ed-hints { display: none; }
}

@media (max-width: 900px) {
  .ed-main { grid-template-columns: 1fr; grid-template-rows: minmax(260px, 55vh) auto auto; overflow-y: auto; }
  .ed-center { order: -1; }
  .ed-left, .ed-right { overflow: visible; border: 0; border-top: 1px solid var(--border); }
  .ed-mini { position: static; }
}
