/* ==========================================================================
   Exam Phone Page Styles
   Shared CSS for all 5 phone exam pages
   Mobile-optimized with stacked single-column layout
   ========================================================================== */

/* Hide timer when mobile menu is open (Hamburger) */
body.menu-open .exam-timer-container {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Page Layout */
.exam-phone-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Prevent iframe from hijacking scroll during smooth scroll animations */
body.is-scrolling iframe {
    pointer-events: none !important;
}

.exam-phone-page main {
    flex: 1;
    margin-top: var(--header-height-mobile);
}

/* Hide Student Login button in header for mobile exams */
.exam-phone-page .main-header .right-nav .btn-primary:not(.mobile-login-btn) {
    display: none !important;
}

.form-container {
    width: calc(100% - 200px);
    /* Default: Enforce 100px margins (Total 200px) */
    max-width: 750px;
    height: auto;
    /* Allow container to shrink-wrap the JS-sized iframe */
    min-height: 40vh;
    /* Ensure some visibility during load */
    overflow-y: hidden;
    /* Let the iframe handle the scroll */
    /* Enable internal scrolling */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    margin: 0 auto !important;
    /* Center by default */
}

/* Safety for actual small screens (e.g. phones < 450px) */
@media (max-width: 600px) {
    .form-container {
        width: calc(100% - 100px);
        margin-left: 80px !important;
        /* Offset for floating navigation */
        margin-right: 20px !important;
    }
}

/* ==========================================================================
   Scroll Indicator Section
   ========================================================================== */

.scroll-indicator-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    background: var(--primary-blue);
    color: var(--white);
}

.scroll-indicator-section h1 {
    font-size: clamp(24px, 5vw, 36px);
    font-weight: 700;
    margin-bottom: 20px;
}

.scroll-indicator-section p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto 30px;
}

.nav-instruction {
    font-size: 15px !important;
    margin: 0 auto 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    max-width: 320px;
    line-height: 1.4;
    text-align: center;
}

/* Animated Arrow */
.scroll-arrow {
    width: 50px;
    height: auto;
    animation: bounceDown 2s ease-in-out infinite;
}

@keyframes bounceDown {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(20px);
    }

    60% {
        transform: translateY(10px);
    }
}

.scroll-text {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 15px;
    opacity: 0.8;
}

/* ==========================================================================
   Form Section Containers
   ========================================================================== */

.exam-section {
    padding: 0;
    background: var(--white);
}

/* Section Header */
.exam-section-header {
    background: var(--dark-grey);
    color: var(--white);
    padding: 20px;
    text-align: center;
}

.exam-section-header h2 {
    font-size: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.exam-section-header .section-icon {
    font-size: 24px;
}

/* Instructions Card */
.exam-instructions {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 10px;
    margin: 0;
    border-left: 4px solid var(--primary-blue);
}

.exam-instructions p {
    margin: 0;
    font-size: 15px;
    color: var(--dark-grey);
    line-height: 1.6;
}

.exam-instructions ul {
    margin: 10px 0 0;
    padding-left: 20px;
    list-style: disc;
}

.exam-instructions li {
    font-size: 14px;
    color: var(--dark-grey);
    margin-bottom: 5px;
}

/* ==========================================================================
   Google Form iframe Container
   ========================================================================== */

.form-container {
    /*width: auto;*/
    /*margin: 0 20px 20px;*/
    background: var(--white);
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.form-container iframe {
    width: 100%;
    min-height: 80vh;
    /* Force tall height to prevent internal scroll trap */
    border: none;
    display: block;
}

/* Loading State */
.form-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    z-index: 1;
}

.form-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-grey);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Form loaded - hide loading state */
.form-container.loaded .form-loading {
    display: none;
}

/* ==========================================================================
   Section Divider
   ========================================================================== */

.section-divider {
    background: var(--primary-blue);
    padding: 30px 20px;
    text-align: center;
}

