/* ==========================================================================
   Exam Computer Page Styles
   Shared CSS for all 5 computer exam pages
   Desktop-optimized with split-pane layout
   ========================================================================== */

/* Page Layout */
.exam-computer-page {
    min-height: 100vh;
    display: block;
    /* Standard block flow */
    overflow-y: auto;
    /* Enable page scroll */
}

/* Prevent iframe from hijacking scroll during smooth scroll animations */
body.is-scrolling iframe {
    pointer-events: none !important;
}

.exam-computer-page main {
    display: block;
    /* Standard block flow */
}

/* ==========================================================================
   Page Title Bar
   ========================================================================== */

.exam-title-bar {
    background: var(--dark-grey);
    color: var(--white);
    padding: 20px 40px;
    text-align: center;
}

.exam-title-bar h1 {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
}

.exam-title-bar p {
    font-size: 14px;
    opacity: 0.8;
    margin: 8px 0 0;
}

/* ==========================================================================
   Split Pane Layout
   ========================================================================== */

/* Main Split Layout - STATIC (No Sticky) for Global Page Scroll */
.exam-split-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    min-height: 100vh;
    /* Allow growing */
    align-items: start;
    /* Allow independent heights, but we usually want stretch */
}

/* Individual Pane */
.exam-pane {
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    position: relative;
    /* Removed overflow:hidden/auto so it grows with content */
    height: auto;
    min-height: 100%;
}

.exam-pane:last-child {
    border-right: none;
}

/* Pane Header */
.pane-header {
    background: var(--primary-blue);
    color: var(--white);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.pane-header.answer-pane {
    background: var(--accent-tan);
}

.pane-header h2 {
    font-size: 16px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.pane-header .pane-icon {
    font-size: 20px;
}

/* Pane Instructions */
.pane-instructions {
    background: #f8f9fa;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.pane-instructions p {
    font-size: 13px;
    color: var(--dark-grey);
    margin: 0;
    line-height: 1.5;
}

/* ==========================================================================
   Form Container
   ========================================================================== */

.pane-form-container {
    flex: 1;
    overflow: auto;
    position: relative;
    padding: 24px;
    background-color: #f4f6f8;
}

.pane-form-container iframe {
    width: 100%;
    height: 100%;
    min-height: 80vh;
    /* Force scrollbar onto the Pane, not the Iframe */
    border: none;
    display: block;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Sticky Answer Pane - DISABLED for Global Page Scroll */
.exam-pane.sticky-pane {
    position: relative;
    /* Was sticky */
    top: 0;
    height: auto;
    /* Allow growing */
    overflow: visible;
    /* No internal scrollbar */
}

.sticky-pane .pane-form-container {
    height: auto;
    overflow: visible;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.pane-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--white);
    z-index: 5;
    gap: 15px;
}

.pane-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-grey);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.pane-loading-text {
    font-size: 14px;
    color: var(--dark-grey);
    opacity: 0.7;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hide loading when form loaded */
.pane-form-container.loaded .pane-loading {
    display: none;
}

/* ==========================================================================
   Resize Handle (between panes)
   ========================================================================== */

.resize-handle {
    width: 6px;
    background: #e0e0e0;
    cursor: col-resize;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.resize-handle:hover {
    background: var(--primary-blue);
}

.resize-handle::after {
    content: '⋮';
    color: #999;
    font-size: 16px;
}

.resize-handle:hover::after {
    color: var(--white);
}

/* ==========================================================================
   Single Form Layout (for pages with only one form)
   ========================================================================== */

.exam-single-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.exam-single-container .pane-header {
    text-align: center;
    justify-content: center;
}

.exam-single-container .pane-form-container {
    flex: 1;
}

.exam-single-container .pane-form-container iframe {
    min-height: 80vh;
}

/* ==========================================================================
   Responsive - Tablet and Mobile Fallback
   ========================================================================== */

@media (max-width: 1024px) {
    .exam-split-container {
        grid-template-columns: 1fr;
    }

    .exam-pane {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .exam-pane:last-child {
        border-bottom: none;
    }

    .exam-pane.sticky-pane {
        position: relative;
        top: 0;
        height: auto;
    }

    .pane-form-container {
        padding: 16px;
    }

    .pane-form-container iframe {
        min-height: 70vh;
    }

    .resize-handle {
        display: none;
    }
}

@media (max-width: 768px) {
    .exam-title-bar {
        padding: 15px 20px;
    }

    .exam-title-bar h1 {
        font-size: 18px;
    }

    .pane-header {
        padding: 12px 16px;
    }

    .pane-header h2 {
        font-size: 14px;
    }

    .pane-instructions {
        padding: 10px 16px;
    }

    .pane-form-container iframe {
        min-height: 60vh;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip links */
.skip-to-reading {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-blue);
    color: var(--white);
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.3s;
    text-decoration: none;
    font-weight: 700;
}

.skip-to-reading:focus {
    top: 0;
}

.skip-to-answers {
    position: absolute;
    top: -40px;
    left: 150px;
    background: var(--accent-tan);
    color: var(--white);
    padding: 8px 16px;
    z-index: 9999;
    transition: top 0.3s;
    text-decoration: none;
    font-weight: 700;
}

.skip-to-answers:focus {
    top: 0;
}

/* Focus states */
.exam-pane:focus-within .pane-header {
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.pane-form-container:focus-within {
    outline: 2px solid var(--primary-blue);
    outline-offset: -2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pane-loading-spinner {
        animation: none;
    }

    .resize-handle {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .exam-pane {
        border: 2px solid var(--dark-grey);
    }

    .pane-header {
        border-bottom: 2px solid var(--white);
    }

    .resize-handle {
        background: var(--dark-grey);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .exam-split-container {
        display: block;
    }

    .exam-pane {
        page-break-inside: avoid;
    }

    .pane-form-container iframe {
        height: auto;
        min-height: 0;
    }
}