/* --- Variáveis e Reset --- */
html {
    scroll-behavior: smooth;
}

:root {
    --quiz-primary: var(--contrast);
    --quiz-secondary: #a29bfe;
    --quiz-success: #00b894;
    --quiz-error: #d63031;
    --quiz-bg: #dfe6e9;
    --quiz-card-bg: #ffffff;
    --quiz-text: #2d3436;
}

.quiz-container {
    max-width: 800px;
    margin: 40px auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--quiz-text);
    text-align: center;
    min-height: 400px;
}

/* --- Barra de Progresso --- */
.quiz-header {
    margin-bottom: 20px;
}

.progress-bar-container {
    background: #ccc;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--quiz-primary);
    width: 0%;
    transition: width 0.3s ease;
}

.header-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.quiz-timer {
    font-weight: bold;
    font-family: monospace;
    font-size: 1.2rem;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 5px;
    color: var(--quiz-text);
}

/* --- Catálogo de Avaliações --- */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.catalog-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: var(--quiz-text);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 160px;
}

.catalog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    border-color: var(--quiz-secondary);
}

.catalog-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--quiz-primary);
}

.catalog-meta {
    font-size: 0.9rem;
    color: #636e72;
    margin-bottom: 15px;
}

.catalog-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.catalog-tag {
    background: #dfe6e9;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.catalog-tag.subject { background: #e0f2f1; color: #00695c; }
.catalog-tag.year { background: #fff3e0; color: #e65100; }

.btn-back {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--quiz-primary);
    text-decoration: none;
    font-weight: 600;
}
.btn-back:hover { text-decoration: underline; }

.score-display {
    font-weight: bold;
    color: var(--contrast-3);    
}

/* --- Cartão da Questão --- */
.question-card {
    background: var(--quiz-card-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    animation: slideUp 0.4s ease-out;
}

.question-text {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* --- Imagem de Apoio --- */
.support-image-container {
    text-align: center;
    margin-bottom: 20px;
}

.support-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* --- Opções (Múltipla Escolha e VF) --- */
.options-grid {
    display: grid;
    gap: 15px;
}

.quiz-btn {
    padding: 15px 20px;
    border: 2px solid #eee;
    color: #361b58 !important;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.3rem;
    font-weight: 600;
    text-align: left;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    background-color: #fbfbfa;
}

h1 {
    text-wrap: balance;
}

.quiz-btn:hover {
    background: #ffdc43;
    font-weight: bold;
    transform: translateY(-2px);
}

/* Estados de Feedback */
.quiz-btn.correct {
    background: #e6fffa;
    border-color: var(--quiz-success);
    color: var(--quiz-success);
}

.quiz-btn.wrong {
    background: #fff5f5;
    border-color: var(--quiz-error);
    color: var(--quiz-error);
}

/* --- Layout VF (Verdadeiro ou Falso) --- */
.vf-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vf-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    gap: 15px;
}

.vf-text {
    flex: 1;
    font-size: 1rem;
}

.vf-actions {
    display: flex;
    gap: 10px;
    min-width: 100px;
    justify-content: flex-end;
}

.vf-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: #fff;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vf-btn:hover {
    border-color: var(--quiz-primary);
    color: var(--quiz-primary);
}

.vf-btn.selected {
    background: var(--quiz-primary);
    border-color: var(--quiz-primary);
    color: white;
}

/* Feedback Visual específico para VF no modo revisão */
.vf-row.correct-row {
    border-left: 5px solid var(--quiz-success);
}
.vf-row.wrong-row {
    border-left: 5px solid var(--quiz-error);
}

.vf-btn.btn-v.correct-answer { background: var(--quiz-success); border-color: var(--quiz-success); color: white; }
.vf-btn.btn-f.correct-answer { background: var(--quiz-success); border-color: var(--quiz-success); color: white; }
.vf-btn.wrong-selection { background: var(--quiz-error); border-color: var(--quiz-error); color: white; }

.btn-confirm {
    background: var(--quiz-primary);
    color: white !important;
    text-align: center;
    width: 100%;
    margin-top: 15px;
}
.btn-confirm:hover {
    background: #5649c0;
}

/* --- Input Lacuna --- */
.lacuna-input {
    border: none;
    border-bottom: 2px solid var(--quiz-secondary);
    font-size: 1.2rem;
    padding: 5px 10px;
    width: 150px;
    text-align: center;
    background: #f0f0f0;
    border-radius: 4px;
    margin: 0 5px;
}
.lacuna-input:focus {
    outline: none;
    border-color: var(--quiz-primary);
    background: #fff;
}

/* --- Feedback Area --- */
.feedback-area {
    margin-top: 25px;
    padding: 15px;
    border-radius: 8px;
    display: none; /* Hidden by default */
    animation: fadeIn 0.3s;
}

.feedback-area.success {
    background: #e6fffa;
    border-left: 5px solid var(--quiz-success);
}

.feedback-area.error {
    background: #fff5f5;
    border-left: 5px solid var(--quiz-error);
}

.btn-next {
    background: var(--quiz-primary);
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    float: right;
    display: none; /* Hidden until answer */
}
.btn-next:hover {
    background: #5649c0;
}

/* --- Tela Final --- */
.result-screen {
    text-align: center;
    padding: 40px;
    display: none;
}

.final-score {
    font-size: 3rem;
    font-weight: bold;
    color: var(--quiz-primary);
}

.action-buttons {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-buttons .quiz-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f0f0f0;
}

/* --- Animações --- */
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

@keyframes pulsate {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); box-shadow: 0 0 10px rgba(214, 48, 49, 0.5); }
    100% { transform: scale(1); }
}

.pulsate {
    animation: pulsate 0.8s infinite;
    background: #fff5f5 !important;
    border: 1px solid var(--quiz-error) !important;
}

.transitioning {
    animation: fadeOut 0.3s ease-in forwards;
}

/* --- Responsivo --- */
@media (max-width: 600px) {
    .question-card { padding: 20px; }
    .question-text { font-size: 1.1rem; }
}

/* --- FULLSCREEN MODE --- */
.btn-fullscreen {
    background: transparent;
    border: 1px solid var(--quiz-primary);
    color: var(--quiz-primary);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-fullscreen:hover {
    background: var(--quiz-primary);
    color: white;
}

body.quiz-fullscreen {
    overflow: hidden; /* Hide main scrollbar */
}

/* Hide WordPress standard elements */
body.quiz-fullscreen #wpadminbar,
body.quiz-fullscreen header, 
body.quiz-fullscreen footer,
body.quiz-fullscreen .site-header,
body.quiz-fullscreen .site-footer,
body.quiz-fullscreen .generate-back-to-top {
    display: none !important;
}

/* Force container to fill screen */
body.quiz-fullscreen .grid-container {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    background: var(--quiz-bg);
    overflow-y: auto; /* Scroll inside container */
    padding: 20px;
    margin: 0 !important;
    max-width: none !important;
    display: block !important;
}

/* Center content in fullscreen */
body.quiz-fullscreen #main {
    max-width: 900px;
    margin: 0 auto;
    padding-bottom: 40px;
}