@import url("./nimr-exam-flow.css");

/* Keep the untransformed legacy markup out of view while scripts build the exam UI. */
body.nimr-exam-mode:not([data-nimr-single-exam-initialized="true"]) > .container {
    visibility: hidden;
}

body.nimr-exam-mode:not([data-nimr-single-exam-initialized="true"])::before {
    content: "جاري تجهيز الاختبار…";
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: grid;
    place-items: center;
    padding-top: 58px;
    color: #174b39;
    background: #f3f7f4;
    font: 700 1rem 'Cairo', sans-serif;
}

html[lang="en"] body.nimr-exam-mode:not([data-nimr-single-exam-initialized="true"])::before {
    content: "Preparing your test…";
}

body.nimr-exam-mode:not([data-nimr-single-exam-initialized="true"])::after {
    content: "";
    position: fixed;
    top: calc(50% - 35px);
    left: calc(50% - 14px);
    z-index: 100001;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(19, 136, 93, 0.2);
    border-top-color: #13885d;
    border-radius: 50%;
    animation: nimr-single-exam-loading 0.8s linear infinite;
}

@keyframes nimr-single-exam-loading {
    to { transform: rotate(360deg); }
}

body.nimr-exam-mode.dark-mode:not([data-nimr-single-exam-initialized="true"])::before {
    color: #d1fae5;
    background: #0b1220;
}

/* Keep the original test identity visible in the shared single-test layout. */
body.nimr-exam-mode .contact-info {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px 16px;
    color: #355744 !important;
}

body.nimr-exam-mode .contact-info > div {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    color: #355744;
    background: #f2f8f4;
    border: 1px solid #e0eee5;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

body.nimr-exam-mode .contact-info i {
    color: #13885d;
}

/* Keep the original explanation-video action available in the sidebar. */
body.nimr-exam-mode .controls > button:not(#submit-btn) {
    display: block !important;
    width: 100%;
    min-height: 42px;
    margin: 8px 0 0 !important;
    padding: 9px 14px !important;
    color: #146b4c !important;
    background: #eff8f2 !important;
    border: 1px solid #cfe6d7 !important;
    border-radius: 9px !important;
    box-shadow: none !important;
    font: 700 14px 'Cairo', sans-serif !important;
}

body.nimr-exam-mode .controls > button:not(#submit-btn):hover {
    background: #e3f3e9 !important;
    border-color: #9fd0b1 !important;
}

body.nimr-exam-mode.dark-mode .contact-info > div {
    color: #dbeee2;
    background: #1b3026;
    border-color: #345642;
}

body.nimr-exam-mode.dark-mode .controls > button:not(#submit-btn) {
    color: #d8f2e2 !important;
    background: #1b392b !important;
    border-color: #37684c !important;
}

@media (max-width: 680px) {
    body.nimr-exam-mode .contact-info {
        justify-content: flex-start;
    }
}

/* Hide later questions only before the single-test UI finishes initializing. */
body.nimr-exam-mode:not([data-nimr-single-exam-initialized="true"]) .questions-container .question[id^="q"]:not(#q1) {
    display: none !important;
}
