:root {
    --primary: #20B2AA;
    --primary-dark: #168f89;
    --dark: #2f2f2f;
    --text-muted: #7b8187;
    --light-bg: #f5f7fa;
    --border: #e3e7eb;

    --easy: #198754;
    --medium: #fd7e14;
    --hard: #dc3545;

    --primary-hover: #0d9488;
    --green-light: #dcfce7;
    --green-text: #166534;
    --green-border: #22c55e;
    --text-main: #374151;
    --bg-page: #e5e7eb;
    --white: #ffffff;
    --border-color: #d1d5db;
}

* {
    box-sizing: border-box;
}

/* =====================================================
   NAVBAR
   ===================================================== */

.navbar-custom {
    height: 70px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.brand {
    text-decoration: none;
    color: var(--dark);
    font-size: 1.2rem;
    font-weight: 700;
}

.brand span {
    color: var(--primary);
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 800;
}

/* =====================================================
   PAGE
   ===================================================== */

.page-header {
    padding: 40px 0 25px;
    text-align: center;
}

h2.page-title {
    margin-bottom: 0;
}

.page-subtitle {
    color: var(--text-muted);
    margin: 0 0 10px;
}

/* =====================================================
   DISCIPLINA
   ===================================================== */

.discipline-banner,
.prova-preview-banner {
    background: linear-gradient(135deg, #ffffff 0%, #f2fffd 100%);
    border: 1px solid rgba(32, 178, 170, .2);
    border-radius: 18px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow:
        0 8px 25px rgba(0, 0, 0, .04);
}

.discipline-icon {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 14px;
    background: rgba(32, 178, 170, .12);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.discipline-label {
    color: var(--text-muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.discipline-name {
    font-size: 1.55rem;
    font-weight: 750;
    margin-top: 2px;
}

.badge-custom {
    background: rgba(32, 178, 170, .1);
    color: var(--primary-dark);
    padding: 7px 11px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
}

/* =====================================================
   CARDS
   ===================================================== */

.main-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow:
        0 6px 25px rgba(0, 0, 0, .035);
}

.card-header-custom {
    padding: 21px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    align-items: center;
}

.card-body-custom {
    padding: 24px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
}

.section-description {
    color: var(--text-muted);
    font-size: .84rem;
    margin: 0;
}

/* =====================================================
   FORM
   ===================================================== */

.form-label {
    font-size: .88rem;
    font-weight: 650;
    margin-bottom: 7px;
}

.form-select,
.form-control {
    border-radius: 9px;
    padding: 11px 13px;
    font-size: 1rem;
    background-color: #f9fbfb;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(32, 178, 170, 0.3);
    /* Borda turquesa suave */
}

.form-select:focus,
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(32, 178, 170, .12);
}

.form-select:disabled {
    cursor: not-allowed;
    background-color: #e9ecef;
    opacity: .5;
}


/* =====================================================
   RADIO ETAPA
   ===================================================== */

.stage-option {
    position: relative;
}

.stage-option input {
    position: absolute;
    opacity: 0;
}

.stage-label {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 11px;
    cursor: pointer;
    transition: .2s;
}

.stage-label:hover {
    border-color: var(--primary);
    background: #f8fffe;
}

.stage-option input:checked+.stage-label {
    border-color: var(--primary);
    background: rgba(32, 178, 170, .07);
    box-shadow: 0 0 0 .2rem rgba(32, 178, 170, .12);
}

.stage-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f4;
    color: #6d747a;
}

.stage-option input:checked+.stage-label .stage-icon {
    background: var(--primary);
    color: white;
}

.stage-title {
    font-weight: 650;
    font-size: .9rem;
}

.stage-description {
    font-size: .74rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* =====================================================
   BNCC
   ===================================================== */
#bnccContainer {
    margin-top: 25px;
}

.bncc-help {
    background: #fcfcfd;
    border: 1px solid #e9ecef;
    border-radius: 9px;
    padding: 11px 13px;
    font-size: .78rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* =====================================================
   CONFIGURAÇÃO CARD BNCC
   ===================================================== */

/* Card Principal da BNCC */
.bncc-card {
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #ffffff 0%, #f2fffd 100%);
    border: 1px solid rgba(32, 178, 170, .2);
}

.bncc-header {
    background-color: var(--primary);
    color: #fff;
    padding: 12px 20px;
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
}

.btn-close-custom {
    cursor: pointer;
    color: #fff;
    font-size: 1.1rem;
    transition: 0.2s;
}

.btn-close-custom:hover {
    opacity: 0.7;
}

/* Container pai */
.q-type-row {
    display: flex;
    flex-wrap: wrap;
    /* Permite que os cards vão para a linha de baixo se faltar espaço */
}

/* Cada card individual */
.q-type-card {
    flex: 1 1 220px;
    /* Cresce, encolhe e define uma largura ideal inicial de 250px */
    min-width: 0;
    /* Impede que o conteúdo interno estoure o flexbox */
}

/* Sub-Card de Tipo de Questão */
.type-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    height: 100%;
    transition: all 0.3s ease;
}

/* Linhas de Dificuldade */
.diff-row {
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
}

.diff-row:last-child {
    border-bottom: none;
}

/* Switch Customizado */
.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}

.form-check .form-switch {
    padding-left: 0 !important;
}

/* Inputs de Quantidade */
.qty-input-group {
    max-width: 100px;
}

.card-q-type-header {
    padding: 8;
    background-color: #dee2e6;
    border-radius: 10px 10px 0 0;
}

.toggle-label {
    font-size: .9rem;
    font-weight: 600;
    color: #333333;
    margin-bottom: 3px;
    letter-spacing: 0.3px;
    padding: 0;
    line-height: 1;
}

/* Container do Toggle */
.custom-switch-wrapper {
    position: relative;
    display: inline-block;
}

/* Dimensões exatas solicitadas: 60px x 20px */
.form-check-input.diff-switch {
    width: 50px;
    height: 25px;
    background-color: #d1d5db;
    /* Cinza OFF padrão */
    border: none;
    border-radius: 10px;
    /* Metade da altura para formato pílula perfeito */
    cursor: pointer;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: background-color 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
    background-image: none !important;
    margin: 0;
}

/* Bolinha Branca (Thumb) proporcional para altura de 20px */
.form-check-input.diff-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background-color: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Estado Ligado (ON) com verde de destaque */
.form-check-input.diff-switch:checked {
    background-color: #20b2aa;
    /* Verde vibrante ON */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15), 0 0 8px rgba(74, 222, 128, 0.35);
}

