/* Enhanced Reading Comprehension Styles */

/* Section titles with decorative elements */
.questions-section-title {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin: 2rem 0 1.5rem;
    padding-bottom: 0.75rem;
    position: relative;
    text-align: center;
}

.questions-section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 3px;
}

/* Card-based question items with subtle hover effect */
.question-item {
    background-color: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.question-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
    border-radius: 4px 0 0 4px;
}

.question-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.question-item:nth-child(odd)::before {
    background: linear-gradient(180deg, var(--accent-color), var(--primary-color));
}

/* Question text styling */
.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Question numbering */
.question-item {
    counter-increment: question;
}

.question-text::before {
    content: "Q" counter(question) ": ";
    color: var(--primary-color);
    font-weight: 700;
}

/* Multiple choice options with enhanced UI */
.mcq-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mcq-option {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.mcq-option::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    opacity: 0;
    transition: opacity 0.2s;
}

.mcq-option:hover {
    transform: translateX(3px);
    border-color: var(--primary-color);
}

.mcq-option:hover::after {
    opacity: 1;
}

.option-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 12px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
}

/* Selected option styles */
.mcq-option.selected {
    border-width: 2px;
}

.mcq-option.selected .option-letter {
    transform: scale(1.1);
}

/* Correct and incorrect option indicators */
.mcq-option.correct {
    background-color: rgba(46, 213, 115, 0.1);
    border-color: #2ed573;
}

.mcq-option.correct .option-letter {
    background-color: #2ed573;
}

.mcq-option.incorrect {
    background-color: rgba(255, 71, 87, 0.1);
    border-color: #ff4757;
}

.mcq-option.incorrect .option-letter {
    background-color: #ff4757;
}

.mcq-option.correct-answer {
    border: 2px dashed #2ed573;
    background-color: rgba(46, 213, 115, 0.05);
}

/* Feedback styling */
.feedback {
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: 500;
    position: relative;
    padding-left: 3rem;
    animation: slideIn 0.3s ease-out;
}

.feedback::before {
    font-family: sans-serif;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
}

.feedback.correct {
    background-color: rgba(46, 213, 115, 0.1);
    color: #10ac84;
    border-left: 4px solid #2ed573;
}

.feedback.correct::before {
    content: '✓';
    color: #2ed573;
}

.feedback.incorrect {
    background-color: rgba(255, 71, 87, 0.1);
    color: #ee5253;
    border-left: 4px solid #ff4757;
}

.feedback.incorrect::before {
    content: '✗';
    color: #ff4757;
}

.feedback.warning {
    background-color: rgba(254, 202, 87, 0.1);
    color: #ff9f43;
    border-left: 4px solid #feca57;
}

.feedback.warning::before {
    content: '!';
    color: #feca57;
}

.feedback.success {
    background-color: rgba(72, 219, 251, 0.1);
    color: #0abde3;
    border-left: 4px solid #48dbfb;
}

.feedback.success::before {
    content: 'ℹ';
    color: #48dbfb;
}

/* Explanation styling */
.explanation {
    display: none;
    background-color: rgba(72, 126, 176, 0.05);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #487eb0;
    margin-top: 1rem;
    font-style: italic;
    animation: fadeIn 0.5s;
}

/* Short answer styling */
.short-answer-input {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
    background-color: #f8f9fa;
    transition: all 0.3s;
}

.short-answer-input:focus {
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(58, 134, 255, 0.15);
    outline: none;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.sample-answer {
    display: none;
    background-color: #f1f8e9;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #8bc34a;
    margin-top: 1rem;
    position: relative;
}

.sample-answer::before {
    content: "Sample Answer:";
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #689f38;
}

/* Progress indicator at the top */
.question-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.3s;
}

.progress-step.completed .progress-circle {
    background-color: var(--primary-color);
}

.progress-step.current .progress-circle {
    background-color: var(--accent-color);
    transform: scale(1.2);
}

.progress-line {
    flex: 1;
    height: 2px;
    background-color: #e0e0e0;
    position: relative;
}

.progress-line-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.5s;
}

/* Animation keyframes */
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive styles */
@media (max-width: 768px) {
    .question-item {
        padding: 1.25rem;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .button-row button {
        width: 100%;
    }
    
    .question-progress {
        display: none;
    }
}

/* Print styles */
/* Styles for completion animations */
.question-completed {
    position: relative;
    animation: completedPulse 0.5s;
}

.question-completed::after {
    content: '✓';
    position: absolute;
    top: -8px;
    right: -8px;
    width: 25px;
    height: 25px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0;
    animation: fadeInCheckmark 0.5s forwards 0.2s;
}

.question-focus {
    position: relative;
}

.question-focus::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px solid var(--accent-color);
    border-radius: 14px;
    animation: pulseFocus 1.5s;
    pointer-events: none;
}

.all-completed {
    animation: celebrationPulse 1s;
}

/* Matching question interface styles */
.matching-exercise {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
}

.matching-instructions {
    margin-bottom: 1.5rem;
    font-style: italic;
    color: var(--light-text);
}

.match-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.match-terms, .match-definitions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.match-term, .match-definition {
    padding: 1rem;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-align: center;
}

.match-term {
    font-weight: 600;
    color: var(--primary-color);
}

.match-term:hover, .match-definition:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.match-term.selected, .match-definition.selected {
    border-width: 2px;
}

.match-term.selected {
    border-color: var(--primary-color);
    background-color: rgba(58, 134, 255, 0.1);
}

.match-definition.selected {
    border-color: var(--secondary-color);
    background-color: rgba(131, 56, 236, 0.1);
}

.match-term.matched, .match-definition.matched {
    background-color: rgba(42, 157, 143, 0.1);
    border-color: var(--success-color);
    cursor: default;
    animation: matched 0.5s;
}

/* Additional animations */
@keyframes completedPulse {
    0% { box-shadow: 0 0 0 0 rgba(58, 134, 255, 0.5); }
    70% { box-shadow: 0 0 0 15px rgba(58, 134, 255, 0); }
    100% { box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05); }
}

@keyframes fadeInCheckmark {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulseFocus {
    0% { opacity: 1; transform: scale(1); }
    70% { opacity: 0.3; transform: scale(1.03); }
    100% { opacity: 0; transform: scale(1.05); }
}

@keyframes celebrationPulse {
    0% { transform: scale(1); }
    25% { transform: scale(1.025); }
    50% { transform: scale(1); }
    75% { transform: scale(1.025); }
    100% { transform: scale(1); }
}

@keyframes matched {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@media print {
    .question-item {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
    
    .mcq-option {
        break-inside: avoid;
    }
    
    .feedback, 
    .button-row,
    .question-progress {
        display: none !important;
    }
    
    .explanation,
    .sample-answer {
        display: block !important;
        border: 1px solid #ddd;
        background: none;
    }
}
