/* ============================================================
   Ministério da Justiça, Assuntos Constitucionais e Religiosos
   Ideia: repartição pública, papel quente, tinta escura,
   verde institucional discreto. Nada de cartões flutuantes
   nem gradientes. Sóbrio, humano, legível.
   ============================================================ */

:root {
    --papel:        #f3efe6;
    --papel-fundo:  #ece6d8;
    --tinta:        #2b2722;
    --tinta-suave:  #5e564a;
    --verde:        #2f5a4c;
    --verde-fundo:  #244a3e;
    --ocre:         #a8742a;
    --linha:        #d6cdba;
    --linha-forte:  #c2b79f;
    --branco:       #fbfaf6;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background-color: var(--papel);
    background-image:
        radial-gradient(circle at 20% 0%, rgba(47,90,76,.05), transparent 60%),
        radial-gradient(circle at 100% 100%, rgba(168,116,42,.05), transparent 55%);
    color: var(--tinta);
    font-family: "Libre Franklin", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

/* ---------------------- Cabeçalho ---------------------- */
.topo {
    position: relative;
    background: var(--verde-fundo);
    color: #f4efe3;
    padding: 30px 24px 34px;
    border-bottom: 4px solid var(--ocre);
}
.topo-interior {
    max-width: 980px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}
.brasao {
    flex: 0 0 auto;
    width: 64px; height: 64px;
    border: 2px solid rgba(255,255,255,.55);
    border-radius: 50%;
    display: grid; place-items: center;
    font-family: "Spectral", serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 1px;
    color: #f4efe3;
}
.topo-orgao {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 12.5px;
    color: #cde0d6;
}
.topo-titulo {
    margin: 4px 0 6px;
    font-family: "Spectral", serif;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.15;
}
.topo-nota { margin: 0; color: #d6e2da; font-size: 14.5px; }

.ligacao-admin {
    position: absolute;
    top: 18px; right: 22px;
    color: #d6e2da;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(255,255,255,.4);
    padding: 6px 12px;
    border-radius: 4px;
    transition: background .2s, color .2s;
}
.ligacao-admin:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---------------------- Corpo / formulário ---------------------- */
.pagina {
    max-width: 980px;
    margin: 0 auto;
    padding: 38px 24px 60px;
}

.formulario { margin: 0; }

.bloco {
    padding: 4px 0 26px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--linha);
}
.bloco:last-of-type { border-bottom: none; }

.bloco-titulo {
    font-family: "Spectral", serif;
    font-weight: 600;
    font-size: 20px;
    color: var(--verde);
    margin: 0 0 4px;
    padding-left: 14px;
    border-left: 3px solid var(--ocre);
}
.bloco-nota {
    margin: 0 0 16px 14px;
    color: var(--tinta-suave);
    font-size: 14px;
}

.grelha {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 22px;
    margin-top: 16px;
}
.campo { display: flex; flex-direction: column; }
.campo-largo { grid-column: 1 / -1; }

.campo label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--tinta-suave);
    margin-bottom: 6px;
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="date"] {
    font: inherit;
    color: var(--tinta);
    background: var(--branco);
    border: 1px solid var(--linha-forte);
    border-radius: 5px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s;
}
.campo input:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(47,90,76,.12);
}
.ajuda { margin-top: 6px; font-size: 12.5px; color: var(--verde); }

.opcoes { display: flex; gap: 18px; padding-top: 4px; }
.radio { display: flex; align-items: center; gap: 7px; font-size: 15px; color: var(--tinta); }