/* Deslocamento exato: 60px largura - 16px bolinha - 4px margens = 40px */
.form-check-input.diff-switch:checked::before {
    transform: translateX(25px);
}

.toggle-text-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    pointer-events: none;
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.text-on {
    color: #ffffff;
    opacity: 0;
    transition: opacity 0.25s ease;
    position: absolute;
    left: 7px;
}

.text-off {
    color: #6b7280;
    opacity: 1;
    transition: opacity 0.25s ease;
    position: absolute;
    right: 7px;
}

.form-check-input.diff-switch:checked~.toggle-text-container .text-on {
    opacity: 1;
}

.form-check-input.diff-switch:checked~.toggle-text-container .text-off {
    opacity: 0;
}

.status-badge {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

.status-badge span {
    font-weight: 700;
}


/* ==================================================================
TIPO DE QUSTÃO (MÚLTIPLA ESCOLHA, VERDADEIRO OU FALSO, DISCURSIVA)
================================================================== */

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    /* Permite que os itens quebrem de linha quando não couberem */
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    user-select: none;
    gap: 10px;
}

/* Cada item individual */
.checkbox-group .checkbox {
    flex: 1 1 200px;
    /* Cresce, encolhe e define uma largura base de 200px */
    min-width: 0;
    /* Evita estouro de conteúdo em flexbox */
}

