/* ──────────────────────────────────────────────────────────────────────────
   Editor da página da ideia — Steam-style, blocos verticais
   ────────────────────────────────────────────────────────────────────────── */

.bp-editor-shell {
  min-height: 100vh;
  background: var(--bp-bg);
  /* Sem padding-top: o /editar/* roda em fullscreen, a BpNav não é
     renderizada nessa rota (index.html linha 840). Ter padding criava
     uma faixa vazia de 64px no topo e empurrava todo o header pra
     baixo (Codex review 2026-05-03). */
}

/* Header sticky no TOPO da viewport (não há nav fixo nessa rota).
   Background OPACO (não usa --bp-glass-bg) pra cobrir cleanly o toolbar
   do Toast UI quando ele passa por baixo durante scroll. Antes, o glass
   semitransparente + backdrop-filter deixavam o toolbar "vazar"
   visualmente atrás do header (ficava com aparência de cortado).
   2026-05-03: solução definitiva após tentativa falha de fazer o
   toolbar virar sticky (quebrava o layout interno do Toast UI). */
.bp-editor-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 28px;
  background: rgb(13 16 22);
  border-bottom: 1px solid var(--bp-line);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.55);
}

.bp-editor-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-r-sm);
  color: var(--bp-ink-mute);
  font-family: var(--bp-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background var(--bp-dur) var(--bp-ease),
    border-color var(--bp-dur) var(--bp-ease),
    color var(--bp-dur) var(--bp-ease);
}
.bp-editor-back:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--bp-line-strong);
  color: var(--bp-ink);
}

.bp-editor-header-title {
  flex: 1;
  min-width: 0;
  font-family: var(--bp-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--bp-ink-mute);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-editor-header-title strong {
  font-family: var(--bp-sans);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--bp-ink);
  text-transform: none;
  font-size: 14px;
  margin-left: 6px;
}

.bp-editor-header-status {
  flex-shrink: 0;
}

/* Main column */
.bp-editor-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 24px 96px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Estado loading / erro */
.bp-editor-state {
  text-align: center;
  padding: 96px 24px;
  color: var(--bp-ink-mute);
  font-size: 14px;
}
.bp-editor-state-error h2 {
  margin: 0 0 12px;
  color: var(--bp-ink);
}
.bp-editor-state-error p {
  margin: 0 0 24px;
  color: var(--bp-ink-mute);
}

/* ── Bloco editável (card glass) ──────────────────────────────────────── */

.bp-edit-block {
  background: var(--bp-glass-bg);
  backdrop-filter: var(--bp-glass-blur);
  -webkit-backdrop-filter: var(--bp-glass-blur);
  border: 1px solid var(--bp-glass-border);
  border-top-color: rgba(255, 255, 255, 0.10);
  border-radius: var(--bp-r-lg);
  box-shadow: var(--bp-shadow-card);
  padding: 22px 26px 24px;
  animation: bpFadeUp 360ms var(--bp-ease) both;
}

.bp-edit-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bp-line);
}

.bp-edit-block-title {
  font-family: var(--bp-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bp-ink);
}

/* ── Status badge ─────────────────────────────────────────────────────── */

.bp-edit-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--bp-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.bp-edit-status-icon {
  display: inline-flex;
  width: 18px; height: 18px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}

.bp-edit-status-saved   { color: var(--bp-ink-faint); }
.bp-edit-status-saved   .bp-edit-status-icon {
  background: rgba(34, 197, 94, 0.15);
  color: rgb(74, 222, 128);
}

