/* ==========================================================
   UNIFACC-MT — Tema de formulários V2
   Este arquivo complementa o Fruity. Não altera o tema central.
   ========================================================== */

:root {
    --unifacc-blue: #001e6a;
    --unifacc-blue-dark: #001240;
    --unifacc-orange: #f3a223;
    --unifacc-bg: #f5f7fb;
    --unifacc-text: #25324a;
    --unifacc-muted: #667085;
    --unifacc-border: #e1e7ef;
}

/* A navbar deste tema fica no fluxo da página (sticky, não fixed).
   O Fruity normalmente adiciona padding superior ao body para a navbar fixa. */
html body {
    padding-top: 0 !important;
    background-color: var(--unifacc-bg) !important;
    color: var(--unifacc-text);
}

/* ---------- Cabeçalho ---------- */
html body #survey-nav.unifacc-survey-nav {
    min-height: 76px;
    padding: 8px 0;
    background: #ffffff !important;
    border: 0 !important;
    border-bottom: 3px solid var(--unifacc-orange) !important;
    box-shadow: 0 3px 14px rgba(16, 24, 40, 0.07);
    z-index: 1030;
}

html body #survey-nav .unifacc-nav-inner {
    min-height: 57px;
    display: flex;
    align-items: center;
    gap: 16px;
}

html body #survey-nav .unifacc-brand {
    min-height: 0;
    height: auto;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    overflow: visible;
}

html body #survey-nav .unifacc-brand-logo {
    display: block;
    width: auto;
    height: 48px;
    max-width: 270px;
    object-fit: contain;
}

html body #survey-nav .unifacc-nav-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

html body #survey-nav .unifacc-site-link {
    align-items: center;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    color: var(--unifacc-blue) !important;
    background: #ffffff;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    transition: background-color .15s ease, border-color .15s ease;
}

html body #survey-nav .unifacc-site-link:hover,
html body #survey-nav .unifacc-site-link:focus {
    background: #f2f5fa;
    border-color: #b9c6da;
}

html body #survey-nav .navbar-action-link {
    padding-right: 0;
    margin: 0;
}

html body #survey-nav .nav-link,
html body #survey-nav a:not(.unifacc-site-link) {
    color: var(--unifacc-blue) !important;
}

/* ---------- Progresso ---------- */
html body .top-container {
    background: transparent !important;
    margin: 0;
}

html body .top-container .top-content {
    padding-top: .6rem !important;
    padding-bottom: .6rem !important;
    margin-bottom: .8rem !important;
}

html body .top-container .progress {
    height: 8px !important;
    margin: 0 !important;
    border-radius: 999px;
    background: #e6ebf2 !important;
    box-shadow: none !important;
    overflow: hidden;
}

html body .top-container .progress .progress-bar {
    background-color: var(--unifacc-blue) !important;
    line-height: 8px !important;
    font-size: 0;
}

/* ---------- Conteúdo ---------- */
html body #outerframeContainer {
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    padding-top: .25rem;
}

html body #main-col {
    margin-top: .5rem !important;
}

html body .group-title-container {
    padding: .6rem .25rem 1rem !important;
    background: transparent !important;
}

html body .group-title {
    margin: 0;
    color: #1d2d49 !important;
    font-size: 1.65rem;
    line-height: 1.25;
    font-weight: 700;
}

/* ---------- Perguntas ---------- */
html body .question-container {
    margin-bottom: 1.25rem !important;
    background: #ffffff !important;
    border: 1px solid var(--unifacc-border) !important;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(16, 24, 40, 0.055);
    overflow: hidden;
}

html body .question-title-container {
    padding: 1rem 1.2rem .55rem !important;
    background: #ffffff !important;
}

html body .question-valid-container {
    padding: 0 1.2rem .5rem;
    background: #ffffff !important;
}

html body .answer-container {
    padding: .65rem 1.2rem 1.15rem !important;
    background: #ffffff !important;
    border: 0 !important;
}

html body .question-text,
html body .question-title-container,
html body label {
    color: var(--unifacc-text);
}

html body .question-title-container label,
html body .question-text {
    font-weight: 600;
}

html body .ls-questionhelp,
html body .questionhelp,
html body .help-block,
html body .text-info {
    color: var(--unifacc-muted) !important;
}

