/* ===== Base do container ===== */
.wysiwyg{
  /* Tipografia neutra; pode trocar por variáveis do seu tema */
  font: 400 1rem/1.7 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:#1a1a1a;
  /* evita que resets globais matem as margens internas */
  --wys-color: #1a1a1a;
  --wys-muted: #666;
  --wys-border: #e5e5e5;
  --wys-softbg: #fafafa;
  --wys-quote: #ddd;
  --wys-accent: #0d6efd;
}

/* ===== Texto e cabeçalhos ===== */
.wysiwyg p{ margin:1em 0; }
.wysiwyg h1,.wysiwyg h2,.wysiwyg h3,.wysiwyg h4,.wysiwyg h5,.wysiwyg h6{
  font-weight:700; line-height:1.25; margin:1.2em 0 .6em; color:var(--wys-color);
}
.wysiwyg h1{ font-size:1.875rem; }
.wysiwyg h2{ font-size:1.5rem; }
.wysiwyg h3{ font-size:1.25rem; }
.wysiwyg h4{ font-size:1.125rem; }
.wysiwyg h5{ font-size:1rem; }
.wysiwyg h6{ font-size:.95rem; letter-spacing:.02em; text-transform:none; }

.wysiwyg small{ font-size:87.5%; color:var(--wys-muted); }
.wysiwyg mark{ background:#fff1a8; }
.wysiwyg sub{ font-size:.75em; vertical-align:sub; }
.wysiwyg sup{ font-size:.75em; vertical-align:super; }

/* ===== Links ===== */
.wysiwyg a{ color:var(--wys-accent); text-decoration:underline; }
.wysiwyg a:hover{ text-decoration:none; }

/* ===== Linhas e citações ===== */
.wysiwyg hr{ border:0; border-top:1px solid var(--wys-border); margin:2em 0; }
.wysiwyg blockquote{
  margin:1.2em 0; padding:.6em 1em; color:var(--wys-muted);
  border-left:4px solid var(--wys-quote); background:#f8f9fa;
}

/* ===== Listas ===== */
.wysiwyg ul,.wysiwyg ol{ margin:.8em 0 1em; padding-left:1.5em; }
.wysiwyg ul{ list-style:disc; }
.wysiwyg ol{ list-style:decimal; }
.wysiwyg li{ margin:.25em 0; }
.wysiwyg ul ul{ list-style:circle; }
.wysiwyg ol ol{ list-style:lower-alpha; }

/* ===== Imagens e figuras do CKEditor ===== */
.wysiwyg img{ max-width:100%; height:auto; }
.wysiwyg figure{ margin:1em 0; }
.wysiwyg figure.image{ display:inline-block; }
.wysiwyg figure.image > img{ display:block; }
.wysiwyg figcaption{
  font-size:.875rem; color:var(--wys-muted);
  text-align:center; margin-top:.4em;
}

/* Alinhamentos (CKEditor 4/5) */
.wysiwyg .image-style-align-left{ float:left; margin: .2em 1em .8em 0; }
.wysiwyg .image-style-align-right{ float:right; margin: .2em 0 .8em 1em; }
.wysiwyg .image-style-align-center{ margin-left:auto; margin-right:auto; text-align:center; }
.wysiwyg .image-style-block-align-left{ margin-right:auto; }
.wysiwyg .image-style-block-align-right{ margin-left:auto; }
.wysiwyg .image_resized{ display:block; height:auto; max-width:100%; }

/* Limpa floats dentro do container */
.wysiwyg::after{ content:""; display:block; clear:both; }

/* ===== Tabelas (inclui estilos de plugin "table" do CKEditor) ===== */
.wysiwyg table{ width:100%; border-collapse:collapse; margin:1em 0; font-size:.95em; }
.wysiwyg th,.wysiwyg td{ border:1px solid var(--wys-border); padding:.6em .8em; }
.wysiwyg th{ background:var(--wys-softbg); text-align:left; }
.wysiwyg thead th{ border-bottom:2px solid var(--wys-border); }
.wysiwyg tbody tr:nth-child(even){ background:#fcfcfc; }

/* CKEditor 5 "table" wrapper */
.wysiwyg .table{ overflow-x:auto; }
.wysiwyg .table table{ width:100%; border-collapse:collapse; }

/* ===== Código / pré-formatado ===== */
.wysiwyg code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background:#f6f8fa; padding:.15em .35em; border-radius:4px;
}
.wysiwyg pre{
  background:#0b0b0b0d; padding:1em; border-radius:6px; overflow:auto;
}
.wysiwyg pre code{ background:transparent; padding:0; }

/* ===== Mídia incorporada (iframe, vídeo) ===== */
.wysiwyg iframe, .wysiwyg video, .wysiwyg embed, .wysiwyg object{
  max-width:100%; width:100%; height:auto;
}

/* ===== Alinhamentos de texto (classes comuns do CKEditor) ===== */
.wysiwyg .text-left{ text-align:left; }
.wysiwyg .text-center{ text-align:center; }
.wysiwyg .text-right{ text-align:right; }

/* ===== Listas de descrição ===== */
.wysiwyg dl{ margin:1em 0; }
.wysiwyg dt{ font-weight:600; }
.wysiwyg dd{ margin:0 0 .6em 1.2em; }

/* ===== Títulos com âncoras (caso use plugin heading id) ===== */
.wysiwyg [id]::before{ content:""; display:block; height:0; margin-top:-80px; visibility:hidden; }

/* ===== “Blindagem” contra resets agressivos (Tailwind/Bootstrap etc.) ===== */
.wysiwyg :where(p, h1,h2,h3,h4,h5,h6, ul,ol,li, blockquote, table, th, td, figure, figcaption){
  /* Garante margens/list-style quando algum reset global zera tudo */
  margin-block: revert;
  margin-inline: revert;
}
.wysiwyg :where(ul,ol){ list-style-position: outside; }
.wysiwyg :where(b,strong){ font-weight:700; }
.wysiwyg :where(i,em){ font-style:italic; }
.wysiwyg :where(u){ text-decoration:underline; }
.wysiwyg :where(s,del){ text-decoration:line-through; }

/* ===== Responsividade para colunas que venham do editor ===== */
@media (max-width: 640px){
  .wysiwyg .image-style-align-left,
  .wysiwyg .image-style-align-right{
    float:none; margin: .6em auto; display:block; text-align:center;
  }
}

/* ===== Espaçamento extra (opcional, para consistência visual) ===== */
.wysiwyg > :first-child{ margin-top:0 !important; }
.wysiwyg > :last-child{ margin-bottom:0 !important; }

/* ===== Listas blindadas ===== */
.wysiwyg ul,
.wysiwyg ol {
  list-style-position: outside !important;
  padding-left: 1.6em !important;
  margin: 0.75em 0 1em !important;
}

.wysiwyg ul { list-style-type: disc !important; }
.wysiwyg ol { list-style-type: decimal !important; }

.wysiwyg li {
  display: list-item !important;
  margin: .3em 0 !important;
  line-height: 1.7 !important;
}

/* Listas aninhadas */
.wysiwyg ul ul { list-style-type: circle !important; margin-top: .3em !important; }
.wysiwyg ol ol { list-style-type: lower-alpha !important; }
.wysiwyg ol ol ol { list-style-type: lower-roman !important; }

/* Corrige quando resets mexem no marker */
.wysiwyg li::marker {
  color: #333 !important;
  font-size: 1em !important;
}