/* ===== TEST PAGE STYLES ===== */
.test-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5e6c8 0%, #f0ddb8 50%, #ebcfa0 100%);
    z-index: 3000;
    overflow-y: auto;
}

.test-page.show {
    display: block;
}

.test-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 50px;
}

.test-header {
    background: #fef8e6;
    border-radius: 15px 15px 0 0;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
}

.test-header::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    right: 0;
    height: 20px;
    background: repeating-linear-gradient(90deg, 
        #ff6b6b 0px, #ff6b6b 15px, transparent 15px, transparent 20px,
        #4ecdc4 20px, #4ecdc4 35px, transparent 35px, transparent 40px,
        #ffe66d 40px, #ffe66d 55px, transparent 55px, transparent 60px,
        #a8e6cf 60px, #a8e6cf 75px, transparent 75px, transparent 80px
    );
    border-radius: 10px 10px 0 0;
}

.question-progress {
    display: flex;
    align-items: center;
    gap: 20px;
}

.progress-counter {
    font-size: 20px;
    font-weight: bold;
    color: #2c3e50;
}

.progress-circles {
    display: flex;
    gap: 6px;
}

.progress-row {
    display: flex;
    gap: 6px;
}

.circle {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid #ccc;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    transition: all 0.3s;
}

.circle:hover {
    transform: scale(1.2);
    border-color: #4caf50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
    transition: all 0.3s;
}

.circle.answered {
    background: #4caf50;
    border-color: #4caf50;
    color: white;
}

