/* ===== IMPROVED CSS FOR STUDY QUESTIONS ===== */
/* ===== THEME-AWARE MAIN CONTAINER ===== */
.mcq-wrapper {
    width: 100%;
    max-width: var(--stdy-content-width, 1100px);
    margin: 24px auto;
    padding: clamp(16px, 2vw, 28px);

    font-size: 16px;
    line-height: 1.55;

    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.stdy-breadcrumb {
    font-size: 14px;
    color: #666;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
}

.stdy-breadcrumb a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
}

.stdy-breadcrumb a:hover {
    color: #005a87;
    text-decoration: underline;
}

h1.question-title {
    font-size: 22px;
    color: #1a1a1a;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 3px solid #0073aa;
    font-weight: 700;
}

.question-content {
    background: #f8f9fa;
    padding: 14px 16px;
    border-radius: 10px;
    margin-bottom: 22px;
    border-left: 5px solid #4CAF50;
    font-size: 16px;
    line-height: 1.7;
}

.options {
    margin: 30px 0;
}

.option {
    margin: 10px 0;
    display: block;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    background: #fff;
    position: relative;
    min-height: auto;
}

.option:hover {
    background: #f0f7ff;
    border-color: #0073aa;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,115,170,0.15);
}

.option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.1);
    vertical-align: middle;
    margin-top: -3px;
}

.option-text {
    font-size: 15.5px;
    color: #333;
    display: inline-block;
    width: calc(100% - 40px);
    vertical-align: middle;
    line-height: 1.45;
}

/* FIXED: Remove duplicate .selected class - it's already defined */
.option.selected {
    background: #e7f3ff;
    border-color: #0073aa;
    box-shadow: 0 4px 10px rgba(0,115,170,0.1);
}

.option.correct {
    background: #d4edda;
    border-color: #28a745;
    box-shadow: 0 4px 10px rgba(40,167,69,0.1);
}

.option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    box-shadow: 0 4px 10px rgba(220,53,69,0.1);
}

button.submit-btn {
    margin-top: 20px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #0073aa 0%, #00a0d2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.3s;
    position: relative;
    letter-spacing: 0.5px;
}

button.submit-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #0073aa 100%);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,115,170,0.3);
}

button.submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.loading {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(243, 243, 243, 0.3);
    border-top: 3px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-left: 12px;
}

.result {
    margin: 30px 0;
    padding: 25px;
    border-radius: 10px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

/* FIXED: Remove duplicate .correct-result/.incorrect-result - use .correct/.incorrect */
.result.correct {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 2px solid #28a745;
    color: #155724;
}

.result.incorrect {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 2px solid #dc3545;
    color: #721c24;
}

.explain {
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f4f7ff 0%, #e8edff 100%);
    border: 2px solid #d1ddff;
    border-radius: 12px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.explain h2 {
    font-size: 19px;
    margin-top: 0;
    color: #1d3bb8;
    padding-bottom: 15px;
    border-bottom: 3px solid #c1d0ff;
    margin-bottom: 25px;
    font-weight: 700;
}

.explain-content {
    font-size: 15.5px;
    line-height: 1.8;
    color: #333;
}

.explain-content p {
    margin-bottom: 20px;
}

.explain-content p:last-child {
    margin-bottom: 0;
}

/* Correct Answer Section inside Explanation */
.correct-answer-section {
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 3px solid #28a745;
    background: #f0f9f0;
    padding: 20px;
    border-radius: 8px;
    margin-top: 10px;
}

.correct-answer-section h3 {
    color: #28a745;
    margin-top: 0;
    font-size: 20px;
    margin-bottom: 15px;
    font-weight: 700;
}

.correct-answer-text {
    font-size: 18px;
    line-height: 1.7;
    color: #155724;
}

/* Related Questions Section */
.related-section {
    margin-top: 70px;
    padding-top: 40px;
    border-top: 3px solid #eee;
    background: #f9fafb;
    border-radius: 15px;
    padding: 35px;
}

.related-section h3 {
    font-size: 24px;
    color: #1a1a1a;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid #0073aa;
    font-weight: 700;
}

.related-questions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.related-question-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.related-question-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 115, 170, 0.15);
    border-color: #0073aa;
}

.related-question-card h4 {
    margin: 0 0 15px 0;
    font-size: 18px;
    line-height: 1.5;
    font-weight: 600;
}

.related-question-card h4 a {
    color: #1a1a1a;
    text-decoration: none;
    transition: color 0.2s;
}

.related-question-card h4 a:hover {
    color: #0073aa;
    text-decoration: none;
}

