/* ============================================================================
   /home/psye/public_html/css/psye.css
   Estilos comuns de todas as páginas do psye.pt.
   As cores vivem só aqui, nas variáveis do :root — para mudar a cor principal
   basta mudar --psye-primaria e --psye-primaria-escura.
   ============================================================================ */

:root {
    --psye-tinta:            #1f2a30;   /* texto */
    --psye-suave:            #5d6d74;   /* texto auxiliar */
    --psye-primaria:         #2e5e6b;   /* azul-petróleo */
    --psye-primaria-escura:  #234954;
    --psye-primaria-clara:   #e6eff1;
    --psye-fundo:            #f4f6f7;
    --psye-linha:            #dbe2e5;

    /* O Bootstrap passa a usar a cor do psye.pt */
    --bs-primary:            var(--psye-primaria);
    --bs-primary-rgb:        46, 94, 107;
    --bs-link-color:         var(--psye-primaria);
    --bs-link-color-rgb:     46, 94, 107;
    --bs-link-hover-color:   var(--psye-primaria-escura);
    --bs-body-color:         var(--psye-tinta);
    --bs-body-bg:            var(--psye-fundo);
    --bs-border-color:       var(--psye-linha);
    --bs-focus-ring-color:   rgba(46, 94, 107, .25);
}

.btn-primary {
    --bs-btn-bg:                  var(--psye-primaria);
    --bs-btn-border-color:        var(--psye-primaria);
    --bs-btn-hover-bg:            var(--psye-primaria-escura);
    --bs-btn-hover-border-color:  var(--psye-primaria-escura);
    --bs-btn-active-bg:           var(--psye-primaria-escura);
    --bs-btn-active-border-color: var(--psye-primaria-escura);
    --bs-btn-disabled-bg:         var(--psye-primaria);
    --bs-btn-disabled-border-color: var(--psye-primaria);
    --bs-btn-focus-shadow-rgb:    46, 94, 107;
}

.form-control {
    background-color: #fff;
}
.form-control::placeholder {
    color: #c1c8cc;
}

.form-control:focus,
.form-select:focus {
    border-color: #8fb0b8;
    box-shadow: 0 0 0 .25rem rgba(46, 94, 107, .2);
}

.form-check-input:checked {
    background-color: var(--psye-primaria);
    border-color: var(--psye-primaria);
}

/* ── Marca ─────────────────────────────────────────────────────────────────── */
.marca {
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--psye-primaria);
    text-decoration: none;
}
.marca span {
    font-weight: 400;
    color: var(--psye-suave);
}
.marca:hover {
    color: var(--psye-primaria-escura);
}
.marca-grande {
    font-size: 2rem;
    line-height: 1;
    margin-bottom: .5rem;
}

/* ── Faixa da entidade de demonstração ─────────────────────────────────────── */
.faixa-demonstracao {
    background: #fff3cd;
    color: #664d03;
    border-bottom: 1px solid #ffe69c;
    text-align: center;
    font-size: .875rem;
    padding: .35rem 1rem;
}
.faixa-aviso-pagamento {
    background: var(--psye-primaria-clara);
    color: var(--psye-primaria-escura);
    border-bottom: 1px solid var(--psye-primaria);
    text-align: center;
    font-size: .875rem;
    padding: .35rem 1rem;
}
.faixa-aviso-pagamento a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Estrutura: barra de topo a toda a largura, com a barra lateral e a
   área principal lado a lado por baixo ───────────────────────────────────── */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.layout-app {
    display: flex;
    flex: 1;
    min-height: 0;   /* para a barra lateral não ultrapassar o espaço que sobra */
}
.area-principal {
    flex: 1;
    min-width: 0;   /* para o conteúdo poder encolher em ecrãs estreitos */
    display: flex;
    flex-direction: column;
}