.checkbox-input {
    /* Code to hide the input */
    clip: rect(0 0 0 0);
    clip-path: inset(100%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;

    &:checked+.checkbox-tile {
        border-color: #20B2AA;
        background-color: rgba(32, 178, 170, .07);
        box-shadow: 0 0 0 .2rem rgba(32, 178, 170, .12);

        &:before {
            transform: scale(1);
            opacity: 1;
            background-color: #20B2AA;
            border-color: #20B2AA;
        }

        /*.checkbox-icon, .checkbox-label {
			color: #2260ff;
		}*/

        .checkbox-icon {
            background: #a0e1de;
            ;
        }
    }
}

.checkbox-wrapper {
    width: 100%;
}

.checkbox-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    border: 1px solid #e5e5e5;
    background-color: #fff;
    box-shadow: 0 5px 10px rgba(#000, 0.1);
    transition: 0.15s ease;
    cursor: pointer;
    position: relative;
    gap: 9px;
    padding: 10px 10px 10px 27px;
    flex-direction: column;
    width: 100%;

    &:before {
        content: "";
        position: absolute;
        display: block;
        width: 1.25rem;
        height: 1.25rem;
        border: 1px solid #b5bfd9;
        background-color: #fff;
        border-radius: 50%;
        top: 0.25rem;
        left: 0.25rem;
        opacity: 0;
        transform: scale(0);
        transition: 0.25s ease;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='192' height='192' fill='%23FFFFFF' viewBox='0 0 256 256'%3E%3Crect width='256' height='256' fill='none'%3E%3C/rect%3E%3Cpolyline points='216 72.005 104 184 48 128.005' fill='none' stroke='%23FFFFFF' stroke-linecap='round' stroke-linejoin='round' stroke-width='32'%3E%3C/polyline%3E%3C/svg%3E");
        background-size: 12px;
        background-repeat: no-repeat;
        background-position: 50% 50%;
    }

    &:hover {
        border-color: #20B2AA;
        background-color: #f8fffe;

        &:before {
            transform: scale(1);
            opacity: 1;
        }
    }
}

.checkbox-icon {
    transition: .375s ease;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f4;
    color: #111111;
}

.checkbox-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 650;
    font-size: .9rem;
    color: #111111;
    transition: .375s ease;
    text-align: center;
}

/* =========================
           QUESTION COUNTER
        ========================= */

.question-counter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.question-counter input {
    text-align: center;
    font-weight: 700;
    width: 100px;
}

.total-counter-btn {
    width: 45px;
    height: 45px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    font-size: 1.1rem;
}

.counter-btn {
    width: 35px;
    height: 35px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    font-size: 1.1rem;
}

button.counter-btn:not(:disabled):hover,
.total-counter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    cursor: pointer;
}

/* Estilo padrão para o botão desabilitado (opcional) */
button.counter-btn:disabled {
    cursor: not-allowed;
}

/* Para Chrome, Safari, Edge e Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Para Firefox */
input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
    /* Padrão moderno */
}

input[type="number"] {
    text-align: center;
}

/* =====================================================
   TOTALIZADOR
   ===================================================== */

.question-summary {
    margin-top: 20px;
    padding: 15px 17px;
    border-radius: 11px;
    background: #f8f9fa;
    border: 1px solid var(--border);
}

.summary-number {
    font-size: 1.2rem;
    font-weight: 800;
}

.summary-limit {
    color: var(--text-muted);
    font-size: .78rem;
}

.progress {
    height: 7px;
    border-radius: 10px;
    background: #e9ecef;
}

.progress-bar {
    background: var(--primary);
    transition: width .25s;
}

.progress-bar.over {
    background: var(--hard);
}

/* =====================================================
   ALERTA
   ===================================================== */

.validation-alert {
    display: none;
    margin-top: 15px;
    border-radius: 10px;
    font-size: .82rem;
}

/* =====================================================
   SIDEBAR
   ===================================================== */

.summary-card {
    position: sticky;
    top: 90px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow:
        0 6px 25px rgba(0, 0, 0, .035);
}

.summary-card-header {
    padding: 19px;
    border-bottom: 1px solid var(--border);
}

.summary-card-body {
    padding: 19px;
}

.summary-item {
    display: flex;
    gap: 11px;
    margin-bottom: 17px;
}

.summary-icon,
.section-title-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(32, 178, 170, .1);
    color: var(--primary);
}

.summary-label {
    color: var(--text-muted);
    font-size: .7rem;
}

