/* ==========================================================================
   Certifica — camada de tema sobre o Bootstrap 5
   ========================================================================== */
:root {
    --brand: #4f46e5;
    --brand-d: #4338ca;
}

body {
    background: #f5f7fb;
    color: #1e293b;
}

/* Marca / navbar */
.navbar-brand { font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 9px;
    background: var(--brand); color: #fff; font-size: .95rem; margin-right: .1rem;
}
.brand-tag {
    background: #0f172a; color: #fff; font-size: .62rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; padding: .12rem .4rem;
    border-radius: 5px; vertical-align: middle;
}

/* Botões / links com a cor da marca */
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-d); --bs-btn-hover-border-color: var(--brand-d);
    --bs-btn-active-bg: var(--brand-d); --bs-btn-active-border-color: var(--brand-d);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-d); --bs-btn-active-border-color: var(--brand-d);
}
a { color: var(--brand); }
.text-brand { color: var(--brand) !important; }

/* Cards com sombra suave e cantos arredondados */
.card {
    border: 1px solid #eef1f6;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px rgba(15,23,42,.04);
}
.card-header { background: transparent; border-bottom-color: #eef1f6; font-weight: 600; }

/* Cabeçalho de página */
.page-head { margin-bottom: 1.5rem; }
.page-head h1 { font-weight: 700; letter-spacing: -.02em; font-size: 1.6rem; }

/* Estatísticas (dashboard) */
.stat-num { font-size: 2rem; font-weight: 700; line-height: 1; }

/* Código de validação e chips */
.code-chip { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .06em; }

/* Input de código de emissão */
.code-input {
    font-family: ui-monospace, monospace; font-size: 1.5rem; letter-spacing: .35rem;
    text-align: center; text-transform: uppercase; font-weight: 700;
}

/* Autenticação */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 2rem 1rem; background: linear-gradient(135deg, #4f46e5 0%, #2563eb 60%, #0ea5e9 100%);
}
.auth-card { width: 100%; max-width: 440px; }
.auth-brand { display: flex; align-items: center; gap: .6rem; }

/* Página de termos */
.legal h2 { font-size: 1rem; margin: 1.2rem 0 .4rem; font-weight: 600; }
.legal p, .legal li { font-size: .92rem; color: #334155; }

/* Palco do certificado */
.cert-stage {
    background: #e9edf3; border-radius: 12px; padding: 1rem; overflow: auto;
    display: flex; justify-content: center;
}
.cert-stage canvas { box-shadow: 0 8px 30px rgba(0,0,0,.18); background: #fff; max-width: 100%; }

/* ==========================================================================
   Editor de modelo (Canvas) — tema próprio, escuro
   ========================================================================== */
.editor-body { background: #0f172a; margin: 0; }
.editor { display: flex; flex-direction: column; height: 100vh; }
.editor-top {
    display: flex; align-items: center; justify-content: space-between;
    background: #1e293b; color: #e2e8f0; padding: .6rem 1rem; border-bottom: 1px solid #334155;
}
.editor-title { display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.editor-title .back { color: #94a3b8; font-size: 1.2rem; text-decoration: none; }
.editor-actions { display: flex; align-items: center; gap: .6rem; }
.save-state { font-size: .85rem; color: #94a3b8; }
.save-state.ok { color: #4ade80; }
.save-state.err { color: #f87171; }

.editor-main { flex: 1; display: grid; grid-template-columns: 240px 1fr 270px; overflow: hidden; }
.editor-tools, .editor-props { background: #1e293b; color: #cbd5e1; overflow-y: auto; padding: 1rem; }
.editor-tools { border-right: 1px solid #334155; }
.editor-props { border-left: 1px solid #334155; }
.tool-group { margin-bottom: 1.5rem; }
.tool-group h4 { margin: 0 0 .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: #94a3b8; }
.tool-hint { font-size: .73rem; color: #64748b; margin: -.3rem 0 .5rem; }
.tool {
    display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left;
    background: #334155; color: #e2e8f0; border: 1px solid #475569; border-radius: 8px;
    padding: .5rem .7rem; margin-bottom: .4rem; font-size: .85rem; cursor: pointer; transition: .15s;
}
.tool:hover { background: #475569; }
.tool.tag { border-left: 3px solid var(--brand); }
.tool i { font-size: 1rem; opacity: .85; }
.tool-file { position: relative; }
.tool-inline { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; margin-bottom: .4rem; }
.tool-inline input[type=color] { width: 42px; height: 30px; border: none; background: none; cursor: pointer; }
.tool-select { width: 100%; background: #334155; color: #e2e8f0; border: 1px solid #475569; border-radius: 8px; padding: .45rem .5rem; font-size: .85rem; }

.editor-canvas-wrap { background: #334155; overflow: auto; display: flex; }
.editor-canvas-scroll { margin: auto; padding: 2rem; }
#canvas { box-shadow: 0 12px 45px rgba(0,0,0,.45); background: #fff; }

.props-empty { color: #64748b; font-size: .85rem; }
.prop-row { margin-bottom: .9rem; }
.prop-row > label { display: block; font-size: .73rem; color: #94a3b8; margin-bottom: .3rem; }
.prop-row input, .prop-row textarea, .prop-row select {
    width: 100%; padding: .45rem .55rem; background: #334155; color: #e2e8f0;
    border: 1px solid #475569; border-radius: 7px; font-size: .85rem; font-family: inherit;
}
.prop-row input[type=color] { padding: 2px; height: 34px; }
.prop-cols { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.btn-row { display: flex; gap: .3rem; }
.mini { flex: 1; background: #334155; color: #e2e8f0; border: 1px solid #475569; border-radius: 7px; padding: .4rem; cursor: pointer; font-size: .85rem; }
.mini:hover { background: #475569; }
.editor-props hr { border-color: #334155; }

/* Pré-visualização do editor (renomeado para não colidir com .modal do Bootstrap) */
.pv-modal { position: fixed; inset: 0; background: rgba(2,6,23,.7); display: flex; align-items: center; justify-content: center; z-index: 1080; padding: 2rem; }
.pv-modal[hidden] { display: none; }
.pv-box { background: #fff; border-radius: 14px; width: 100%; max-width: 1000px; max-height: 92vh; overflow: auto; }
.pv-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid #e2e8f0; }
.pv-head h3 { margin: 0; font-size: 1rem; }
.pv-close { background: none; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: #64748b; }
.pv-body { padding: 1.5rem; }

@media (max-width: 860px) {
    .editor-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
}