/* ---------- Campos ---------- */
html body .form-control,
html body .form-select,
html body input[type="text"],
html body input[type="email"],
html body input[type="tel"],
html body input[type="number"],
html body input[type="date"],
html body textarea,
html body select {
    min-height: 44px;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #ffffff;
    box-shadow: none !important;
}

html body .form-control:focus,
html body .form-select:focus,
html body input:focus,
html body textarea:focus,
html body select:focus {
    border-color: var(--unifacc-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 30, 106, .12) !important;
    outline: 0 !important;
}

/* ---------- Botões ---------- */
html body .btn-primary,
html body .btn-primary:focus {
    background-color: var(--unifacc-blue) !important;
    border-color: var(--unifacc-blue) !important;
    color: #ffffff !important;
    border-radius: 8px;
    font-weight: 600;
    min-height: 42px;
}

html body .btn-primary:hover,
html body .btn-primary:active {
    background-color: var(--unifacc-blue-dark) !important;
    border-color: var(--unifacc-blue-dark) !important;
}

html body .btn-secondary,
html body .btn-default {
    border-radius: 8px;
}

html body a {
    color: var(--unifacc-blue);
}

html body a:hover {
    color: var(--unifacc-blue-dark);
}

/* ---------- Navegação inferior ---------- */
html body #navigator-container {
    padding-top: .35rem;
    padding-bottom: 1.5rem;
}

/* ---------- Boas-vindas ---------- */
html body .survey-name,
html body .survey-name h1,
html body #welcome-container h1 {
    color: #1d2d49 !important;
    font-weight: 700;
    line-height: 1.2;
}

/* ---------- Mobile ---------- */
@media (max-width: 767.98px) {
    html body #survey-nav.unifacc-survey-nav {
        min-height: 66px;
        padding: 7px 0;
    }

    html body #survey-nav .unifacc-nav-inner {
        min-height: 49px;
        padding-left: 14px;
        padding-right: 14px;
    }

    html body #survey-nav .unifacc-brand-logo {
        height: 38px;
        max-width: 205px;
    }

    html body #survey-nav .unifacc-navbar-toggler {
        order: 2;
        margin-left: auto;
        border-color: #cbd5e1;
    }

    html body #survey-nav .unifacc-brand {
        order: 1;
    }

    html body #survey-nav .unifacc-nav-actions {
        order: 3;
        width: 100%;
    }

    html body #survey-nav #unifacc-navbar-menu {
        width: 100%;
        padding-top: 8px;
    }

    html body #outerframeContainer {
        padding-left: 12px;
        padding-right: 12px;
    }

    html body .group-title {
        font-size: 1.35rem;
    }

    html body .question-container {
        border-radius: 10px;
        margin-bottom: 1rem !important;
    }

    html body .question-title-container,
    html body .answer-container,
    html body .question-valid-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

/* ==========================================================
   Refinamentos V3 — navegação, boas-vindas, ações e rodapé
   ========================================================== */

html body #survey-nav .unifacc-quick-links {
    align-items: center;
    gap: 10px;
}

html body #survey-nav .unifacc-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 7px 13px;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    background: #ffffff;
    color: var(--unifacc-blue) !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none !important;
    white-space: nowrap;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

html body #survey-nav .unifacc-nav-button:hover,
html body #survey-nav .unifacc-nav-button:focus {
    background: #f2f5fa;
    border-color: #b9c6da;
}

html body #survey-nav .unifacc-home-link {
    border-color: transparent;
    background: transparent;
}

html body #survey-nav .navbar-action-link > .nav-item {
    display: flex;
    align-items: center;
}

html body #survey-nav .navbar-action-link .nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 10px !important;
    border-radius: 8px;
    color: var(--unifacc-blue) !important;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    text-decoration: none !important;
}

html body #survey-nav .navbar-action-link .nav-link:hover,
html body #survey-nav .navbar-action-link .nav-link:focus {
    background: #eef3fa;
}

html body #welcome-container {
    max-width: 1120px;
    margin: .8rem auto 1.2rem;
    padding: 1.8rem 2rem;
    background: #ffffff;
    border: 1px solid var(--unifacc-border);
    border-radius: 16px;
    box-shadow: 0 5px 18px rgba(16, 24, 40, .05);
}

html body #welcome-container .survey-name {
    max-width: 1000px;
    margin: 0 auto 1rem;
    color: #1d2d49 !important;
    font-size: clamp(1.7rem, 2.4vw, 2.35rem) !important;
    line-height: 1.2 !important;
    font-weight: 700 !important;
    letter-spacing: -.015em;
}