/* ── Barra lateral ─────────────────────────────────────────────────────────── */
/* Em ecrã largo (≥768px) é uma coluna fixa; em telemóvel é o menu do Bootstrap
   (offcanvas), que trata sozinho de abrir, fechar e escurecer o fundo. */
.barra-lateral {
    background: #fff;
    border-right: 1px solid var(--psye-linha);
}
@media (min-width: 768px) {
    .barra-lateral {
        flex: 0 0 220px;
        max-width: 220px;
    }
    .barra-lateral .offcanvas-header {
        display: none;   /* a marca já vai na barra de topo em ecrã largo */
    }
}
@media (max-width: 767.98px) {
    .barra-lateral {
        --bs-offcanvas-width: 17rem;
    }
}
.barra-lateral .offcanvas-body {
    display: block;   /* anula o display:flex que o Bootstrap só aplica ≥768px */
    padding: 0;   /* o Bootstrap só zera isto a partir dos 768px — aqui fica sempre a zero */
}
.barra-lateral-nav {
    padding: .75rem 0;
}
.barra-lateral-nav .nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    color: var(--psye-suave);
    font-weight: 500;
    padding: .6rem 1.25rem;
}
.barra-lateral-nav .nav-link .bi {
    font-size: 1.1rem;
    width: 1.3rem;
    text-align: center;
}
.barra-lateral-nav .nav-link:hover {
    background: var(--psye-fundo);
    color: var(--psye-tinta);
}
.barra-lateral-nav .nav-link.active {
    background: var(--psye-primaria-clara);
    color: var(--psye-primaria);
    box-shadow: inset 3px 0 0 var(--psye-primaria);
}
.barra-lateral-nav .nav-link.disabled {
    color: #a9b5ba;
    pointer-events: none;
}

/* ── Barra de topo, fina ───────────────────────────────────────────────────── */
.barra-topo {
    background: #fff;
    border-bottom: 1px solid var(--psye-linha);
    padding: .6rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.barra-topo .marca {
    font-size: 1.2rem;
}
.topo-direita {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.link-parametros {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--psye-suave);
    font-weight: 500;
    text-decoration: none;
}
.link-parametros:hover {
    color: var(--psye-tinta);
}
.link-parametros.active {
    color: var(--psye-primaria);
}
.barra-topo .quem {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}
.barra-topo .quem.dropdown-toggle::after {
    display: none;
}
.quem-nome {
    color: var(--psye-tinta);
    font-weight: 500;
}
.quem-entidade {
    font-size: .8rem;
    color: var(--psye-suave);
}

/* ── Conteúdo ──────────────────────────────────────────────────────────────── */
.pagina {
    padding: 2rem 1.5rem 3rem;
}
.pagina.com-botoes {
    padding-right: 5.5rem;   /* espaço para a coluna fixa de botões */
}
.titulo-pagina {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: .35rem;
}
.texto-auxiliar {
    color: var(--psye-suave);
    font-size: 1.05rem;
    margin-bottom: 1.75rem;
}

/* Campo obrigatório: risca vermelha à esquerda, sempre visível — não é um
   estado de validação, é a marca fixa de "este campo é obrigatório". Norma
   para todos os formulários do psye.pt daqui em diante. O padding-left
   desconta a diferença face à borda normal (1px), para o texto começar no
   mesmo sítio dos campos sem marca. */
.campo-obrigatorio {
    border-left: 5px solid var(--bs-danger);
    padding-left: .5rem;
}

/* Legenda que explica a marca — uma vez por formulário, depois dos campos,
   alinhada com a coluna dos campos (não a das etiquetas). */
.legenda-obrigatorio {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--psye-suave);
    font-size: .875rem;
    margin-top: .5rem;
    margin-bottom: 0;
}
.legenda-obrigatorio .marca-obrigatorio {
    display: inline-block;
    width: .625rem;
    height: .625rem;
    background: var(--bs-danger);
    flex-shrink: 0;
}

