/* ==========================================================================
   MCQ module: question rendering, admin bank/builder, practice, exam UI.
   Colours follow the Sneat theme (primary #696cff).
   ========================================================================== */

/* ---------- Question rendering (mcq/partials/question) ---------- */
.mcq-question { color: #384551; line-height: 1.6; }
.mcq-q-head { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .5rem; }
.mcq-q-no { font-weight: 700; color: #566a7f; margin-right: .25rem; }
.mcq-q-text { overflow-wrap: anywhere; }
.mcq-q-text p, .mcq-explanation-body p { margin-bottom: .5rem; }
.mcq-q-text p:last-child, .mcq-explanation-body p:last-child { margin-bottom: 0; }
.mcq-q-text ul, .mcq-q-text ol, .mcq-explanation-body ul, .mcq-explanation-body ol { padding-left: 1.25rem; margin-bottom: .5rem; }
.mcq-diagram { display: block; max-width: 100%; height: auto; max-height: 380px; margin: .6rem 0; border: 1px solid #e4e6e8; border-radius: .5rem; background: #fff; cursor: zoom-in; }
.mcq-option .mcq-diagram { max-height: 180px; margin: .35rem 0 0; }
.mcq-options { display: grid; grid-template-columns: 1fr; gap: .55rem; margin-top: .85rem; }
.mcq-option { position: relative; display: flex; align-items: flex-start; gap: .65rem; padding: .65rem .85rem; border: 1px solid #d9dee3; border-radius: .5rem; background: #fff; transition: border-color .15s ease, background-color .15s ease; }
label.mcq-option { cursor: pointer; margin: 0; }
label.mcq-option:hover { border-color: #b4b6ff; }
.mcq-option-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.mcq-option-key { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #f0f1f4; color: #566a7f; font-weight: 600; font-size: .85rem; }
.mcq-option-body { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; padding-top: .15rem; }
.mcq-option-tag { flex: 0 0 auto; font-size: .7rem; font-weight: 700; padding-top: .35rem; white-space: nowrap; }
.mcq-option.is-selected { border-color: #696cff; background: #f3f3ff; }
.mcq-option.is-selected .mcq-option-key { background: #696cff; color: #fff; }
.mcq-option.is-correct { border-color: #71dd37; background: #f1fbea; }
.mcq-option.is-correct .mcq-option-key { background: #71dd37; color: #fff; }
.mcq-option.is-correct .mcq-option-tag { color: #3b8b12; }
.mcq-option.is-wrong { border-color: #ff3e1d; background: #fff1ee; }
.mcq-option.is-wrong .mcq-option-key { background: #ff3e1d; color: #fff; }
.mcq-option.is-wrong .mcq-option-tag { color: #c4260d; }
.mcq-options.is-locked label.mcq-option { cursor: default; }
.mcq-answer { margin-top: .85rem; font-weight: 600; color: #3b8b12; }
.mcq-explanation { margin-top: .6rem; padding: .75rem .9rem; background: #f8f9fb; border-left: 3px solid #71dd37; border-radius: .375rem; }
.mcq-explanation-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #8592a3; font-weight: 700; margin-bottom: .25rem; }
.mcq-math .katex { font-size: 1.05em; }
.mcq-math .katex-display { margin: .5rem 0; overflow-x: auto; overflow-y: hidden; padding: .1rem 0; }

/* ---------- Badges ---------- */
.mcq-badge { display: inline-flex; align-items: center; gap: .2rem; padding: .22rem .5rem; border-radius: .35rem; font-size: .7rem; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.mcq-badge-easy { background: #e8fadf; color: #3b8b12; }
.mcq-badge-moderate { background: #fff2d6; color: #a06f00; }
.mcq-badge-hard { background: #ffe5e0; color: #c4260d; }
.mcq-badge-pyq { background: #28a745; color: #fff; }
.mcq-badge-muted { background: #eceef1; color: #697a8d; }
.mcq-badge-primary { background: #e7e7ff; color: #5f61e6; }

/* ---------- Admin: question list ---------- */
.mcq-q-list .list-group-item { padding: 1rem 1.25rem; }
.mcq-q-snippet { color: #384551; margin: .35rem 0; overflow-wrap: anywhere; }
.mcq-q-meta { font-size: .8rem; color: #8592a3; display: flex; flex-wrap: wrap; gap: .2rem .9rem; }
.mcq-filter-card .form-label { font-size: .75rem; margin-bottom: .2rem; }

/* ---------- Page shells ----------
   Sneat's spacing scale: 4 = 1rem, 6 = 1.5rem (cards pad 1.5rem). Pages use the 6-step between blocks. */
.mcq-page { padding-bottom: 1.5rem; } /* gap above the site footer */
.mcq-admin .form-label, .mcq-wrap-label { white-space: normal; } /* Sneat labels never wrap: long labels overflowed on phones */
.mcq-q-topline { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; font-size: .8125rem; color: #8592a3; margin-bottom: 1rem; }
.mcq-side-card { position: sticky; top: 1.5rem; }
@media (max-width: 1199.98px) { .mcq-side-card { position: static; } }

/* ---------- Admin: question form ---------- */
.mcq-option-editor .correct-flag { display: none; }
.mcq-option-editor.is-correct .correct-flag { display: inline; }
.mcq-field-tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .35rem; flex-wrap: wrap; }
.mcq-image-slot { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .45rem; }
.mcq-image-thumb { position: relative; display: inline-block; }
.mcq-image-thumb img { display: block; max-height: 72px; max-width: 160px; border: 1px solid #d9dee3; border-radius: .375rem; background: #fff; }
.mcq-image-thumb .mcq-thumb-remove { position: absolute; top: -.55rem; right: -.55rem; width: 1.4rem; height: 1.4rem; padding: 0; border-radius: 50%; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.mcq-option-editor { border: 1px solid #d9dee3; border-radius: .5rem; padding: .75rem; height: 100%; background: #fff; transition: border-color .15s ease, box-shadow .15s ease; }
.mcq-option-editor.is-correct { border-color: #71dd37; box-shadow: 0 0 0 .15rem rgba(113, 221, 55, .18); }
.mcq-option-editor .form-check-input:checked { background-color: #71dd37; border-color: #71dd37; }
.mcq-preview { background: #fcfcfd; border: 1px dashed #d9dee3; border-radius: .5rem; padding: 1rem; }
.mcq-formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: .4rem; }
.mcq-formula-grid .btn { font-size: .85rem; padding: .35rem .25rem; }
.mcq-formula-preview { min-height: 3rem; padding: .6rem; border: 1px dashed #d9dee3; border-radius: .375rem; background: #fcfcfd; }
.mcq-sticky-actions { position: sticky; bottom: 0; z-index: 5; background: rgba(255, 255, 255, .97); border-top: 1px solid #eceef1; padding: .75rem 1.25rem; border-bottom-left-radius: .5rem; border-bottom-right-radius: .5rem; }
.mcq-pyq-row + .mcq-pyq-row { margin-top: .5rem; }
.rich-editor-container .ql-editor { min-height: inherit; }

/* ---------- Admin: syllabus ---------- */
.mcq-syllabus-list .list-group-item { display: flex; align-items: center; gap: .5rem; }
.mcq-syllabus-list .list-group-item.is-active-node { background: #f3f3ff; border-left: 3px solid #696cff; }
.mcq-syllabus-list .node-name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mcq-syllabus-list .node-actions { flex: 0 0 auto; display: flex; gap: .15rem; }
.mcq-syllabus-list .node-actions .btn { padding: .1rem .3rem; }

/* ---------- Admin: mock builder ---------- */
.mcq-bank-item { display: flex; gap: .75rem; align-items: flex-start; }
.mcq-bank-item .form-check-input { margin-top: .3rem; flex: 0 0 auto; }
.mcq-bank-item.is-picked { background: #f7f7ff; }
.mcq-paper-pane { position: sticky; top: 5.5rem; }
.mcq-paper-list { max-height: 440px; overflow-y: auto; border-top: 1px solid #f0f1f4; }
.mcq-paper-item { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem .25rem; border-bottom: 1px solid #f0f1f4; font-size: .85rem; background: #fff; }
.mcq-paper-item .handle { cursor: grab; color: #a1acb8; padding-top: .1rem; }
.mcq-paper-item .num { color: #8592a3; min-width: 1.75rem; text-align: right; }
.mcq-paper-item .txt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.mcq-stat-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.mcq-stat-chip { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 70px; padding: .35rem .55rem; border-radius: .5rem; background: #f5f5f9; font-size: .72rem; color: #697a8d; }
.mcq-stat-chip strong { font-size: 1.05rem; color: #384551; }
.mcq-subject-breakdown { font-size: .8rem; }
.mcq-subject-breakdown .chap { color: #8592a3; padding-left: .75rem; }
.mcq-mobile-paperbar { display: none; }
@media (max-width: 1199.98px) {
    .mcq-paper-pane { position: static; }
    .mcq-mobile-paperbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1075; padding: .65rem 1rem; background: #fff; border-top: 1px solid #e4e6e8; box-shadow: 0 -2px 8px rgba(67, 89, 113, .12); }
    .mcq-builder-page { padding-bottom: 4.5rem; }
}

/* ---------- Paper preview / print ---------- */
.mcq-print-q { padding: 1rem 0; border-bottom: 1px solid #eceef1; }
.mcq-print-q:last-child { border-bottom: 0; }
@media print {
    .layout-menu, .layout-navbar, .content-footer, .no-print, #toast-container { display: none !important; }
    .layout-page, .content-wrapper, .container-xxl { padding: 0 !important; margin: 0 !important; }
    .card { box-shadow: none !important; border: 0 !important; }
    .mcq-print-q { page-break-inside: avoid; }
    .mcq-diagram { cursor: default; }
}

/* ---------- Student: listings & practice ---------- */
.mcq-hero { background: linear-gradient(135deg, #696cff 0%, #8f7bff 100%); color: #fff; border-radius: .75rem; padding: 1.25rem 1.5rem; }
.mcq-hero h4, .mcq-hero h5 { color: #fff; }
.mcq-hero p { opacity: .92; margin-bottom: 0; }
/* One swipeable row on phones (Sneat forces wrapping via .nav.nav-pills:not(...), hence !important). */
.mcq-tabs { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
.mcq-tabs::-webkit-scrollbar { display: none; }
.mcq-tabs .nav-link { white-space: nowrap; }
.mcq-card { height: 100%; transition: transform .15s ease, box-shadow .15s ease; }
.mcq-card:hover { transform: translateY(-2px); box-shadow: 0 .25rem 1rem rgba(161, 172, 184, .45); }
.mcq-card .mcq-card-code { width: 2.75rem; height: 2.75rem; border-radius: .6rem; background: #e7e7ff; color: #5f61e6; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: 0 0 auto; }
.mcq-card-meta { font-size: .8rem; color: #8592a3; display: flex; flex-wrap: wrap; gap: .25rem .8rem; }
.mcq-progress-thin { height: .4rem; }
.mcq-chapter-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.mcq-chapter-row .name { flex: 1 1 220px; min-width: 0; }
.mcq-practice-nav { display: flex; gap: .75rem; justify-content: space-between; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid #f0f1f4; }
.mcq-section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8592a3; margin: .5rem 0 1rem; }
/* Label on top, value pinned to the bottom so values line up even when a label wraps. */
.mcq-result-tile { border-radius: .6rem; padding: .9rem 1rem; background: #f5f5f9; height: 100%; display: flex; flex-direction: column; justify-content: space-between; gap: .25rem; }
.mcq-result-tile .label { font-size: .75rem; color: #8592a3; text-transform: uppercase; letter-spacing: .03em; }
.mcq-result-tile .value { font-size: 1.35rem; font-weight: 700; color: #384551; }
.mcq-solution-filter { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mcq-solution-filter .btn { white-space: nowrap; }
.mcq-zoom-img { max-width: 100%; height: auto; }

/* ---------- Exam UI (website/layouts/exam) ---------- */
body.mcq-exam { background: #f5f5f9; min-height: 100vh; font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Bengali", Roboto, sans-serif; }
.mcq-exam-header { position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .6rem; padding: .55rem 1rem; background: #fff; border-bottom: 1px solid #e4e6e8; box-shadow: 0 1px 4px rgba(67, 89, 113, .08); }
.mcq-exam-title { flex: 1 1 auto; min-width: 0; font-weight: 600; color: #384551; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcq-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.05rem; padding: .3rem .65rem; border-radius: .5rem; background: #f0f1f4; color: #384551; white-space: nowrap; }
.mcq-timer.is-warning { background: #fff2d6; color: #a06f00; }
.mcq-timer.is-danger { background: #ffe5e0; color: #c4260d; animation: mcqPulse 1s ease-in-out infinite; }
@keyframes mcqPulse { 50% { opacity: .55; } }
.mcq-exam-body { display: flex; gap: 1rem; max-width: 1320px; margin: 0 auto; padding: 1rem 1rem 5.5rem; align-items: flex-start; }
.mcq-exam-main { flex: 1 1 auto; min-width: 0; background: #fff; border-radius: .6rem; box-shadow: 0 2px 6px rgba(67, 89, 113, .12); padding: 1rem 1.25rem 1.25rem; }
.mcq-exam-qbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; padding-bottom: .65rem; margin-bottom: .85rem; border-bottom: 1px solid #f0f1f4; font-size: .85rem; color: #697a8d; }
.mcq-save-state { font-size: .78rem; white-space: nowrap; }
.mcq-save-state.is-saved { color: #3b8b12; }
.mcq-save-state.is-saving { color: #8592a3; }
.mcq-save-state.is-offline { color: #c4260d; }
.mcq-attempt-q { display: none; }
.mcq-attempt-q.is-current { display: block; }
.mcq-exam-footer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid #e4e6e8; box-shadow: 0 -2px 8px rgba(67, 89, 113, .1); }
.mcq-exam-footer-inner { max-width: 1320px; margin: 0 auto; padding: .6rem 1rem; display: flex; gap: .5rem; align-items: center; }
.mcq-exam-footer-inner .spacer { flex: 1 1 auto; }
.mcq-palette-panel { width: 300px; flex: 0 0 300px; }
.mcq-palette-card { background: #fff; border-radius: .6rem; box-shadow: 0 2px 6px rgba(67, 89, 113, .12); padding: 1rem; position: sticky; top: 4.5rem; max-height: calc(100vh - 10rem); overflow-y: auto; }
.mcq-palette-subject { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #8592a3; margin: .75rem 0 .4rem; }
.mcq-palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.35rem, 1fr)); gap: .4rem; }
.mcq-pal-btn { position: relative; height: 2.35rem; border: 1px solid #d9dee3; border-radius: .4rem; background: #fff; color: #566a7f; font-weight: 600; font-size: .8rem; padding: 0; }
.mcq-pal-btn.st-answered { background: #71dd37; border-color: #71dd37; color: #fff; }
.mcq-pal-btn.st-unanswered { background: #ff3e1d; border-color: #ff3e1d; color: #fff; }
.mcq-pal-btn.st-marked { background: #8b5cf6; border-color: #8b5cf6; color: #fff; border-radius: 50%; }
.mcq-pal-btn.st-answered-marked { background: #8b5cf6; border-color: #8b5cf6; color: #fff; border-radius: 50%; }
.mcq-pal-btn.st-answered-marked::after { content: ""; position: absolute; right: -2px; bottom: -2px; width: .65rem; height: .65rem; border-radius: 50%; background: #71dd37; border: 2px solid #fff; }
.mcq-pal-btn.is-current { outline: 2px solid #384551; outline-offset: 2px; }
.mcq-legend { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; font-size: .72rem; color: #697a8d; }
.mcq-legend .sw { display: inline-block; width: .9rem; height: .9rem; border-radius: .2rem; vertical-align: -2px; margin-right: .3rem; border: 1px solid #d9dee3; background: #fff; }
.mcq-legend .sw.answered { background: #71dd37; border-color: #71dd37; }
.mcq-legend .sw.unanswered { background: #ff3e1d; border-color: #ff3e1d; }
.mcq-legend .sw.marked { background: #8b5cf6; border-color: #8b5cf6; border-radius: 50%; }
@media (max-width: 1199.98px) {
    .mcq-palette-panel { width: auto; flex: none; }
    .mcq-palette-card { position: static; max-height: none; box-shadow: none; padding: 0; }
}
@media (max-width: 575.98px) {
    .mcq-exam-body { padding: .5rem .5rem 5.5rem; }
    .mcq-exam-main { padding: .85rem .9rem 1rem; border-radius: .5rem; }
    .mcq-exam-footer-inner .btn { padding-left: .6rem; padding-right: .6rem; font-size: .85rem; }
    .mcq-exam-footer-inner .btn .btn-label-long { display: none; }
}