html body #welcome-container .survey-description {
    margin: 0 auto 1rem;
    color: var(--unifacc-muted) !important;
    font-size: .98rem;
    line-height: 1.55;
}

html body #welcome-container .survey-description img,
html body #welcome-container .survey-welcome img {
    max-width: 100% !important;
    height: auto !important;
}

html body #welcome-container .survey-welcome {
    color: var(--unifacc-text) !important;
    font-size: 1rem !important;
    line-height: 1.65;
    font-weight: 400;
}

html body #welcome-container .survey-welcome p:last-child,
html body #welcome-container .survey-description p:last-child {
    margin-bottom: 0;
}

html body #welcome-container .number-of-questions {
    margin-top: 1rem;
    padding-top: .9rem;
    border-top: 1px solid #edf0f4;
    color: #7b8798 !important;
    font-size: .92rem;
}

html body .group-title {
    letter-spacing: -.01em;
}

html body .asterisk,
html body .text-danger,
html body .mandatory .asterisk {
    color: #b42318 !important;
}

html body .em_tip,
html body .em_num_answers,
html body .question-valid-container .text-info {
    font-size: .9rem;
    line-height: 1.4;
}

html body #navigator-container {
    margin-top: .35rem;
}

html body #navigator-container .btn {
    min-width: 106px;
    padding-left: 18px;
    padding-right: 18px;
}

html body .load-survey-row,
html body .save-survey-row,
html body .token-form {
    max-width: 760px;
}

html body .unifacc-survey-footer {
    margin-top: 2rem;
    background: #ffffff;
    border-top: 1px solid var(--unifacc-border);
}

html body .unifacc-survey-footer-inner {
    min-height: 82px;
    padding-top: 16px;
    padding-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

html body .unifacc-footer-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

html body .unifacc-footer-identity strong {
    color: #1d2d49;
    font-size: 13px;
    font-weight: 700;
}

html body .unifacc-footer-identity span {
    color: #7b8798;
    font-size: 12px;
}

html body .unifacc-footer-links {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

html body .unifacc-footer-links a {
    color: #5f6c7d !important;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none !important;
}

html body .unifacc-footer-links a:hover,
html body .unifacc-footer-links a:focus {
    color: var(--unifacc-blue) !important;
    text-decoration: underline !important;
}

@media (max-width: 767.98px) {
    html body #survey-nav .unifacc-nav-inner {
        flex-wrap: wrap;
    }

    html body #survey-nav .unifacc-navbar-toggler {
        order: 2;
    }

    html body #survey-nav .unifacc-nav-actions {
        order: 3;
        flex-basis: 100%;
    }

    html body #survey-nav #unifacc-navbar-menu {
        margin-top: 6px;
        padding: 8px;
        background: #f7f9fc;
        border: 1px solid #e3e9f1;
        border-radius: 10px;
    }

    html body #survey-nav .navbar-action-link {
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }

    html body #survey-nav .navbar-action-link > .nav-item {
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body #survey-nav .navbar-action-link .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 9px 10px !important;
    }

    html body #welcome-container {
        margin-top: .5rem;
        padding: 1.25rem 1rem;
        border-radius: 12px;
    }

    html body #welcome-container .survey-name {
        font-size: clamp(1.45rem, 7vw, 1.85rem) !important;
        margin-bottom: .8rem;
    }

    html body #navigator-container .btn {
        min-width: 0;
    }

    html body .unifacc-survey-footer-inner {
        min-height: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-left: 16px;
        padding-right: 16px;
    }

    html body .unifacc-footer-links {
        gap: 12px 16px;
    }
}

/* ==========================================================
   Refinamentos V4 — validação, conclusão e mobile
   ========================================================== */

/* Mantém o rodapé no fim da tela em páginas curtas, inclusive conclusão. */
html,
html body {
    min-height: 100%;
}

html body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html body > article {
    width: 100%;
    flex: 1 0 auto;
}

html body > .unifacc-survey-footer {
    flex: 0 0 auto;
}

/* ---------- Validação de perguntas ----------
   O LimeSurvey acrescenta a classe input-error quando uma pergunta falha.
   Retiramos contornos/handles herdados do bloco de resposta e deixamos o
   erro concentrado na mensagem e no próprio campo. */