.bp-edit-status-dirty   { color: var(--bp-amber, #fbbf24); }
.bp-edit-status-dirty   .bp-edit-status-icon {
  background: rgba(251, 191, 36, 0.18);
  color: var(--bp-amber, #fbbf24);
}

.bp-edit-status-saving  { color: var(--bp-blue-hi, #38b0ff); }
.bp-edit-status-saving  .bp-edit-status-icon {
  background: rgba(0, 153, 255, 0.18);
  color: var(--bp-blue-hi, #38b0ff);
  animation: bpEditSpinner 1.2s linear infinite;
}
@keyframes bpEditSpinner {
  to { transform: rotate(360deg); }
}

.bp-edit-status-error   { color: var(--bp-red, #e85d5d); }
.bp-edit-status-error   .bp-edit-status-icon {
  background: rgba(232, 93, 93, 0.18);
  color: var(--bp-red, #e85d5d);
}

/* ── Tags input — chips ───────────────────────────────────────────────── */

.bp-tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.20);
  border: 1px solid var(--bp-line);
  border-radius: var(--bp-r);
  min-height: 48px;
  transition:
    border-color var(--bp-dur) var(--bp-ease),
    background var(--bp-dur) var(--bp-ease);
}
.bp-tag-input-wrap:focus-within {
  border-color: rgba(0, 153, 255, 0.50);
  background: rgba(0, 0, 0, 0.30);
  box-shadow: 0 0 0 3px rgba(0, 153, 255, 0.12);
}

.bp-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 4px 10px;
  background: rgba(0, 153, 255, 0.12);
  border: 1px solid rgba(0, 153, 255, 0.30);
  border-radius: var(--bp-r-sm);
  color: var(--bp-blue-hi, #38b0ff);
  font-family: var(--bp-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.bp-tag-chip-x {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 16px; height: 16px;
  background: transparent;
  border: 0;
  color: rgba(56, 176, 255, 0.60);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  border-radius: 50%;
  transition: color var(--bp-dur) var(--bp-ease), background var(--bp-dur) var(--bp-ease);
}
.bp-tag-chip-x:hover {
  background: rgba(232, 93, 93, 0.20);
  color: var(--bp-red, #e85d5d);
}

.bp-tag-input {
  flex: 1;
  min-width: 120px;
  padding: 4px 6px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--bp-ink);
  font-size: 13px;
  font-family: inherit;
}
.bp-tag-input::placeholder { color: var(--bp-ink-faint); }

.bp-tag-counter {
  margin-top: 8px;
  font-family: var(--bp-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--bp-ink-faint);
  text-align: right;
}

/* ── Hero slides — wrapper interno (sem o card duplicado) ─────────────── */

.bp-hero-slides-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bp-hero-slides-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--bp-ink-mute);
  flex-wrap: wrap;
}
.bp-hero-slides-summary strong {
  color: var(--bp-blue-hi, #38b0ff);
  font-family: var(--bp-mono);
  font-size: 14px;
  letter-spacing: -0.02em;
}

/* ── Toast UI Editor mount + overrides ────────────────────────────────── */

.bp-toast-editor-mount {
  border-radius: var(--bp-r);
  overflow: hidden;
}

.bp-toast-editor-loading {
  padding: 32px;
  text-align: center;
  color: var(--bp-ink-faint);
  font-style: italic;
  font-size: 13px;
}

/* Containers do Toast UI — bate com paleta BP */
.toastui-editor-defaultUI {
  border: 1px solid var(--bp-line) !important;
  border-radius: var(--bp-r) !important;
  background: rgba(0, 0, 0, 0.15) !important;
}
.toastui-editor-defaultUI-toolbar,
.toastui-editor-toolbar {
  /* OPACO: o Toast UI faz a toolbar virar sticky no topo do container
     conforme o usuário rola dentro do editor — quando ela é semi-
     transparente, o markdown que passa atrás "vaza" e fica visível
     duplicado (H B I aparecendo sobre o título da apresentação).
     Solução 2026-05-03: background opaco mate. */
  background: rgb(20 24 32) !important;
  border-bottom: 1px solid var(--bp-line) !important;
}
.toastui-editor-md-container,
.toastui-editor-ww-container {
  background: rgba(0, 0, 0, 0.20) !important;
  color: var(--bp-ink) !important;
  font-family: var(--bp-sans) !important;
}
.toastui-editor-contents {
  font-family: var(--bp-sans) !important;
  font-size: 15px !important;
  line-height: 1.65 !important;
  color: var(--bp-ink) !important;
}
.toastui-editor-contents h1,
.toastui-editor-contents h2,
.toastui-editor-contents h3 {
  color: var(--bp-ink) !important;
  border-bottom-color: var(--bp-line) !important;
}
/* Imagens dentro do preview ganham a moldura igual ao detail */
.toastui-editor-contents img {
  border-radius: var(--bp-r-lg) !important;
  box-shadow: var(--bp-shadow-card) !important;
  border: 1px solid var(--bp-glass-border) !important;
  margin: 24px auto !important;
  max-width: 100% !important;
}
.toastui-editor-contents code,
.toastui-editor-contents pre {
  background: rgba(255, 255, 255, 0.04) !important;
  color: var(--bp-blue-hi, #38b0ff) !important;
}
/* Mode switch (Markdown/WYSIWYG) — placement no canto direito */
.toastui-editor-mode-switch {
  background: rgba(255, 255, 255, 0.03) !important;
  border-top: 1px solid var(--bp-line) !important;
}
.toastui-editor-mode-switch .tab-item {
  color: var(--bp-ink-mute) !important;
}
.toastui-editor-mode-switch .tab-item.active {
  color: var(--bp-blue-hi, #38b0ff) !important;
  border-bottom-color: var(--bp-blue, #0099ff) !important;
}

/* ── Edit footer (última atualização + excluir ideia) ─────────────────── */

.bp-edit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 26px;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--bp-line);
  border-top-color: rgba(255, 255, 255, 0.06);
  border-radius: var(--bp-r-lg);
  flex-wrap: wrap;
}
.bp-edit-footer-info {
  flex: 1;
  min-width: 220px;
}
.bp-edit-footer-line {
  margin: 0;
  font-size: 13.5px;
  color: var(--bp-ink-dim);
}
.bp-edit-footer-line strong {
  color: var(--bp-ink);
  font-weight: 600;
}

/* ── Botão destrutivo (excluir ideia) ─────────────────────────────────── */

.bp-btn-danger {
  background: transparent;
  border: 1px solid rgba(232, 93, 93, 0.45);
  color: var(--bp-red, #e85d5d);
  padding: 9px 16px;
  border-radius: var(--bp-r-sm);
  font-family: var(--bp-mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background var(--bp-dur) var(--bp-ease),
    border-color var(--bp-dur) var(--bp-ease),
    color var(--bp-dur) var(--bp-ease);
}
.bp-btn-danger:hover:not(:disabled) {
  background: rgba(232, 93, 93, 0.10);
  border-color: rgba(232, 93, 93, 0.85);
  color: #ff7a7a;
}
.bp-btn-danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Toast flutuante (sucesso re-eval) ────────────────────────────────── */

.bp-toast-floating {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: rgba(8, 12, 18, 0.95);
  border: 1px solid rgba(0, 153, 255, 0.40);
  border-radius: var(--bp-r);
  color: var(--bp-blue-hi, #38b0ff);
  font-family: var(--bp-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  box-shadow:
    0 0 0 3px rgba(0, 153, 255, 0.15),
    0 12px 32px -6px rgba(0, 153, 255, 0.40);
  z-index: 1500;
  animation: bpToastIn 240ms var(--bp-ease) both;
}
@keyframes bpToastIn {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Responsive ───────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .bp-editor-header {
    padding: 10px 14px;
    gap: 8px;
  }
  /* Mobile: esconde o pill "AGUARDANDO REVISÃO/RASCUNHO" e o status
     "tudo salvo" no header — o título sozinho cabe e o status volta a
     aparecer no rodapé do bp-edit-footer. Antes (2026-05-03) ficava
     tudo apertado virando "AC ✓" truncado em cima do botão Publicar. */
  .bp-editor-header-title { font-size: 11px; }
  .bp-editor-header-title strong { font-size: 13px; }
  .bp-editor-aguardando-pill,
  .bp-editor-draft-pill { display: none !important; }
  .bp-editor-header-status { display: none; }
  .bp-editor-main {
    padding: 20px 14px 80px;
    gap: 18px;
  }
  .bp-edit-block {
    padding: 18px 18px 20px;
  }
  .bp-edit-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }

  /* Toast UI Editor toolbar em mobile: o layout default tenta encolher
     ícones em uma única linha e acaba cortando metade. Forçamos wrap
     em múltiplas linhas pra todos os botões caberem visíveis, sem
     overflow horizontal nem fantasmas. */
  .toastui-editor-defaultUI-toolbar,
  .toastui-editor-toolbar {
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: 40px !important;
    padding: 6px 8px !important;
    gap: 2px !important;
    overflow: visible !important;
  }
  .toastui-editor-defaultUI-toolbar .toastui-editor-toolbar-group,
  .toastui-editor-toolbar .toastui-editor-toolbar-group {
    flex-wrap: wrap !important;
    margin-right: 4px !important;
  }
  /* Os botões de ícone do Toast UI são 32×32 por design — o sprite PNG é
     recortado pra mostrar UM ícone nesse tamanho. A regra global de touch
     target (mobile.css `button { min-height: 44px }`) estica o botão pra 44px,
     então o recorte do sprite passa a mostrar ~12px da linha de ícones DE
     BAIXO (a folha tem 146px de altura = várias linhas) — é o "ícone azul
     fantasma" embaixo. Travamos de volta em 32×32 e cortamos o que vazar.
     Só atinge os botões de ícone da toolbar; o toggle Markdown/WYSIWYG (botão
     de texto) mantém o touch target de 44px. */
  .toastui-editor-defaultUI-toolbar button,
  .toastui-editor-toolbar button {
    margin: 1px !important;
    width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
  /* Esconde divisores verticais pequenos que viram artefatos quando
     a toolbar quebra em múltiplas linhas */
  .toastui-editor-toolbar-divider { display: none !important; }
}

/* ── Draft mode (rascunhos importados ou aguardando publicação) ────────── */

.bp-editor-shell.is-draft .bp-editor-header {
  border-bottom-color: rgba(245, 158, 11, 0.35);
}

.bp-editor-draft-pill {
  display: inline-block;
  background: rgba(245, 158, 11, 0.18);
  color: #f59e0b;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(245, 158, 11, 0.45);
  margin-right: 8px;
  vertical-align: middle;
}

.bp-editor-draft-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 18px;
  margin: 0 24px 20px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 10px;
  color: var(--bp-text, rgba(255, 255, 255, 0.92));
  font-size: 13px;
  line-height: 1.5;
}

.bp-editor-draft-banner svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #f59e0b;
}

.bp-editor-draft-banner strong {
  color: #f59e0b;
}

.bp-editor-draft-banner code {
  background: rgba(0,0,0,0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--bp-mono, monospace);
}

/* ─── Aguardando publicação (pós-pipeline, autor revisa) — 2026-05-03 ─── */
.bp-editor-aguardando-pill {
  display: inline-flex; align-items: center;
  font-family: var(--bp-mono);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em;
  padding: 3px 8px;
  background: rgba(53, 195, 164, 0.18);
  color: #35C3A4;
  border: 1px solid rgba(53, 195, 164, 0.4);
  border-radius: var(--bp-r-sm);
  margin-right: 8px;
  text-transform: uppercase;
}
.bp-editor-aguardando-banner {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(180deg, rgba(53, 195, 164, 0.10), rgba(53, 195, 164, 0.04));
  border: 1px solid rgba(53, 195, 164, 0.35);
  border-left: 3px solid #35C3A4;
  border-radius: var(--bp-r);
  padding: 14px 18px;
  margin: 18px 0;
  color: var(--bp-ink-dim);
  font-size: 13.5px; line-height: 1.55;
}
.bp-editor-aguardando-banner svg {
  flex-shrink: 0;
  color: #35C3A4;
  margin-top: 2px;
}
.bp-editor-aguardando-banner strong {
  color: var(--bp-ink);
}
.bp-editor-shell.is-aguardando .bp-editor-header {
  border-bottom: 2px solid rgba(53, 195, 164, 0.35);
}

/* Mine card draft state */
.bp-mine-card.is-draft .bp-mine-card-thumb {
  filter: grayscale(0.5);
  opacity: 0.85;
}

.bp-mine-card.is-draft {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(180deg,
    rgba(245, 158, 11, 0.04) 0%,
    transparent 100%);
}