/* ── Cartões de plano (Mensal / Semestral / Anual) ─────────────────────────── */
.subtitulo-seccao {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
}
.plano-cartao {
    cursor: pointer;
    height: 100%;
    border: 2px solid rgba(0, 0, 0, .08);
    border-radius: .5rem;
    padding: 1rem .5rem;
    text-align: center;
    opacity: .6;
    transition: opacity .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.plano-cartao:hover {
    opacity: .85;
}
.plano-cartao.selecionado {
    opacity: 1;
    border-color: var(--psye-primaria);
    box-shadow: 0 .25rem .75rem rgba(46, 94, 107, .18);
}
.plano-mensal    { background: #f7f1e6; }
.plano-semestral { background: #f0e3cc; }
.plano-anual     { background: #e8d5ae; }
.plano-nome {
    font-weight: 600;
    font-size: .9rem;
    color: var(--psye-tinta);
}
.plano-preco {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--psye-tinta);
    white-space: nowrap;
    margin: .35rem 0 .1rem;
}
.plano-preco .plano-periodo {
    font-size: .7rem;
    font-weight: 400;
    color: var(--psye-suave);
}
.plano-equivalente {
    font-size: .7rem;
    color: var(--psye-suave);
}

/* ── Coluna fixa de botões à direita ───────────────────────────────────────── */
.coluna-botoes {
    position: fixed;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: .6rem;
    z-index: 1020;
}
.coluna-botoes .btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(31, 42, 48, .18);
}
.aviso-consentimento {
    background: #fff3cd;
    color: #664d03;
    border: 1px solid #ffe69c;
    border-radius: .5rem;
    padding: .75rem 1.25rem;
    font-size: 1.05rem;
    width: 75%;
}
@media (max-width: 575.98px) {
    .coluna-botoes {
        right: .75rem;
        top: auto;
        bottom: 1rem;
        transform: none;
    }
    .pagina.com-botoes {
        padding-right: 1.5rem;
    }
    .aviso-consentimento {
        width: 100%;
    }
    .acao-so-desktop {
        display: none !important;
    }
    .aba-corpo {
        padding: .75rem;
    }
    .titulo-aba-movel {
        font-size: 1.1rem;
        font-weight: 600;
        margin: -.75rem -.75rem 0 -.75rem;
        padding: .6rem 1rem;
    }
    .tabela-cheia-movel {
        margin-left: -.75rem;
        margin-right: -.75rem;
        margin-top: 0;
    }
}


/* ── Estado vazio ──────────────────────────────────────────────────────────── */
.vazio {
    background: #fff;
    border: 1px dashed var(--psye-linha);
    border-radius: .5rem;
    padding: 2rem 1.5rem;
}
.vazio-titulo {
    font-weight: 600;
    margin-bottom: .25rem;
}
.vazio-texto {
    color: var(--psye-suave);
    margin-bottom: 0;
}

/* ── Separadores dentro de uma página ─────────────────────────────────────── */
/* Regra comum a todos os projetos: sem ícones nos títulos, a contagem entre
   parênteses simples no próprio título. O separador ativo e o corpo
   partilham o mesmo tom (branco), com moldura a enquadrar os dois. */
.abas {
    display: flex;
    gap: .25rem;
    border-bottom: 1px solid var(--psye-linha);
    margin-bottom: 0;
}
.aba {
    background: var(--psye-fundo);
    border: 1px solid var(--psye-linha);
    border-bottom: none;
    border-radius: .5rem .5rem 0 0;
    padding: .55rem 1.1rem;
    color: var(--psye-suave);
    font-weight: 500;
    margin-bottom: -1px;
}
/* Separador que leva a outra página (por exemplo, do Contacto para o Processo). */
a.aba, span.aba {
    display: inline-block;
    text-decoration: none;
}
a.aba:hover {
    color: var(--psye-tinta);
}
.aba.ativa {
    background: #fff;
    color: var(--psye-tinta);
    border-bottom: 1px solid #fff;
}
.aba-contagem {
    background: var(--psye-primaria-clara);
    color: var(--psye-primaria-escura);
    font-size: .7rem;
    font-weight: 600;
    vertical-align: middle;
}
.select-primario {
    background-color: var(--psye-primaria);
    color: #fff;
    border-color: var(--psye-primaria);
}
.select-primario:focus {
    border-color: var(--psye-primaria-escura);
    box-shadow: 0 0 0 .25rem rgba(46, 94, 107, .35);
}
.sobreposicao-select {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(46, 94, 107, .85);
    border-radius: .375rem;
}
.linha-clicavel {
    cursor: pointer;
}
.aba-corpo {
    background: #fff;
    border: 1px solid var(--psye-linha);
    border-top: none;
    border-radius: 0 0 .5rem .5rem;
    padding: 1.25rem;
}

/* ── Lista de marcações ───────────────────────────────────────────────────── */
/* Comum ao Hoje e à Agenda: uma linha por marcação, com a hora, o assunto e
   um pormenor a cinzento por baixo. */
.lista-marcacoes {
    background: #fff;
    border: 1px solid var(--psye-linha);
    border-radius: .5rem;
    overflow: hidden;
}
.linha-marcacao {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .55rem .9rem;
    border-bottom: 1px solid var(--psye-linha);
    cursor: pointer;
}
.linha-marcacao:last-child {
    border-bottom: none;
}
.linha-marcacao:hover {
    background: var(--psye-fundo);
}
.linha-marcacao .hora {
    font-variant-numeric: tabular-nums;
    color: var(--psye-suave);
    width: 7rem;
    flex-shrink: 0;
}
.linha-marcacao .assunto {
    flex-grow: 1;
    min-width: 0;
}
.linha-marcacao .assunto .titulo-marcacao {
    font-weight: 500;
}
.linha-marcacao .assunto .detalhe-marcacao {
    color: var(--psye-suave);
    font-size: .875rem;
}
.linha-marcacao.estado-faltou .titulo-marcacao,
.linha-marcacao.estado-desmarcada .titulo-marcacao {
    text-decoration: line-through;
    color: var(--psye-suave);
}
.linha-marcacao.marcacao-oculta {
    cursor: default;
    color: var(--psye-suave);
    font-style: italic;
}
.linha-marcacao.marcacao-oculta:hover {
    background: none;
}

.sem-marcacoes {
    padding: .6rem .9rem;
    color: var(--psye-suave);
    font-size: .9rem;
}

/* ── Cartões de ajuda ──────────────────────────────────────────────────────── */
.cartao-ajuda {
    position: relative;
    background: var(--psye-primaria-clara);
    border: 1px solid #c7dade;
    border-radius: .5rem;
    padding: 1rem 2.5rem 1rem 1rem;
    margin-bottom: 1.5rem;
    max-width: 40rem;
    font-family: 'Inter', var(--bs-font-sans-serif);
    font-size: .9rem;
}
/* Título + cartão de ajuda lado a lado (ver $ajuda_pagina no cabecalho.php).
   Em ecrãs pequenos, o Bootstrap já empilha sozinho (col-md-*). */
.topo-pagina-linha .cartao-ajuda {
    max-width: none;
    margin-top: .35rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 767.98px) {
    .topo-pagina-linha .cartao-ajuda {
        margin-top: .5rem;
    }
}
.cartao-ajuda .btn-close {
    position: absolute;
    top: .9rem;
    right: .9rem;
    font-size: .75rem;
}
.cartao-ajuda-titulo {
    font-weight: 500;
    color: var(--psye-primaria-escura);
    margin-bottom: .25rem;
}
.cartao-ajuda-titulo .bi {
    font-size: .85em;
    font-weight: 400;
    color: var(--psye-primaria);
    margin-right: .4rem;
}
.cartao-ajuda-texto {
    color: var(--psye-tinta);
    font-weight: 300;
    margin-bottom: .5rem;
}
.cartao-ajuda .dispensar-ajuda {
    font-size: .85rem;
    font-weight: 400;
}

/* ── Interruptor "Mostrar ajuda" no menu do utilizador ────────────────────── */
.item-ajuda {
    display: flex;
    align-items: center;
    gap: .6rem;
    cursor: pointer;
}
.item-ajuda .form-check-input {
    flex-shrink: 0;
    margin-top: 0;
}

/* ── Secções agrupadas de formulário ──────────────────────────────────────── */
/* Comum ao mapa de campos de um modelo e ao formulário de uma anamnese. */
.seccao-mapa {
    margin-bottom: 1.5rem;
}
.seccao-mapa h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--psye-primaria);
    margin-bottom: .5rem;
}
.seccao-mapa .tipo-campo {
    color: var(--psye-suave);
    font-weight: 400;
    font-size: .85rem;
}

