/* Image to PSD v2: in-site editing of recognised text (PRD F9, D18). Loads after style.css and psd.css
   and only adds the text mode: panel tabs, the text list, the editor card, and editable-text boxes on the preview. */

/* panel tabs */
.layer-tabs { display: flex; gap: 4px; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); }
.layer-tabs button { flex: 1; height: 32px; border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--muted); font: 600 13px var(--body); cursor: pointer; white-space: nowrap; }
.layer-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.layer-tabs b { font-weight: 700; margin-left: 4px; opacity: 0.7; }
.layers[data-tab="layers"] .text-pane, .layers[data-tab="text"] .layer-list, .layers[data-tab="text"] > header { display: none; }
.text-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.text-note { margin: 0; padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); text-align: left; }
.text-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; min-height: 0; }
.text-list li button { width: 100%; display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: center; padding: 7px 8px; border: 0; border-radius: 10px; background: transparent; color: #e4e0db; font: 13px var(--body); text-align: left; cursor: pointer; }
.text-list li button:hover, .text-list li button[aria-current="true"] { background: rgba(255,255,255,0.06); }
.text-list li button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-list li button i { color: var(--accent); font-size: 15px; }
.text-list li.edited button i { color: #7bd88f; }

/* editor card inside the panel */
.text-editor { display: none; padding: 12px 14px 14px; border-top: 1px solid var(--line); background: rgba(20,20,22,0.98); text-align: left; }
.layers.editing .text-editor { display: grid; gap: 8px; }
.text-editor label { font: 600 12px var(--body); color: var(--muted); letter-spacing: 0.02em; }
.text-editor .was { font-size: 12.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.text-editor input { height: 40px; width: 100%; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: 15px var(--body); padding: 0 12px; outline: 0; }
.text-editor input:focus { border-color: rgba(240,112,63,0.6); }
.text-editor .font-note { font-size: 12px; color: var(--faint); }
.text-editor .acts { display: flex; gap: 8px; }
.text-editor .acts button { flex: 1; height: 38px; border-radius: 999px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); font: 600 13.5px var(--body); cursor: pointer; }
.text-editor .acts .apply { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* editable text on the flat preview */
.text-boxes { position: absolute; inset: 0; pointer-events: none; display: none; }
.stack.show-text:not(.exploded) .text-boxes { display: block; }
.tbox { position: absolute; pointer-events: auto; border: 1.5px dashed rgba(240,112,63,0.95); border-radius: 3px; background: rgba(240,112,63,0.08); cursor: text; padding: 0; transform-origin: left center; }
.tbox:hover { background: rgba(240,112,63,0.2); border-style: solid; }
/* the line being edited gets a spotlight: solid accent frame and glow, everything else on the preview dimmed */
.tbox.sel { z-index: 3; border: 2.5px solid var(--accent); background: rgba(240,112,63,0.16); box-shadow: 0 0 0 3px rgba(240,112,63,0.35), 0 0 22px 4px rgba(240,112,63,0.55), 0 0 0 9999px rgba(11,11,12,0.5); }
.tbox.sel::after { content: "Editing"; position: absolute; left: -2.5px; bottom: calc(100% + 7px); padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 700 11px/1.2 var(--body); letter-spacing: 0.02em; white-space: nowrap; pointer-events: none; }
.tbox.edited { border-color: rgba(123,216,143,0.95); background: transparent; }
.tbox .new { position: absolute; inset: -1px; display: flex; align-items: center; white-space: nowrap; overflow: visible; font-family: "Arimo", var(--body); line-height: 1; padding: 0 1px; }
/* the old pixel text is covered by a patch in the mockup; production uses the automatically cleaned layer instead */

.version-pill { display: none; position: absolute; left: 12px; bottom: 12px; z-index: 4; padding: 5px 12px; border-radius: 999px; background: rgba(11,11,12,0.78); font: 600 12px var(--body); color: #c9f2d2; }
.stage.has-edit[data-s="result"] .version-pill { display: inline-flex; }

@media (max-width: 767px) {
  .layer-tabs { padding: 8px 10px 6px; }
  .text-note { display: none; }
  .text-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px 10px 10px; }
  .text-list li { flex: none; }
  .text-list li button { max-width: 180px; border: 1px solid var(--line); }
  .version-pill { bottom: auto; top: 52px; }
}
