html {
    scroll-behavior: smooth;
}

/* ============================================================
   1. CONFIGURAÇÕES GERAIS E CONTAINER
   ============================================================ */
.pps-simulador {
    max-width: 1000px;
    margin: 40px auto;
    padding: 20px;
    background: #f8fafc;
    border-radius: 14px;
    box-shadow: 0 10px 35px rgba(0,0,0,.08);
    font-family: 'Inter', system-ui, sans-serif;
}

/* Suporte para formatação rica */
.pps-simulador strong, .pps-simulador b { font-weight: 800 !important; color: #000; }
.pps-simulador em, .pps-simulador i { font-style: italic !important; }
.pps-simulador u { text-decoration: underline !important; }


/* ============================================================
    2. SELECT2 - DESIGN PREMIUM (CORREÇÃO DE "ÁREA FANTASMA")
   ============================================================ */
.select2-container { 
    width: 100% !important; 
    font-size: 16px; 
    position: relative;
    /* Removemos o overflow visible que pode estar ajudando o campo a vazar */
    overflow: hidden; 
    border-radius: 10px;
}

/* 1. Prioridade máxima ao abrir */
.select2-container--open {
    z-index: 99999 !important; 
    overflow: visible !important; /* Só permite vazar quando aberto para o dropdown aparecer */
}

/* Container Principal */
.select2-container--default .select2-selection--multiple {
    min-height: 38px !important; 
    height: auto !important;
    border-radius: 10px;
    border: 2px solid #d1d5db !important;
    padding: 2px 8px !important;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    background: #fff;
    transition: all 0.2s;
    position: relative;
    /* Impede que o conteúdo interno (azul da imagem) saia dos limites */
    overflow: hidden !important; 
}

/* Input de Texto - CORREÇÃO CRÍTICA AQUI */
.select2-container--default .select2-selection--multiple .select2-search--inline,
.select2-container--default .select2-selection--multiple .select2-search__field {
    margin: 0 !important;
    padding: 0 !important;
    height: 32px !important; /* Alinhado à altura do container */
    line-height: 32px !important; 
    border: none !important;
    min-width: 50px !important;
    background: transparent !important;
    /* Garante que o campo de busca não se expanda verticalmente além do necessário */
    display: inline-block !important;
    vertical-align: middle !important;
    position: static !important; /* Evita que o absolute o jogue para cima do botão */
}

/* Dropdown (Lista de sugestões) */
.select2-container--default .select2-dropdown {
    border-radius: 0 0 10px 10px;
    border: 2px solid #6366f1 !important;
    border-top: none !important;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    background-color: #fff !important;
    margin-top: -2px !important; 
    padding-top: 2px !important; 
    display: none; 
}

/* Mostra o dropdown APENAS quando o select estiver aberto */
.select2-container--open .select2-dropdown {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 100001 !important;
}

/* Estado Aberto */
.select2-container--open .select2-selection--multiple {
    border-color: #6366f1 !important;
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-bottom-color: #6366f1 !important; 
    overflow: visible !important;
}

/* Destaque das opções */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #6366f1 !important;
    color: #fff !important;
}

/* Tags Selecionadas */
.select2-container--default .select2-selection__choice {
    background: #6366f1 !important;
    border: none !important;
    color: #fff !important;
    padding: 2px 10px !important;
    border-radius: 8px !important;
    margin: 2px 2px !important;
}

.select2-container--default .select2-selection__choice__remove {
    border: none !important;
    color: rgba(255,255,255,0.7) !important;
    margin-right: 5px !important;
}

/* ============================================================
   BOTÃO INICIAR SIMULADO (Ajuste de Posição e Segurança)
   ============================================================ */
/* Se o seu botão usa uma dessas classes ou ID, esse ajuste garante o clique */
#btn-iniciar-simulado, .pps-button-iniciar {
    margin-top: 30px !important; /* Cria um respiro maior entre os Selects e o Botão */
    position: relative;
    z-index: 10; /* Garante que ele fique acima de containers vazios */
    display: block;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    background: #6366f1;
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-weight: 800;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

#btn-iniciar-simulado:hover {
    transform: scale(1.02);
    background: #4f46e5;
}


/* ============================================================
   3. BARRA DE PROGRESSO - VERSÃO REFORÇADA
   ============================================================ */
#pps-progresso, .estatistica .progress-bar {
    width: 100%;
    background-color: #f0f0f0; 
    border-radius: 20px;
    height: 25px;
    margin: 15px 0;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
    border: 1px solid #444;
}

