/**
 * Páginas auxiliares FCT: grelhas, conta, home, login, legais (sem <style> inline nos templates).
 */

/* —— Erros de formulário (DC, conta) —— */
.field-with-error .form-control,
.field-with-error .form-select,
.field-with-error textarea,
.field-with-error input[type="file"] {
    border-color: #dc3545;
    background-color: #fff7f8;
}

/* —— Grelhas de avaliação / autoavaliação / inquérito —— */
.grelha-dominio-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0d6efd;
    background: linear-gradient(to right, rgba(13, 110, 253, 0.12), transparent);
    border-left: 4px solid #0d6efd;
    padding: 0.5rem 1rem;
    margin: 1.25rem 0 0.5rem 0;
    border-radius: 0 0.25rem 0.25rem 0;
}
.grelha-dominio-titulo:first-of-type {
    margin-top: 0;
}

.table-grelha-avaliacao,
.table-consulta-grelha {
    table-layout: fixed;
    width: 100%;
}
.table-grelha-avaliacao .col-indicador {
    width: 75%;
}
.table-grelha-avaliacao .col-avaliacao {
    width: 25%;
}
.table-consulta-grelha .col-indicador {
    width: 85%;
}
.table-consulta-grelha .col-avaliacao {
    width: 15%;
}
.table-grelha-avaliacao td,
.table-grelha-avaliacao th,
.table-consulta-grelha td {
    overflow-wrap: break-word;
}

select.nivel-qualitativo option[value="muito_insuficiente"] {
    background: #e57373;
}
select.nivel-qualitativo option[value="insuficiente"] {
    background: #ffcdd2;
}
select.nivel-qualitativo option[value="suficiente"] {
    background: #e8f5e9;
}
select.nivel-qualitativo option[value="bom"] {
    background: #e3f2fd;
}
select.nivel-qualitativo option[value="muito_bom"] {
    background: #fff8e1;
}

.table-grelha-5-niveis,
.table-consulta-5-niveis {
    width: 100%;
}
.table-grelha-5-niveis th,
.table-grelha-5-niveis td,
.table-consulta-5-niveis th,
.table-consulta-5-niveis td {
    vertical-align: middle;
    border: 1px solid #dee2e6;
    padding: 0.5rem;
}
.table-grelha-5-niveis th,
.table-consulta-5-niveis th {
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    background: #f8f9fa;
}
.table-grelha-5-niveis .col-indicador,
.table-consulta-5-niveis .col-indicador {
    text-align: left;
    min-width: 6rem;
}
.table-consulta-5-niveis .col-indicador {
    min-width: 10rem;
}
.table-grelha-5-niveis td.col-nivel,
.table-grelha-5-niveis th.col-nivel,
.table-consulta-5-niveis td.col-nivel,
.table-consulta-5-niveis th.col-nivel {
    text-align: center;
    width: 8rem;
    min-width: 7rem;
}
.table-grelha-5-niveis td.col-nota,
.table-grelha-5-niveis th.col-nota,
.table-consulta-5-niveis td.col-nota {
    text-align: center;
    width: 4rem;
}
.table-consulta-5-niveis td.col-nota {
    font-weight: 600;
}
.table-grelha-5-niveis .col-nota input.form-control {
    width: 3.5rem;
    margin: 0 auto;
    text-align: center;
    padding: 0.2rem 0.25rem;
    font-size: 0.875rem;
}
.table-grelha-5-niveis td.col-nota input.form-control.nota-indicador-0-20 {
    background-color: transparent !important;
    box-shadow: none !important;
}
.table-grelha-5-niveis td.col-nivel,
.table-grelha-5-niveis td.col-nota {
    transition: background-color 0.15s ease;
}

.nivel-radio,
.nivel-radio-consulta {
    display: inline-block;
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid #0d6efd;
    border-radius: 50%;
    background: #fff;
}
.nivel-radio.selecionado,
.nivel-radio-consulta.selecionado {
    background: #0d6efd;
}

