/* ==========================================================================
   Natal 2026 · Mealhada — identidade retirada do dossier da campanha
   Cores: verde #14352b · vermelho #b2182d · creme #efe8dc · papel #e2d8c6
   Tipos: DM Serif Display (títulos) · Instrument Sans (texto) · DM Mono (rótulos)
   ========================================================================== */

:root {
    --verde: #14352b;
    --verde-escuro: #0d241d;
    --vermelho: #b2182d;
    --vermelho-escuro: #8f1324;
    --creme: #efe8dc;
    --papel: #e2d8c6;
    --branco: #fffdf8;
    --tinta: #1d1d1b;
    --cinza: #5f5a50;
    --linha: #d6cbb6;

    --serif: "DM Serif Display", Georgia, "Times New Roman", serif;
    --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --mono: "DM Mono", ui-monospace, "Courier New", monospace;

    --raio: 2px;
    --sombra: 0 1px 0 rgba(20, 53, 43, .06), 0 10px 30px -12px rgba(20, 53, 43, .25);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--creme);
    color: var(--tinta);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.55;
}

img { max-width: 100%; height: auto; }

a { color: var(--vermelho); text-underline-offset: 3px; }
a:hover { color: var(--vermelho-escuro); }

:focus-visible { outline: 3px solid var(--vermelho); outline-offset: 2px; }

.contentor { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }

/* --- Faixa de correio aéreo (as riscas dos envelopes do dossier) ------ */
.correio {
    height: 10px;
    background: repeating-linear-gradient(
        -45deg,
        var(--vermelho) 0 14px,
        var(--creme) 14px 22px,
        var(--verde) 22px 36px,
        var(--creme) 36px 44px
    );
}

/* --- Tipografia ------------------------------------------------------- */
.rotulo {
    margin: 0 0 .5rem;
    font-family: var(--mono);
    font-size: .75rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--verde);
}

.titulo-grande, .titulo-medio {
    margin: 0;
    font-family: var(--serif);
    font-weight: 400;
    color: var(--verde);
    line-height: 1.02;
    letter-spacing: -.01em;
}
.titulo-grande { font-size: clamp(3rem, 8vw, 6rem); }
.titulo-medio  { font-size: clamp(1.9rem, 4vw, 2.75rem); }
.titulo-grande em, .titulo-medio em { color: var(--vermelho); font-style: italic; }

.ajuda { font-size: .875rem; color: var(--cinza); margin: .35rem 0 0; }

/* --- Topo ------------------------------------------------------------- */
.topo { background: var(--creme); border-bottom: 1px solid var(--linha); }
.topo__linha { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1rem; }
.topo__marca img { display: block; width: 200px; }
.topo .rotulo { margin: 0; }

/* --- Destaque --------------------------------------------------------- */
.destaque { padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2rem, 4vw, 3rem); }
.destaque__grelha { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2rem; }
.destaque__texto { max-width: 34rem; margin: 1.5rem 0 0; font-size: 1.125rem; }
.destaque__selo {
    width: clamp(160px, 22vw, 260px);
    transform: rotate(5deg);
    filter: drop-shadow(0 12px 18px rgba(20, 53, 43, .25));
}

/* --- Blocos ----------------------------------------------------------- */
.bloco { padding-block: 1rem 4rem; }
.bloco__cabecalho { margin-bottom: 2rem; padding-top: 2rem; border-top: 1px solid var(--linha); }

.voltar { display: inline-block; margin: 1rem 0 1.5rem; font-family: var(--mono); font-size: .8rem; text-decoration: none; color: var(--verde); }

/* --- Postais (cartões dos eventos) ------------------------------------ */
.postais { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 1.5rem; }

.postal {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--branco);
    box-shadow: var(--sombra);
}
/* Moldura de envelope */
.postal::before, .cartao--correio::before {
    content: "";
    position: absolute;
    inset: 0;
    padding: 6px;
    background: repeating-linear-gradient(-45deg, var(--vermelho) 0 12px, transparent 12px 20px, var(--verde) 20px 32px, transparent 32px 40px);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    pointer-events: none;
}

/* Selo com picotado */
.postal__selo {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 100px;
    margin: .35rem .25rem 0;
    background: var(--vermelho);
    color: var(--creme);
    border: 5px solid var(--creme);
    outline: 5px dotted var(--creme);
    outline-offset: -2px;
    box-shadow: 0 6px 14px -6px rgba(20, 53, 43, .45);
    transform: rotate(-3deg);
}
.postal__dia { font-family: var(--serif); font-size: 2.75rem; line-height: 1; }
.postal__mes { font-family: var(--serif); font-style: italic; font-size: 1.25rem; line-height: 1; }

.postal__corpo { min-width: 0; display: flex; flex-direction: column; }
.postal__titulo { margin: 0 0 1rem; font-family: var(--serif); font-weight: 400; font-size: 1.6rem; line-height: 1.1; }
.postal__titulo a { color: var(--verde); text-decoration: none; }
.postal__titulo a:hover { color: var(--vermelho); }
.postal__rodape { margin-top: auto !important; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--linha); }

