/* Quiz Educacional Pro - Public Styles (Cores da marca) */
.qep-quiz {
    width: 100%; max-width: 100%;
    margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #2d3748;
}

/* Cabeçalho: gradiente vermelho da marca */
.qep-quiz-header {
    background: linear-gradient(135deg, #d42b42, #a52233);
    color: #fff; padding: 28px 24px; border-radius: 8px 8px 0 0;
}
.qep-quiz-header h2 { margin: 0 0 4px; font-size: 22px; }
.qep-quiz-desc { margin: 0; opacity: 0.9; font-size: 14px; }

.qep-quiz-body {
    background: #fff; border: 1px solid #e2e8f0; border-top: none;
    padding: 24px; border-radius: 0 0 8px 8px; min-height: 200px;
}
.qep-quiz-body.qep-result-view { padding-bottom: 0; }

/* Instruções */
.qep-instrucoes {
    background: #fff5e3; border-left: 4px solid #ffa200;
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
}
.qep-instrucoes strong { display: block; margin-bottom: 4px; color: #8e5a00; }
.qep-instrucoes p { margin: 0; font-size: 14px; }

/* Alertas */
.qep-alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px; }
.qep-alert.info { background: #e7f2fb; color: #154d78; border: 1px solid #87beea; }
.qep-alert.error { background: #fae7ea; color: #761825; border: 1px solid #e78996; }
.qep-alert a { color: inherit; font-weight: 600; }

/* Botões */
.qep-btn {
    border: none; border-radius: 6px; padding: 12px 22px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: background 0.15s, transform 0.1s; display: inline-block;
}
.qep-btn:active { transform: scale(0.98); }
.qep-btn-primary { background: #278ad8; color: #fff; }
.qep-btn-primary:hover { background: #1e6ca8; }
.qep-btn-secondary { background: #e2e8f0; color: #2d3748; }
.qep-btn-secondary:hover { background: #cbd5e0; }
.qep-btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.qep-btn-submit { background: #2c989b; color: #fff; }
.qep-btn-submit:hover { background: #1f6c6e; }

/* Barra de progresso: gradiente verde da marca */
.qep-progress-wrap { margin-bottom: 24px; }
.qep-progress { height: 10px; background: #edf2f7; border-radius: 999px; overflow: hidden; }
.qep-progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #38c3c7, #2c989b);
    transition: width 0.3s ease; border-radius: 999px;
}
.qep-progress-label { font-size: 13px; color: #718096; margin-top: 6px; text-align: right; }

/* Exercício */
.qep-exercicio { animation: qep-fadein 0.3s ease; }
@keyframes qep-fadein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.qep-exercicio-enunciado {
    background: #f7fafc; border-left: 4px solid #278ad8;
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px;
    font-size: 15px; font-style: italic;
}

/* Áudio */
.qep-audio-player { margin-bottom: 20px; }
.qep-audio-player audio { width: 100%; max-width: 400px; }

/* Pergunta: numero e enunciado lado a lado */
.qep-pergunta { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid #edf2f7; }
.qep-pergunta:last-child { border-bottom: none; margin-bottom: 0; }
.qep-pergunta-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 12px; }
.qep-pergunta-numero { font-weight: 700; color: #278ad8; font-size: 16px; flex-shrink: 0; }
.qep-pergunta-enunciado { font-size: 16px; line-height: 1.5; }

/* Input de texto */
.qep-text-answer {
    width: 100%; max-width: 300px; padding: 10px 14px;
    border: 2px solid #cbd5e0; border-radius: 8px; font-size: 16px;
    transition: border-color 0.15s;
}
.qep-text-answer:focus { outline: none; border-color: #278ad8; }

/* Opções: label + radio nativo (não usa button para evitar conflito com tema WP) */
.qep-opcoes-lista { display: flex; flex-direction: column; gap: 8px; }

.qep-option-label {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    background: #ffffff !important;
    color: #2d3748 !important;
    border-radius: 8px; cursor: pointer; font-size: 15px;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.qep-option-label:hover {
    border-color: #278ad8;
    background: #f7fafc !important;
}
.qep-option-label.selected {
    border-color: #278ad8;
    background: #e7f2fb !important;
    color: #154d78 !important;
    font-weight: 600;
}

/* Radio input nativo oculto */
.qep-radio-input {
    position: absolute; opacity: 0; width: 0; height: 0; margin: 0;
}

/* Círculo customizado */
.qep-radio-custom {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid #cbd5e0; flex-shrink: 0;
    background: #fff; position: relative; transition: all 0.15s;
}
.qep-option-label:hover .qep-radio-custom { border-color: #278ad8; }
.qep-option-label.selected .qep-radio-custom {
    border-color: #278ad8; background: #278ad8;
}
.qep-option-label.selected .qep-radio-custom::after {
    content: ''; position: absolute;
    left: 4px; top: 1px; width: 6px; height: 10px;
    border: solid #fff; border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.qep-option-text { flex: 1; }

/* Navegação */
.qep-nav-actions {
    display: flex; justify-content: space-between; gap: 10px;
    margin-top: 28px; padding: 24px; border-top: 1px solid #edf2f7;
}

/* Loading */
.qep-loading { text-align: center; padding: 40px; color: #718096; font-size: 14px; }

/* Resultado */
.qep-results { text-align: center; animation: qep-fadein 0.4s ease; }
.qep-results h2 { font-size: 24px; margin: 0 0 16px; color: #1a202c; }
.qep-result-percentage { font-size: 64px; font-weight: 800; color: #278ad8; margin: 10px 0; line-height: 1; }
.qep-result-percentage.high { color: #2c989b; }
.qep-result-percentage.low { color: #d42b42; }
.qep-result-correct { font-size: 18px; color: #4a5568; margin: 8px 0 20px; }
.qep-result-wrong {
    background: #fae7ea; border: 1px solid #e78996; border-radius: 8px;
    padding: 14px; margin: 16px auto; max-width: 500px; color: #761825; font-size: 15px;
}
.qep-result-wrong strong { display: block; margin-bottom: 4px; }
.qep-result-wrong .qep-wrong-numbers { font-size: 20px; font-weight: 700; letter-spacing: 2px; }
.qep-result-perfect {
    background: #e9f8f9; border: 1px solid #64d0d3; border-radius: 8px;
    padding: 16px; margin: 16px auto; max-width: 500px;
    color: #1f6c6e; font-size: 16px; font-weight: 600;
}
.qep-result-repeat { margin-top: 24px; }
.qep-result-image { display: block; width: 222px; margin: 20px auto 0; }

/* ====== Arrasta e Solta (neutro com azul) ====== */
.qep-pergunta-arrasta {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px;
    margin-bottom: 20px; padding-bottom: 16px;
    border-bottom: 1px solid #edf2f7; font-size: 16px; line-height: 2.4;
}
.qep-pergunta-arrasta .qep-pergunta-numero { font-weight: 700; color: #278ad8; margin-right: 4px; }

.qep-drop-zone {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 100px; min-height: 38px;
    border: 2px dashed #cbd5e0; border-radius: 8px;
    background: #f7fafc; vertical-align: middle;
    transition: all 0.15s; cursor: pointer; margin: 0 4px; padding: 4px 12px;
}
.qep-drop-zone.qep-drag-over { border-color: #278ad8; background: #e7f2fb; border-style: solid; transform: scale(1.02); }
.qep-drop-zone.qep-zone-active { border-color: #278ad8; background: #e7f2fb; animation: qep-pulse 1s infinite; }
@keyframes qep-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(39,138,216,0.3); } 50% { box-shadow: 0 0 0 6px rgba(39,138,216,0); } }
.qep-drop-zone.qep-zone-filled { border-style: solid; border-color: #278ad8; background: #fff; }

.qep-placed-item {
    display: inline-block; padding: 4px 12px; background: #278ad8; color: #fff;
    border-radius: 6px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.qep-placed-item:hover { background: #1e6ca8; }

.qep-drag-bank { margin-top: 24px; padding: 16px; background: #f7fafc; border: 1px solid #e2e8f0; border-radius: 10px; }
.qep-drag-bank-label { font-weight: 700; color: #2d3748; margin: 0 0 4px; font-size: 15px; }
.qep-drag-hint { font-size: 12px; color: #718096; margin: 0 0 12px; }
.qep-drag-options { display: flex; flex-wrap: wrap; gap: 10px; }
.qep-drag-item {
    padding: 10px 18px; background: #fff; border: 2px solid #cbd5e0; border-radius: 8px;
    font-size: 14px; font-weight: 600; color: #2d3748; cursor: grab; user-select: none; transition: all 0.15s;
}
.qep-drag-item:hover { border-color: #278ad8; color: #154d78; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(39,138,216,0.2); }
.qep-drag-item:active { cursor: grabbing; }
.qep-drag-item.qep-dragging { opacity: 0.4; }
.qep-drag-item.qep-selected { border-color: #278ad8; background: #e7f2fb; color: #154d78; box-shadow: 0 0 0 3px rgba(39,138,216,0.3); }
.qep-drag-item.qep-item-used { opacity: 0.3; pointer-events: none; border-color: #e2e8f0; color: #a0aec0; }

/* ====== Dashboard do Aluno (100% largura) ====== */
.qep-dashboard { width: 100%; max-width: 100%; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #2d3748; }
.qep-dashboard-header { background: linear-gradient(135deg, #d42b42, #a52233); color: #fff; padding: 28px 24px; border-radius: 8px 8px 0 0; }
.qep-dashboard-header h2 { margin: 0 0 4px; font-size: 22px; }
.qep-dashboard-subtitle { margin: 0; opacity: 0.9; font-size: 14px; }
.qep-dashboard-body { background: #fff; border: 1px solid #e2e8f0; border-top: none; padding: 24px; border-radius: 0 0 8px 8px; }

.qep-dashboard-section { margin-bottom: 32px; }
.qep-dashboard-section:last-child { margin-bottom: 0; }
.qep-dashboard-section-title { font-size: 18px; font-weight: 700; color: #1a202c; margin: 0 0 16px; padding-bottom: 8px; border-bottom: 2px solid #278ad8; }

.qep-categoria-card { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.qep-categoria-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #f7fafc; cursor: pointer; }
.qep-categoria-header:hover { background: #e7f2fb; }
.qep-categoria-name { font-weight: 700; font-size: 15px; flex: 1; }
.qep-categoria-stats { font-size: 13px; color: #718096; }
.qep-toggle-icon { font-size: 12px; color: #a0aec0; transition: transform 0.2s; }
.qep-categoria-header.expanded .qep-toggle-icon { transform: rotate(180deg); }
.qep-categoria-body { padding: 8px 16px; }
.qep-prova-resumo { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #edf2f7; }
.qep-prova-resumo:last-child { border-bottom: none; }
.qep-prova-resumo.nao-feita { opacity: 0.6; }
.qep-prova-info { flex: 1; }
.qep-prova-info strong { display: block; font-size: 14px; }
.qep-prova-info .qep-muted { font-size: 12px; color: #718096; }
.qep-prova-status { display: flex; gap: 6px; }
.qep-badge.done { background: #e9f8f9; color: #1f6c6e; }
.qep-badge.score { background: #e9f8f9; color: #1f6c6e; }
.qep-badge.pending { background: #f0f0f1; color: #646970; }

.qep-historico-dia { margin-bottom: 16px; }
.qep-historico-data { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; color: #278ad8; margin-bottom: 8px; padding: 6px 0; border-bottom: 1px solid #e2e8f0; }
.qep-historico-tentativa { border: 1px solid #e2e8f0; border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.qep-tentativa-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; cursor: pointer; }
.qep-tentativa-header:hover { background: #f7fafc; }
.qep-tentativa-header.expanded .qep-toggle-icon { transform: rotate(180deg); }
.qep-tentativa-info strong { font-size: 14px; }
.qep-tentativa-info .qep-muted { font-size: 12px; color: #718096; }
.qep-tentativa-resultado { display: flex; align-items: center; gap: 10px; }
.qep-tentativa-nota { font-size: 20px; font-weight: 800; color: #278ad8; min-width: 50px; text-align: right; }
.qep-tentativa-nota.high { color: #2c989b; }
.qep-tentativa-nota.low { color: #d42b42; }
.qep-tentativa-acertos { font-size: 13px; color: #4a5568; }
.qep-tentativa-detalhes { padding: 14px 16px; background: #f7fafc; }
.qep-tentativa-erradas { background: #fae7ea; border: 1px solid #e78996; border-radius: 6px; padding: 10px 12px; }
.qep-tentativa-erradas strong { display: block; margin-bottom: 4px; font-size: 13px; color: #761825; }
.qep-tentativa-erradas .qep-wrong-numbers { font-size: 18px; font-weight: 700; color: #761825; letter-spacing: 2px; }

/* Modal de Revisão de Respostas */
#qep-review-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); z-index: 9999;
}
#qep-review-modal-overlay.active { display: flex; align-items: center; justify-content: center; }
#qep-review-modal {
    background: #fff; border-radius: 8px; max-width: 900px; width: 90%;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}
.qep-review-close-icon {
    position: absolute; top: 16px; right: 16px; z-index: 10;
    width: 32px; height: 32px; border-radius: 50%; border: none;
    background: rgba(255, 255, 255, 0.9); color: #2d3748;
    font-size: 20px; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.qep-review-close-icon:hover { background: #fff; color: #d42b42; }

/* Modo Revisão de Respostas (reaproveita o layout da prova) */
.qep-review-mode .qep-quiz-header { background: linear-gradient(135deg, #278ad8, #1e5fa8); }

/* Somente-leitura: desabilita interação visualmente */
.qep-review-mode .qep-text-answer,
.qep-review-mode .qep-radio-input { cursor: not-allowed; }
.qep-review-mode .qep-option-label { cursor: default; pointer-events: none; }
.qep-review-mode .qep-drag-bank { display: none; }
.qep-review-mode .qep-drop-zone { cursor: default; pointer-events: none; }

/* Indicador de acerto/erro abaixo de cada resposta */
.qep-status-indicator {
    display: flex; width: fit-content; align-items: center; gap: 6px;
    margin-top: 10px; padding: 6px 12px; border-radius: 6px;
    font-weight: 600; font-size: 13px;
}
.qep-status-indicator.resposta-correta { background: #d5f4e6; color: #1e7a45; border-left: 4px solid #27ae60; }
.qep-status-indicator.resposta-errada { background: #fadbd8; color: #a5322a; border-left: 4px solid #e74c3c; }

.qep-review-mode .qep-text-answer.resposta-correta { border-color: #27ae60; background: #e8f8f0; }
.qep-review-mode .qep-text-answer.resposta-errada { border-color: #e74c3c; background: #fadbd8; }

.qep-btn-secondary { background: #cbd5e0; color: #2d3748; border: none; }
.qep-btn-secondary:hover { background: #a0aec0; }

/* Modal de Confirmação (substitui window.confirm) */
#qep-confirm-modal-overlay {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.5); z-index: 10000;
}
#qep-confirm-modal-overlay.active { display: flex; align-items: center; justify-content: center; }
#qep-confirm-modal {
    background: #fff; border-radius: 10px; max-width: 420px; width: 90%;
    padding: 28px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    text-align: center; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.qep-confirm-message { font-size: 16px; color: #2d3748; line-height: 1.5; margin-bottom: 22px; }
.qep-confirm-actions { display: flex; justify-content: center; gap: 12px; }
.qep-confirm-actions .qep-btn { min-width: 120px; }

#qep-repeat-btn { background: #fff; border: 2px solid #d42b42; color: #d42b42; font-weight: 600; }
#qep-repeat-btn:hover { background: #d42b42; color: #fff; }

@media (max-width: 600px) {
    .qep-quiz-body, .qep-dashboard-body { padding: 16px; }
    .qep-quiz-header, .qep-dashboard-header { padding: 20px 16px; }
    .qep-nav-actions { flex-direction: column-reverse; }
    .qep-nav-actions .qep-btn { width: 100%; }
    .qep-result-percentage { font-size: 48px; }
    .qep-text-answer { max-width: 100%; }
    .qep-pergunta-header { flex-direction: row; }
    .qep-prova-resumo { flex-direction: column; align-items: flex-start; gap: 6px; }
    .qep-tentativa-header { flex-direction: column; align-items: flex-start; gap: 6px; }
    .qep-tentativa-resultado { width: 100%; justify-content: space-between; }
}