/* EGE exam shell — public variant + student assigned (exam_track=ege) */

/* Fullscreen + hide site chrome */
body.exam-shell-active,
body.take-test-ege-page,
body.ege-variant-exam-page.ege-variant-active {
    overflow: hidden;
    height: 100vh;
}

body.exam-shell-active .wrapper,
body.take-test-ege-page .wrapper,
body.ege-variant-exam-page.ege-variant-active .wrapper {
    min-height: 0;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

body.exam-shell-active main.flex-grow-1,
body.take-test-ege-page main.flex-grow-1,
body.ege-variant-exam-page.ege-variant-active main.flex-grow-1 {
    display: flex;
    flex-direction: column;
    flex: 1 1 0% !important;
    min-height: 0;
    overflow: hidden;
}

body.exam-shell-active nav.site-navbar,
body.exam-shell-active footer.footer,
body.exam-shell-active #site-messages,
body.exam-shell-active .legal-consent-reopen,
body.exam-shell-active #legalConsentDock,
body.exam-shell-active .ev-exam-breadcrumbs {
    display: none !important;
}

body.ege-variant-exam-page main.flex-grow-1 {
    display: flex;
    flex-direction: column;
}

.exam-shell-wrap,
body.take-test-ege-page .test-container,
body.ege-variant-exam-page .ev-exam-shell {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

body.take-test-ege-page #test-taking,
body.ege-variant-exam-page #ev-taking {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.test-container {
    flex: 1 1 0%;
    display: flex;
    flex-direction: column;
    background-color: #f5f9ff;
    width: 100%;
    max-width: none;
    margin: 0;
    min-height: 0;
    overflow: hidden;
}

.test-container[hidden] {
    display: none !important;
}

/* Header */
.test-header {
    background-color: #203961;
    color: white;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    min-height: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    flex-shrink: 0;
}

.test-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.test-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.test-id {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.exam-code {
    white-space: nowrap;
    color: #fff;
}

.header-btn {
    background: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #1e3a8a;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.2;
}

.header-btn:hover:not(:disabled) {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.header-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.header-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0.9;
    transition: opacity 0.2s, background-color 0.2s;
    padding: 0;
}

.header-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.18);
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.timer-label {
    display: none;
}

.timer-display {
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 64px;
    text-align: center;
    line-height: 1.2;
}

.timer-display.timer-warning,
.timer-display.timer-danger {
    color: #ffc107;
    animation: exam-shell-timer-pulse 1s infinite;
}

.timer-display.timer-expired,
.timer-display.timer-danger {
    color: #ff6b6b;
}

@keyframes exam-shell-timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.65; }
}

/* Content layout */
.test-content {
    flex: 1;
    display: flex;
    gap: 0;
    min-height: 0;
    overflow: hidden;
}

.test-sidebar.nav-wrap {
    width: 150px;
    flex-shrink: 0;
    background-color: transparent;
    border-right: none;
    padding: 0;
    overflow: hidden;
    min-height: 0;
}

.test-sidebar .nav {
    display: grid;
    grid-template-rows: auto auto;
    align-content: start;
    width: 150px;
    height: calc(100% - 20px);
    max-height: calc(100% - 20px);
    min-height: 0;
    margin: 10px 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.nav-answers {
    width: 103px;
    margin: 0 auto 0;
    text-align: center;
}

.nav-ans {
    margin: 16px 0;
    padding: 0;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.2;
    color: #666;
}

.nav-anscount {
    margin: 0 0 10px;
    padding: 0;
    font-size: 36px;
    font-weight: 400;
    line-height: 1;
    color: #222;
}

.question-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 0;
    width: 100%;
}