.section-divider-text {
    font-size: 16px;
    font-weight: 700;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.section-divider-text::before,
.section-divider-text::after {
    content: '';
    width: 40px;
    height: 2px;
    background: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 480px) {
    .scroll-indicator-section {
        min-height: 50vh;
        padding: 30px 15px;
    }

    .scroll-indicator-section h1 {
        font-size: 22px;
    }

    .exam-section-header {
        padding: 15px;
    }

    .exam-section-header h2 {
        font-size: 16px;
    }

    .exam-instructions {
        padding: 10px;
    }

    .exam-instructions p {
        font-size: 12.6px;
    }

    .form-container {
        /* Base margin-top etc preserved if needed, but remove margin override */
        /*margin: 0 15px 15px;*/
    }

    .form-container iframe {
        min-height: 70vh;
    }

    .section-divider {
        padding: 10px 10px;
        text-align: center;
    }
}

@media (max-width: 630px) {
    .nav-instruction {
        font-size: 14px !important;
        margin-left: 80px !important;
        margin-right: 20px !important;
        max-width: calc(100% - 110px);
        text-align: left;
    }
}



/* Larger screens - still stacked but more breathing room */
/* Larger screens - still stacked but more breathing room */
@media (min-width: 769px) {
    .exam-phone-page main {
        margin-top: var(--header-height);
        /* Ensure content starts below fixed header */
    }



    .scroll-indicator-section {
        min-height: 40vh;
    }

    .exam-section-header {
        padding: 25px 40px;
    }

    .exam-instructions {
        padding: 25px 40px;
    }
}

/* ==========================================================================
   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 to form link */
.skip-to-form {
    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-form:focus {
    top: 0;
}

/* Focus visible for interactive elements */
.exam-section-header:focus-within,
.form-container:focus-within {
    outline: 2px solid var(--accent-tan);
    outline-offset: 2px;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .scroll-arrow {
        animation: none;
    }

    .form-loading::after {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .exam-section-header {
        border: 2px solid var(--white);
    }

    .exam-instructions {
        border: 2px solid var(--dark-grey);
    }
}

/* ==========================================================================
   Floating Navigation (Questions / Answers)
   ========================================================================== */

.floating-exam-nav {
    position: fixed;
    top: 50%;
    left: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 500;
}

.exam-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 18px;
    text-decoration: none;
    outline: none;
    font-family: var(--font-primary);
    padding: 0;
}

.exam-nav-btn:hover {
    transform: scale(1.1);
    background: var(--white);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.exam-nav-btn:active {
    transform: scale(0.95);
}

/* Active State */
#exam-nav-q.active,
#exam-nav-a.active {
    background: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(0, 140, 188, 0.4);
    transform: scale(1.1);
    border: 2px solid var(--dark-grey) !important;
}

/* Page Scroll Buttons */
#exam-nav-page-up,
#exam-nav-page-down {
    background: rgba(240, 240, 240, 0.9);
    color: var(--dark-grey);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#exam-nav-page-up:disabled,
#exam-nav-page-down:disabled,
#exam-nav-focus:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
    filter: grayscale(1);
}

#exam-nav-focus {
    background: rgba(255, 255, 255, 0.95);
    color: var(--primary-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

#exam-nav-focus .icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#exam-nav-focus .icon svg {
    width: 100%;
    height: 100%;
}

#exam-nav-focus:active {
    transform: scale(0.9);
}

#exam-nav-focus:not(:disabled):hover {
    box-shadow: 0 0 15px rgba(0, 140, 188, 0.3);
}

/* Focus Glow Animation */
@keyframes focus-glow-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 140, 188, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 25px 10px rgba(0, 140, 188, 0.4);
        transform: scale(1.06);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 140, 188, 0);
        transform: scale(1);
    }
}

.form-container.focus-glow {
    animation: focus-glow-pulse 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    z-index: 10;
    position: relative;
}

#exam-nav-page-up:hover,
#exam-nav-page-down:hover {
    background: var(--white);
    color: var(--primary-blue);
}

.exam-nav-btn .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Hide on very small screens if it overlaps content too much? 
   Or just adjust position. Left 20px is standard. */
@media (max-width: 360px) {
    .floating-exam-nav {
        left: 10px;
    }

    .exam-nav-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

.form-container iframe {
    background: peachpuff;
}