.grelha-classificacao-final-destaque {
    border: 2px solid rgba(0, 0, 0, 0.08) !important;
    transition: background-color 0.15s ease;
}
.grelha-classificacao-final-destaque input.form-control {
    background: transparent !important;
    box-shadow: none !important;
}

.fct-page-grelha .classificacao-final-destaque {
    font-size: 1.5rem;
    font-weight: 700;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.table-inquerito-tutor {
    width: 100%;
}
.table-inquerito-tutor th,
.table-inquerito-tutor td {
    vertical-align: middle;
    font-size: 0.9rem;
}
.table-inquerito-tutor th {
    white-space: nowrap;
}

/* —— Minha conta —— */
.profile-edit-shell {
    scroll-behavior: smooth;
}
.profile-edit-shell .step-nav-link {
    text-decoration: none;
}
.profile-edit-shell .step-nav-target {
    scroll-margin-top: 6rem;
}
.profile-edit-shell .form-control,
.profile-edit-shell .form-select,
.profile-edit-shell textarea,
.profile-edit-shell input[type="file"] {
    border-radius: 0.6rem;
    min-height: 2.65rem;
    border-color: #cbd5e1;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.profile-edit-shell textarea {
    min-height: 6.5rem;
}
.profile-edit-shell .form-control:focus,
.profile-edit-shell .form-select:focus,
.profile-edit-shell textarea:focus,
.profile-edit-shell input[type="file"]:focus {
    border-color: #7aa7d9;
    box-shadow: 0 0 0 0.18rem rgba(30, 90, 160, 0.16);
}
.profile-edit-shell .section-title {
    letter-spacing: 0.01em;
}
.profile-edit-shell .sticky-actions {
    position: sticky;
    bottom: 0;
    background: linear-gradient(to top, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.9));
    backdrop-filter: blur(3px);
    border-radius: 0.75rem;
    padding-inline: 0.5rem;
    z-index: 2;
}
@media (max-width: 767.98px) {
    .profile-edit-shell .sticky-actions {
        padding-inline: 0;
    }
    .profile-edit-shell .sticky-actions .btn {
        width: 100%;
    }
}
@media (prefers-reduced-motion: reduce) {
    .profile-edit-shell {
        scroll-behavior: auto;
    }
}

/* —— Home —— */
.home-hero {
    border: none;
    border-radius: 1rem;
    background: linear-gradient(130deg, #153154 0%, #1e4a7e 55%, #2b78d2 100%);
    color: #fff;
    box-shadow: 0 16px 34px rgba(16, 37, 65, 0.28);
}
.home-hero .text-muted {
    color: rgba(255, 255, 255, 0.84) !important;
}
.home-kicker {
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-size: 0.74rem;
    opacity: 0.86;
    font-weight: 600;
}
.home-quick-card {
    border: 1px solid #e6edf7;
    border-radius: 0.85rem;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    transition: transform 120ms ease, box-shadow 120ms ease;
}
.home-quick-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.1);
}
.home-quick-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #1f3b63;
}
@media (prefers-reduced-motion: reduce) {
    .home-quick-card {
        transition: none;
    }
    .home-quick-card:hover {
        transform: none;
    }
}

