/* EduAssistant Quiz Module Styles */

/* Quiz container */
.quiz-container {
    min-height: calc(100vh - 180px);
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Quiz header */
.quiz-header {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Question card */
.question-card {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s;
}

.question-card:hover {
    transform: translateY(-2px);
}

/* Answer options */
.answer-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.answer-option:hover {
    border-color: #4f46e5;
    background-color: #eff6ff;
}

.answer-option.selected {
    border-color: #4f46e5;
    background-color: #eff6ff;
}

.answer-option input {
    margin-right: 1rem;
}

/* Quiz progress bar */
.quiz-progress-bar {
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.quiz-progress-bar-fill {
    height: 100%;
    background-color: #4f46e5;
    transition: width 0.5s ease;
}

/* Feedback styles */
.answer-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.5rem;
}

.answer-feedback.correct {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
}

.answer-feedback.incorrect {
    background-color: #fee2e2;
    border-left: 4px solid #ef4444;
}

/* Question type indicators */
.question-type-icon {
    color: #6b7280;
    margin-right: 0.5rem;
}

/* Navigation buttons */
.navigation-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
}

.navigation-btn.btn-primary {
    background-color: #4f46e5;
    color: white;
}

.navigation-btn.btn-primary:hover {
    background-color: #4338ca;
}

.navigation-btn.btn-outline {
    border: 2px solid #e5e7eb;
    background-color: white;
}

.navigation-btn.btn-outline:hover {
    border-color: #4f46e5;
    background-color: #eff6ff;
}

/* Text input for free-text questions */
.text-input {
    width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
    resize: none;
    min-height: 150px;
    transition: all 0.2s;
}

.text-input:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Category sorting styles */
.category-container {
    min-height: 100px;
    border: 2px dashed #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.category-container.dragover {
    border-color: #4f46e5;
    background-color: #eff6ff;
}

/* Sorting items */
.sortable-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: grab;
    transition: all 0.2s;
}

.sortable-item:hover {
    background-color: #f9fafb;
}

.sortable-item:active {
    cursor: grabbing;
}

/* Quiz completion screen */
.quiz-completion {
    text-align: center;
    padding: 3rem 1.5rem;
}

.score-display {
    font-size: 3rem;
    font-weight: 700;
    color: #4f46e5;
    margin: 1.5rem 0;
}

/* Timer styles */
.quiz-timer {
    font-size: 1.25rem;
    font-weight: 600;
    color: #4f46e5;
}

/* Results page specific styles */
.result-summary {
    text-align: center;
    padding: 2rem;
    border-radius: 1rem;
    background-color: #f9fafb;
    margin-bottom: 2rem;
}

/* Enhanced drag and drop styles for category sorting */
.categorysorting-question .sortable-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background-color: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: grab;
    transition: all 0.2s;
    user-select: none;
    display: block;
}

.categorysorting-question .sortable-item:hover {
    background-color: #f9fafb;
    border-color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.categorysorting-question .sortable-item:active {
    cursor: grabbing;
}

.categorysorting-question .category-container {
    min-height: 100px;
    border: 2px dashed #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.2s;
    background-color: #fafafa;
}

.categorysorting-question .category-container.dragover {
    border-color: #4f46e5;
    background-color: #eff6ff;
    box-shadow: inset 0 2px 4px rgba(79, 70, 229, 0.1);
}

.categorysorting-question .category-container:empty::after {
    content: "Drop items here";
    color: #9ca3af;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 2rem 0;
}

.categorysorting-question #items-container:empty::after {
    content: "All items have been sorted";
}

/* Dragging state */
.categorysorting-question .sortable-item[style*="opacity: 0.5"] {
    transform: rotate(5deg);
}

/* Feedback styles for category sorting */
.categorysorting-question .sortable-item.correct-answer {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: #10b981 !important;
    position: relative;
}

.categorysorting-question .sortable-item.incorrect-answer {
    background-color: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
    position: relative;
}

/* Add checkmarks and X marks for category sorting items */
.categorysorting-question .sortable-item.correct-answer::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #10b981;
    font-size: 1rem;
}

.categorysorting-question .sortable-item.incorrect-answer::after {
    content: "\f00d";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #ef4444;
    font-size: 1rem;
}

/* Disable drag and drop during feedback */
.categorysorting-question .sortable-item[draggable="false"] {
    cursor: default;
    opacity: 1;
}

.categorysorting-question .sortable-item[draggable="false"]:hover {
    transform: none;
}

/* Style for category containers during feedback */
.categorysorting-question .category-container {
    pointer-events: auto;
}