/* ── Ecrã de pagamento (pagar.php) ─────────────────────────────────────────── */
.resumo-pagamento {
    text-align: center;
    background: var(--psye-fundo);
    border-radius: .5rem;
    padding: 1.5rem 1rem;
    margin-bottom: 1.75rem;
}
.resumo-plano {
    color: var(--psye-suave);
    margin-bottom: .25rem;
}
.resumo-valor {
    font-size: 2rem;
    font-weight: 700;
    color: var(--psye-tinta);
}
.resumo-valor .resumo-periodo {
    font-size: 1rem;
    font-weight: 400;
    color: var(--psye-suave);
}
.metodos-titulo {
    font-weight: 600;
    margin-bottom: .75rem;
}
.btn-metodo {
    text-align: left;
    padding: .75rem 1rem;
}
.btn-metodo .bi {
    margin-right: .5rem;
    width: 1.25rem;
}
.resultado-referencia {
    background: var(--psye-fundo);
    border-radius: .5rem;
    padding: 1.25rem;
}
.resultado-referencia-titulo {
    font-weight: 600;
    margin-bottom: .75rem;
}
.resultado-referencia-linha {
    display: flex;
    justify-content: space-between;
    padding: .35rem 0;
    border-bottom: 1px solid var(--psye-linha);
}
.resultado-referencia-linha:last-of-type {
    border-bottom: none;
}
.resultado-referencia-linha span {
    color: var(--psye-suave);
}
.resultado-referencia-nota {
    font-size: .85rem;
    color: var(--psye-suave);
    margin: .75rem 0 .5rem;
}

