Spaces:
Sleeping
Sleeping
{% extends "base.html" %} | |
{% block content %} | |
<style> | |
body { | |
font-family: 'Open Sans', sans-serif; | |
background: linear-gradient(to bottom, #a8dadc, #457b9d); | |
color: #1d3557; | |
margin: 0; | |
padding: 0; | |
} | |
.header { | |
background: #1d3557; | |
color: white; /* Changed to white for better contrast */ | |
padding: 20px; | |
text-align: center; | |
border-bottom: 5px solid #457b9d; | |
border-radius: 0 0 20px 20px; | |
box-shadow: 0 4px 10px rgba(0,0,0,0.2); | |
} | |
.header h1 { | |
margin: 0; | |
font-size: 28px; | |
letter-spacing: 1px; | |
} | |
.header a { | |
color: #f1faee; | |
text-decoration: none; | |
font-size: 16px; | |
background: #457b9d; | |
padding: 6px 12px; | |
border-radius: 12px; | |
transition: background 0.3s; | |
} | |
.header a:hover { | |
background: #1d3557; | |
} | |
.quiz-form, .quiz-results { | |
background: rgba(255, 255, 255, 0.9); | |
margin: 40px auto; | |
padding: 30px; | |
width: 80%; | |
max-width: 700px; | |
border-radius: 20px; | |
box-shadow: 0 6px 15px rgba(0,0,0,0.2); | |
border: 2px solid #457b9d; | |
} | |
.quiz-form h3, .quiz-results h3 { | |
font-size: 20px; | |
color: #1d3557; | |
margin-bottom: 10px; | |
} | |
.quiz-form label { | |
display: block; | |
background: #e0f7fa; | |
padding: 10px 15px; | |
border-radius: 10px; | |
margin-bottom: 8px; | |
border: 1px solid #b2ebf2; | |
cursor: pointer; | |
transition: all 0.3s ease; | |
} | |
.quiz-form label:hover { | |
background: #b2ebf2; | |
transform: translateY(-2px); | |
} | |
.quiz-form input[type="radio"] { | |
margin-right: 10px; | |
} | |
button[type="submit"] { | |
background: linear-gradient(90deg, #219ebc, #023047); | |
color: #f1faee; | |
border: none; | |
padding: 12px 25px; | |
border-radius: 20px; | |
font-size: 18px; | |
font-weight: bold; | |
cursor: pointer; | |
margin-top: 20px; | |
display: block; | |
width: 100%; | |
transition: transform 0.2s, background 0.3s; | |
} | |
button[type="submit"]:hover { | |
transform: scale(1.05); | |
background: linear-gradient(90deg, #48cae4, #023047); | |
} | |
/* Styles for quiz results */ | |
.quiz-results h2 { | |
font-family: 'Montserrat', sans-serif; | |
color: #1d3557; | |
margin-bottom: 25px; | |
font-size: 2.2em; | |
} | |
.quiz-results p.score { | |
font-size: 1.5em; | |
font-weight: bold; | |
color: #023047; | |
margin-bottom: 30px; | |
} | |
.quiz-question-feedback { | |
margin-bottom: 30px; | |
padding: 20px; | |
border-radius: 15px; | |
border: 1px solid #ddd; | |
text-align: left; | |
} | |
.quiz-question-feedback.correct { | |
background-color: #e6ffed; /* Light green */ | |
border-color: #28a745; /* Green */ | |
} | |
.quiz-question-feedback.incorrect { | |
background-color: #ffe6e6; /* Light red */ | |
border-color: #dc3545; /* Red */ | |
} | |
.quiz-question-feedback h4 { | |
margin-top: 0; | |
color: #1d3557; | |
font-size: 1.3em; | |
} | |
.quiz-question-feedback .user-answer, .quiz-question-feedback .correct-answer { | |
font-size: 1.1em; | |
margin-bottom: 8px; | |
} | |
.quiz-question-feedback .user-answer span, .quiz-question-feedback .correct-answer span { | |
font-weight: bold; | |
} | |
.quiz-question-feedback .user-answer.correct-choice { | |
color: #28a745; | |
} | |
.quiz-question-feedback .user-answer.incorrect-choice { | |
color: #dc3545; | |
} | |
.quiz-question-feedback .correct-answer-text { | |
color: #28a745; | |
} | |
.quiz-question-feedback .reason { | |
font-style: italic; | |
color: #555; | |
margin-top: 15px; | |
padding-top: 10px; | |
border-top: 1px dashed #ccc; | |
} | |
.quiz-results .back-to-dashboard { | |
display: inline-block; | |
margin-top: 30px; | |
background: #007bff; | |
color: white; | |
padding: 12px 25px; | |
border-radius: 20px; | |
text-decoration: none; | |
font-weight: bold; | |
transition: background 0.3s; | |
} | |
.quiz-results .back-to-dashboard:hover { | |
background: #0056b3; | |
} | |
</style> | |
<div class="header"> | |
<h1>Quiz for: {{ video.title }}</h1> | |
<a href="{{ url_for('dashboard') }}">Back to Dashboard</a> | |
</div> | |
{% if quiz_submitted %} | |
<div class="quiz-results"> | |
<h2>Quiz Results</h2> | |
<p class="score">Your Score: {{ user_score }} / {{ total_quiz_points }} points</p> | |
{% for feedback in quiz_feedback %} | |
<div class="quiz-question-feedback {% if feedback.is_correct %}correct{% else %}incorrect{% endif %}"> | |
<h4>{{ loop.index }}. {{ feedback.question }}</h4> | |
<p class="user-answer {% if feedback.is_correct %}correct-choice{% else %}incorrect-choice{% endif %}"> | |
Your Answer: <span>{{ feedback.user_selected_option }}</span> | |
{% if feedback.is_correct %} (Correct! π){% else %} (Incorrect π){% endif %} | |
</p> | |
{% if not feedback.is_correct %} | |
<p class="correct-answer"> | |
Correct Answer: <span class="correct-answer-text">{{ feedback.correct_option }}</span> | |
</p> | |
{% endif %} | |
<p class="reason"> | |
<strong>Reason:</strong> {{ feedback.reason }} | |
</p> | |
</div> | |
{% endfor %} | |
<a href="{{ url_for('dashboard') }}" class="back-to-dashboard">Return to Dashboard</a> | |
</div> | |
{% else %} | |
<form method="POST" class="quiz-form"> | |
{% for i, question_data in enumerate(quiz_questions) %} | |
<h3>{{ i+1 }}. {{ question_data.question }}</h3> | |
{% for j, option in enumerate(question_data.options) %} | |
<label> | |
<input type="radio" name="question_{{ i }}" value="{{ j }}" required> | |
{{ option }} | |
</label> | |
{% endfor %} | |
<br> | |
{% endfor %} | |
<button type="submit">Submit Quiz</button> | |
</form> | |
{% endif %} | |
{% endblock %} |