/* ============================================================
   Interface de edição. Nada daqui entra no HTML exportado —
   o export é montado a partir do modelo, não do DOM da tela.
   ============================================================ */

.ed-fab {
  position: fixed; left: 30px; bottom: 74px; z-index: 90;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .02em;
  box-shadow: 0 2px 6px rgba(31,31,78,.10), 0 10px 26px rgba(31,31,78,.12);
  transition: transform 180ms var(--ease);
}
.ed-fab:hover { transform: translateY(-1px); }
.ed-fab svg { width: 15px; height: 15px; color: var(--accent-soft); }
body.editando .ed-fab { background: var(--accent); color: #fff; border-color: var(--accent); }
body.editando .ed-fab svg { color: #fff; }
body.apresentando .ed-fab { display: none; }

.ed-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95;
  display: none; align-items: center; gap: 9px; flex-wrap: wrap;
  padding: 10px 18px; background: var(--ink); color: #fff;
  box-shadow: 0 4px 18px rgba(31,31,78,.3);
}
body.editando .ed-bar { display: flex; }
body.editando .topnav { top: 66px; }
.ed-bar__tag {
  font-family: var(--display); font-weight: 800; font-size: 10.5px;
  letter-spacing: .16em; text-transform: uppercase; color: #F05880; margin-right: 3px;
}
.ed-btn {
  appearance: none; cursor: pointer; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.22); background: rgba(255,255,255,.08);
  color: #fff; font-family: var(--sans); font-weight: 600; font-size: 12.5px;
  padding: 7px 13px; transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.ed-btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.42); }
.ed-btn--pri { background: var(--accent); border-color: var(--accent); }
.ed-btn--pri:hover { background: #EE5C8C; border-color: #EE5C8C; }
.ed-bar__sep { width: 1px; height: 22px; background: rgba(255,255,255,.18); }
.ed-bar__estado {
  margin-left: auto; font-size: 11.5px; font-weight: 600;
  color: rgba(255,255,255,.55); letter-spacing: .04em;
}
.ed-bar__estado.ok { color: #6EE7B7; }
.ed-bar__estado.sujo { color: #FDBA74; }

/* alvos de edição */
body.editando [contenteditable] { outline: 1px dashed rgba(226,74,127,.4); outline-offset: 3px; border-radius: 3px; }
body.editando [contenteditable]:hover { outline-color: rgba(226,74,127,.85); background: rgba(226,74,127,.05); }
body.editando [contenteditable]:focus { outline: 2px solid var(--accent); background: rgba(226,74,127,.06); }
body.editando .page--dark [contenteditable], body.editando .page--imagem [contenteditable] { outline-color: rgba(240,88,128,.55); }
body.editando .page--dark [contenteditable]:hover, body.editando .page--dark [contenteditable]:focus,
body.editando .page--imagem [contenteditable]:hover, body.editando .page--imagem [contenteditable]:focus { background: rgba(255,255,255,.08); }

body.editando main img { cursor: pointer; outline: 2px dashed rgba(226,74,127,.5); outline-offset: -2px; }
body.editando main img:hover { outline: 3px solid var(--accent); }

/* barra por página */
.ed-pagbar {
  position: absolute; top: 12px; right: 14px; z-index: 40;
  display: flex; align-items: center; gap: 4px;
  padding: 6px 8px; border-radius: 999px;
  background: rgba(31,31,78,.93); backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(31,31,78,.3);
}
body.editando .topnav ~ main .ed-pagbar { top: 78px; }
.ed-pagbar__n {
  font-family: var(--display); font-weight: 800; font-size: 11px;
  color: rgba(255,255,255,.5); padding: 0 6px 0 3px; letter-spacing: .06em;
}
.ed-pagbar button {
  appearance: none; cursor: pointer; border: 0; border-radius: 7px;
  background: rgba(255,255,255,.1); color: #fff;
  font-family: var(--sans); font-weight: 600; font-size: 11.5px; padding: 6px 10px;
  transition: background-color 150ms var(--ease);
}
.ed-pagbar button:hover { background: rgba(255,255,255,.24); }
.ed-pagbar button.perigo:hover { background: #E5484D; }

/* escolha de layout */
.ed-modal {
  position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center;
  background: rgba(20,19,58,.62); backdrop-filter: blur(5px); padding: 24px;
}
.ed-modal[hidden] { display: none; }
.ed-modal__caixa {
  background: var(--surface); border-radius: 22px; padding: 32px;
  max-width: 880px; width: 100%; box-shadow: 0 30px 80px rgba(31,31,78,.4);
}
.ed-modal__caixa h3 { font-size: 26px; margin-bottom: 6px; }
.ed-modal__caixa > p { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.ed-modal__grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ed-layout {
  appearance: none; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease);
}
.ed-layout:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.ed-layout b { font-family: var(--display); font-size: 14px; color: var(--text); }
.ed-layout i { font-style: normal; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.ed-layout__arte {
  display: block; height: 68px; border-radius: 10px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); position: relative; overflow: hidden;
}
.ed-layout__arte--cheia { background: linear-gradient(135deg, var(--accent), var(--eyebrow)); }
.ed-layout__arte--texto::before {
  content: ""; position: absolute; left: 12px; top: 16px; width: 60%; height: 9px;
  border-radius: 3px; background: var(--accent);
  box-shadow: 0 17px 0 -1px var(--border-strong), 0 30px 0 -2px var(--border-strong);
}
.ed-layout__arte--lado::before {
  content: ""; position: absolute; left: 10px; top: 12px; width: 46%; height: 44px;
  border-radius: 6px; background: var(--accent);
}
.ed-layout__arte--lado::after {
  content: ""; position: absolute; right: 10px; top: 18px; width: 34%; height: 7px;
  border-radius: 3px; background: var(--border-strong);
  box-shadow: 0 14px 0 0 var(--border-strong);
}
.ed-layout__arte--cards::before {
  content: ""; position: absolute; left: 10px; top: 16px; width: 26%; height: 36px;
  border-radius: 6px; background: var(--accent);
  box-shadow: 34px 0 0 0 var(--eyebrow), 68px 0 0 0 var(--border-strong);
}
.ed-modal__fechar { margin-top: 22px; background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.ed-modal__fechar:hover { background: var(--border); border-color: var(--border-strong); }

.ed-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  z-index: 120; background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px;
  font-family: var(--sans); font-size: 13px; font-weight: 500; max-width: 90vw; text-align: center;
  box-shadow: 0 10px 30px rgba(31,31,78,.34);
  opacity: 0; pointer-events: none; transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.ed-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) { .ed-modal__grade { grid-template-columns: repeat(2, 1fr); } }
@media print { .ed-fab, .ed-bar, .ed-toast, .ed-pagbar, .ed-modal { display: none !important; } }

/* atalho para a tela de acessos, só para administradores */
.ed-fab--acessos { left: 168px; text-decoration: none; }
.ed-fab--acessos svg { width: 15px; height: 15px; color: var(--accent-soft); }
body.editando .ed-fab--acessos { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
body.apresentando .ed-fab--acessos { display: none; }
@media (max-width: 680px) { .ed-fab--acessos { display: none; } }