.progress-bar-inner {
    line-height: 25px;
    font-size: 13px;
    height: 100%;
    width: 0%; 
    background: linear-gradient(
        to right, 
        #bf953f 0%, 
        #fcf6ba 45%, 
        #b38728 70%, 
        #fbf5b7 85%, 
        #aa771c 100%
    );
    color: #000000; 
    text-align: center;
    font-weight: bold;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 20px 0 0 20px;
    box-shadow: 0 0 10px rgba(191, 149, 63, 0.4);
}

.progress-bar-inner[style*="width: 100%"] {
    border-radius: 20px;
}

/* ============================================================
   4. QUESTÃO E ENUNCIADO
   ============================================================ */
.pps-question {
    display: none;
    background: #ffffff;
    padding: 35px;
    margin-bottom: 25px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.06);
    border: 1px solid #f1f5f9;
}

.pps-enunciado {
    font-size: 17px;
    line-height: 1.7;
    margin-bottom: 15px;
    padding: 30px; 
    max-height: 250px;   
    overflow-y: auto;    
    background-color: #e5e6e7; 
    color: #000000;            
    border-radius: 12px;
    border-bottom: 5px solid #d4af37;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   5. ALTERNATIVAS
   ============================================================ */
.pps-question ul { list-style: none; padding: 0; counter-reset: alternativa; }

.pps-question input[type="radio"] {
    display: none !important;
}

.pps-question li {
    margin-bottom: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    background: #d5d6d6;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 16px;
    font-weight: 400;
    color: #334155;
    border: 2px solid #e2e8f0;
}

.pps-question li:hover {
    background: #fffdf5;
    transform: translateX(8px);
    border-color: #d4af37; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    color: #856404;
}

.pps-question li.selecionada {
    background: #fef9e7;
    border-color: #d4af37; 
    color: #856404;
    box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.1);
}

.pps-question li.correta { 
    background: #1cb970 !important; 
    border-color: #10b981 !important; 
    color: #012c20 !important; 
}

.pps-question li.errada { 
    background: #ac0202 !important; 
    border-color: #ef4444 !important; 
    color: #220101 !important; 
}

.pps-question.respondida li {
    cursor: default !important;
    transform: none !important;
}

.pps-question.respondida li:hover {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: none !important;
    color: #334155 !important;
}

.pps-question li::before {
    counter-increment: alternativa; 
    content: counter(alternativa, upper-alpha) ") "; 
    margin-right: 10px;
    font-weight: 800;
    color: inherit;
}

/* ============================================================
   6. BOTÕES E EXPLICAÇÃO
   ============================================================ */