html body .input-error .answer-container,
html body .input-error .ls-answers,
html body .input-error .answer-item,
html body .input-error .form-group,
html body .input-error .dropdown-item,
html body .input-error .dropdown-list,
html body .input-error .list-dropdown {
    outline: 0 !important;
    box-shadow: none !important;
}

html body .input-error .ls-answers,
html body .input-error .answer-item {
    border: 0 !important;
}

html body .input-error .ls-answers::before,
html body .input-error .ls-answers::after,
html body .input-error .answer-item::before,
html body .input-error .answer-item::after {
    content: none !important;
    display: none !important;
}

html body .input-error select,
html body .input-error .form-select,
html body .input-error .form-control,
html body .input-error input:not([type="radio"]):not([type="checkbox"]),
html body .input-error textarea {
    border-color: #b42318 !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .08) !important;
}

html body .input-error select:focus,
html body .input-error .form-select:focus,
html body .input-error .form-control:focus,
html body .input-error input:not([type="radio"]):not([type="checkbox"]):focus,
html body .input-error textarea:focus {
    border-color: #9b1c13 !important;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .12) !important;
}

/* Mensagens obrigatórias/erros sem caixas ou bordas chamativas. */
html body .input-error .question-valid-container,
html body .question-valid-container {
    outline: 0 !important;
}

html body .question-valid-container .text-danger,
html body .input-error .text-danger {
    color: #b42318 !important;
}

/* Selects: largura natural, sem área vazia/resize ao redor. */
html body .dropdown-list .ls-answers,
html body .list-dropdown .ls-answers,
html body .answer-item.dropdown-item,
html body .answer-container select {
    resize: none !important;
}

html body .answer-container select,
html body .answer-container .form-select {
    max-width: 100%;
}

/* ---------- Botão hamburguer mobile ---------- */
html body #survey-nav .unifacc-navbar-toggler {
    width: 42px;
    height: 38px;
    padding: 8px 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cfd8e6 !important;
    border-radius: 8px;
    background: #ffffff !important;
    box-shadow: none !important;
}

html body #survey-nav .unifacc-hamburger {
    width: 20px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

html body #survey-nav .unifacc-hamburger > span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--unifacc-blue);
}

html body #survey-nav .unifacc-navbar-toggler:focus {
    border-color: var(--unifacc-blue) !important;
    box-shadow: 0 0 0 3px rgba(0, 30, 106, .10) !important;
}

/* ---------- Página de conclusão ---------- */
html body .completed-wrapper {
    width: min(760px, calc(100% - 32px));
    margin: 2.4rem auto 3rem !important;
    padding: 0 !important;
}

html body .completed-text {
    position: relative;
    padding: 1.8rem 1.8rem 1.7rem 5.25rem;
    background: #ffffff;
    border: 1px solid #dfe6ef;
    border-radius: 16px;
    box-shadow: 0 8px 26px rgba(16, 24, 40, .07);
    color: var(--unifacc-text);
    font-size: 1rem;
    line-height: 1.6;
}

html body .completed-text::before {
    content: "✓";
    position: absolute;
    left: 1.65rem;
    top: 1.55rem;
    width: 2.55rem;
    height: 2.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #eaf7ef;
    color: #1d7a46;
    font-size: 1.35rem;
    font-weight: 800;
}

html body .completed-text > :first-child {
    margin-top: 0;
}

html body .completed-text > :last-child {
    margin-bottom: 0;
}

html body .completed-text p:first-child,
html body .completed-text .completed-heading {
    color: #1d2d49;
    font-size: 1.3rem;
    font-weight: 700;
}

html body .completed-wrapper .url-wrapper {
    margin-top: 1rem;
}

html body .completed-wrapper .url-wrapper a,
html body .completed-wrapper .ls-print {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid #cfd8e6;
    border-radius: 8px;
    background: #ffffff;
    color: var(--unifacc-blue) !important;
    font-weight: 600;
    text-decoration: none !important;
}

/* Flash messages eventualmente usados após submissão. */
html body #yii-flash-message {
    max-width: 760px;
    margin: 2.2rem auto !important;
}

html body #yii-flash-message .alert,
html body #yii-flash-message.alert {
    padding: 1rem 1.2rem;
    background: #ffffff !important;
    border: 1px solid #dfe6ef !important;
    border-left: 4px solid #1d7a46 !important;
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(16, 24, 40, .05);
    color: var(--unifacc-text) !important;
}