.circle.active {
    background: #ffd700;
    border-color: #ffd700;
    color: #333;
    transform: scale(1.15);
    font-weight: bold;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-icon {
    width: 35px;
    height: 35px;
    background: #ffd700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.timer-display {
    font-size: 22px;
    font-weight: bold;
    color: #2c3e50;
}

.question-card {
    background: #fef8e6;
    padding: 40px;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
}

.section-header {
    background: linear-gradient(135deg, #d4a020 0%, #c49018 100%);
    color: #ffffff;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(212, 160, 32, 0.3);
}

.section-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
}

.section-description {
    font-size: 14px;
    opacity: 0.9;
}

.audio-section {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.audio-section audio {
    display: none; /* Hide default audio player */
}

.audio-info {
    font-size: 14px;
    color: #1976d2;
    font-weight: bold;
    margin-bottom: 15px;
}

#audioControls {
    max-width: 500px;
    margin: 0 auto;
}

.audio-play-btn {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 50px;
    cursor: pointer;
    margin-bottom: 15px;
    transition: all 0.3s;
    font-weight: bold;
}

.audio-play-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

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

.audio-play-btn.playing {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

#audioProgress {
    width: 100%;
    height: 8px;
    background: #ddd;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

#audioProgressBar {
    height: 100%;
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    width: 0%;
    transition: width 0.1s;
}

#audioTime {
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

.reading-passage {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 5px solid #2196f3;
}

.passage-title {
    font-size: 20px;
    font-weight: bold;
    color: #1976d2;
    margin-bottom: 15px;
}

.passage-text {
    font-size: 16px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
}

.question-item {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.question-item:last-child {
    margin-bottom: 0;
}

.writing-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
}

.writing-instruction {
    background: #fff3e0;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 5px solid #ff9800;
}

.word-count {
    text-align: right;
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

.question-header {
    font-size: 18px;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 25px;
}

/* Image choice (Yes/No) for Section 2 */
.image-choice-item {
    display: grid;
    grid-template-columns: 120px 1fr 180px;
    gap: 16px;
    align-items: center;
}
.image-thumb {
    width: 120px;
    height: 90px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    background: #f7f7f7;
}
.image-caption {
    color: #333;
    font-size: 15px;
}
.image-choice-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.image-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 25px;
    border: 2px solid #e0e0e0;
    background: #fff;
    cursor: pointer;
    font-weight: 700;
    color: #333;
    transition: all 0.2s ease;
    user-select: none;
}
.image-toggle:hover { transform: translateY(-2px); }
.image-toggle.yes.selected {
    border-color: #4caf50;
    background: #e8f5e9;
    color: #2e7d32;
}
.image-toggle.no.selected {
    border-color: #ef5350;
    background: #ffebee;
    color: #c62828;
}

.question-text {
    font-size: 17px;
    color: #333;
    line-height: 1.8;
    margin-bottom: 25px;
}

.audio-player {
    margin: 25px 0;
    display: none;
}

.audio-player audio {
    width: 100%;
    max-width: 500px;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 30px;
}

.option-item {
    background: white;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-item:hover {
    border-color: #7cb342;
    background: #f1f8e9;
}

.option-item.selected {
    border-color: #4caf50;
    background: #e8f5e9;
}

.option-label {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
    transition: all 0.3s;
}

.option-item.selected .option-label {
    background: #4caf50;
    color: white;
}

.option-text {
    flex: 1;
    font-size: 16px;
    color: #333;
}

/* Text input for fill-in questions - MUST SHOW */
.text-input-container {
    margin-top: 20px !important;
    margin-bottom: 10px !important;
    display: block !important;
    width: 100% !important;
}

.text-input {
    width: 100% !important;
    padding: 15px 20px !important;
    border: 3px solid #e0e0e0 !important;
    border-radius: 12px !important;
    font-size: 16px !important;
    transition: all 0.3s !important;
    font-family: 'Nunito', 'Segoe UI', sans-serif !important;
    background: white !important;
    display: block !important;
    box-sizing: border-box !important;
}

.text-input:focus {
    outline: none !important;
    border-color: #4caf50 !important;
    background: #f1f8e9 !important;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1) !important;
}

/* Essay textarea */
.essay-input-container {
    margin-top: 30px;
}

.essay-input {
    width: 100%;
    min-height: 200px;
    padding: 15px 20px;
    border: 3px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    resize: vertical;
}

.essay-input:focus {
    outline: none;
    border-color: #4caf50;
    background: #f1f8e9;
}

/* Page info */
.page-info {
    text-align: center;
    margin-top: 15px;
    font-size: 16px;
    color: #2c3e50;
    font-weight: bold;
}

.question-nav {
    background: #fef8e6;
    border-radius: 0 0 15px 15px;
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-button {
    padding: 12px 35px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-prev {
    background: #9e9e9e;
    color: white;
}

.btn-prev:hover:not(:disabled) {
    background: #757575;
}

.btn-next {
    background: #2196f3;
    color: white;
}

.btn-next:hover:not(:disabled) {
    background: #1976d2;
}

/* Next page button */
.btn-next-page {
    background: #ff9800;
    color: white;
}

.btn-next-page:hover:not(:disabled) {
    background: #f57c00;
}

.btn-submit {
    background: #ff6b6b;
    color: white;
    flex: 1;
    max-width: 200px;
}

.btn-submit:hover:not(:disabled) {
    background: #ee5a6f;
    transform: translateY(-2px);
}

/* ===== RESULT PAGE STYLES ===== */
.result-page {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #f5e6c8 0%, #f0ddb8 50%, #ebcfa0 100%);
    z-index: 4000;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    overflow-y: auto;
    position: relative;
}

.result-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 15% 20%, rgba(212, 160, 32, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(230, 184, 50, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(240, 200, 70, 0.1) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.result-page::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.01) 100px,
            rgba(255, 255, 255, 0.01) 200px
        );
    pointer-events: none;
    z-index: 0;
    animation: backgroundShift 60s linear infinite;
}

@keyframes backgroundShift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.result-page.show {
    display: flex;
}

.result-container {
    max-width: 750px;
    width: 100%;
    background: #fffef9;
    border-radius: 2px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    z-index: 1;
    margin: 20px auto;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    padding: 45px 35px 40px 35px;
    background: linear-gradient(to bottom, #fffef9 0%, #fffdf5 100%);
}

/* Spiral binding effect */
.spiral-binding {
    height: 40px;
    background: linear-gradient(180deg, #d4a020 0%, #c49018 50%, #b48010 100%);
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.spiral-binding::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
}

.spiral-hole {
    width: 20px;
    height: 20px;
    background: radial-gradient(circle at 35% 35%, #ffffff, #f5e6c8 60%, #d4a020);
    border-radius: 50%;
    box-shadow: 
        inset 0 2px 5px rgba(0, 0, 0, 0.4),
        inset 0 -1px 2px rgba(255, 255, 255, 0.3),
        0 2px 3px rgba(255, 255, 255, 0.4);
    border: 2.5px solid #8b6914;
    position: relative;
}

.spiral-hole::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: radial-gradient(circle, #666 0%, #333 100%);
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.8);
}

.result-logo {
    position: absolute;
    top: 55px;
    left: 35px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #00a8cc 0%, #0077a3 100%);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 5px 15px rgba(0, 120, 163, 0.4),
        inset 0 -2px 5px rgba(0, 0, 0, 0.2),
        inset 0 2px 5px rgba(255, 255, 255, 0.2);
    transform: rotate(-5deg);
    transition: transform 0.3s ease;
}

.result-logo:hover {
    transform: rotate(0deg) scale(1.05);
}

.logo-lines {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.logo-line {
    width: 28px;
    height: 3.5px;
    background: white;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}


.result-title-new {
    text-align: center;
    color: #1a202c;
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    padding-bottom: 12px;
}

.result-title-new::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #8dc563, transparent);
    border-radius: 2px;
}

.result-card {
    background: linear-gradient(135deg, #c49018 0%, #a87d10 50%, #8b6914 100%);
    border-radius: 15px;
    padding: 24px 28px;
    margin-bottom: 24px;
    box-shadow: 
        0 5px 20px rgba(141, 197, 99, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.result-info {
    margin-bottom: 10px;
    color: #ffffff;
    font-size: 15px;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

.result-info:last-child {
    margin-bottom: 0;
}

.result-info strong {
    font-weight: 800;
}

.completion-message {
    background: white;
    padding: 22px 25px;
    border-radius: 10px;
    margin-bottom: 24px;
    line-height: 1.7;
    color: #2d3748;
    font-size: 14px;
    border: 1px solid #e8e8e3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
}

.completion-message::before {
    content: '🎓';
    position: absolute;
    top: -15px;
    left: 30px;
    font-size: 28px;
    background: white;
    padding: 0 8px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.completion-message p {
    margin-bottom: 12px;
}

.completion-message p:last-child {
    margin-bottom: 0;
}

.completion-message a {
    color: #0077b6;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    padding-bottom: 1px;
}

.completion-message a:hover {
    border-bottom-color: #0077b6;
    color: #005f8f;
}

.answers-grid {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
}

.answers-section h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.answers-grid-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.answers-subsection h4 {
    color: #2c3e50;
    font-size: 18px;
    margin-bottom: 15px;
    text-align: center;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.answer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    background: white;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.answer-item.correct {
    background: #e8f5e8;
    border-color: #4caf50;
}

.answer-item.incorrect {
    background: #ffebee;
    border-color: #f44336;
}

.answer-item span {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.check-icon {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.check-icon.correct {
    background: #4caf50;
    color: white;
}

.check-icon.incorrect {
    background: #f44336;
    color: white;
}

.result-buttons {
    text-align: center;
    margin-top: 30px;
}

.btn-result {
    padding: 15px 40px;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    background: #4caf50;
    color: white;
}

.btn-result:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.3);
}

.btn-result.retake {
    background: #ff9800;
    margin-left: 15px;
}

.btn-result.retake:hover {
    background: #f57c00;
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

/* AI Feedback Section */
.ai-feedback-section {
    background: #f0f8ff;
    border-radius: 12px;
    padding: 25px;
    margin-top: 30px;
    border-left: 5px solid #2196f3;
}

.ai-feedback-header h3 {
    color: #2c3e50;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.ai-feedback-content {
    line-height: 1.6;
    color: #333;
}

.ai-loading {
    text-align: center;
    padding: 20px;
}

.ai-loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4caf50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
