/* Exam Quiz Styles */

.exam-quiz {
    margin: 0 auto;
    padding: 20px;
}

/* Exam List */
.exam-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.exam-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.exam-card h3 {
    margin-top: 0;
    color: #333;
}

.exam-meta {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    font-size: 0.9em;
    color: #666;
}

.exam-meta li {
    margin: 5px 0;
}

/* Quiz Container */
.exam-quiz-container {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    .quiz-start-actions {
        margin-top: 20px;
    }
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #eee;
}

.quiz-progress {
    display: flex;
    gap: 20px;
    font-size: 0.9em;
    color: #666;
}

.timer {
    font-weight: bold;
    color: #d9534f;
}

/* Question Slide */
.question-slide {
    min-height: 300px;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.question-numbering {
    font-weight: bold;
    color: #0073aa;
    font-size: 1.1em;
}

.correct-count-hint {
    font-size: 0.85em;
    color: #888;
    font-style: italic;
}

.question-text {
    font-size: 1.2em;
    line-height: 1.6;
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

/* Answers */
.answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.answer-option:hover {
    border-color: #0073aa;
    background: #f0f7fc;
}

.answer-checkbox {
    margin-top: 3px;
    width: 18px;
    height: 18px;
}

.answer-checkbox:checked + .answer-text {
    font-weight: 500;
}

.answer-option:has(.answer-checkbox:checked) {
    border-color: #0073aa;
    background: #e6f3ff;
}

/* Navigation */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Results */
.exam-result {
    text-align: center;
}

.result-summary {
    padding: 40px;
    border-radius: 12px;
    margin: 30px 0;
}

.result-passed {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
}

.result-failed {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 2px solid #dc3545;
}

.result-status {
    font-size: 2em;
    margin-bottom: 20px;
}

.result-passed .status-icon {
    color: #28a745;
}

.result-failed .status-icon {
    color: #dc3545;
}

.status-text {
    margin-left: 10px;
    font-weight: bold;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.score-percentage {
    font-size: 2em;
    font-weight: bold;
}

.result-passed .score-percentage {
    color: #28a745;
}

.result-failed .score-percentage {
    color: #dc3545;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Review Section */
.result-review {
    text-align: left;
    margin-top: 40px;
}

.review-question {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #ddd;
}

.review-correct {
    border-left-color: #28a745;
}

.review-incorrect {
    border-left-color: #dc3545;
}

.review-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.review-status {
    font-weight: bold;
}

.review-correct .review-status {
    color: #28a745;
}

.review-incorrect .review-status {
    color: #dc3545;
}

.review-explanation {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 0.9em;
}

.review-answers {
    margin: 15px 0;
}

.review-answer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.review-answer.answer-correct {
    background: #d4edda;
    border-color: #c3e6cb;
}

.review-answer.answer-incorrect {
    background: #f8d7da;
    border-color: #f5c6cb;
}

.review-answer.answer-selected {
    border-width: 3px;
    border-style: solid;
    font-weight: 500;
    background-color: #fff3cd;
    position: relative;
}

.review-answer.answer-selected.answer-correct {
    background-color: #d4edda;
    border-color: #28a745;
}

.review-answer.answer-selected.answer-incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
}

.user-selection-badge {
    display: inline-block;
    background: #007bff;
    color: #fff;
    font-size: 0.75em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 10px;
}

.answer-marker {
    font-weight: bold;
    min-width: 20px;
}

.review-answer.answer-correct .answer-marker {
    color: #28a745;
}

.review-answer.answer-incorrect .answer-marker {
    color: #dc3545;
}

.answer-text {
    flex: 1;
}

.user-selection-badge {
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.75em;
    font-weight: bold;
}

/* Question Editor */
.question-editor-form {
    max-width: 800px;
}

.form-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
}

.form-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
}

.form-control:focus {
    border-color: #0073aa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0,115,170,0.2);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.answer-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.form-actions {
    text-align: center;
    padding: 20px 0;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #0073aa;
    color: #fff;
}

.btn-primary:hover {
    background: #005a87;
}

.btn-secondary {
    background: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: #fff;
}

.btn-success:hover {
    background: #218838;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1em;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
}

.alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

/* =====================================================
   Explanation Plugin Styles
   ===================================================== */

.exam-explanation-container {
    margin: 0 auto;
    padding: 20px;
}

.explanation-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.explanation-header h2 {
    margin: 0 0 10px 0;
    color: #333;
}

.explanation-subtitle {
    color: #666;
    margin: 0 0 10px 0;
}

.question-count {
    color: #888;
    font-size: 0.9em;
    margin: 0;
}

.explanation-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.explanation-list p {
    font-size: 1rem;
}

.explanation-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.explanation-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.explanation-item.is-expanded {
    border-color: #0073aa;
}

.explanation-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #f9f9f9;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 1em;
    transition: background 0.2s ease;
}

.explanation-toggle:hover {
    background: #f0f0f0;
}

.explanation-item.is-expanded .explanation-toggle {
    background: #e6f3ff;
    border-bottom: 1px solid #ddd;
}

.toggle-icon {
    font-size: 0.8em;
    color: #666;
    transition: transform 0.2s ease;
}

