/* Multiple Choice Quiz Styles */

/* Default (Light Mode) Variables */
:root {
    --background-color: #f0f2f5;
    --text-color: #1a1a1a;
    --card-background-color: #ffffff;
    --card-border-color: #ced4da;
    --card-shadow-color: rgba(0, 0, 0, 0.1);
    --answer-background-color: #f8f9fa;
    --answer-border-color: #ced4da;
    --answer-hover-background-color: #e2e6ea;
    --selected-background-color: #d1e7dd;
    --selected-border-color: #0f5132;
    --selected-text-color: #0f5132;
    --correct-border-color: #198754;
    --incorrect-border-color: #dc3545;
    --button-background-color: #0d6efd;
    --button-text-color: #ffffff;
    --button-hover-background-color: #0b5ed7;
    --toast-background-color: rgba(33, 37, 41, 0.9);
    --toast-text-color: #ffffff;
    --toast-success-background-color: rgba(25, 135, 84, 0.9);
    --toast-success-text-color: #ffffff;
    --toast-error-background-color: rgba(220, 53, 69, 0.9);
    --toast-error-text-color: #ffffff;

    /* Timer Variables */
    --timer-background-color: #e9ecef;
    --timer-text-color: #212529;
    --progress-bar-background-color: #28a745; /* Green */
    --progress-bar-warning-color: #ffc107;    /* Yellow */
    --progress-bar-danger-color: #dc3545;     /* Red */
    --progress-bar-transition: width 1s linear;
}

/* Dark Mode Variables */
[data-mode="dark"] {
    --text-color: #e9ecef !important;
    --card-background-color: #111522a4;
    --card-border-color: #343640;
    --card-shadow-color: rgba(0, 0, 0, 0.5);
    --answer-background-color: #11152201;
    --answer-border-color: #343a40;
    --answer-hover-background-color: #80a2ff1b;
    --selected-background-color: #0096879a;
    --selected-border-color: #0f5132;
    --selected-text-color: #ffffff;
    --correct-border-color: #198754;
    --incorrect-border-color: #dc3545;
    --button-background-color: #0d6efd;
    --button-text-color: #ffffff;
    --button-hover-background-color: #0b5ed7;
    --toast-background-color: rgba(248, 249, 250, 0.9);
    --toast-text-color: #212529;
    --toast-success-background-color: rgba(25, 135, 84, 0.9);
    --toast-success-text-color: #ffffff;
    --toast-error-background-color: rgba(220, 53, 69, 0.9);
    --toast-error-text-color: #ffffff;

    /* Timer variables */
    --timer-background-color: #343a40;
    --timer-text-color: #f8f9fa;
    --progress-bar-background-color: #28a745; /* Green */
    --progress-bar-warning-color: #ffc107;    /* Yellow */
    --progress-bar-danger-color: #dc3545;     /* Red */
    --progress-bar-transition: width 1s linear;
}

/* Auto Mode Variables */
[data-mode="auto"] { /* inherits light variables by default */ }

@media (prefers-color-scheme: dark) {
    [data-mode="auto"] {
        --text-color: #e9ecef !important;
        --card-background-color: #111522a4;
        --card-border-color: #343a40;
        --card-shadow-color: rgba(0, 0, 0, 0.5);
        --answer-background-color: #11152201;
        --answer-border-color: #343a40;
        --answer-hover-background-color: #80a2ff1b;
        --selected-background-color: #0096879a;
        --selected-border-color: #0f5132;
        --selected-text-color: #ffffff;
        --correct-border-color: #198754;
        --incorrect-border-color: #dc3545;
        --button-background-color: #0d6efd;
        --button-text-color: #ffffff;
        --button-hover-background-color: #0b5ed7;
        --toast-background-color: rgba(248, 249, 250, 0.9);
        --toast-text-color: #212529;
        --toast-success-background-color: rgba(25, 135, 84, 0.9);
        --toast-success-text-color: #ffffff;
        --toast-error-background-color: rgba(220, 53, 69, 0.9);
        --toast-error-text-color: #ffffff;
        --timer-background-color: #343a40;
        --timer-text-color: #f8f9fa;
        --progress-bar-background-color: #28a745;
        --progress-bar-warning-color: #ffc107;
        --progress-bar-danger-color: #dc3545;
        --progress-bar-transition: width 1s linear;
    }
}

/* Multiple Choice Quiz Container */
.mcq-container {
    margin: 20px 0;
    position: relative;
}

/* Question Card Styles */
.question-card {
    background-color: var(--card-background-color);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--card-border-color);
    line-height: 1.6;
    box-shadow: 0 4px 10px var(--card-shadow-color);
    transition: transform 0.3s, box-shadow 0.3s;
}

