/* --- Basisstijlen --- */
body {
    font-family: 'Lato', sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 900px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
header {
    background-color: #00796b;
    color: white;
    padding: 20px 30px;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

/* --- Startpagina --- */
#start-container {
    padding: 40px;
    text-align: center;
}
#start-container h2 {
    color: #004d40;
    margin-bottom: 20px;
}
#start-container p {
    font-size: 1.2em;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* --- Quiz Containers --- */
#quiz-container, #results-container {
    padding: 30px;
    display: none;
}

#question-header {
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

#question-tally {
    font-size: 0.9em;
    font-weight: bold;
    color: #555;
}

#question-text-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

#question-text {
    font-size: 1.4em;
    font-weight: 700;
    color: #004d40;
    line-height: 1.4;
}

/* --- Audio Knoppen --- */
#speak-question-btn, #speech-btn-uitleg {
    font-size: 1.5em;
    cursor: pointer;
    color: #00796b;
    border: 2px solid #00796b;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    transition: all 0.2s;
    flex-shrink: 0;
}
#speak-question-btn:hover {
    background-color: #e0f2f1;
}

/* --- Input Velden & Stappen --- */
.step-container {
    background-color: #fafafa;
    border: 2px solid #eee;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.step-active {
    border-color: #4CAF50; /* Groene rand voor actieve stap */
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}

.step-label {
    font-weight: bold;
    color: #00796b;
    margin-bottom: 15px;
    display: block;
    font-size: 1.1em;
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 1.4em;
    font-weight: bold;
    margin-bottom: 10px;
}

input[type=number], input[type=text] {
    width: 80px;
    padding: 8px;
    font-size: 0.9em;
    border: 2px solid #ccc;
    border-radius: 5px;
    text-align: center;
    font-family: 'Lato', sans-serif;
    -moz-appearance: textfield;
}
input[type=number]:focus, input[type=text]:focus {
    border-color: #00796b;
    outline: none;
}

/* Verberg spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input:disabled {
    background-color: #e8f5e9; /* Lichtgroen als het klaar is */
    color: #2e7d32;
    border-color: #a5d6a7;
    font-weight: bold;
}

/* --- Speciale Breuk Notatie (Ouderwets) --- */
.fraction-group {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    margin: 0 10px;
}
.fraction-group input {
    width: 60px;
    margin: 2px 0;
}
.fraction-line {
    width: 100%;
    height: 2px;
    background-color: #333;
    margin: 2px 0;
}

/* --- Voortgang --- */
.progress-bar-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 5px;
    height: 15px;
    margin-bottom: 15px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4CAF50;
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}

/* --- Knoppen Sectie --- */
#controls-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 700;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn {
    background-color: #00796b;
    color: white;
    flex-grow: 1;
}
.btn:hover {
    background-color: #004d40;
}
.btn:disabled {
    background-color: #aaa;
    cursor: not-allowed;
}

.btn-green-action {
    background-color: #43a047;
    color: white;
}
.btn-green-action:hover {
    background-color: #2e7d32;
}

#next-question-btn {
    background-color: #ff9800;
    color: white;
    display: none;
    margin-top: 20px;
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
}
#next-question-btn:hover {
    background-color: #f57c00;
}

/* --- Feedback --- */
.feedback {
    font-size: 1.1em;
    font-weight: bold;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    margin-bottom: 10px;
    line-height: 1.6;
    display: none;
}
.feedback.correct {
    color: #2e7d32;
    background-color: #c8e6c9;
    border: 1px solid #2e7d32;
}
.feedback.incorrect {
    color: #c62828;
    background-color: #ffcdd2;
    border: 1px solid #c62828;
}
.feedback.info {
    color: #0d47a1;
    background-color: #e3f2fd;
    border: 1px solid #0d47a1;
}

/* --- Modal (Pop-up) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto; 
    background-color: rgba(0, 0, 0, 0.6); 
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s;
}

.modal-header {
    padding: 15px 20px;
    background-color: #00796b;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3em;
}

.modal-header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.speech-btn-modal {
    background: none;
    border: 2px solid white;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}
.speech-btn-modal:hover {
    background-color: rgba(255,255,255,0.2);
}

.close-btn {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    padding: 20px 30px;
    max-height: 500px;
    overflow-y: auto;
    line-height: 1.7;
    font-size: 1.1em;
}

.modal-body h3 {
    color: #004d40;
    border-bottom: 2px solid #eee;
    padding-bottom: 5px;
    margin-top: 20px;
}

.explanation-image-container {
    text-align: center;
    margin: 20px 0;
}
.explanation-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}
.explanation-image:hover {
    transform: scale(1.02);
}

/* --- Resultaten --- */
#results-container h2 {
    color: #004d40;
    text-align: center;
}

#score-percentage {
    font-size: 3.5em;
    font-weight: 700;
    color: #4CAF50;
    text-align: center;
    margin: 20px 0;
}

#results-container ul {
    background-color: #fafafa;
    border: 1px solid #ddd;
    border-left: 5px solid #00796b;
    border-radius: 5px;
    padding: 20px 40px;
}

#results-container li {
     margin-bottom: 10px;
     line-height: 1.6;
 }

#results-buttons {
    margin-top: 30px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

#print-summary {
    margin-top: 30px;
}

.summary-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    font-weight: bold;
    padding: 10px;
    background-color: #eee;
    border-bottom: 2px solid #ccc;
}

.summary-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}
.summary-item:last-child {
    border-bottom: none;
}

.summary-col {
    padding: 0 10px;
}
.summary-col.center {
    border-left: 2px solid #eee;
    border-right: 2px solid #eee;
}

footer {
    text-align: center;
    font-size: 0.9em;
    color: #888;
    padding: 20px 30px;
    border-top: 1px solid #eee;
    margin-top: auto;
}

@keyframes fadeIn {
    from {opacity: 0;}
    to {opacity: 1;}
}
@keyframes slideIn {
    from {transform: translateY(-50px); opacity: 0;}
    to {transform: translateY(0); opacity: 1;}
}

/* --- Print Stijlen --- */
@media print {
    body { padding: 0; margin: 0; background-color: #fff; }
    .container { box-shadow: none; border: none; width: 100%; max-width: 100%; }
    #quiz-container, header, #results-buttons, footer, .modal, #start-container, #controls-container, #question-header, #score-percentage {
        display: none !important; 
    }
    #results-container {
        display: block !important;
        padding: 0;
    }
    #results-container h2 { display: block; font-size: 24px; margin-bottom: 20px; }
    #results-container h3 { display: block; font-size: 1.2em; text-align: left; margin-bottom: 10px; color: black; }
    #results-container ul { display: block; border: 1px solid #000; color: black; page-break-inside: avoid; }
    #print-summary { margin-top: 20px; display: block !important; }
    
    .summary-header {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        background-color: #ccc !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
    }

    .summary-item {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
        page-break-inside: avoid;
        width: 100%;
        border-bottom: 1px solid #000;
        padding: 10px 0;
    }
    .summary-col {
        padding: 5px;
        color: black;
        font-size: 12px;
    }
    .summary-col.center {
        border-left: 1px solid #000;
        border-right: 1px solid #000;
    }
    .print-green { color: green !important; font-weight: bold; }
    .print-red { color: red !important; font-weight: bold; }
}