/* ---------------------- Carreiras ---------------------- */
.carreiras-grelha {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 18px;
    margin-left: 14px;
}
.carreira {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 14.5px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.carreira:hover { background: rgba(47,90,76,.06); }
.carreira input { accent-color: var(--verde); width: 16px; height: 16px; }
.carreira input:checked + span { color: var(--verde); font-weight: 500; }

/* ---------------------- Acções ---------------------- */
.accoes {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.botao {
    font: inherit;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    padding: 13px 26px;
    cursor: pointer;
    transition: transform .08s, background .2s, opacity .2s;
}
.botao:active { transform: translateY(1px); }
.botao-principal { background: var(--verde); color: #f4efe3; }
.botao-principal:hover { background: var(--verde-fundo); }
.botao-pdf {
    background: var(--ocre); color: #fff;
    border: 1px solid var(--ocre);
}
.botao-pdf:hover { background: #8f6020; }
.botao-pdf:disabled {
    background: transparent;
    color: var(--tinta-suave);
    border: 1px dashed var(--linha-forte);
    cursor: not-allowed;
}

/* ---------------------- Pré-visualização ---------------------- */
.previsualizacao { margin-top: 44px; }
.previsualizacao-cabecalho h2 {
    font-family: "Spectral", serif;
    font-size: 22px;
    color: var(--verde);
    margin: 0 0 4px;
}
.previsualizacao-cabecalho p { margin: 0 0 22px; color: var(--tinta-suave); font-size: 14.5px; }

.folhas { display: flex; flex-direction: column; gap: 32px; align-items: center; }

/* A folha A4 imita o papel: proporção e margens reais (3/2/3/2 cm). */
.pagina-a4 {
    background: #fff;
    width: 100%;
    max-width: 820px;
    aspect-ratio: 210 / 297;
    box-shadow: 0 10px 30px rgba(43,39,34,.16);
    padding: 11.34% 7.56% 7.56% 11.34%; /* 3/2/2/3 cm em relação à largura */
    overflow: hidden;
    border: 1px solid #e8e2d4;
}

/* ---------------------- Rodapé ---------------------- */
.rodape {
    text-align: center;
    padding: 24px;
    color: var(--tinta-suave);
    font-size: 13px;
    border-top: 1px solid var(--linha);
}

/* ---------------------- Ecrãs pequenos ---------------------- */
@media (max-width: 760px) {
    .grelha { grid-template-columns: 1fr; }
    .carreiras-grelha { grid-template-columns: 1fr 1fr; }
    .topo-interior { flex-direction: column; text-align: center; }
    .ligacao-admin { position: static; display: inline-block; margin-top: 14px; }
    .pagina-a4 { padding: 36px 26px; aspect-ratio: auto; }
}
@media (max-width: 460px) {
    .carreiras-grelha { grid-template-columns: 1fr; }
}

/* ============================================================
   Área do administrador (reaproveita as variáveis acima)
   ============================================================ */
.admin-corpo {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 60px;
}
.admin-login {
    max-width: 400px;
    margin: 80px auto;
    background: var(--branco);
    border: 1px solid var(--linha-forte);
    border-top: 4px solid var(--ocre);
    border-radius: 8px;
    padding: 36px 32px;
}
.admin-login h1 {
    font-family: "Spectral", serif;
    font-size: 24px;
    color: var(--verde);
    margin: 0 0 6px;
}
.admin-login p { margin: 0 0 22px; color: var(--tinta-suave); font-size: 14px; }
.admin-login .campo { margin-bottom: 16px; }
.erro {
    background: #f6e3df;
    border: 1px solid #d8a89f;
    color: #8a3024;
    padding: 10px 14px;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 18px;
}

.admin-barra {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 26px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--linha);
}
.admin-barra h1 {
    font-family: "Spectral", serif;
    font-size: 24px;
    color: var(--verde);
    margin: 0;
}
.admin-barra .accoes-barra { display: flex; gap: 10px; align-items: center; }
.ligacao-simples { color: var(--tinta-suave); text-decoration: none; font-size: 14px; }
.ligacao-simples:hover { color: var(--verde); }

.tabela {
    width: 100%;
    border-collapse: collapse;
    background: var(--branco);
    border: 1px solid var(--linha-forte);
    border-radius: 8px;
    overflow: hidden;
}
.tabela th, .tabela td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--linha);
    font-size: 14px;
}
.tabela th {
    background: #efe9db;
    font-weight: 600;
    color: var(--tinta-suave);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-size: 12px;
}
.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: rgba(47,90,76,.04); }
.etiqueta {
    display: inline-block;
    background: rgba(47,90,76,.1);
    color: var(--verde);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    margin: 2px 3px 2px 0;
}
.accoes-linha { display: flex; gap: 10px; white-space: nowrap; }
.accoes-linha a { font-size: 13px; text-decoration: none; }
.acao-ver { color: var(--verde); }
.acao-editar { color: var(--ocre); }
.acao-pdf { color: var(--tinta-suave); }
.acao-apagar { color: #a8392a; }

.vazio {
    text-align: center;
    padding: 50px 20px;
    color: var(--tinta-suave);
    background: var(--branco);
    border: 1px dashed var(--linha-forte);
    border-radius: 8px;
}

.botao-pequeno {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    background: var(--verde);
    color: #f4efe3;
    border: none;
    border-radius: 5px;
    padding: 9px 18px;
    cursor: pointer;
    text-decoration: none;
}
.botao-pequeno:hover { background: var(--verde-fundo); }

/* ---------------------- Aviso do concurso ---------------------- */
.aviso-concurso {
    background: #b45309;
    border-bottom: 3px solid #7c3a02;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    padding: 13px 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: .01em;
}
.aviso-icone { font-size: 18px; flex-shrink: 0; }
.aviso-concurso a {
    color: #fde68a;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
}
.aviso-concurso a:hover { color: #fff; }

/* ---------------------- Botão CV ---------------------- */
.botao-cv-area {
    display: flex;
    justify-content: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px dashed var(--linha-forte);
}
.botao-cv {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--branco);
    color: var(--verde);
    border: 2px solid var(--verde);
    border-radius: 8px;
    padding: 13px 28px;
    font-family: "Libre Franklin", system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s, color .2s, transform .08s;
}
.botao-cv:hover {
    background: var(--verde);
    color: #f4efe3;
    transform: translateY(-1px);
}
