/* ══════════════════════════════════════════════════════════
   EDITOR v3 — layout de referência (toolbar · canvas · inspector · rail)
   ══════════════════════════════════════════════════════════ */
.editor-shell {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font-family: 'Schibsted Grotesk', system-ui, sans-serif;
  animation: rise .25s ease both;
}

/* ── Toolbar ───────────────────────────────────────────── */
.ed-toolbar {
  height: 56px; flex: none; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.ed-back { display: flex; align-items: center; gap: 6px; background: transparent; border: none; cursor: pointer; color: var(--text-2); font-size: 13px; font-weight: 600; font-family: inherit; padding: 7px 8px; border-radius: 8px; }
.ed-back:hover { background: var(--subtle); color: var(--text); }
.ed-divider { width: 1px; height: 22px; background: var(--border-2); flex: none; }
.ed-brand-dot { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.ed-title { font-weight: 700; font-size: 14px; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-indicator { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; color: var(--st-pub); }
.save-dot { width: 6px; height: 6px; border-radius: 50%; }
.save-dot.saved { background: var(--st-pub-dot); }
.save-dot.dirty { background: var(--warning); animation: pulse .8s infinite; }
.save-dot.error { background: #E0463A; }
.save-text { color: inherit; }
.save-indicator:has(.save-dot.dirty) { color: var(--warning); }
.save-indicator:has(.save-dot.error) { color: #E0463A; }
.ed-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.ed-tools::-webkit-scrollbar { display: none; }
.ed-tools > * { flex: none; }
.ed-tbtn { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; padding: 8px 12px; cursor: pointer; color: var(--text); font-weight: 600; font-size: 12.5px; font-family: inherit; white-space: nowrap; }
.ed-tbtn:hover { border-color: var(--muted-3); background: var(--subtle-3); }
.ed-tbtn svg { flex: none; }
.ed-tbtn[data-regen-btn] svg { stroke: var(--accent); }

/* ── Middle (canvas + inspector) ───────────────────────── */
.ed-mid { flex: 1; display: flex; min-height: 0; }

/* ── Canvas ────────────────────────────────────────────── */
.editor-canvas {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 40%, #F1EFE9, #E8E5DD);
  min-width: 0; overflow: hidden;
}
#iframe-wrapper { display: none; position: relative; }
#editor-iframe { border: none; transform-origin: top left; border-radius: 14px; box-shadow: var(--shadow-slide); background: #fff; }
.editor-empty-state { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.editor-empty-state .icon { font-size: 42px; opacity: .4; }
.editor-empty-state p { font-size: 13px; }

/* prev/next nav */
.canvas-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%; border: 1px solid #E2DFD7; background: rgba(255,255,255,.9); cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-2); box-shadow: 0 2px 8px rgba(0,0,0,.06); z-index: 2; }
.canvas-nav:hover { background: #fff; }
.canvas-nav.prev { left: 18px; } .canvas-nav.next { right: 18px; }

/* zoom */
.zoom-controls { position: absolute; left: 18px; bottom: 18px; display: flex; align-items: center; gap: 2px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 3px; box-shadow: 0 2px 8px rgba(0,0,0,.05); z-index: 2; }
.zoom-btn { width: 30px; height: 28px; border: none; background: transparent; cursor: pointer; color: var(--text-2); font-size: 16px; border-radius: 7px; }
.zoom-btn:hover { background: var(--subtle); }
.zoom-label { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 44px; text-align: center; }
.slide-counter { position: absolute; right: 18px; bottom: 18px; font-size: 12px; font-weight: 600; color: var(--muted-2); background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 11px; z-index: 2; }

/* insert toolbar (Canva-like) */
.insert-bar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 3px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; padding: 5px; box-shadow: 0 4px 14px rgba(30,28,24,.12); z-index: 5; }
.insert-btn { width: 34px; height: 34px; border: none; background: transparent; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.insert-btn:hover { background: var(--subtle); color: var(--accent); }
.insert-btn svg { flex: none; }
.insert-sep { width: 1px; height: 20px; background: var(--border-2); margin: 0 2px; }

/* log drawer */
.log-toggle { position: absolute; right: 18px; bottom: 56px; z-index: 3; }
.log-toggle-btn { display: flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 6px 11px; cursor: pointer; font-size: 12px; color: var(--text-2); font-family: inherit; }
.log-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-3); }
.log-dot.running { background: var(--warning); animation: pulse .8s infinite; }
.log-dot.done { background: var(--st-pub-dot); }
.log-dot.error { background: #E0463A; }
.log-drawer { display: none; position: absolute; right: 18px; bottom: 90px; width: 360px; max-height: 260px; overflow-y: auto; background: #1A1916; color: #E8E6DF; border-radius: 12px; padding: 12px 14px; z-index: 4; box-shadow: var(--shadow-pop); }
.log-drawer.open { display: block; }
.log-drawer-body { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; }
.log-drawer-body .line-done { color: #7BE0A0; }
.log-drawer-body .line-error { color: #F87171; }
.log-drawer-body .line-img { color: #9A6BFF; }

.panel-toggle-btn { display: none; position: absolute; top: 14px; right: 14px; z-index: 5; width: 38px; height: 38px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border-2); color: var(--text); font-size: 15px; cursor: pointer; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }
.panel-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Inspector ─────────────────────────────────────────── */
.editor-right { width: 312px; flex: none; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inspector-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 13.5px; }
.inspector-head svg { stroke: var(--accent); }
.panel-tabs { display: flex; border-bottom: 1px solid var(--border); }
.panel-tab { flex: 1; padding: 10px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; border: none; background: none; border-bottom: 2px solid transparent; font-family: inherit; }
.panel-tab:hover { color: var(--text-2); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.inspector-foot { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 6px; }

/* design panel props */
.panel-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.panel-header h3 { font-size: 13px; font-weight: 700; flex: 1; }
.panel-header .tag { font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--accent-tint); padding: 2px 7px; border-radius: 99px; }
.panel-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-section:last-child { border-bottom: none; }
.section-title { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.panel-empty { padding: 30px 20px; text-align: center; color: var(--muted); }
.panel-empty .icon { font-size: 30px; opacity: .4; margin-bottom: 8px; }
.panel-empty p { font-size: 13px; font-weight: 600; color: var(--text-2); }
.panel-empty .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.prop-row { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.prop-row:last-child { margin-bottom: 0; }
.prop-label { font-size: 11px; color: var(--muted-2); min-width: 24px; font-weight: 600; }
.prop-input { flex: 1; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 9px; color: var(--text); font-size: 12.5px; outline: none; min-width: 0; font-family: inherit; }
.prop-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.prop-input-sm { width: 56px; text-align: center; }
.prop-color { width: 30px; height: 30px; border: 1px solid var(--border-2); border-radius: 8px; padding: 2px; cursor: pointer; background: none; }
.prop-color:hover { border-color: var(--accent); }
/* wrapper + badge "?" quando a seleção de texto tem cores mistas */
.prop-color-wrap { position: relative; display: inline-flex; width: 30px; height: 30px; flex: none; }
.prop-color-mixed { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 10px 10px; color: #111; font-weight: 800; font-size: 15px; pointer-events: none; border: 1px solid var(--border-2); }
.prop-slider { flex: 1; accent-color: var(--accent); height: 4px; }
.prop-select { flex: 1; background: var(--surface); border: 1px solid var(--border-2); border-radius: 8px; padding: 7px 9px; color: var(--text); font-size: 12.5px; outline: none; cursor: pointer; font-family: inherit; }
.prop-select:focus { border-color: var(--accent); }
.prop-btn-row { display: flex; gap: 4px; }
.prop-btn { flex: 1; padding: 8px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 600; text-align: center; font-family: inherit; display: flex; align-items: center; justify-content: center; }
.prop-btn:hover { border-color: var(--accent); color: var(--text); }
.prop-btn.active { border-color: var(--dark); background: var(--dark); color: #fff; }

/* layers */
.layer-list { padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.layer-row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.layer-row:hover { background: var(--subtle); }
.layer-row.active { background: var(--accent-tint); border-color: var(--accent); color: var(--text); }
.layer-icon { width: 22px; height: 22px; border-radius: 6px; background: var(--subtle-2); display: flex; align-items: center; justify-content: center; font-size: 11px; flex: none; }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-vis { width: 24px; height: 24px; border: none; background: none; color: var(--muted); cursor: pointer; font-size: 12px; }

/* ── Rail (filmstrip) ──────────────────────────────────── */
.editor-filmstrip { height: 118px; flex: none; background: var(--surface); border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 16px; overflow-x: auto; }
.filmstrip-slide { flex: none; position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; background: transparent; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.filmstrip-slide .fs-wrap, .filmstrip-slide > .fs-preview, .filmstrip-slide { --fs-w: 66px; }
.filmstrip-slide .fs-preview { position: relative; width: 66px; height: 82px; border-radius: 9px; background: var(--subtle-2); border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0,0,0,.1); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.filmstrip-slide.active .fs-preview { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.filmstrip-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filmstrip-slide .fs-iframe { position: absolute; top: 0; left: 0; width: 1080px; height: 1350px; border: none; pointer-events: none; transform: scale(0.0611); transform-origin: 0 0; }
.filmstrip-slide .num { font-size: 11px; font-family: 'JetBrains Mono', monospace; color: var(--muted); font-weight: 600; }
.filmstrip-slide .placeholder { font-size: 9px; color: var(--muted); font-family: monospace; }
.filmstrip-add { flex: none; width: 66px; height: 82px; border-radius: 9px; border: 2px dashed #D8D6CE; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); margin-bottom: 21px; font-size: 22px; }
.filmstrip-add:hover { border-color: var(--accent); color: var(--accent); }
.filmstrip-sep { width: 1px; height: 50px; background: var(--border-2); flex: none; margin: 0 4px 21px; }
.filmstrip-actions { flex: none; display: flex; gap: 6px; margin-bottom: 21px; }
.filmstrip-action { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-2); cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.filmstrip-action:hover { background: var(--subtle); color: var(--text); }
.filmstrip-action.danger { color: #B0463C; }
.filmstrip-action.danger:hover { background: var(--red-dim); }

/* separador vertical dentro de um prop-btn-row (ex.: B I | ⇤ ≡ ⇥) */
.prop-div { width: 1px; align-self: stretch; background: var(--border-2); margin: 2px 3px; flex: none; }

/* ── Image picker ──────────────────────────────────────── */
.img-picker-overlay { display: none; position: fixed; inset: 0; background: rgba(20,18,16,.5); z-index: 3300; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.img-picker-overlay.open { display: flex; }
.img-picker { background: var(--surface); border: 1px solid var(--border-2); border-radius: 18px; width: 680px; max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-lg); animation: modalIn .2s var(--ease); }
.img-picker-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.img-picker-head h2 { font-size: 15px; font-weight: 700; flex: 1; }
.img-source-tabs { display: flex; gap: 4px; padding: 12px 20px 0; }
.img-source-tab { padding: 7px 14px; border: none; background: var(--subtle); border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-2); font-family: inherit; }
.img-source-tab:hover { background: var(--subtle-2); }
.img-source-tab.active { background: var(--dark); color: #fff; }
.img-search-row { padding: 12px 20px; display: flex; gap: 8px; }
.img-grid { flex: 1; overflow-y: auto; padding: 8px 20px 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; grid-auto-rows: max-content; align-content: start; }
.img-card { border-radius: 10px; overflow: hidden; cursor: pointer; border: 2px solid transparent; position: relative; background: var(--subtle); transition: all .15s; }
.img-card:hover { border-color: var(--accent); transform: scale(1.02); }
.img-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; }
.img-card-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,.8)); font-size: 10px; color: rgba(255,255,255,.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.img-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--border); flex: none; }
.img-pag-info { font-size: 12px; color: var(--muted); font-weight: 600; min-width: 110px; text-align: center; }

/* ── Lightbox ──────────────────────────────────────────── */
.lightbox { display: none; position: fixed; inset: 0; background: rgba(20,18,16,.92); z-index: 3400; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 82vw; max-height: 82vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
.lb-close { position: absolute; top: 20px; right: 26px; color: #fff; font-size: 30px; cursor: pointer; opacity: .8; }
.lb-nav button { position: fixed; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,.15); color: #fff; font-size: 22px; cursor: pointer; }
.lb-nav button:first-child { left: 24px; } .lb-nav button:last-child { right: 24px; }

/* ── Slide type picker (add slide) ─────────────────────── */
.slide-type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.slide-type-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; }
.slide-type-card:hover { border-color: var(--accent); background: var(--accent-tint-2); }
.slide-type-card .icon { font-size: 20px; }
.slide-type-card .name { font-size: 13px; font-weight: 700; }
.slide-type-card .desc { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ── Caption / publish / IG modals internals ───────────── */
.caption-field { display: flex; flex-direction: column; gap: 6px; }
.caption-field-head { display: flex; align-items: center; gap: 8px; }
.caption-field-head label { font-size: 12.5px; font-weight: 600; color: var(--text-2); flex: 1; }
.caption-textarea { width: 100%; border: 1px solid var(--border-2); border-radius: 10px; padding: 10px 12px; font-family: inherit; font-size: 13px; line-height: 1.5; resize: vertical; outline: none; color: var(--text); }
.caption-textarea:focus { border-color: var(--accent); }
.caption-counter { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.ig-status { display: flex; flex-direction: column; }
.ig-ok, .ig-warn, .ig-info { padding: 14px 16px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.ig-ok { background: var(--st-pub-tint); color: var(--st-pub); }
.ig-warn { background: var(--st-sched-tint); color: var(--st-sched-fg); }
.ig-info { background: var(--accent-tint); color: var(--accent); }
.ig-ok strong, .ig-warn strong, .ig-info strong { display: block; font-size: 13.5px; margin-bottom: 5px; }
.ig-warn p, .ig-ok p { color: var(--text-2); margin-top: 4px; font-size: 12.5px; line-height: 1.5; }
.ig-ok .btn, .ig-warn .btn { margin-top: 12px; }
.ig-info ol { color: var(--text-2); margin: 8px 0 0 18px; padding: 0; font-size: 12.5px; line-height: 1.7; }
.ig-info ol li { margin-bottom: 4px; }
.ig-info small { display: block; margin-top: 10px; color: var(--text-2); font-size: 11.5px; line-height: 1.5; }
.ig-info div { margin-top: 6px; color: var(--text-2); }
.ig-info a { color: var(--accent); font-weight: 600; }
.ig-info code, .ig-warn code, .ig-ok code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; font-family: 'JetBrains Mono', monospace; word-break: break-word; }
.ig-preview { padding: 14px 16px; background: var(--subtle-3); border: 1px solid var(--border); border-radius: 12px; }
.ig-preview strong { font-size: 12.5px; color: var(--text); }
.publish-mode-tabs { display: flex; gap: 6px; }
.publish-mode-tab { flex: 1; padding: 10px 14px; background: var(--subtle); border: 2px solid var(--border-2); border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); font-family: inherit; }
.publish-mode-tab:hover { border-color: var(--accent); }
.publish-mode-tab.active { background: var(--accent-tint); border-color: var(--accent); color: var(--accent); }

/* ── Responsivo ────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-right { position: absolute; top: 56px; bottom: 118px; right: 0; width: min(312px, 88vw); z-index: 30; box-shadow: -10px 0 28px rgba(0,0,0,.15); transform: translateX(105%); transition: transform .22s var(--ease); }
  .editor-shell.panel-open .editor-right { transform: translateX(0); }
  .panel-toggle-btn { display: flex; }
  .ed-title { max-width: 160px; }
}
@media (max-width: 560px) {
  .editor-filmstrip { height: 96px; }
  .editor-right { bottom: 96px; }
}