.pps-button-corrigir, .pps-button-next {
    margin-top: 10px;
    margin-right: 12px;
    padding: 12px 25px;
    width: auto;
    border: none;
    display: inline-block;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pps-button-corrigir { background: #d97706; box-shadow: 0 10px 20px rgba(79, 70, 229, 0.2); }
.pps-button-next { background: #0a865d; box-shadow: 0 10px 20px rgba(16, 185, 129, 0.2); }

.pps-explicacao {
    margin-top: 25px;
    padding: 20px;
    background: #fffbeb;
    border-left: 6px solid #f59e0b;
    border-radius: 12px;
    display: none;
    font-size: 16px;
    line-height: 1.7;
}

/* ============================================================
   7. ENUNCIADO DO NUMERADOS DAS QUESTOES
   ============================================================ */
.pps-question-counter {
    display: inline-block; 
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #000000; 
    padding: 2px 8px;
    margin-bottom: 10px; 
    margin-top: 10px;
    background-color: #f1f5f9;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.pps-question {
    position: relative; /* Garante que elementos internos respeitem o container */
    padding-top: 50px !important; /* Abre espaço extra no topo para o contador */
}

.pps-question-counter {
    position: absolute;
    top: 15px;
    left: 35px;
    z-index: 5;
}

/* ============================================================
   8. VISUAL DAS ESTATISTICAS
   ============================================================ */
.pps-resultado-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.pps-stat-card {
    background: linear-gradient(145deg, #ffffff 0%, #f1f5f9 100%);
    border-radius: 16px;
    padding: 22px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.pps-stat-card:hover {
    transform: translateY(-5px);
    border-color: #94a3b8;
}

.pps-stat-principal {
    text-align: center;
    border-top: 5px solid #d4af37;
    background: linear-gradient(to bottom, #fffdf5, #ffffff);
}

.pps-stat-principal .pps-stat-value {
    display: block;
    font-size: 42px;
    font-weight: 800;
    color: #1e293b;
    margin: 10px 0;
}

.pps-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.pps-stat-card .pps-stat-category {
    font-size: 17px;
    color: #464647;
    display: block;
    margin-bottom: 5px;
}

.pps-stat-card .pps-stat-name {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.pps-stat-card .pps-stat-hits {
    display: block;       /* Força a quebra de linha */
    font-size: 14px;
    font-weight: 600;
    color: #10b981;
    margin-top: 5px; /* Espaço entre o nome da matéria e os acertos */
    margin-bottom: 10px;  /* Espaço entre os acertos e a barra dourada */
}

.pps-stat-grid .pps-stat-card {
    border-left: 4px solid #6366f1;
}

/* ============================================================
   9. RESPONSIVIDADE
   ============================================================ */
@media (max-width: 700px) {
    .pps-simulador {
        max-width: 900px;
        margin: 10px auto;
        padding: 15px;
    }
}

/* ============================================================
   10. BARRA DOS CARD DE FEEDBACK
   ============================================================ */
/* Container da barra (o fundo cinza) */
.pps-stat-card .progress-bar {
    width: 100%;
    background-color: #e2e8f0 !important; /* Cinza claro para o fundo */
    border-radius: 10px;
    height: 20px; /* Aumentei um pouco a altura para o texto caber melhor */
    margin-top: 10px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

/* A parte preenchida (dourada) */
.pps-stat-card .progress-bar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #000000 !important; /* Texto em preto como solicitado */
    background: linear-gradient(to right, #bf953f, #fcf6ba, #b38728);
    transition: width 0.8s ease-in-out;
    border-radius: 10px 0 0 10px;
}


/* ============================================================
   11. AJUSTES DE RESPONSIVIDADE (MOBILE & TABLET)
   ============================================================ */

@media (max-width: 768px) {
    /* Ajuste do container principal */
    .pps-simulador {
        margin: 10px auto;
        padding: 15px;
        border-radius: 0; /* Remove arredondamento nas bordas em telas pequenas para ganhar espaço */
    }

    /* Redução de espaçamentos internos para não "espremer" o texto */
    .pps-question {
        padding: 20px 15px;
        margin-bottom: 15px;
    }

    /* Enunciado: Remove o scroll interno no mobile para facilitar a leitura */
    .pps-enunciado {
        padding: 15px;
        font-size: 16px;
        max-height: none; 
        overflow-y: visible;
        line-height: 1.6;
    }

    /* Alternativas: Aumenta a área de toque (UX) */
    .pps-question li {
        padding: 15px;
        font-size: 15px;
        margin-bottom: 10px;
        line-height: 1.4;
    }

    /* Botões: Ocupam a largura total para facilitar o clique com o polegar */
    .pps-button-corrigir, 
    .pps-button-next {
        width: 100%;
        margin-right: 0;
        margin-top: 10px;
        padding: 15px;
        display: block;
        text-align: center;
    }

    /* Ajuste das estatísticas finais */
    .pps-stat-grid {
        grid-template-columns: 1fr; /* Força uma coluna única no celular */
        gap: 10px;
    }

    .pps-stat-principal .pps-stat-value,
    .pps-tempo-resumo .pps-stat-value {
        font-size: 32px; /* Diminui o número grande para não quebrar */
    }
}

/* Ajustes para Tablets e telas médias */
@media (min-width: 769px) and (max-width: 1024px) {
    .pps-simulador {
        max-width: 90%;
    }
    
    .pps-stat-grid {
        grid-template-columns: repeat(2, 1fr); /* Duas colunas no Tablet */
    }
}

/* Melhoria para dispositivos Touch (dedo vs mouse) */
@media (pointer: coarse) {
    .pps-question li:hover {
        transform: none; /* Remove o efeito de deslocamento lateral que pode ser estranho no touch */
    }
}

/* ============================================================
   12. TIMER DO SIMULADO
   ============================================================ */
#pps-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
    padding: 14px 28px;
    border-radius: 16px;
    font-size: 28px;
    font-weight: 800;
    font-family: 'Inter', monospace, sans-serif;
    margin: 15px 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    letter-spacing: 2px;
    position: sticky;
    top: 10px;
    z-index: 100;
    transition: all 0.3s ease;
}

.pps-timer-icon {
    font-size: 24px;
}

#pps-timer.pps-timer-urgente {
    background: linear-gradient(135deg, #991b1b 0%, #dc2626 100%);
    animation: pps-timer-pulse 1s ease-in-out infinite;
    box-shadow: 0 8px 30px rgba(220, 38, 38, 0.4);
}

#pps-timer.pps-timer-expirado {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    animation: none;
    opacity: 0.85;
}

@keyframes pps-timer-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); box-shadow: 0 8px 35px rgba(220, 38, 38, 0.6); }
}

/* ============================================================
   13. TABELA DE TEMPO NO FEEDBACK
   ============================================================ */
.pps-tempo-resumo {
    text-align: center;
    border-top: 5px solid #d4af37;
    background: linear-gradient(to bottom, #fffdf5, #ffffff);
}

.pps-tempo-resumo .pps-stat-value {
    display: block;
    font-size: 42px;
    font-weight: 800;
    color: #1e293b;
    margin: 10px 0;
}

/* ============================================================
   FORMULÁRIO DE CONFIGURAÇÃO DO SIMULADO (NOVO VISUAL)
   ============================================================ */
.pps-modern-form {
    background: #ffffff;
    padding: 25px 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    margin-bottom: 30px;
}

.pps-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.pps-modern-form label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pps-select-modern {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background-color: #f8fafc;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

.pps-select-modern:focus {
    outline: none;
    border-color: #6366f1;
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.pps-form-group-full {
    margin-bottom: 20px;
}

.pps-form-submit {
    text-align: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #f1f5f9;
}

.pps-form-submit button {
    font-size: 18px;
    padding: 16px 40px;
}

/* Ajustes visuais para o Select2 (Matéria, Banca, Conteúdo) */
.select2-container--default .select2-selection--multiple {
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    min-height: 48px !important;
    padding: 4px 8px !important;
    background-color: #f8fafc !important;
    transition: all 0.2s ease;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #6366f1 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15) !important;
}

.select2-container--default .select2-dropdown {
    border: 1px solid #cbd5e1 !important;
    border-radius: 12px !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15) !important;
    margin-top: 8px !important; /* Afasta a caixa de sugestão para não cobrir o campo de digitação */
    overflow: hidden;
}

.select2-container--default .select2-dropdown--above {
    margin-top: -8px !important; /* Caso abra para cima, afasta para cima */
    box-shadow: 0 -15px 30px rgba(0, 0, 0, 0.15) !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #4f46e5 !important; /* Cor de destaque azul premium */
    color: white !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #e0e7ff !important;
    border: 1px solid #c7d2fe !important;
    color: #3730a3 !important;
    border-radius: 6px !important;
    padding: 4px 10px 4px 28px !important; /* Padding maior na esquerda (28px) para dar espaço ao 'x' */
    font-size: 14px;
    font-weight: 600;
    position: relative; /* Garante que o 'x' absoluto fique posicionado corretamente */
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    color: #4f46e5 !important;
    border: none !important; /* Remove a borda que estava riscando o texto */
    font-weight: 900;
    transition: color 0.2s ease;
    position: absolute !important;
    left: 8px !important; /* Posiciona o 'x' exatamente na área de padding que criamos acima */
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #ef4444 !important;
    background: transparent !important;
}

.pps-tempo-tabela-wrapper {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
    margin-top: 10px;
}

.pps-tempo-tabela {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.pps-tempo-tabela thead {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f8fafc;
}

.pps-tempo-tabela th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pps-tempo-tabela td {
    padding: 12px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.pps-tempo-tabela tbody tr {
    transition: all 0.2s ease;
}

.pps-tempo-tabela tbody tr:last-child td {
    border-bottom: none;
}

/* Tabela Interativa (Click para Revisar) */
.pps-tabela-hoverable tbody tr {
    cursor: pointer;
}

.pps-tabela-hoverable tbody tr:hover {
    background: #eef2ff !important;
    transform: scale(1.01);
    box-shadow: -4px 0 0 #6366f1, 4px 0 0 #6366f1;
    z-index: 10;
    position: relative;
}

.pps-resultado-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.pps-resultado-badge.pps-tempo-acerto {
    background: #dcfce7;
    color: #166534;
}

.pps-resultado-badge.pps-tempo-erro {
    background: #fee2e2;
    color: #991b1b;
}

.pps-resultado-badge.pps-tempo-nao-respondida {
    background: #f3f4f6;
    color: #6b7280;
}

.pps-tempo-valor {
    font-family: 'Inter', monospace, sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #1e293b;
    letter-spacing: 1px;
}

/* Responsivo - Timer e Tabela de Tempo */
@media (max-width: 768px) {
    #pps-timer {
        font-size: 22px;
        padding: 10px 20px;
        border-radius: 12px;
        position: sticky;
        top: 5px;
    }

    .pps-tempo-tabela th,
    .pps-tempo-tabela td {
        padding: 10px 12px;
        font-size: 13px;
    }

    .pps-tempo-valor {
        font-size: 14px;
    }

    .pps-resultado-badge {
        font-size: 11px;
        padding: 3px 10px;
    }
}