/* ==========================================================================
   OPENX 遨游 — editor.css  海报编辑器
   ========================================================================== */

.ed-body {
  height: 100vh; overflow: hidden;
  background: #EEF0F6;
  display: flex; flex-direction: column;
}

/* ---------- Top bar ---------- */
.ed-bar {
  height: 56px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.ed-back {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  color: var(--text-2); background: var(--paper-1);
  transition: all .2s;
}
.ed-back:hover { background: var(--paper-2); color: var(--text); }
.ed-back svg { width: 16px; height: 16px; }

.ed-name { display: flex; align-items: center; gap: 8px; }
.ed-name input {
  width: 200px; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 1.5px solid transparent;
  font-size: .88rem; font-weight: 620; background: transparent;
}
.ed-name input:hover { background: var(--paper-1); }
.ed-name input:focus { outline: 0; background: #fff; border-color: var(--brand); }

.ed-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.ed-btn {
  height: 34px; min-width: 34px; padding: 0 10px;
  border-radius: 9px; display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 620; color: var(--text-2);
  background: transparent;
  transition: all .18s;
}
.ed-btn:hover { background: var(--paper-1); color: var(--text); }
.ed-btn:disabled { opacity: .35; pointer-events: none; }
.ed-btn svg { width: 15px; height: 15px; }
.ed-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.ed-zoom {
  min-width: 54px; text-align: center;
  font-size: .78rem; font-weight: 650; font-family: var(--font-mono);
  color: var(--text-2);
}

/* ---------- Layout ---------- */
.ed-main {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 236px 1fr 272px;
}

.ed-left, .ed-right {
  background: #fff;
  display: flex; flex-direction: column;
  min-height: 0;
}
.ed-left { border-right: 1px solid var(--line); }
.ed-right { border-left: 1px solid var(--line); overflow-y: auto; }

.ed-tabs {
  display: flex; gap: 2px; padding: 8px;
  border-bottom: 1px solid var(--line-2);
  flex: none;
}
.ed-tabs button {
  flex: 1; height: 32px; border-radius: 8px;
  font-size: .8rem; font-weight: 620; color: var(--text-3);
  transition: all .18s;
}
.ed-tabs button:hover { background: var(--paper-1); color: var(--text-2); }
.ed-tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

.ed-pane { padding: 14px; overflow-y: auto; flex: 1; }
.pane-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  margin: 18px 0 9px;
}
.pane-label:first-child { margin-top: 0; }

.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.add-btn {
  height: 62px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  background: var(--paper-1);
  font-size: .76rem; font-weight: 620; color: var(--text-2);
  transition: all .2s;
}
.add-btn:hover { background: var(--brand-soft); color: var(--brand-deep); transform: translateY(-2px); }
.add-btn svg { width: 18px; height: 18px; }

.pal-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.pal {
  aspect-ratio: 1; border-radius: 8px; position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  transition: transform .2s;
}
.pal:hover { transform: scale(1.08); }
.pal[aria-pressed="true"] { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand); }