.nav-tasks {
    width: 40px;
    margin: 10px auto;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(100vh - 260px);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-tasks::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.nav-block {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    text-align: center;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav-block:last-child {
    margin-bottom: 0;
}

.nav-arrow {
    border: none;
    background: #1e325a;
    color: #fff;
}

.nav-arrow:hover {
    background: #243c6b;
}

.nav-task {
    border: 1px solid #fff;
    background: #fff;
    color: #222;
}

.nav-task.task-empty {
    border-color: #fff;
    background: #fff;
    color: #222;
}

.nav-task.task-fill {
    border-color: #222;
    background: transparent;
    color: #222;
}

.nav-task.task-current,
.nav-btn-info.task-current {
    border-color: #1e325a;
    background: #1e325a;
    color: #fff;
}

.nav-task:hover,
.nav-btn-info:hover {
    filter: brightness(0.97);
}

.nav-task.task-current:hover,
.nav-btn-info.task-current:hover {
    background: #243c6b;
    border-color: #243c6b;
}

.nav-btn-info {
    font-style: italic;
    font-weight: 700;
}

/* Legacy aliases for pages not yet on nav-block markup */
.answers-count {
    text-align: center;
    margin-bottom: 8px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

.answers-count--rail .answers-count-number {
    font-size: 36px;
    font-weight: 400;
    color: #222;
    line-height: 1;
}

.answers-count--rail .answers-count-label {
    font-size: 16px;
    color: #666;
    margin: 16px 0 0;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.2;
}

.nav-btn,
.nav-arrow {
    width: 40px;
    height: 40px;
    min-width: 40px;
    max-width: 40px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    padding: 0;
    flex-shrink: 0;
    font-weight: 400;
    font-size: 16px;
}

.nav-btn {
    border: 1px solid #fff;
    background: white;
    color: #222;
}

.nav-btn:hover {
    filter: brightness(0.97);
}

.nav-btn.current {
    background-color: #1e325a;
    color: white;
    border-color: #1e325a;
    box-shadow: none;
}

.nav-btn.answered {
    background: transparent;
    color: #222;
    border-color: #222;
}

.nav-btn.answered.current {
    background-color: #1e325a;
    color: white;
    border-color: #1e325a;
    box-shadow: none;
}

.nav-btn-info {
    border: 1px solid #222;
    background: transparent;
    color: #222;
    font-size: 16px;
    font-style: italic;
    font-weight: 700;
}

.nav-btn-info:hover {
    filter: brightness(0.97);
}

.nav-btn-info.current,
.nav-btn-info.task-current {
    background-color: #1e325a;
    color: white;
    border-color: #1e325a;
    box-shadow: none;
}

.nav-arrow {
    border: none;
    background: #1e325a;
    color: white;
    font-weight: 400;
    font-size: 16px;
}

.nav-arrow:hover {
    background-color: #243c6b;
    transform: none;
}

.test-stage {
    flex: 1;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr) 80px;
    align-items: stretch;
    min-width: 0;
    min-height: 0;
    background: #fff;
}

.exam-arrow-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #fff;
    padding: 10px;
    box-sizing: border-box;
}

.exam-arrow-wrap-left {
    grid-column: 1;
    min-height: 100%;
}

.exam-arrow-wrap-right {
    grid-column: 3;
    justify-content: center;
}

.exam-font-controls {
    display: none;
}

body:not(.ege-variant-exam-page) .exam-arrow-wrap-left {
    justify-content: center;
}

.exam-font-btn {
    display: block;
    margin: 0;
    padding: 0 0 10px;
    border: 0;
    background: transparent;
    cursor: pointer;
    line-height: 0;
}

.exam-font-btn img {
    display: block;
    width: 32px;
    max-width: 32px;
    height: auto;
}

.exam-font-btn:focus-visible {
    outline: 2px solid #4a90c8;
    outline-offset: 2px;
}

.exam-arrow-wrap .page-arrow-nav {
    width: 60px;
    height: 60px;
    border: 2px solid #a8c7f6;
    border-radius: 50%;
    background: #fff;
    color: #a8c7f6;
    font-size: 30px;
    font-weight: 400;
    box-shadow: none;
}

.exam-arrow-wrap .page-arrow-nav:hover:not(:disabled) {
    color: #7eb0e5;
    border-color: #7eb0e5;
    background: #fff;
    box-shadow: none;
}

.exam-arrow-wrap .page-arrow-nav:disabled {
    color: #c5d9ef;
    border-color: #c5d9ef;
    background: #fff;
}

.test-container[data-single-question="1"] .page-arrow {
    display: none;
}

.test-container[data-single-question="1"] .test-stage {
    grid-template-columns: minmax(0, 1fr);
}

.test-container[data-single-question="1"] .question-main {
    grid-column: 1;
}

.test-container[data-single-question="1"] .question-nav {
    display: none;
}

.page-arrow-left {
    justify-self: center;
}

.page-arrow-right {
    justify-self: center;
}

.page-arrow {
    align-self: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 2px solid #7eb0e5;
    border-radius: 50%;
    background: #fff;
    color: #1a1a1a;
    font-size: 1.75rem;
    font-weight: 400;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.page-arrow:hover:not(:disabled) {
    color: #0f172a;
    border-color: #4a90c8;
    background: #f8fbff;
    box-shadow: 0 3px 12px rgba(74, 144, 200, 0.22);
}

.page-arrow:active:not(:disabled) {
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.page-arrow:disabled {
    color: #94a3b8;
    border-color: #c5d9ef;
    background: #f8fafc;
    box-shadow: none;
    opacity: 1;
    cursor: not-allowed;
}

.page-arrow.page-arrow-hint-pulse {
    color: #0f172a;
    border-color: #4a90c8;
    box-shadow: 0 0 0 3px rgba(74, 144, 200, 0.35), 0 2px 8px rgba(15, 23, 42, 0.12);
}

.question-main {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.question-content.exam-scroll {
    flex: 1 1 0%;
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: white;
    min-height: 0;
    max-height: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #b6c2d1 #f0f4f8;
}

.exam-scroll::-webkit-scrollbar {
    width: 10px;
}

.exam-scroll::-webkit-scrollbar-track {
    background: #e8eef4;
}

.exam-scroll::-webkit-scrollbar-thumb {
    background: #7a8fa8;
    border-radius: 5px;
    border: 2px solid #e8eef4;
}

.exam-scroll::-webkit-scrollbar-thumb:hover {
    background: #5c6f87;
}

#examView.exam-paper {
    width: 100%;
}

.question-title {
    font-size: 16px;
    font-weight: 700;
    color: #495057;
    margin-bottom: 15px;
    line-height: 1.4;
}

.question-text {
    font-size: 15px;
    line-height: 1.5;
    color: #212529;
    margin-bottom: 15px;
}

body.ege-variant-exam-page .question-text {
    font-size: 20px;
    line-height: 30px;
    color: #222;
    margin-bottom: 0;
}

/* Exam instructions modal */
.exam-instructions-modal .modal-header {
    background: #203961;
    color: #fff;
}

.exam-instructions-modal .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.exam-instructions-modal .btn-close {
    filter: invert(1);
}

@media (max-width: 1100px) {
    .test-header {
        flex-wrap: nowrap;
        padding: 6px 10px;
    }

    .test-header-right {
        gap: 8px;
    }

    .timer-display {
        font-size: 15px;
        min-width: 60px;
    }

    .header-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
}

@media (max-width: 1024px) {
    .test-sidebar {
        width: 52px;
        padding: 6px 3px;
    }

    .question-content.exam-scroll {
        padding: 18px;
    }

    .test-id {
        font-size: 14px;
    }

    .header-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    .test-container {
        height: 100%;
    }

    .test-header {
        padding: 6px 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .test-id {
        font-size: 14px;
        order: 2;
        width: 100%;
        text-align: center;
        margin-top: 4px;
    }

    .header-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .header-icon {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 12px;
    }

    .test-content {
        flex-direction: column;
    }

    .test-sidebar {
        width: 100%;
        height: auto;
        max-height: 120px;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .answers-count--rail {
        flex-shrink: 0;
        margin-bottom: 0;
        min-width: 48px;
    }

    .question-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 4px;
        align-items: center;
    }

    .test-stage {
        grid-template-columns: 56px minmax(0, 1fr) 56px;
    }

    .page-arrow {
        width: 40px;
        height: 40px;
        font-size: 1.45rem;
    }

    .nav-btn,
    .nav-arrow {
        flex-shrink: 0;
    }

    .nav-arrow {
        margin: 0;
    }

    .question-content.exam-scroll {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .test-id {
        font-size: 13px;
    }

    .header-btn {
        padding: 3px 6px;
        font-size: 9px;
    }

    .test-sidebar {
        padding: 6px 10px;
        max-height: 100px;
    }

    .nav-btn,
    .nav-arrow {
        width: 30px;
        height: 30px;
        min-width: 30px;
        max-width: 30px;
        font-size: 11px;
    }

    .question-content.exam-scroll {
        padding: 12px;
    }

    .test-stage {
        grid-template-columns: 48px minmax(0, 1fr) 48px;
    }

    .page-arrow {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
    }
}

.mobile-version .test-container {
    -webkit-overflow-scrolling: touch;
}

.mobile-version .nav-btn:active,
.mobile-version .nav-arrow:active,
.mobile-version .page-arrow:active {
    transform: scale(0.95);
    transition: transform 0.1s;
}

@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .page-arrow {
        -webkit-tap-highlight-color: transparent;
    }
}