.summary-value {
    font-size: .9rem;
    font-weight: 500;
}

.ready-status {
    padding: 11px;
    border-radius: 9px;
    background: #ffc1071a;
    color: #997404;
    font-size: .8rem;
    font-weight: 600;
}

/* =====================================================
   BOTÕES
   ===================================================== */

.btn-generate {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    border-radius: 9px;
    padding: 11px 20px;
    font-weight: 650;
}

/* Estilo padrão para o botão desabilitado (opcional) */
button.btn-generate:not(:disabled):hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
}

button.btn-generate:disabled {
    background-color: #e5e5e5;
    border-color: #b3b3b3;
}

.btn-outline-custom {
    background: white;
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 18px;
    font-weight: 600;
}

.btn-outline-custom:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* =====================================================
   TOM SELECT
   ===================================================== */

.ts-control {
    border-radius: 9px !important;
    padding: 8px 12px !important;
    min-height: 45px;
    background-color: #f9fbfb;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(32, 178, 170, 0.3);
    /* Borda turquesa suave */
}

.focus .ts-control {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 .2rem rgba(32, 178, 170, .12) !important;
}

.disabled .ts-control,
.disabled .ts-control * {
    cursor: not-allowed !important;
}

.item {
    background: rgba(32, 178, 170, .1) !important;
    color: var(--primary-dark) !important;
    border-radius: 6px !important;
}

/* Quando estiver carregando, aplica um efeito semi-transparente e bloqueia cliques */
.ts-control.ts-loading-state {
    opacity: 0.7;
    pointer-events: none;
    /* Impede o usuário de abrir o menu antes da hora */
    position: relative;
}

/* Substitui ou complementa o ícone de seta por um Spinner Giratório Moderno */
.ts-control.ts-loading-state::after {
    content: "";
    position: absolute;
    right: 12px;
    top: calc(50% - 8px);
    width: 16px;
    height: 16px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    /* Cor azul moderna do spinner */
    border-radius: 50%;
    animation: ts-input-spin 0.6s linear infinite;
}

/* Oculta a seta padrão do Tom Select apenas durante o carregamento */
.ts-wrapper.single.ts-loading-state .ts-control::after {
    border: none !important;
    /* Remove o triângulo se usar o layout padrão */
}

@keyframes ts-input-spin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   FOOTER
   ===================================================== */

/* footer {
    padding: 35px 0;
    text-align: center;
    color: #8b9196;
    font-size: .75rem;
} */

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 991px) {
    .summary-card {
        position: static;
        margin-top: 20px;
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 1.45rem;
    }

    .discipline-name {
        font-size: 1.3rem;
    }

    .card-body-custom {
        padding: 18px;
    }

    .card-header-custom {
        padding: 18px;
    }
}

/* =========================================================
   VISUALIZAR, IMPRIMIR, GERAR PDF DA PROVA
========================================================= */

#section-body-preview {
    /* oculta a página até que a prova seja gerada */
    display: none;
}

.fade-in-out {
    opacity: 0;
    transition: opacity 1s ease;
}

.fade-in-out.visivel {
    opacity: 1;
}

/* ================= TOOLBAR DE EDIÇÃO ================= */
#floating-toolbar {
    position: absolute;
    top: 0;
    left: 0;

    border-radius: 8px;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    gap: 4px;

    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s ease-in-out;

    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #ffffff 0%, #f2fffd 100%);
    border: 1px solid rgba(32, 178, 170, .2);
}

.hide-selection *::selection {
    background: transparent !important;
    color: inherit !important;
}

#floating-toolbar.active {
    visibility: visible;
    opacity: 1;
}

.toolbar-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    font-size: 18px;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.toolbar-btn:hover {
    background: #e5e7eb;
    color: #000;
}

.btn-text {
    font-size: 14px;
    font-weight: bold;
    font-family: sans-serif;
}

.separator {
    width: 1px;
    height: 24px;
    background-color: #d1d5db;
    margin: 0 4px;
}

.color-picker-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
    cursor: pointer;
    margin: 0 8px;
    border: 1px solid #d1d5db;
}