/* 图层列表 */
.layer {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 8px;
  font-size: .8rem; color: var(--text-2);
  cursor: pointer;
  transition: background .15s;
}
.layer:hover { background: var(--paper-1); }
.layer[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-deep); font-weight: 650; }
.layer svg { width: 14px; height: 14px; flex: none; opacity: .7; }
.layer span {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.layer .lk { font-size: .66rem; color: var(--text-3); }

/* ---------- Stage ---------- */
.ed-stage {
  position: relative; overflow: auto;
  display: grid; place-items: center;
  padding: 34px;
  background-color: #EDEFF6;
  background-image: radial-gradient(rgba(20,24,50,.11) 1px, transparent 1px);
  background-size: 18px 18px;
}
.stage-inner { position: relative; flex: none; }
.artboard {
  position: absolute; left: 0; top: 0;
  transform-origin: top left;
  background: #fff;
  box-shadow: 0 20px 50px -20px rgba(16,20,40,.35), 0 0 0 1px rgba(16,20,40,.08);
  overflow: hidden;
}
.el { position: absolute; cursor: move; user-select: none; }
.el[data-type="text"] {
  display: flex; flex-direction: column; justify-content: flex-start;
  white-space: pre-wrap; word-break: break-word;
  line-height: 1.15;
}
.el.editing { cursor: text; user-select: text; outline: 1.5px dashed var(--brand); }
.el.hidden { display: none; }

.sel { position: absolute; pointer-events: none; z-index: 999; }
.sel-box {
  position: absolute; inset: 0;
  outline: 1.5px solid var(--brand);
  outline-offset: 0;
}
.sel .h {
  position: absolute; width: 10px; height: 10px;
  background: #fff; border: 1.5px solid var(--brand); border-radius: 2px;
  pointer-events: auto; z-index: 2;
}
.sel .h.nw { cursor: nwse-resize; }
.sel .h.ne { cursor: nesw-resize; }
.sel .h.sw { cursor: nesw-resize; }
.sel .h.se { cursor: nwse-resize; }
.sel .h.n  { cursor: ns-resize; }
.sel .h.s  { cursor: ns-resize; }
.sel .h.w  { cursor: ew-resize; }
.sel .h.e  { cursor: ew-resize; }
.sel .size-tag {
  position: absolute; left: 50%; top: -26px; transform: translateX(-50%);
  padding: 2px 8px; border-radius: 5px;
  background: var(--brand); color: #fff;
  font-size: .66rem; font-weight: 650; white-space: nowrap;
  font-family: var(--font-mono);
}

/* ---------- Props ---------- */
.props-empty {
  padding: 40px 18px; text-align: center;
  color: var(--text-3); font-size: .8rem; line-height: 1.8;
}
.props-empty svg { width: 26px; height: 26px; margin: 0 auto 12px; opacity: .4; }
.prop-group { padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.prop-title {
  font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: 11px;
}
.prop-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prop-row.one { grid-template-columns: 1fr; }
.prop-row.three { grid-template-columns: 1fr 1fr 1fr; }
.mini-field { display: flex; flex-direction: column; gap: 4px; }
.mini-field label { font-size: .68rem; color: var(--text-3); font-weight: 600; }
.mini-field input, .mini-field select {
  height: 32px; padding: 0 8px; width: 100%;
  border-radius: 7px; border: 1.5px solid var(--line);
  font-size: .78rem; background: #fff;
}
.mini-field input:focus, .mini-field select:focus {
  outline: 0; border-color: var(--brand);
}
.color-field { display: flex; align-items: center; gap: 8px; }
.color-field input[type="color"] {
  width: 32px; height: 32px; padding: 0; border: 1.5px solid var(--line);
  border-radius: 7px; background: #fff; cursor: pointer;
}
.color-field input[type="text"] {
  flex: 1; height: 32px; padding: 0 8px;
  border-radius: 7px; border: 1.5px solid var(--line);
  font-size: .76rem; font-family: var(--font-mono);
}
.seg { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: var(--paper-1); }
.seg button {
  flex: 1; height: 26px; border-radius: 6px;
  font-size: .74rem; font-weight: 620; color: var(--text-2);
  display: grid; place-items: center;
}
.seg button svg { width: 13px; height: 13px; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--text); box-shadow: var(--sh-1); }
.act-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.act {
  height: 32px; border-radius: 7px;
  display: grid; place-items: center;
  background: var(--paper-1); color: var(--text-2);
  transition: all .18s;
}
.act:hover { background: var(--paper-2); color: var(--text); }
.act.danger:hover { background: var(--accent-soft); color: #C0391B; }
.act svg { width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .ed-main { grid-template-columns: 200px 1fr 240px; }
}
@media (max-width: 860px) {
  .ed-main { grid-template-columns: 1fr; }
  .ed-left, .ed-right { display: none; }
  .ed-name input { width: 120px; }
}

/* 选择框手柄定位（外层未缩放，手柄恒定 10px） */
.sel .h.nw { left: -5px; top: -5px; }
.sel .h.ne { right: -5px; top: -5px; }
.sel .h.sw { left: -5px; bottom: -5px; }
.sel .h.se { right: -5px; bottom: -5px; }
.sel .h.n  { left: 50%; top: -5px; margin-left: -5px; }
.sel .h.s  { left: 50%; bottom: -5px; margin-left: -5px; }
.sel .h.w  { top: 50%; left: -5px; margin-top: -5px; }
.sel .h.e  { top: 50%; right: -5px; margin-top: -5px; }
