/* الحاوية الكبرى لضمان التوسط */
.quiz-wrapper {
    display: flex;
    justify-content: center;
    padding: 20px;
    min-height: 200px;
}

/* البطاقة بحجم محدد وثابت */
.quiz-card {
    width: 100%;
    max-width: 700px;
    background: #ffffff;
    border-radius: 20px;
    padding: 25px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

/* تنسيق الرأس */
.quiz-header {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 30px;
}

.question-number {
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 700;
    color: #475569;
}

.question-text {
    flex-grow: 1;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

/* ===== زر الشرح ===== */

/* الحالة الافتراضية: معطّل */
.explanation-btn {
    width: 42px;
    height: 42px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    color: #cbd5e1;
    cursor: not-allowed;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

/* مفعّل بعد الإجابة، لكن الشرح مغلق — رمادي مع مؤشر pointer */
.explanation-btn:not(:disabled) {
    background: #e2e8f0;
    color: #64748b;
    cursor: pointer;
}

.explanation-btn:not(:disabled):hover {
    background: #cbd5e1;
    color: #334155;
}

/* مفعّل والشرح مفتوح (toggle on) — أخضر */
.explanation-btn.explanation-active {
    background: #088395 !important;
    color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.math-block {
    display: inline-block;
    text-align: right;
    direction: rtl;
    line-height: normal;
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;
}

/* Ensure MathJax text (mtext, etc.) inherits the project font */
.MathJax,
.MathJax_Display,
.mjx-chtml,
.MathJax span,
.MathJax nobr,
.MathJax_CHTML {
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;
    font-variant-numeric: tabular-nums !important;
    /* Keep digits aligned if needed */
}

/* Specific overrides for mathjax internal nodes to help with RTL Arabic fonts */
.MathJax .mtext,
.MathJax .ms,
.MathJax .mo {
    font-family: 'IBM Plex Sans Arabic', sans-serif !important;
}


/* ===== تنسيق الخيارات ===== */
.options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.option-btn {
    background: #f1f5f9;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    color: #1a1a2e;
    cursor: pointer;
    transition: background 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* الإجابة الخاطئة */
.option-btn.wrong {
    background-color: #ff5f5f !important;
    color: white !important;
    border: none !important;
}

/* الإجابة الصحيحة */
.option-btn.correct {
    background-color: #088395 !important;
    color: white !important;
    border: none !important;
}

/* الخيارات عمودية عند أكثر من اثنين */
.options-container.vertical {
    grid-template-columns: 1fr;
}

.option-label {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 14px;
    flex-shrink: 0;
}

/* صندوق الشرح */
.explanation-content {
    margin-top: 25px;
    padding: 20px;
    border-top: 1px solid #f1f5f9;
    display: none;
}

/* Single Question Navigation */
.quiz-wrapper.hidden {
    display: none;
}

.navigation-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 700px;
    margin: 20px auto;
    padding: 0 20px;
}

.nav-btn {
    background: #088395;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.nav-btn:hover {
    background: #066d7c;
    transform: translateY(-2px);
}

.nav-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.nav-btn i {
    width: 18px;
    height: 18px;
}

.tab-btn.answered {
    background: #088395 !important;
    color: #fff !important;
}

.tab-btn.active-tab {
    border: 2px solid #088395 !important;
}