/* —— Login —— */
body.page-login {
    background: linear-gradient(165deg, #e8eef8 0%, #f4f6fb 38%, #f5f5f7 100%);
}
body.page-login main.container {
    margin-bottom: 2rem;
}
body.page-login .navbar-esag.mb-4 {
    margin-bottom: 1.25rem !important;
}
.login-shell {
    max-width: 420px;
    margin: 0 auto;
}
.login-brand {
    text-align: center;
    margin-bottom: 1rem;
}
.login-brand-logo {
    max-height: 88px;
    width: auto;
    opacity: 0.95;
}
.login-brand-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f3b63;
}
.login-subtitle {
    text-align: center;
    color: #475569;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.45;
}
.login-card {
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.07);
}
.login-card .form-control {
    border-radius: 0.65rem;
    border-color: #cbd5e1;
    min-height: 2.75rem;
}
.login-card .form-control:focus {
    border-color: var(--esag-primary, #1e5aa0);
    box-shadow: 0 0 0 0.2rem rgba(30, 90, 160, 0.2);
}
.login-card .form-label {
    font-weight: 600;
    color: #334155;
    font-size: 0.875rem;
}
.password-field-wrap {
    position: relative;
}
.password-toggle-btn {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: 0.4rem;
    min-height: 2.25rem;
    min-width: 2.75rem;
}
.password-toggle-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}
.password-toggle-btn:focus-visible {
    outline: 2px solid var(--esag-primary, #1e5aa0);
    outline-offset: 2px;
}
.login-submit {
    min-height: 2.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border-radius: 0.65rem;
    box-shadow: 0 4px 14px rgba(30, 90, 160, 0.28);
}
.login-submit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(30, 90, 160, 0.45);
}
.login-forgot {
    font-size: 0.8125rem;
}
.login-forgot a {
    color: #64748b;
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
.login-forgot a:hover {
    color: var(--esag-primary, #1e5aa0);
}
.login-forgot a:focus-visible {
    outline: 2px solid var(--esag-primary, #1e5aa0);
    outline-offset: 2px;
    border-radius: 2px;
}
.login-legal-footer {
    border-top: 1px solid #eef2f7;
}
.login-legal-footer .login-legal-link {
    color: var(--esag-primary, #1e5aa0);
    font-weight: 600;
    text-decoration: none;
}
.login-legal-footer .login-legal-link:hover {
    text-decoration: underline;
    color: var(--esag-primary-hover, #164a82);
}
.login-legal-footer .login-legal-link:focus-visible {
    outline: 2px solid var(--esag-primary, #1e5aa0);
    outline-offset: 2px;
    border-radius: 2px;
}

/* —— Termos / privacidade —— */
.fct-legal-prose {
    max-width: 48rem;
    margin: 0 auto;
}
.fct-legal-prose h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 1rem;
}
.fct-legal-prose h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-top: 1.75rem;
    margin-bottom: 0.65rem;
}
.fct-legal-prose p,
.fct-legal-prose li {
    color: #334155;
    line-height: 1.65;
}
.fct-legal-prose ul {
    padding-left: 1.25rem;
}
.fct-legal-divider {
    border: 0;
    border-top: 1px solid #e2e8f0;
    margin: 1.5rem 0;
}

/* —— Aceitar termos (primeiro login) —— */
.consent-shell {
    max-width: 460px;
    margin: 0 auto;
}
.consent-card {
    border-radius: 0.95rem;
    border: 1px solid #e5edf8;
}
.consent-card .form-check-input {
    margin-top: 0.35rem;
}

/* —— Direção: utilizadores institucionais (linha clicável) —— */
tr.fct-util-inst-row-detalhe {
    cursor: pointer;
}
tr.fct-util-inst-row-detalhe:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: -2px;
}

/* —— Painel Direção: detalhes, pesquisa, KPIs —— */
#direcao-resumo-cursos-details > summary,
.fct-direcao-lote-details > summary {
    cursor: pointer;
}
.fct-direcao-search-input {
    min-width: 12rem;
    max-width: 22rem;
}
.fct-direcao-tabela-legenda {
    min-width: 14rem;
}
.fct-kpi-card-link .card {
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.fct-kpi-card-link:hover .card,
.fct-kpi-card-link:focus-visible .card {
    box-shadow: 0 0.25rem 0.75rem rgba(30, 90, 160, 0.15);
    border-color: var(--bs-primary) !important;
}
.fct-progress-thin {
    height: 5px;
}
.fct-progress-funil {
    height: 6px;
}
[data-direcao-open-url] {
    cursor: pointer;
}