.color-picker-wrapper input[type="color"] {
    opacity: 0;
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

[contenteditable="true"]:focus {
    outline: 2px dashed var(--primary);
    outline-offset: 4px;
}

/* =========================================================
   ESTILO PARA QUESTÕES DISCURSIVAS
========================================================= */

/* ================= ESTILOS PARA QUESTÕES DISCURSIVAS ================= */
.discursive-line-block {
    padding: 0 0 5px 20px;
}

.discursive-line {
    border-bottom: 1px solid #000;
    outline: none;
    margin-bottom: 8px;
}

/* ================= ESTILOS PARA QUESTÕES VERDADEIRO / FALSO ================= */
.vf-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.option-item,
.vf-item {
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.vf-statement {
    flex-grow: 1;
    font-size: 0.95rem;
    margin-right: 15px;
}

.vf-boxes {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.vf-box {
    width: 32px;
    height: 32px;
    border: 1px solid #9ca3af;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    background: white;
}

/* Destaque da resposta correta no Modo Professor*/
.modo-professor .option-item.correct .opt-letter,
.modo-professor .vf-item .vf-box.vf-target-correto {
    background-color: var(--green-light);
    border-color: var(--green-border);
    color: var(--green-text);
}

/* =========================================================
   MODO ALUNO E MODO PROFESSOR
========================================================= */

/* Container do Toggle */
.modern-toggle-group {
    background-color: #ffffff;
    padding: 6px;
    border-radius: 9px;
    display: inline-flex;
    border: 1px solid #e3e7eb;
}

/* Estilização base dos botões */
.modern-toggle-group .btn-custom {
    border: none;
    background: transparent;
    color: #6c757d;
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    /* Espaço entre o ícone e o texto */
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* Efeito de Hover nos botões inativos */
.modern-toggle-group .btn-custom:not(.active):hover {
    color: var(--primary);
    background-color: rgba(32, 178, 170, 0.08);
}

/* Estado Ativo (Botão Selecionado) */
.modern-toggle-group .btn-custom.active {
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(32, 178, 170, 0.3);
}

/* Ajuste fino dos ícones */
.modern-toggle-group .btn-custom i {
    font-size: 1.1rem;
    line-height: 1;
}

/*============================================================================*/

/* ===== CONTAINER QUE ENVOLVE AFOLHA A4 ===== */
#previewContainer {
    background: #dfe3e8;
    padding: 35px 20px;
    border-radius: 16px;
    overflow-x: auto;
}

/* ================= FOLHA A4 ================= */
.a4-container {
    width: 210mm;
    min-height: 297mm;
    background: white;
    margin: 0 auto;
    padding: 15mm;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Cabeçalho da Prova */
.school-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* .logo-box {
    background: var(--primary);
    color: white;
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
} */

/* Caixa mãe (opcional: use para dar margens ou alinhar na página) */
.logo-container {
    display: inline-block;
    /* Faz a div ter exatamente o tamanho do conteúdo */
}

/* A caixa clicável da Logo */
.logo-box {
    display: flex;
    align-items: center;
    justify-content: center;

    /* Tamanho exato solicitado */
    width: 64px;
    height: 64px;

    cursor: pointer;

    /* Configurações da imagem de fundo */
    background-size: contain;
    /* Reduz a imagem para caber inteira sem cortes */
    background-position: center;
    /* Centraliza a imagem */
    background-repeat: no-repeat;
    /* Não duplica a imagem */
}

/* Efeito visual ao passar o mouse */
.logo-box:hover {
    border: 2px dashed var(--primary);
    border-radius: 4px;
}


.school-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.school-sub {
    font-size: 0.9rem;
    color: #6b7280;
}

.exam-title-area {
    text-align: right;
}

.exam-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.exam-sub {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
}

.student-info {
    margin-bottom: 20px;
    gap: 10px;
}

.info-field {
    color: #111111
}

/* Instruções */
.instructions {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 30px;
}

.inst-title {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions ol {
    padding-left: 20px;
    font-size: 0.9rem;
    color: #4b5563;
    margin: 0;
}

/* Questões */
.question-block {
    margin-bottom: 40px;
    /* page-break-inside: avoid; */
    /* Para navegadores antigos/html2pdf */
    /* break-inside: avoid; */
    /* Para navegadores modernos */
}

.question-block .q-text {
    border-left: 5px solid #c7c7c7;
    padding: 5px 10px;
    background: #00000008;
    border-radius: 4px;
}

.question-block .q-text p {
    text-indent: 2rem;
}

.question-block .q-text p:last-child {
    margin-bottom: 0 !important;
}

.q-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.q-badge {
    background-color: #ebebeb;
    padding: 5px;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 490;
}

.q-line {
    height: 2px;
    background-image: linear-gradient(to right, #d7d2cc 0%, #898989 100%);
    flex-grow: 1;
}

.q-text {
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Alternativas */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opt-letter {
    width: 28px;
    height: 28px;
    border: 1px solid #9ca3af;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.opt-text {
    flex-grow: 1;
}

/* ESTILOS MODO PROFESSOR (GABARITO) */
/* .modo-professor .option-item {
    background-color: #ffe2e2;
    border: 1px solid #ffb8b8;
    border-radius: 4px;
} */

.modo-professor .option-item:not(.correct) .opt-text {
    text-decoration: line-through;
}

.modo-professor .discursive-block .opt-comment {
    border-radius: 6px;
    padding: 10px 15px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.modo-professor .vf-item .opt-comment {
    margin-top: 8px;
}

.opt-comment {
    display: none;
    padding: 2px 0 5px;
    text-align: justify;
}

.modo-professor .vf-item .opt-comment {
    padding: 0 !important;
}

/* .modo-professor .option-item:not(.correct) .opt-comment {
    color: #ff008b !important;
} */

.modo-professor .opt-comment {
    display: block;
}

/* .modo-professor .option-item .opt-letter {
    border-color: #c52222;
    background-color: #c52222;
    color: white;
} */

/* .modo-professor .option-item.correct .opt-letter {
    background-color: var(--green-light);
    border-color: var(--green-border);
    color: var(--green-text);
} */

/* =================== COMENTÁRIOS ==================== */
/* .commentary-box {
    display: none;
    background: #f5f5f5;
    border: 1px solid #e3e3e3;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #69736c;
}

.corretas-container {
    background: #e8f5e9;
    border-left: 5px solid #2e7d32 !important;
}

.distratores-container {
    background: #fff5f5;
    border-left: 5px solid #d32f2f !important;
}

.distrator-item:not(:last-child),
.correta-item:not(:last-child) {
    border-bottom: 1px solid #eee;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.comment-title {
    color: #20b2aa;
}

.text-green {
    color: #006400;
}

.text-red {
    color: #bd0000;
}

.modo-professor .commentary-box {
    display: block;
} */

/* .comment-title {
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
} */

/* ================= IMPRESSÃO ================= */
@media print {

    /* Configura a página para o tamanho A4 com margens zeradas */
    @page {
        size: A4;
        margin: 5mm 15mm 5mm 15mm;
        /* Topo, Direita, Baixo, Esquerda */
        padding: 15mm 0;
    }

    body {
        background: white !important;
        padding: 0;
    }

    #section-body-preview {
        background: white !important;
        margin: 0;
    }

    .top-panel,
    .no-print,
    #floating-toolbar {
        display: none !important;
    }

    /* Remove estilizações de layout web (como margens do Bootstrap mt-5/mb-5 e sombras) */
    #previewContainer,
    #section-body-preview {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        background: white !important;
    }

    /* Força o container A4 a ocupar as dimensões exatas do papel */
    #prova-documento {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Força a impressão das cores de fundo (Verde do gabarito) */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* 1. Mantém cada parágrafo inteiro na mesma página (evita cortar texto do <p> ao meio) */
    p {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* 2. Mantém os containers específicos inteiros no mesmo bloco */
    .option-item,
    .vf-item {
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    /* 3. Impede que ocorra uma quebra de página imediatamente após o título de comentários */
    .q-header {
        break-after: avoid !important;
        page-break-after: avoid !important;
    }
}


/* =========================================================
   RESPONSIVIDADE DO PREVIEW
========================================================= */

@media (max-width: 767px) {
    #previewContainer {
        padding: 20px 10px;
    }
}