/**
 * Estilo da barra e do painel de edição no site.
 *
 * Vive num ficheiro próprio para não se misturar com o motor de render. A
 * barra é fixa no fundo, discreta, e não desloca a página: o conteúdo continua
 * a ser o do visitante, só com ferramentas por cima quando há sessão
 * autorizada.
 */

.mf-edit-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 14px;
    background: #101828;
    color: #eef2f8;
    font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, .28);
}

.mf-edit-bar .mf-eb-left,
.mf-edit-bar .mf-eb-mid,
.mf-edit-bar .mf-eb-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mf-edit-bar .mf-eb-right {
    margin-left: auto;
}

.mf-eb-parish { font-weight: 700; }
.mf-eb-soft { color: #a9b6c9; }
.mf-eb-page { color: #d6e2f5; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mf-eb-sep { color: #4b5b71; }

.mf-eb-chip {
    background: #1d2939;
    border: 1px solid #344054;
    color: #d6e2f5;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 11px;
    white-space: nowrap;
}
.mf-eb-chip-ok { border-color: #12b76a; color: #6ce9a6; }
.mf-eb-chip-warn { border-color: #f79009; color: #fec84b; }
/* Aviso de ensaio: cor própria para não se confundir com um estado normal. */
.mf-eb-chip-ensai {
  background: #422006;
  border-color: #b54708;
  color: #fec84b;
  font-weight: 700;
}
.mf-eb-chip-ensai::before { content: "⚠ "; }

.mf-eb-btn,
.mf-eb-view {
    border: 1px solid #344054;
    background: #1d2939;
    color: #eef2f8;
    border-radius: 7px;
    padding: 5px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.mf-eb-btn:hover:not(:disabled),
.mf-eb-view:hover { background: #24324a; }
.mf-eb-btn:disabled { opacity: .45; cursor: default; }
.mf-eb-primary { background: #1c3998; border-color: #2a4bc0; font-weight: 700; }
.mf-eb-primary:hover:not(:disabled) { background: #2346b8; }
.mf-eb-ghost { background: transparent; }
.mf-eb-view.is-on { background: #1c3998; border-color: #2a4bc0; }

.mf-eb-note {
    flex-basis: 100%;
    font-size: 12px;
    color: #6ce9a6;
}
.mf-eb-note.is-err { color: #fda29b; }

.mf-eb-history {
    position: fixed;
    right: 14px;
    bottom: 56px;
    z-index: 2147483001;
    width: min(360px, calc(100vw - 28px));
    max-height: 50vh;
    overflow: auto;
    background: #101828;
    color: #eef2f8;
    border: 1px solid #344054;
    border-radius: 10px;
    padding: 10px;
    font: 12px/1.5 system-ui, sans-serif;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.mf-eb-hrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px solid #1d2939;
}

/* Alvos na página. */
.mf-eb-target {
    outline: 2px dashed rgba(28, 57, 152, .35);
    outline-offset: 3px;
    cursor: pointer;
    transition: outline-color .15s ease;
}
.mf-eb-target:hover { outline-color: #1c3998; }
.mf-eb-selected { outline: 3px solid #12b76a !important; outline-offset: 3px; }

/* Painel de propriedades. */
.mf-edit-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 2147482999;
    width: min(380px, 100vw);
    background: #fff;
    color: #101828;
    border-left: 1px solid #e4e7ec;
    box-shadow: -8px 0 30px rgba(16, 24, 40, .12);
    overflow: auto;
    padding: 14px;
    font: 13px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    transform: translateX(100%);
    transition: transform .18s ease;
}
.mf-edit-panel.is-open { transform: translateX(0); }

.mf-ep-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eef2f8;
    margin-bottom: 10px;
    font-size: 15px;
}
.mf-ep-x {
    border: 1px solid #e4e7ec;
    background: #fff;
    border-radius: 6px;
    width: 26px;
    height: 26px;
    line-height: 1;
    cursor: pointer;
    font-size: 14px;
}
.mf-ep-field { display: block; margin: 0 0 10px; }
.mf-ep-label { display: block; font-size: 11px; font-weight: 700; color: #475467; margin-bottom: 3px; text-transform: uppercase; letter-spacing: .02em; }
.mf-ep-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    padding: 5px 7px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: #101828;
}
.mf-ep-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mf-ep-check { display: flex; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; }
.mf-ep-hint { display: block; color: #667085; font-size: 11px; margin-top: 2px; }
.mf-ep-moves { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef2f8; }
.mf-ep-btn {
    border: 1px solid #d0d5dd;
    background: #fff;
    border-radius: 7px;
    padding: 5px 10px;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}
.mf-ep-btn:hover { background: #f9fafb; }
.mf-ep-primary { background: #1c3998; border-color: #1c3998; color: #fff; }
.mf-ep-composite { margin-top: 14px; padding-top: 10px; border-top: 1px solid #eef2f8; }
.mf-ep-h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; color: #475467; letter-spacing: .03em; }
.mf-ep-el { border: 1px solid #eef2f8; border-radius: 8px; padding: 8px; margin-bottom: 8px; background: #fcfcfd; }
.mf-ep-el-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; font-size: 12px; }
.mf-ep-el-head strong { margin-right: auto; }
.mf-ep-add { display: flex; gap: 6px; align-items: center; }

/* Pré-visualização estreita: o conteúdo encolhe, a página não muda. */
body.mf-eb-narrow main#panel,
body.mf-eb-narrow .mf-motor-root {
    max-width: var(--mf-eb-preview-w, 768px);
    margin: 0 auto;
    box-shadow: 0 0 0 1px #e4e7ec;
}

/* O `localStorage` não é partilhado entre esta origem e o MF Gestão, por isso
   a passagem de sessão faz-se pelo fragmento do URL e é guardada aqui. O
   fragmento é limpo logo a seguir, para não ficar no histórico. */
/* Seletor de página e paletas. */
.mf-eb-pageselect {
  background: #1d2939;
  color: #eef2f8;
  border: 1px solid #344054;
  border-radius: 7px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  max-width: 180px;
}
.mf-eb-palette,
.mf-eb-layouts { max-height: 62vh; }

.mf-eb-login {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 2147482998;
  background: #101828;
  color: #eef2f8;
  border: 1px solid #344054;
  border-radius: 999px;
  padding: 6px 14px;
  font: 600 12px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .25);
}
.mf-eb-login:hover { background: #1d2939; }

@media (max-width: 700px) {
    .mf-edit-bar { font-size: 12px; padding: 6px 8px; gap: 6px; }
    .mf-edit-bar .mf-eb-right { margin-left: 0; }
    .mf-edit-panel { width: 100vw; }
}
