
/* ==========================================================================
   Base CSS — estilos gerais da aplicação (NÃO incluir regras de impressão)
   ========================================================================== */

/* Variáveis e fontes */
:root {
  --bg-body: #f7f7f9;
  --fg-body: #111;
  --fg-muted: #666;
  --border: #e5e7eb;
  --shadow: 0 1px 6px rgba(0,0,0,0.06);
  --radius: 12px;
  --page-margin-top: 0.4in;
  --page-margin-right: 0.4in;
  --page-margin-bottom: 0.4in;
  --page-margin-left: 0.4in;
  --font-body: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* Body / layout geral */
html, body { height: 100%; }
body { margin: 0; background: var(--bg-body); color: var(--fg-body); font-family: var(--font-body); }


/* Navbar */
.navbar { background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 100; }
.navbar .brand { font-weight: 700; }
.navbar a { text-decoration: none; color: inherit; }
.navbar .active { color: #0d6efd; }

/* Zonas de interação */
.dropzone {
  border: 2px dashed #bbb; border-radius: var(--radius); padding: 24px; text-align: center; background: #fff;
}
.dropzone.dragover { background: #f0f8ff; }

.div-box {
  background: #fff; 
  padding: 0px; 
  min-height: 320px;
}

.toolbar { background: #fff; border-bottom: 1px solid #eee; padding: .75rem; position: sticky; top: 0; z-index: 90; }

/* Document look (área renderizada do markdown) */
#doc-root { line-height: 1.45; font-size: 11.5pt; color: var(--fg-body); padding: 0.2in 0.3in;}
#doc-root h1, #doc-root h2, #doc-root h3 { font-weight: 700; line-height: 1.25; }
#doc-root h1 { font-size: 22pt; margin: 0 0 12pt; }
#doc-root h2 { font-size: 18pt; margin: 18pt 0 8pt; border-bottom: 1px solid #ddd; padding-bottom: 4pt; }
#doc-root h3 { font-size: 14pt; margin: 14pt 0 6pt; }

#doc-root p  { margin: 6pt 0 10pt; }
#doc-root ul, #doc-root ol { margin: 6pt 0 10pt 20pt; }
#doc-root ul { list-style-type: disc; }
#doc-root ol { list-style-type: decimal; }
#doc-root li { margin: 2pt 0; }

#doc-root pre { background: #f6f8fa; padding: 10px; border-radius: 6px; overflow: auto; }
#doc-root code { font-family: var(--font-mono); background: #f6f8fa; padding: 2px 4px; border-radius: 4px; }

#doc-root table { border-collapse: collapse; width: 100%; margin: 10pt 0; }
#doc-root th, #doc-root td { border: 1px solid var(--border); padding: 6px 8px; }
#doc-root thead th { background: #fafafa; }

#doc-root blockquote { border-left: 3px solid var(--border); color: #444; padding: 4px 12px; margin: 8px 0; }

#doc-root img { max-width: 100%; height: auto; }
img.emoji { height: 1em !important; width: auto; vertical-align: text-bottom; }

/* Utilitários */
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-muted { color: var(--fg-muted); }

.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:1rem}.mt-4{margin-top:1.5rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:1rem}.mb-4{margin-bottom:1.5rem}

/* Links gerais */
a { color: #0d6efd; }
a:hover { text-decoration: underline; }


.pagedjs_page {
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
    border: solid 1px lightgray;
    margin: 5px 0px;
    padding: 0px;
}

.preview {
  background: #fff; 
  padding: 0px; 
  min-height: 320px;
  width: fit-content;
}

.pagedjs_left_page {

}

section.preview {
  position: relative; /* importante pro overlay absoluto */
  min-height: 40vh;   /* evita overlay “amassado” quando vazio */
}

/* overlay ocupando toda a área da seção */
.preview-loading {
  position: absolute;
  inset: 0;               /* top/right/bottom/left: 0 */
  background: rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  z-index: 10;
  pointer-events: all;    /* captura cliques */
}

/* Enquanto o overlay está visível, o resto não deve receber interação */
.preview-loading:not([hidden]) ~ * {
  pointer-events: none;   /* segurança extra, mas o overlay já cobre tudo */
}

/* spinner simples (círculo girando) */
.preview-loading .spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.preview-loading .msg {
  color: #fff;
  font-size: .95rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


@media (min-width: 576px) {
.container-narrow { max-width: 400px; margin: 0 auto; padding: 1rem; }
.container-wide   { max-width: 500px; margin: 0 auto; padding: 1rem; }
}

@media (min-width: 768px) {
.container-narrow { max-width: 640px; margin: 0 auto; padding: 1rem; }
.container-wide   { max-width: 720px; margin: 0 auto; padding: 1rem; }
}

@media (min-width: 992px) {
  .container-narrow { max-width: 800px; margin: 0 auto; padding: 1rem; }
  .container-wide   { max-width: 900px; margin: 0 auto; padding: 1rem; }
}

@media (min-width: 1300px) {
.container-narrow { max-width: 900px; margin: 0 auto; padding: 1rem; }
.container-wide   { max-width: 1200px; margin: 0 auto; padding: 1rem; }
}

@media (min-width: 1620px) {
.container-narrow { max-width: 1024px; margin: 0 auto; padding: 1rem; }
.container-wide   { max-width: 1600px; margin: 0 auto; padding: 1rem; }
}