.explanation-item.is-expanded .toggle-icon {
    color: #0073aa;
}

.explanation-toggle .question-numbering {
    font-weight: bold;
    color: #0073aa;
    white-space: nowrap;
}

.explanation-toggle .question-preview {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #333;
}

.explanation-toggle .question-preview p {
    margin: 0;
    display: inline;
}

.explanation-toggle .question-preview strong {
    font-weight: normal;
}

.explanation-content {
    padding: 0;
}

.question-full {
    padding: 20px;
}

.question-text-full {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.question-text-full p {
    margin: 0 0 10px 0;
}

.question-text-full p:last-child {
    margin-bottom: 0;
}

.question-text-full code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.question-text-full pre,
.question-text-full figure.code {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

.question-text-full pre code,
.question-text-full figure.code code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.question-answers {
    margin-bottom: 20px;
}

.question-answers h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1em;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.answers-list-explanation {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.answers-list-explanation li {
    padding: 10px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.answers-list-explanation li.answer-revealed {
    background: #d4edda;
    border-color: #c3e6cb;
}

.answers-list-explanation li code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.answers-list-explanation li.answer-revealed code {
    background: #b8dabc;
}

.correct-count-info {
    margin: 10px 0 0 0;
    color: #666;
    font-size: 0.9em;
}

.question-explanation {
    background: #fff8e6;
    border: 1px solid #ffe0a6;
    border-radius: 6px;
    padding: 15px;
}

.question-explanation h4 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 1em;
}

.explanation-text {
    line-height: 1.6;
    color: #333;
}

.explanation-text p {
    margin: 0 0 10px 0;
}

.explanation-text p:last-child {
    margin-bottom: 0;
}

.explanation-text code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.explanation-text pre,
.explanation-text figure.code {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 15px 0;
}

.explanation-text pre code,
.explanation-text figure.code code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.explanation-text blockquote {
    border-left: 4px solid #0073aa;
    margin: 15px 0;
    padding: 10px 20px;
    background: #f9f9f9;
}

.explanation-text img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.explanation-text aside.blurb {
    background: #e6f3ff;
    border: 1px solid #b8daff;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.explanation-text aside.blurb h3 {
    margin: 0 0 10px 0;
    color: #004085;
    font-size: 1em;
}

.explanation-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.no-questions {
    text-align: center;
    color: #666;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
}

/* Chapter Selection */
.chapter-selection {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.chapter-selection h3 {
    margin: 0 0 20px 0;
    color: #333;
}

.chapter-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.chapter-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chapter-checkbox-label:hover {
    background: #f0f0f0;
    border-color: #0073aa;
}

.chapter-checkbox-label:has(.chapter-checkbox:checked) {
    background: #e6f3ff;
    border-color: #0073aa;
}

.chapter-checkbox {
    width: 18px;
    height: 18px;
}

.chapter-selection-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9em;
}

.reveal-answer-btn {
    margin-top: 0;
}

.explanation-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.edit-explanation-btn {
    background: #0073aa;
}

.question-explanation-empty {
    background: #f9f9f9;
    border: 1px dashed #ccc;
}

.question-explanation-empty p {
    margin: 0 0 10px 0;
    color: #666;
}

/* Login Status Bar */
.login-status-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.login-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-status.logged-in {
    color: #28a745;
}

.login-icon {
    font-size: 1.1em;
}

.login-username {
    font-weight: 500;
}

.login-action-link {
    padding: 5px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.login-action-link.login-link {
    background: #0073aa;
    color: #fff;
}

.login-action-link.login-link:hover {
    background: #005a87;
}

.login-action-link.logout-link {
    background: #dc3545;
    color: #fff;
}

.login-action-link.logout-link:hover {
    background: #c82333;
}

/* Frontend Login Form Styling */
.frame-type-felogin_login {
    max-width: 480px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.frame-type-felogin_login h3,
.frame-type-felogin_login .felogin-header {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}

.frame-type-felogin_login form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.frame-type-felogin_login label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.frame-type-felogin_login input[type="text"],
.frame-type-felogin_login input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.frame-type-felogin_login input[type="text"]:focus,
.frame-type-felogin_login input[type="password"]:focus {
    border-color: #0073aa;
    outline: none;
}

.frame-type-felogin_login input[type="submit"],
.frame-type-felogin_login button[type="submit"] {
    width: 100%;
    padding: 12px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.frame-type-felogin_login input[type="submit"]:hover,
.frame-type-felogin_login button[type="submit"]:hover {
    background: #005a87;
}

.frame-type-felogin_login .felogin-message,
.frame-type-felogin_login .alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.frame-type-felogin_login .felogin-message-error,
.frame-type-felogin_login .alert-danger {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.frame-type-felogin_login .felogin-message-success,
.frame-type-felogin_login .alert-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.frame-type-felogin_login .felogin-forgot-password {
    text-align: center;
    margin-top: 15px;
}

.frame-type-felogin_login .felogin-forgot-password a {
    color: #0073aa;
    text-decoration: none;
}

.frame-type-felogin_login .felogin-forgot-password a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-header {
        flex-direction: column;
        gap: 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .result-actions {
        flex-direction: column;
    }

    .answer-row {
        flex-direction: column;
        align-items: stretch;
    }
}