.related-excerpt {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.related-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.related-read-more {
    color: #0073aa;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s;
    padding: 8px 16px;
    background: #e7f3ff;
    border-radius: 6px;
}

.related-read-more:hover {
    color: #005a87;
    background: #d4e8ff;
    text-decoration: none;
}

.stdy-nav-single {
    margin-top: 50px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.stdy-nav-single a {
    flex: 1;
    min-width: 220px;
    text-align: center;
    padding: 18px 25px;
    background: linear-gradient(135deg, #e7ecff 0%, #f0f2ff 100%);
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    color: #1d3bb8;
    border: 2px solid #cdd6ff;
    transition: all 0.3s;
    font-size: 17px;
}

.stdy-nav-single a:hover {
    background: linear-gradient(135deg, #d4dcff 0%, #e7ecff 100%);
    border-color: #1d3bb8;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(29,59,184,0.2);
}

.topic-navigation {
    margin-top: 50px;
    padding: 30px;
    background: linear-gradient(135deg, #e7ecff 0%, #f0f2ff 100%);
    border-radius: 15px;
    text-align: center;
    border: 3px solid #cdd6ff;
}

.topic-navigation h3 {
    margin: 0 0 20px 0;
    color: #1d3bb8;
    font-size: 22px;
    font-weight: 700;
}

.topic-all-questions {
    display: inline-block;
    padding: 15px 35px;
    background: linear-gradient(135deg, #1d3bb8 0%, #2d4bc8 100%);
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 17px;
    transition: all 0.3s;
    border: none;
}

.topic-all-questions:hover {
    background: linear-gradient(135deg, #152a8a 0%, #1d3bb8 100%);
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(29, 59, 184, 0.3);
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mcq-wrapper {
        padding: 15px;
        font-size: 17px;
        margin: 15px;
        border-radius: 10px;
    }
    
    h1.question-title {
        font-size: 22px;
        padding-bottom: 18px;
    }
    
    .question-content {
        padding: 14px;
        font-size: 18px;
        margin-bottom: 22px;
    }
    
    .option {
        padding: 12px 14px;
        margin: 10px 0;
        min-height: auto;
    }
    
    .option-text {
        font-size: 15.5px;
    }
    
    button.submit-btn {
        font-size: 18px;
        padding: 20px;
    }
    
    .explain {
        padding: 20px;
        margin: 25px 0;
    }
    
    .explain h2 {
        font-size: 20px;
    }
    
    .explain-content {
        font-size: 16px;
    }
    
    .stdy-nav-single {
        flex-direction: column;
        margin-top: 40px;
        gap: 15px;
    }
    
    .stdy-nav-single a {
        min-width: 100%;
        padding: 16px;
        font-size: 16px;
    }
    
    .related-section {
        padding: 20px;
        margin-top: 50px;
    }
    
    .related-section h3 {
        font-size: 21px;
    }
    
    .related-questions-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .related-question-card {
        padding: 20px;
    }
    
    .related-question-card h4 {
        font-size: 17px;
    }
    
    .topic-navigation {
        padding: 20px;
        margin-top: 40px;
    }
    
    .topic-navigation h3 {
        font-size: 20px;
    }
    
    .topic-all-questions {
        padding: 12px 25px;
        font-size: 16px;
    }
}

/* Print Styles */
@media print {
    .stdy-nav-single,
    .related-section,
    .topic-navigation,
    button.submit-btn,
    .option input[type="radio"] {
        display: none !important;
    }
    
    .mcq-wrapper {
        box-shadow: none;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .result,
    .explain {
        display: block !important;
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd !important;
        background: #fff !important;
        color: #000 !important;
    }
    
    .option {
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .option.correct {
        background: #fff !important;
        border: 2px solid #000 !important;
    }
    
    a {
        color: #000 !important;
        text-decoration: underline !important;
    }
}

/* Accessibility Improvements */
.option:focus-within {
    outline: 3px solid #0073aa;
    outline-offset: 2px;
}

button.submit-btn:focus {
    outline: 3px solid #0073aa;
    outline-offset: 3px;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* KaTeX specific improvements */
.katex {
    font-size: 1.1em;
}

.katex-display {
    margin: 1em 0;
    overflow: auto hidden;
}

/* Ensure proper spacing for LaTeX equations */
.katex-display > .katex {
    max-width: 100%;
}
.correct-answer-box {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
    padding: 12px 15px;
    margin-bottom: 16px;
    font-size: 15.5px;
}

.correct-answer-text {
    margin-top: 6px;
}