/* ---------- Navegação inferior / celulares ---------- */
html body #navigator-container {
    padding-bottom: max(1.75rem, env(safe-area-inset-bottom));
}

@media (max-width: 767.98px) {
    html body #survey-nav .unifacc-navbar-toggler {
        flex: 0 0 42px;
        margin-left: auto;
    }

    html body #navigator-container {
        padding-bottom: max(2.25rem, env(safe-area-inset-bottom));
    }

    html body .completed-wrapper {
        width: calc(100% - 24px);
        margin-top: 1.25rem !important;
        margin-bottom: 1.75rem !important;
    }

    html body .completed-text {
        padding: 4.75rem 1.15rem 1.3rem;
        border-radius: 12px;
        text-align: left;
    }

    html body .completed-text::before {
        left: 1.15rem;
        top: 1.15rem;
    }

    html body .unifacc-survey-footer {
        margin-top: 1rem;
    }
}



/* ==========================================================
   Refinamento V5 — SELECT / LISTA DROPDOWN
   O LimeSurvey gera este tipo como:
   .list-dropdown > .col-auto > select.form-select.form-control
   Remove o segundo contorno visual criado pelo wrapper/gutter.
   ========================================================== */

html body .list-dropdown.row {
    --bs-gutter-x: 0 !important;
    --bs-gutter-y: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

html body .list-dropdown > .col-auto {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

html body .list-dropdown > .col-auto::before,
html body .list-dropdown > .col-auto::after {
    content: none !important;
    display: none !important;
}

html body .list-dropdown select.form-select.form-control,
html body .list-dropdown select.list-question-select {
    display: block !important;
    width: auto !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    background-color: #ffffff !important;
    box-shadow: none !important;
    outline: 0 !important;
}

/* Remove qualquer decoração residual do bloco de respostas apenas
   neste tipo de pergunta, sem afetar radio, texto, data etc. */
html body .list-dropdown,
html body .list-dropdown .ls-answers,
html body .list-dropdown .answer-item {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}


/* ==========================================================
   Refinamentos V6 — MENU MOBILE + NAVEGAÇÃO INFERIOR
   ========================================================== */

/* O menu institucional existe sempre no celular. */
@media (max-width: 767.98px) {
    html body #survey-nav .unifacc-nav-inner {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 10px;
        row-gap: 0;
    }

    html body #survey-nav .unifacc-brand {
        flex: 1 1 auto;
        min-width: 0;
    }

    html body #survey-nav .unifacc-navbar-toggler {
        display: inline-flex !important;
        flex: 0 0 42px;
        margin-left: auto !important;
        order: 2;
    }

    html body #survey-nav .unifacc-nav-actions {
        width: 100%;
        flex: 0 0 100%;
        order: 3;
        margin-left: 0 !important;
    }

    html body #survey-nav #unifacc-navbar-menu {
        width: 100%;
        margin-top: 8px;
        padding: 8px;
        background: #f7f9fc;
        border: 1px solid #e3e9f1;
        border-radius: 10px;
    }

    html body #survey-nav #unifacc-navbar-menu:not(.show) {
        display: none;
    }

    html body #survey-nav #unifacc-navbar-menu.show {
        display: block;
    }

    /* Neutraliza os gutters negativos da .row do navigator do LimeSurvey.
       Assim Anterior/Próximo/Enviar não encostam nas laterais da tela. */
    html body #navigator-container.row {
        --bs-gutter-x: 0 !important;
        --bs-gutter-y: 0 !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-top: 1rem !important;
        padding-left: 16px !important;
        padding-right: 16px !important;
        padding-bottom: max(2.25rem, env(safe-area-inset-bottom)) !important;
        display: flex;
        flex-wrap: nowrap;
        gap: 12px;
        box-sizing: border-box;
    }

    html body #navigator-container.row > .col-6 {
        flex: 1 1 0;
        width: auto !important;
        max-width: none !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    html body #navigator-container.row > .col-6:first-child {
        text-align: left !important;
    }

    html body #navigator-container.row > .col-6:last-child {
        text-align: right !important;
    }

    html body #navigator-container.row .btn {
        width: 100%;
        max-width: 220px;
        min-height: 48px;
        padding: 10px 14px !important;
        margin: 0 !important;
    }

    html body #navigator-container.row > .col-6:first-child .btn {
        margin-right: auto !important;
    }

    html body #navigator-container.row > .col-6:last-child .btn {
        margin-left: auto !important;
    }
}
