/* Quiz IA - Estilos Frontend (responsivo e adaptativo) */

.quiz-ia-container {
    box-sizing: border-box;
    width: 100%;
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.quiz-ia-container *,
.quiz-ia-container *::before,
.quiz-ia-container *::after {
    box-sizing: border-box;
}

.quiz-ia-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 3px;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
}

.quiz-step {
    display: none;
    background: #ffffff;
    border-radius: 18px;
    padding: 40px;
    min-height: 280px;
    animation: fadeIn 0.5s ease-in-out;
}

.quiz-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quiz-header {
    text-align: center;
    margin-bottom: 40px;
}

.quiz-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 15px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-description {
    font-size: 16px;
    color: #718096;
    line-height: 1.6;
}

.quiz-content h3 {
    font-size: 24px;
    color: #2d3748;
    margin-bottom: 30px;
    font-weight: 600;
}

/* Formulário de Informações */
.quiz-form {
    max-width: 500px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Barra de Progresso */
.quiz-progress {
    margin-bottom: 40px;
}

.quiz-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.quiz-progress-text {
    text-align: center;
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

/* Pergunta */
.quiz-question-image {
    text-align: center;
    margin-bottom: 20px;
}

.quiz-question-image img {
    max-width: 100%;
    max-height: 250px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-question-video {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-question-video-youtube iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 315px;
    border: none;
}

.quiz-question-video-upload video {
    width: 100%;
    max-height: 400px;
    display: block;
}

/* Mensagem final - imagem e vídeo */
.quiz-loading-success-media {
    margin-bottom: 20px;
}

.quiz-success-image {
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-success-image img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
}

.quiz-success-video {
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.quiz-success-video-yt iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 315px;
    border: none;
}

.quiz-success-video-upload video {
    width: 100%;
    max-height: 300px;
    display: block;
}

.quiz-question-emoji {
    font-size: 1.5em;
    margin-right: 10px;
    vertical-align: middle;
}

.quiz-question-text {
    font-size: 22px;
    color: #2d3748;
    margin-bottom: 30px;
    line-height: 1.5;
}

.quiz-question-text strong {
    font-weight: 700;
    color: #1a202c;
}

.quiz-question-text em {
    font-style: italic;
    color: #667eea;
}

/* Opções */
.quiz-options {
    margin-bottom: 40px;
}

.quiz-option {
    display: block;
    padding: 18px 24px;
    margin-bottom: 15px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.quiz-option:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateX(5px);
}

.quiz-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.quiz-option input[type="radio"]:checked+.quiz-option-text {
    color: #667eea;
    font-weight: 600;
}

.quiz-option input[type="radio"]:checked~* {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.quiz-option-text {
    display: block;
    font-size: 16px;
    color: #4a5568;
    line-height: 1.5;
}

/* Botões */
.quiz-btn {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quiz-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.quiz-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.quiz-btn-primary:active {
    transform: translateY(0);
}

.quiz-btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.quiz-btn-secondary:hover {
    background: #cbd5e0;
}

/* Navegação */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.quiz-navigation .quiz-btn {
    flex: 1;
}

/* Loading */
.quiz-step-loading {
    text-align: center;
}

.quiz-loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 30px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.quiz-step-loading h3 {
    color: #2d3748;
    margin-bottom: 15px;
}

.quiz-step-loading p {
    color: #718096;
    font-size: 16px;
}

.quiz-final-buttons-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.quiz-final-buttons-wrap .quiz-final-btn {
    display: inline-block;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    color: #fff !important;
    transition: filter 0.2s;
}

.quiz-final-buttons-wrap .quiz-final-btn:hover {
    filter: brightness(1.1);
}

/* Página de Resultado com Pontuação */
.quiz-result-score-wrap {
    text-align: center;
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
}

.quiz-result-score-label {
    font-size: 14px;
    color: #718096;
    margin-bottom: 8px;
}

.quiz-result-score-value {
    font-size: 36px;
    font-weight: 700;
    color: #2d3748;
}

.quiz-result-score-pct {
    font-size: 20px;
    font-weight: 600;
    color: #667eea;
    margin-top: 5px;
}

.quiz-result-title {
    font-size: 22px;
    color: #2d3748;
    margin: 0 0 15px;
}

.quiz-result-text {
    font-size: 16px;
    line-height: 1.6;
    color: #4a5568;
    margin-bottom: 25px;
}

.quiz-result-content {
    text-align: left;
}

.quiz-result-image {
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
}

.quiz-result-image img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 320px;
    object-fit: contain;
}

.quiz-result-content .quiz-result-markdown {
    margin-bottom: 25px;
}

.quiz-result-content .quiz-result-markdown h2,
.quiz-result-content .quiz-result-markdown h3,
.quiz-result-content .quiz-result-markdown h4 {
    margin: 1em 0 0.5em;
    color: #2d3748;
}

.quiz-result-content .quiz-result-markdown h2 { font-size: 1.35em; }
.quiz-result-content .quiz-result-markdown h3 { font-size: 1.2em; }
.quiz-result-content .quiz-result-markdown h4 { font-size: 1.05em; }

.quiz-result-content .quiz-result-markdown ul,
.quiz-result-content .quiz-result-markdown ol {
    margin: 0.75em 0;
    padding-left: 1.5em;
}

.quiz-result-content .quiz-result-markdown li {
    margin: 0.35em 0;
}

.quiz-result-content .quiz-result-markdown a {
    color: #667eea;
    text-decoration: underline;
}

.quiz-result-content .quiz-result-markdown a:hover {
    color: #5a67d8;
}

.quiz-result-continue-btn {
    display: block;
    margin: 0 auto;
    width: 100%;
    max-width: 320px;
}

/* ========== Responsivo e adaptativo ========== */

/* Tablet e telas médias */
@media (max-width: 1024px) {
    .quiz-ia-container {
        padding: 16px;
        margin: 24px auto;
    }

    .quiz-step {
        padding: 28px 24px;
        min-height: 260px;
    }

    .quiz-header h2 {
        font-size: clamp(22px, 4vw, 28px);
    }

    .quiz-content h3,
    .quiz-question-text {
        font-size: clamp(16px, 2.5vw, 20px);
    }

    .quiz-option {
        padding: 14px 18px;
    }

    .quiz-option-text {
        font-size: 15px;
    }

    .quiz-btn {
        padding: 12px 24px;
        font-size: 15px;
    }

    .quiz-navigation {
        gap: 12px;
    }

    .quiz-result-score-value {
        font-size: 28px;
    }

    .quiz-result-score-pct {
        font-size: 18px;
    }

    .quiz-result-title {
        font-size: 20px;
    }

    .quiz-result-text {
        font-size: 15px;
    }
}

/* Celular e telas pequenas */
@media (max-width: 768px) {
    .quiz-ia-container {
        padding: 12px;
        margin: 16px auto;
    }

    .quiz-ia-wrapper {
        border-radius: 16px;
        padding: 2px;
    }

    .quiz-step {
        padding: 20px 16px;
        border-radius: 14px;
        min-height: 240px;
    }

    .quiz-header {
        margin-bottom: 24px;
    }

    .quiz-header h2 {
        font-size: 22px;
        line-height: 1.3;
    }

    .quiz-description {
        font-size: 14px;
    }

    .quiz-content h3,
    .quiz-question-text {
        font-size: 18px;
        margin-bottom: 20px;
    }

    /* Opções: sempre 1 coluna em telas pequenas */
    .quiz-ia-container .quiz-options {
        grid-template-columns: 1fr !important;
        gap: 10px;
        margin-bottom: 28px;
    }

    .quiz-option {
        padding: 14px 16px;
        margin-bottom: 0;
    }

    .quiz-option-text {
        font-size: 15px;
    }

    .quiz-option:hover {
        transform: none;
    }

    .quiz-navigation {
        flex-direction: column;
        gap: 10px;
        margin-top: 8px;
    }

    .quiz-navigation .quiz-btn {
        width: 100%;
    }

    .quiz-form {
        max-width: 100%;
    }

    .form-group input {
        padding: 12px 14px;
        font-size: 16px; /* evita zoom no iOS */
    }

    .quiz-progress {
        margin-bottom: 24px;
    }

    .quiz-progress-text {
        font-size: 13px;
    }

    .quiz-result-score-wrap {
        padding: 18px 16px;
        margin-bottom: 20px;
    }

    .quiz-result-score-value {
        font-size: 26px;
    }

    .quiz-result-score-pct {
        font-size: 16px;
    }

    .quiz-result-title {
        font-size: 18px;
    }

    .quiz-result-text {
        font-size: 14px;
    }

    .quiz-result-continue-btn {
        max-width: 100%;
    }

    .quiz-result-image img {
        max-height: 240px;
    }

    .quiz-loading-spinner {
        width: 48px;
        height: 48px;
        margin-bottom: 20px;
    }

    .quiz-step-loading h3 {
        font-size: 20px;
    }

    .quiz-step-loading p {
        font-size: 14px;
    }

    .quiz-final-buttons-wrap {
        flex-direction: column;
    }

    .quiz-final-buttons-wrap .quiz-final-btn {
        width: 100%;
        text-align: center;
    }

    .quiz-question-image img {
        max-height: 180px;
    }
}

/* Telas muito pequenas (celular em retrato) */
@media (max-width: 480px) {
    .quiz-ia-container {
        padding: 10px;
        margin: 12px auto;
    }

    .quiz-step {
        padding: 16px 12px;
        min-height: 220px;
    }

    .quiz-header h2 {
        font-size: 20px;
    }

    .quiz-content h3,
    .quiz-question-text {
        font-size: 17px;
    }

    .quiz-option-text {
        font-size: 14px;
    }

    .quiz-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .quiz-result-score-value {
        font-size: 22px;
    }
}