/* ── MB WAY: relógio, barra e resultados ──────────────────────────────────── */
.mbway-texto {
    color: var(--psye-suave);
    margin-bottom: 1.25rem;
}
.mbway-relogio {
    font-size: 2.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
    color: var(--psye-tinta);
    transition: color .3s ease;
}
.mbway-relogio.mbway-urgente {
    color: var(--bs-danger);
}
.mbway-barra {
    height: .4rem;
    background: var(--psye-linha);
    border-radius: .2rem;
    overflow: hidden;
    margin: .75rem 0 .25rem;
}
.mbway-barra-interior {
    height: 100%;
    background: var(--psye-primaria);
    width: 100%;
    transition: width 1s linear, background-color .3s ease;
}
.mbway-barra-interior.mbway-urgente {
    background: var(--bs-danger);
}
.mbway-resultado {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.mbway-resultado .bi {
    margin-right: .35rem;
}
.mbway-sucesso {
    color: #1e7e34;
}
.mbway-erro {
    color: var(--bs-danger);
}
#mbwayRecusado, #mbwayExpirado, #mbwayPago {
    text-align: center;
}

/* Caixas de texto de várias linhas que crescem com o conteúdo (a altura é acertada pelo JS da página). */
textarea.auto-cresce {
    overflow: hidden;
    resize: none;
}