/* Unanswered items warning styling */
.categorysorting-question .card.border-warning .sortable-item {
    background-color: rgba(255, 193, 7, 0.1) !important;
    border-color: #ffc107 !important;
}

.result-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.result-badge.success {
    background-color: #d1fae5;
    color: #10b981;
}

.result-badge.warning {
    background-color: #fef3c7;
    color: #f59e0b;
}

.result-badge.danger {
    background-color: #fee2e2;
    color: #ef4444;
}

/* Adding styles to highlight correct and incorrect answers */
.correct-answer {
    background-color: rgba(16, 185, 129, 0.1) !important;  /* Light green background */
    border-color: #10b981 !important;  /* Green border */
}

.correct-answer .form-check-input:checked {
    background-color: #10b981;
    border-color: #10b981;
}

.incorrect-answer {
    background-color: rgba(239, 68, 68, 0.1) !important;  /* Light red background */
    border-color: #ef4444 !important;  /* Red border */
}

.incorrect-answer .form-check-input:checked {
    background-color: #ef4444;
    border-color: #ef4444;
}

/* Apply to text input fields as well */
textarea.correct-answer {
    border-color: #10b981 !important;
    border-width: 2px !important;
}

textarea.incorrect-answer {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

/* Apply to select boxes for category sorting */
select.correct-answer {
    border-color: #10b981 !important;
    border-width: 2px !important;
}

select.incorrect-answer {
    border-color: #ef4444 !important;
    border-width: 2px !important;
}

/* When answers are disabled, maintain their style */
.answer-option input:disabled {
    opacity: 1;
}

.form-check-input:disabled ~ .form-check-label {
    opacity: 1;
    color: inherit;
}

/* Emphasize correct answers when showing feedback */
.correct-answer::after {
    content: "\f00c";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 1rem;
    color: #10b981;
}

.incorrect-answer::after {
    content: "\f00d";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    right: 1rem;
    color: #ef4444;
}

/* Fix positioning for checkmarks and X marks */
.form-check.answer-option {
    position: relative;
    padding-right: 3rem;
}


/* Quiz Material styling - Add to /css/quiz.css */

/* Quiz material card */
.quiz-material-card {
    margin-bottom: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.2s ease;
}

.quiz-material-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.quiz-material-card .card-header {
    background-color: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 1rem;
}

/* Quiz material content container with max height and scrollbar */
.quiz-material-wrapper {
    max-height: 300px; /* Shows approximately 15 lines by default */
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Styling for markdown content */
.markdown-content {
    font-size: inherit; /* match surrounding text size */
    line-height: 1.5;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}

.markdown-content h1 {
    font-size: 1.5rem;
}

.markdown-content h2 {
    font-size: 1.3rem;
}

.markdown-content h3 {
    font-size: 1.2rem;
}

.markdown-content h4 {
    font-size: 1.1rem;
}

.markdown-content p {
    margin-bottom: 0.75rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-content code {
    padding: 0.2em 0.4em;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: inherit; /* keep inline code size consistent */
}

.markdown-content pre {
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
    overflow-x: auto;
    font-size: inherit; /* override global pre size (.875em) */
}

.markdown-content pre code {
    padding: 0;
    background-color: transparent;
    font-size: inherit; /* match container */
}

.markdown-content img {
    max-width: 100%;
    height: auto;
}

.markdown-content blockquote {
    padding: 0.5rem 1rem;
    border-left: 4px solid #e5e7eb;
    margin-bottom: 1rem;
    color: #4b5563;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content table th,
.markdown-content table td {
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
}

.markdown-content table th {
    background-color: #f9fafb;
}

/* Toggle button styling */
.toggle-material-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.85rem;
}

.toggle-material-btn:hover {
    background-color: #f3f4f6;
}

/* Custom scrollbar styling for material content */
.quiz-material-wrapper::-webkit-scrollbar {
    width: 8px;
}

.quiz-material-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.quiz-material-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.quiz-material-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Preview Mode Styles */
.preview-mode-notice {
    border-left: 4px solid #3b82f6;
    background-color: #eff6ff;
}

.preview-feedback {
    position: relative;
}

.preview-feedback::before {
    content: "PREVIEW";
    position: absolute;
    top: -10px;
    right: 10px;
    background-color: #6b7280;
    color: white;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    border-radius: 4px;
}

/* Quiz card styling for public quizzes */
.quiz-card.public-quiz {
    border-left: 4px solid #10b981;
}

.quiz-card.public-quiz .card-body {
    background-color: rgba(16, 185, 129, 0.02);
}

/* Preview results modal styling */
.modal-content .display-1 {
    font-weight: 700;
}

.preview-stats {
    display: flex;
    justify-content: space-around;
    margin: 2rem 0;
}

.preview-stat {
    text-align: center;
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f9fafb;
    min-width: 80px;
}

.preview-stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.preview-stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Public quiz badge */
.badge.bg-success {
    background-color: #10b981 !important;
}

/* Preview mode navigation adjustments */
.quiz-container.preview-mode .navigation-btn {
    position: relative;
}

.quiz-container.preview-mode .navigation-btn::after {
    content: "";
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border-radius: 50%;
}

/* Responsive adjustments for preview modal */
@media (max-width: 768px) {
    .modal-dialog.modal-lg {
        margin: 1rem;
    }

    .preview-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .preview-stat {
        margin: 0;
    }
}

/* Enhanced preview results modal */
.question-results-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background-color: #f9fafb;
}

.preview-stat {
    padding: 1rem;
    border-radius: 0.5rem;
    background-color: #f8f9fa;
}

.preview-stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.preview-stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    font-weight: 500;
}

/* Badge styling for question results */
.question-results-list .badge {
    font-size: 0.8rem;
}

/* Responsive adjustments for question results */
@media (max-width: 768px) {
    .question-results-list {
        max-height: 250px;
        padding: 0.25rem;
    }

    .question-results-list .fw-medium {
        font-size: 0.9rem;
    }

    .preview-stat {
        padding: 0.5rem;
    }

    .preview-stat-value {
        font-size: 1.5rem;
    }
}

/* Quiz Mode Selection Styles */
.mode-selection-card {
    transition: transform 0.2s ease;
}

.mode-selection-card:hover {
    transform: translateY(-5px);
}

.mode-card {
    cursor: pointer;
    transition: all 0.3s ease;
    border-color: #e5e7eb !important;
}

.mode-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.mode-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.learning-mode-icon {
    background-color: rgba(25, 135, 84, 0.1);
    color: #198754;
}

.test-mode-icon {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.quiz-info-item {
    padding: 1rem;
}

.features-list ul li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.start-quiz-btn {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

.start-quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Test mode notice styling */
.alert.alert-info {
    border-left: 4px solid #0dcaf0;
}

/* Enhanced badge styling */
.badge {
    font-size: 0.75rem;
    padding: 0.4em 0.8em;
}

/* Feedback display for category sorting */
.category-container-feedback {
    min-height: 60px;
    padding: 1rem;
}

.category-container-feedback:empty::after {
    content: "No items placed here";
    color: #9ca3af;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 1rem 0;
}

.categorysorting-question .sortable-item.correct-answer small {
    display: inline-block;
    margin-left: 0.5rem;
}

/* Ensure feedback items are not draggable */
.category-container-feedback .sortable-item {
    cursor: default;
    pointer-events: none;
}

/* Enhanced feedback display for category sorting */
.category-container-feedback {
    min-height: 60px;
    padding: 1rem;
}

.category-container-feedback:empty::after {
    content: "No items placed here";
    color: #9ca3af;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 1rem 0;
}

/* Styling for correct answers section */
.border-success {
    border-color: #10b981 !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.text-success {
    color: #10b981 !important;
}

/* Styling for warning section (unanswered items) */
.border-warning {
    border-color: #f59e0b !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(245, 158, 11, 0.1) !important;
}

.text-warning {
    color: #f59e0b !important;
}

/* Item analysis section styling */
.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #1e40af;
}

/* Ensure feedback items are not draggable */
.category-container-feedback .sortable-item {
    cursor: default;
    pointer-events: none;
}

/* Special styling for comparison items */
.alert-info .sortable-item {
    display: inline-block;
    margin: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Enhance contrast for text colors */
.text-danger {
    color: #ef4444 !important;
    font-weight: 500;
}

.text-success {
    color: #10b981 !important;
    font-weight: 500;
}

/* Hide empty category message when there are items */
.category-container-feedback:has(.sortable-item) .empty-category-message {
    display: none;
}

/* Fallback for browsers that don't support :has() */
.category-container-feedback .sortable-item ~ .empty-category-message {
    display: none;
}

/* Enhanced feedback display for category sorting */
.category-container-feedback {
    min-height: 60px;
    padding: 1rem;
}

/* Styling for correct answers section */
.border-success {
    border-color: #10b981 !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(16, 185, 129, 0.1) !important;
}

.text-success {
    color: #10b981 !important;
}

/* Ensure feedback items are not draggable */
.category-container-feedback .sortable-item {
    cursor: default;
    pointer-events: none;
}