.question-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px var(--card-shadow-color);
}

/* Answers Grid */
.answers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* Answer Card Styles */
.answer-card {
    flex: 1 1 calc(50% - 15px);
    background-color: var(--answer-background-color);
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    border: 1px solid var(--answer-border-color);
    transition: background-color 0.3s, border-color 0.3s;
    line-height: 1.4;
}

.answer-card pre,
.answer-card code {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

.answer-card:hover {
    background-color: var(--answer-hover-background-color);
}

.answer-card.selected {
    background-color: var(--selected-background-color);
    border: 2px solid var(--selected-border-color);
    color: var(--selected-text-color);
}

/* Correct and Incorrect Question Card Borders */
.question-card.correct {
    border: 2px solid var(--correct-border-color);
}

.question-card.incorrect {
    border: 2px solid var(--incorrect-border-color);
}

/* Buttons */
.quiz-main-container .button-container {
    margin-top: 20px;
    text-align: center; /* match original */
}

/* Ensure inline layout and spacing like original */
.quiz-main-container .button { display: inline-block; margin: 5px; }

.button {
    color: teal;
    border: none;
    padding: 8px 20px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.3s, transform 0.2s;
}

.button:hover {
    background-color: var(--button-hover-background-color);
    transform: translateY(-2px);
}

.button:active {
    transform: translateY(0);
}

/* Run (Check) button aligns with interactive code style */
.button-run {
    background-color: #28a745;
    color: black;
}

.button-run:hover {
    background-color: #218838;
}

.button-run:active {
    background-color: #1e7e34;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

/* Next button */
.button-next {
    background-color: #00ffb7bd;
    color: black !important;
}

.button-next:hover {
    background-color: #02cbbe;
}

.button-next:active {
    background-color: #00a095;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

/* Previous button */
.button-prev {
    background-color: #ff8800;
    color: black !important;
}

.button-prev:hover {
    background-color: #c66900;
}

.button-prev:active {
    background-color: #ad5d01;
    box-shadow: 0 5px #666;
    transform: translateY(4px);
}

/* Toast Notification */
.toast {
    position: absolute;
    padding: 15px;
    border-radius: 8px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toast p {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

/* Success Toast */
.toast-success {
    background-color: var(--toast-success-background-color);
    color: var(--toast-success-text-color);
}

/* Error Toast */
.toast-error {
    background-color: var(--toast-error-background-color) !important;
    color: var(--toast-error-text-color);
}

/* Main Quiz Container */
.quiz-main-container {
    position: relative;
}

/* Responsive Design */
@media (max-width: 600px) {
    .answer-card {
        flex: 1 1 100%;
    }
    .quiz-main-container .button-container { text-align: center; }
}

/* Question Counter */
.question-counter {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    color: var(--text-color);
}

/* Quiz Completion Message */
.quiz-completion-message {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    padding: 50px;
}

/* Resume Prompt Styles */
.quiz-resume-prompt {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--card-border-color);
    border-radius: 8px;
    background: var(--card-background-color);
    box-shadow: var(--card-shadow-color);
    margin: 0 0 1rem 0;
}

.quiz-resume-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-color);
}

.quiz-resume-actions {
    display: flex;
    gap: 0.5rem;
}

/* Light mode specific styling for resume prompt */
@media (prefers-color-scheme: light) {
    .quiz-resume-prompt {
        background: #E8F0FE;
        color: #000000;
        border-color: #B3D4FF;
    }
}

/* Explicit light theme overrides */
html.light-mode .quiz-resume-prompt,
body.light-mode .quiz-resume-prompt,
html[data-theme='light'] .quiz-resume-prompt,
body[data-theme='light'] .quiz-resume-prompt,
[data-mode='light'] .quiz-resume-prompt {
    background: #E8F0FE !important;
    color: #000000 !important;
    border-color: #B3D4FF !important;
}

/* Dark mode specific styling for resume prompt */
@media (prefers-color-scheme: dark) {
    .quiz-resume-prompt {
        background: var(--card-background-color);
        color: var(--text-color);
        border-color: var(--card-border-color);
    }
}

/* Explicit dark theme overrides */
html.dark-mode .quiz-resume-prompt,
body.dark-mode .quiz-resume-prompt,
html[data-theme='dark'] .quiz-resume-prompt,
body[data-theme='dark'] .quiz-resume-prompt,
[data-mode='dark'] .quiz-resume-prompt {
    background: var(--card-background-color) !important;
    color: var(--text-color) !important;
    border-color: var(--card-border-color) !important;
}

