/*
 * Quiz Styles - Common for all educational websites
 * Version: 1.1.0 - Fixed CSS Variables
 */

/* Quiz Container */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
}

.quiz-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.quiz-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

[data-theme="dark"] .progress-bar {
    background: #475569;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Question Card */
.question-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.question-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.question-text .katex {
    font-size: 1.1em;
}

/* Answer Options */
.answers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.answer-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.15s ease;
}

[data-theme="dark"] .answer-option {
    border-color: #475569;
}

.answer-option:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .answer-option:hover {
    background: rgba(99, 102, 241, 0.15);
}

.answer-option.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .answer-option.selected {
    background: rgba(99, 102, 241, 0.2);
}

.answer-option.correct {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.answer-option.incorrect {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.answer-option.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.answer-marker {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.answer-option:hover .answer-marker,
.answer-option.selected .answer-marker {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.answer-option.correct .answer-marker {
    border-color: #10b981;
    background: #10b981;
    color: #ffffff;
}

.answer-option.incorrect .answer-marker {
    border-color: #ef4444;
    background: #ef4444;
    color: #ffffff;
}

.answer-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text);
}

.answer-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Explanation */
.explanation {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(251, 191, 36, 0.1);
    border-radius: var(--radius-lg);
    border-left: 4px solid #f59e0b;
    display: none;
}

.explanation.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.explanation h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .explanation h4 {
    color: #e2e8f0;
}

.explanation p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-quiz {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-quiz-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    box-shadow: var(--shadow-md);
}

.btn-quiz-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-quiz-secondary {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-quiz-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Quiz Results */
.quiz-results {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.results-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.results-score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.results-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.results-details {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2rem;
}

.result-item {
    text-align: center;
}

.result-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
}

.result-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-item.correct .result-value {
    color: #10b981;
}

.result-item.incorrect .result-value {
    color: #ef4444;
}

/* Quiz Category Cards */
.quiz-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.quiz-category-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.2s ease;
    border: 2px solid transparent;
    text-align: center;
    cursor: pointer;
}

.quiz-category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.quiz-category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.quiz-category-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.quiz-category-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.quiz-category-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.quiz-category-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Timer */
.quiz-timer {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-secondary);
}

.quiz-timer .timer-icon {
    font-size: 1.25rem;
}

.quiz-timer.warning {
    color: var(--warning);
}

.quiz-timer.danger {
    color: var(--error);
    animation: pulse 1s infinite;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.question-card.animate {
    animation: slideIn 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-container {
        padding: 0 var(--spacing-md);
    }

    .question-card {
        padding: var(--spacing-lg);
    }

    .results-details {
        flex-direction: column;
        gap: var(--spacing-md);
    }

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

    .btn-quiz {
        width: 100%;
    }
}