/* =====================================================================
   Gerador de Documentos - complementos ao tema base (app.css)
   ===================================================================== */

/* ---------- marca na sidebar quando nao ha logotipo ---------- */
.fc-brand-texto {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-style: italic;
    color: var(--fc-primary);
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
}
.fc-brand-texto i { font-size: 1.3rem; flex: 0 0 auto; }
body.sidebar-collapsed .fc-brand-texto span { display: none; }

.fc-topbar-espaco { flex: 1 1 auto; }

/* ---------- barra de status (rodape) por estilo ---------- */
.gd-barra-info    { border-left: 4px solid var(--fc-blue); }
.gd-barra-sucesso { border-left: 4px solid var(--fc-green); }
.gd-barra-aviso   { border-left: 4px solid var(--fc-secondary); }
.gd-barra-perigo  { border-left: 4px solid var(--fc-primary); }
.gd-barra-neutro  { border-left: 4px solid var(--fc-muted); }
.gd-barra-escuro  { border-left: 4px solid var(--fc-text); }

.fc-footer-brand i { color: var(--fc-primary); font-size: 1rem; }

/* ---------- editor de documentos ---------- */
.CodeMirror {
    height: 520px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    line-height: 1.5;
    border-radius: 0 0 var(--fc-radius) var(--fc-radius);
}

.preview-frame {
    width: 100%;
    height: 620px;
    border: 0;
    background: #fff;
    border-radius: 0 0 var(--fc-radius) var(--fc-radius);
}

.lista-expressoes { max-height: 420px; overflow-y: auto; }

.exp-item {
    padding: .3rem .45rem;
    border-radius: var(--fc-radius-sm);
    cursor: pointer;
    font-size: .76rem;
    display: flex;
    align-items: center;
    gap: .3rem;
    border: 1px solid transparent;
}
.exp-item:hover { background: var(--fc-primary-soft); border-color: rgba(var(--fc-primary-rgb), .25); }
.exp-item code { color: var(--fc-primary); font-weight: 600; }
.exp-rotulo {
    color: var(--fc-muted);
    margin-left: auto;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lista-check {
    max-height: 45vh;
    overflow-y: auto;
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-sm);
    padding: .35rem;
}
.item-check {
    display: block;
    padding: .25rem .4rem;
    border-radius: var(--fc-radius-sm);
    cursor: pointer;
    font-size: .78rem;
}
.item-check:hover { background: var(--fc-soft-gray); }

.gd-faltante {
    background: rgba(var(--fc-secondary-rgb), .25);
    color: #7a5a00;
    border: 1px dashed var(--fc-secondary);
    padding: 0 2px;
    border-radius: 3px;
}

/* ---------- saida JSON das consultas ---------- */
.gd-json {
    background: #11111a;
    color: #d6d6e0;
    border-radius: var(--fc-radius-sm);
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .76rem;
    line-height: 1.55;
    max-height: 48vh;
    overflow: auto;
    margin: 0;
    white-space: pre;
}
.gd-json .j-chave  { color: #7fd1ff; }
.gd-json .j-texto  { color: #b6e3a7; }
.gd-json .j-numero { color: #ffc46b; }
.gd-json .j-bool   { color: #ff9ea8; }

.gd-sql {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .8rem;
    min-height: 140px;
}

.gd-chip-driver {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    padding: .15rem .55rem;
    border-radius: 999px;
    background: var(--fc-soft-gray);
    color: var(--fc-muted);
}
.gd-chip-driver.ok { background: var(--fc-green-soft); color: var(--fc-green); }

/* ---------- impressao ---------- */
.gd-doc-selecionado {
    border: 1px solid var(--fc-card-border);
    border-radius: var(--fc-radius-sm);
    background: var(--fc-soft-gray);
    padding: .75rem 1rem;
}

.ts-opcao .ts-linha { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.ts-opcao .ts-nome { font-weight: 500; }
.ts-opcao .ts-desc { font-size: .73rem; color: var(--fc-muted); }
.ts-wrapper.single .ts-control { min-height: 46px; font-size: 1rem; }

.logo-preview {
    border: 1px dashed var(--fc-card-border);
    border-radius: var(--fc-radius-sm);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--fc-soft-gray);
    padding: .5rem;
}
.logo-preview img { max-height: 80px; max-width: 100%; }

.fc-color { display: flex; gap: .4rem; align-items: center; }
.fc-color input[type=color] { width: 44px; padding: 2px; height: 38px; }

/* ---------- Fancybox ---------- */
.fb-documento .fancybox__content {
    width: 94vw;
    max-width: 1200px;
    height: 90vh;
    padding: 0;
    background: #fff;
    border-radius: var(--fc-radius);
    overflow: hidden;
}
.fb-documento .fancybox__iframe { border: 0; background: #fff; }
.fb-documento .fancybox__caption { display: flex; align-items: center; gap: 1rem; font-size: .8rem; }
.fb-doc-titulo { font-weight: 600; }
.fb-doc-link { color: #9ec5fe; text-decoration: none; }
.fb-doc-link:hover { color: #fff; text-decoration: underline; }

@media (max-width: 768px) {
  .fb-documento .fancybox__content { width: 100vw; height: 94vh; border-radius: 0; }
}