/* Ficha de dados */
.ficha { margin: 0; display: grid; gap: .35rem; font-size: .95rem; }
.ficha > div { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; }
.ficha dt { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--cinza); padding-top: .2rem; }
.ficha dd { margin: 0; }
.ficha--grande { margin-block: 1.5rem; font-size: 1rem; }
.ficha--grande > div { padding-block: .55rem; border-bottom: 1px solid var(--linha); grid-template-columns: 8.5rem 1fr; }

/* Estados */
.estado {
    display: inline-block;
    padding: .3rem .6rem;
    font-family: var(--mono);
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    border-radius: var(--raio);
}
.estado--aberto, .estado--confirmada { color: var(--verde); background: #e3ece6; }
.estado--espera, .estado--lista_espera { color: #7a4b00; background: #f6e7c8; }
.estado--esgotado, .estado--cancelada { color: var(--vermelho); background: #f5dfe1; }
.estado--encerrado { color: var(--cinza); background: #ebe6dc; }

/* --- Botões ----------------------------------------------------------- */
.botao {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .75rem 1.35rem;
    border: 2px solid var(--verde);
    border-radius: var(--raio);
    background: var(--verde);
    color: var(--creme);
    font: 600 .95rem/1 var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.botao:hover { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.botao--linha { background: transparent; color: var(--verde); }
.botao--linha:hover { background: var(--verde); border-color: var(--verde); color: var(--creme); }
.botao--largo { width: 100%; margin-top: 1rem; padding-block: 1rem; font-size: 1.05rem; }
.botao--pequeno { padding: .5rem .85rem; font-size: .85rem; }
.botao--perigo { background: transparent; border-color: var(--vermelho); color: var(--vermelho); }
.botao--perigo:hover { background: var(--vermelho); color: #fff; }

/* --- Página do evento ------------------------------------------------- */
.evento { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(1.5rem, 4vw, 3.5rem); align-items: start; }
.evento__descricao { font-size: 1.15rem; margin: 1.25rem 0 0; }
.nota { padding: 1rem 1.25rem; background: var(--papel); border-left: 4px solid var(--vermelho); }
.nota p:last-child { margin: 0; }

.cartao { position: relative; padding: clamp(1.25rem, 3vw, 2rem); background: var(--branco); box-shadow: var(--sombra); }
.cartao--correio { padding: clamp(1.75rem, 3.5vw, 2.5rem); }
.cartao .estado { margin: 0 0 1rem; }

/* Formulários */
.campo { margin-top: 1rem; }
.campo label, .opcoes legend { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .92rem; color: var(--verde); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea, .campo input:not([type]) {
    width: 100%;
    padding: .7rem .8rem;
    border: 1px solid var(--linha);
    border-bottom: 2px solid var(--verde);
    border-radius: var(--raio);
    background: #fff;
    color: var(--tinta);
    font: inherit;
    font-size: 1rem;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--vermelho); box-shadow: 0 0 0 3px rgba(178, 24, 45, .15); }
textarea { resize: vertical; }
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.campo-triplo { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }

.consentimento { display: flex; gap: .65rem; align-items: flex-start; margin-top: 1.25rem; font-size: .9rem; color: var(--cinza); }
.consentimento input { margin-top: .25rem; width: 1.1rem; height: 1.1rem; accent-color: var(--verde); flex: none; }

.armadilha { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Alertas */
.alerta { margin: 0 0 1.25rem; padding: .9rem 1.1rem; border-left: 4px solid; font-size: .95rem; background: #fff; }
.alerta ul { margin: .4rem 0 0; padding-left: 1.2rem; }
.alerta--ok { border-color: var(--verde); background: #e3ece6; }
.alerta--erro { border-color: var(--vermelho); background: #f8e5e7; }

/* Concluída */
.concluida { max-width: 680px; margin: 2rem auto 0; }
.concluida > p { font-size: 1.1rem; }

/* --- Rodapé ----------------------------------------------------------- */
.rodape { background: var(--verde); color: var(--creme); }
.rodape__linha { display: flex; justify-content: space-between; align-items: center; gap: 2rem; padding-block: 2.5rem; }
.rodape__frase { margin: 0; font-family: var(--serif); font-size: clamp(1.6rem, 3.5vw, 2.4rem); line-height: 1.1; }
.rodape__frase em { color: #e9a3ad; }
.rodape__contacto { margin: .75rem 0 0; font-size: .9rem; opacity: .9; }
.rodape a { color: var(--creme); }
.rodape img { width: 180px; }

/* ==========================================================================
   Backoffice
   ========================================================================== */
.admin { background: var(--creme); }
.admin-topo { background: var(--verde); color: var(--creme); }
.admin-topo__linha { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; padding-block: .9rem; }
.admin-topo__marca { display: flex; align-items: center; gap: 1rem; color: var(--creme); text-decoration: none; font-family: var(--serif); font-size: 1.15rem; }
.admin-topo__marca img { width: 120px; }
.admin-topo__marca em { color: #e9a3ad; }
.admin-nav { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.admin-nav a { color: var(--creme); text-decoration: none; font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.admin-nav a:hover { color: #fff; text-decoration: underline; }

.admin-main { padding-block: 2rem 4rem; }
.admin-cabecalho { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.75rem; }
.acoes { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.admin-cabecalho .acoes { margin-top: 0; }

.painel-resumo { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 1.25rem; }
.resumo { padding: 1.4rem; background: var(--branco); box-shadow: var(--sombra); border-top: 6px solid var(--vermelho); }
.resumo--inativo { opacity: .65; border-top-color: var(--cinza); }
.resumo__titulo { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 1.45rem; line-height: 1.1; color: var(--verde); }
.resumo__local { margin: .35rem 0 0; font-size: .9rem; color: var(--cinza); }
.resumo__numeros { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: 1.1rem; }
.resumo__numeros strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 2rem; line-height: 1; color: var(--verde); }
.resumo__numeros span { font-family: var(--mono); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; color: var(--cinza); }
.resumo__estado { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0 0; }
.medidor { height: 8px; margin-top: .9rem; background: var(--papel); }
.medidor span { display: block; height: 100%; background: var(--verde); }

.formulario-admin { max-width: 860px; }
.formulario-estreito { max-width: 460px; }
.opcoes { margin: 1.25rem 0 0; padding: 1rem 1.1rem; border: 1px solid var(--linha); display: grid; gap: .5rem; }
.opcoes label { display: flex; gap: .6rem; align-items: center; font-size: .95rem; }
.opcoes input { accent-color: var(--verde); width: 1.05rem; height: 1.05rem; }
.zona-perigo { margin-top: 2rem; }

.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.25rem; }
.filtros select, .filtros input { width: auto; flex: 1 1 200px; }
.filtros .botao { flex: none; }

.tabela-rolagem { overflow-x: auto; background: var(--branco); box-shadow: var(--sombra); }
.tabela { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tabela th { position: sticky; top: 0; padding: .75rem .8rem; background: var(--verde); color: var(--creme); text-align: left; font-family: var(--mono); font-weight: 400; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.tabela td { padding: .75rem .8rem; border-bottom: 1px solid var(--linha); vertical-align: top; }
.tabela tr:hover td { background: #faf6ee; }
.tabela .num { text-align: center; font-weight: 600; }
.tabela details { margin-top: .3rem; font-size: .85rem; }
.tabela details p { margin: .3rem 0 0; }
.tabela summary { cursor: pointer; color: var(--vermelho); }
.linha--cancelada td { color: var(--cinza); }
.linha--cancelada strong { text-decoration: line-through; }
.aviso { color: var(--vermelho); }
.acoes-tabela { white-space: nowrap; }
.acoes-tabela form { display: block; }
.ligacao { padding: .1rem 0; border: 0; background: none; color: var(--verde); font: inherit; font-size: .85rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ligacao:hover { color: var(--vermelho); }
.ligacao--perigo { color: var(--vermelho); }

.login { max-width: 440px; margin: 3rem auto; text-align: center; }
.login > img { width: 190px; margin-bottom: 1.5rem; }
.login .cartao { text-align: left; }
.login .titulo-medio { margin-bottom: .5rem; }

/* Paginação (vista por omissão do CodeIgniter) */
.pagination { display: flex; gap: .3rem; list-style: none; padding: 0; margin: 1.25rem 0 0; }
.pagination a { display: block; padding: .4rem .7rem; border: 1px solid var(--linha); background: #fff; text-decoration: none; color: var(--verde); }
.pagination .active a { background: var(--verde); color: var(--creme); border-color: var(--verde); }

/* --- Responsivo ------------------------------------------------------- */
@media (max-width: 820px) {
    .destaque__grelha { grid-template-columns: 1fr; }
    .destaque__selo { justify-self: end; margin-top: -1rem; width: 150px; }
    .evento { grid-template-columns: 1fr; }
    .campo-triplo { grid-template-columns: 1fr 1fr; }
    .rodape__linha { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
    .topo .rotulo { display: none; }
    .postal { grid-template-columns: 1fr; }
    .postal__selo { width: 76px; height: 88px; }
    .campo-duplo, .campo-triplo { grid-template-columns: 1fr; }
    .ficha > div, .ficha--grande > div { grid-template-columns: 1fr; gap: .1rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
.postal .ficha { margin-bottom: 1.25rem; }

/* Botão a enviar */
.botao:disabled, .botao--a-enviar { cursor: progress; opacity: .85; }
.botao--a-enviar:hover { background: var(--verde); border-color: var(--verde); color: var(--creme); }
.rodinha {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: rodar .7s linear infinite;
}
@keyframes rodar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rodinha { animation-duration: 2s; } }
