/* Base Styles for Options */
.hlOption,
.selected,
.selectedTask1,
.selectedTask2,
.correct {
    cursor: pointer;
    border-radius: 1.5em;
    padding: 0.4em;
    transition: all 0.3s ease;
    border: 2px solid rgb(100, 208, 255);
    background-color: white;
    font-size: 1.1rem;
}

/* Selected States */
.selected {
    background-color: rgb(217, 242, 253);
    border: 1px solid lightblue;
}

.selectedTask1 {
    background-color: #d9f2fd;
    border: 2px solid #64d0ff;
}

.selectedTask2 {
    background-color: #ffe6e6;
    border: 2px solid #ff9999;
}

/* Correct/Incorrect States */
.hlOption.selected-correct,
.correct {
    background-color: #c8e6c9 !important;
    border: 2px solid green !important;
}

.hlOption.selected-incorrect {
    background-color: #ffcdd2 !important;
    border: 2px solid rgb(201, 60, 60) !important;
    color: rgb(57, 57, 57) !important;
}

.hlOption.unselected-correct {
    background-color: #ffffff !important;
    border: 2px solid green !important;
    opacity: 0.7 !important;
}

.hlOption.unselected-incorrect {
    background-color: #ffffff !important;
    border: 2px solid rgb(98, 98, 98) !important;
}

/* Text Styles */
p, span {
    font-size: 1.1rem;
}

/* Score Display */
#score {
    display: block;
}

/* Text and Options Container */
#textAndOptions {
    width: 100%;
    flex-direction: column;
    padding: 1em;
    height: 96%;
    flex: 1 1 auto;
    overflow: auto;
    text-align: justify;    
    line-height: 2.5rem;
    font-size: 1rem;
}

#fullWritingSection {
    margin: 1em 0;
    width: 100%;
}

/* Button Styles */
button {
    padding: 0.6em 1.2em;
    margin: 0.5em 0;
    font-size: 1rem;
    border: none;
    border-radius: 1em;
    background-color: #502f77;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover:not(:disabled) {
    background-color: #4cbce0;
}

button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

/* Hidden Sections */
.hidden {
    display: none;
}

/* Task Sections */
#task2Section,
#task3Section,
#task4Section,
#task5Section,
#task6Section,
#completionSection {
    margin-top: 2em;
}

/* Progress Bars */
#progressBars {
    margin: 1em 0;
}

#progressBars .progressBar {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 0.5em;
    overflow: hidden;
    margin-bottom: 0.5em;
}

#progressBars .progressBarFilled {
    height: 1em;
    background-color: #64d0ff;
    width: 0%;
    transition: width 0.3s;
}

/* Active States */
.hlExplanation,
.hlOption,
[id^="ExplanationFor"] {
    transition: all 0.3s ease;
}

.hlExplanation.active,
.hlOption.active,
[id^="ExplanationFor"].active {
    box-shadow: 0 0 8px rgba(76, 188, 224, 0.8);
    background-color: rgb(217, 242, 253);
    font-weight: bolder;
    color: rgb(0, 0, 0);
}

/* Task Instructions */
.task-instructions {
    padding: 1em;
    margin: 1em 0;
    background-color: #f8f9fa;
    border-radius: 0.5em;
}

/* Explanation Panel */
.explanation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
    border-top: 3px solid #2E8B57;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    font-size: 1.1em;
    line-height: 1.4;
    min-height: 4em;
    max-height: 40vh;
    overflow-y: auto;
    transition: all 0.3s ease-in-out;
}

.explanation-item {
    position: relative;
    margin: 0 auto;
    color: #333;
    max-width: 800px;
    background-color: white;
    border-radius: 2em;
    padding: 0.2em 0.8em;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;

}

.explanation-item.correct {
    box-shadow: 0 0 20px rgb(18, 92, 31);
}

.explanation-item.incorrect {
    box-shadow: 0 0 20px rgb(128, 128, 128);
}

/* Active Highlight */
.hlOption {
    position: relative;
    z-index: 1;
}

.span-active {
    box-shadow: 0 0 20px rgb(0, 0, 0);
}

/* Video Container and Controls */
.video-container {
    position: relative;
    width: 70%;
    max-width: min(800px, 90vh * (16/9));
    margin: 0 auto;
    aspect-ratio: 16/9;
}

/* Add video overlay to prevent direct video interaction */
.video-overlay {
    position: absolute;
    top: 0;
    left: 50%;
    width: 70%;
    height: 100%;
    background: transparent;
    z-index: 1;
    cursor: default;
    transform: translateX(-50%);
}

#player {
    width: 100%;
    height: 100%;
}

.custom-controls {
    position: relative;
    padding: 5px;
    color: white;
    height: auto;
    min-height: 45px;
    background-color: white;
    z-index: 2;
}

/* Speaking Scores Container */
.speaking-scores {
    position: relative;
    max-width: 800px;
    margin: 20px auto;
    padding-top: 45px;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    z-index: 1;
    padding: 0rem 1rem;
}

/* Start Overlay */
.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
}

.start-button {
    padding: 15px 30px;
    font-size: 18px;
    background-color: #4cbce0;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.start-button:hover {
    background-color: #502f77;
}

/* Base styles for custom controls */
.custom-controls {
    position: relative;
    padding: 5px;
    color: white;
    height: auto;
    min-height: 45px;
}

.controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2px;
}

.playback-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.control-button {
    background: none;
    border: none;
    padding: 2px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-icon {
    width: 20px;
    height: 20px;
}

/* Question overlay styles */
#question-overlay {
    position: relative;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
    min-height: 200px;
    z-index: 2;
}

#question-overlay::after {
    content: '';
    display: block;
    height: 60vh;
    width: 100%;
}

/* Extra large screen adjustments */
@media (min-width: 1440px) {
    body {
        font-size: 20px;
    }

    .name-container {
        font-size: 18px;
    }

    .label {
        font-size: 16px;
        width: 200px;
    }

    .bar-container-left, .bar-container-right {
        height: 14px;
    }

    .control-button {
        width: 40px;
        height: 40px;
    }

    .control-icon {
        width: 28px;
        height: 28px;
    }

    .progress-bar {
        height: 1rem;
    }

    #question-overlay {
        padding: 30px;
    }

    .question-text {
        font-size: 1.4em;
    }

    #question-overlay button {
        padding: 10px 20px;
        font-size: 1.1em;
        min-height: 40px;
    }
}

#question-overlay button {
    padding: 4px 8px;
    height: 28px;
    margin: 1px;
    font-size: 0.85em;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 1rem;
    background-color: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    margin: 1px 0;
    cursor: pointer;
}

.progress-filled {
    height: 100%;
    background-color: #4cbce0;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-markers {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.marker, .question-marker {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: #006400;  /* Dark green default */
    cursor: pointer;
    pointer-events: auto;
    transform: translateX(-50%);
}

.question {
    line-height: 1.5rem;
}

.question-marker {
    background-color: #0c080c;  /* Dark blue */
}

.marker:hover .marker-tooltip {
    opacity: 1;
    visibility: visible;
}

.marker-tooltip {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #006400;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.marker-tooltip:after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #006400 transparent transparent transparent;
}

/* Time Display */
#currentTime, #duration {
    font-size: 1em;
    color: #666;
    font-family: monospace;
    min-width: 45px;
    text-align: center;
}

/* Question Overlay Styles */
.question-overlay {
    position: relative;
    background-color: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin: 20px 0;
    min-height: 200px;
    z-index: 2;
}

.question-text {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
   
    align-items: center;
}

.option-button {
    padding: 3px 20px;
    margin: 1px;
    font-size: 0.85em;
    min-height: 24px;
    border-radius: 1.5em;
    max-width: 40rem;
    border: 2px solid rgb(100, 208, 255); /* Default border */
    background-color: white; /* Default background */
    color: #502f77;
    cursor: pointer;
    transition: background-color 0.3s, border 0.3s;
}

/* Only apply hover effect on devices that support hover */
@media (hover: hover) {
    .option-button:hover:not(:disabled) {
        background-color: #502f77;
        border: 2px solid white; 
        color: white;
    }
}

.option-button.correct {
    background-color: #4CAF50;
    color: rgb(46, 46, 46);
    border-color: #4CAF50;
}

.option-button.incorrect {
    background-color: #ffd1cd;
    color: rgb(46, 46, 46);
    border-color: #f44336;
}

.option-button:disabled {
    display: inline-block !important;
    background-color: white !important;
    cursor: not-allowed;
    opacity: 0.6;
    pointer-events: none;
}

.continue-button {
    display: block;
    margin: 20px auto 0;
    padding: 12px 24px;
    background-color: #4cbce0;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.continue-button:hover {
    background-color: #3da1c1;
}

.controls-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.playback-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.control-button:hover {
    background-color: rgba(76, 188, 224, 0.1);
}

.control-button:active {
    background-color: rgba(76, 188, 224, 0.3);
    animation: buttonPress 0.5s ease-out;
}

.control-button.answer-ready {
    animation: blinkShadow 3s ease-out;
}

.control-icon {
    width: 24px;
    height: 24px;
    color: #502f77;
}

.time-display {
    font-size: 14px;
    color: #502f77;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

.subtitle-container {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1.4;
    text-align: center;
    width: 90%;
    max-width: 90%;
    transition: opacity 0.3s ease-in-out;
    opacity: 0;
    z-index: 1000;
    font-family: Arial, sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    white-space: pre-line;
    font-weight: 500;
    letter-spacing: 0.3px;
    box-sizing: border-box;
}

.subtitle-visible {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide subtitles when question overlay is present 
.question-overlay ~ .subtitle-container {
    display: none !important;
   
}*/

/* Define the button press animation */
@keyframes buttonPress {
    0% {
        background-color: rgba(76, 188, 224, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

/* Update the blinking shadow animation */
@keyframes blinkShadow {
    0%, 66% {  /* Stay invisible for first 2/3 of animation duration */
        box-shadow: 0 0 0 0 rgba(76, 188, 224, 0);
        transform: scale(1);
    }
    83% {  /* Blink at 2.5s mark */
        box-shadow: 0 0 15px 5px rgba(76, 188, 224, 0.7);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 188, 224, 0);
    }
}

/* Hide YouTube top chrome bar */
.ytp-chrome-top {
    display: none !important;
}

/* Also hide the related videos overlay at the end */
.ytp-pause-overlay {
    display: none !important;
}

.explanation-text {
    margin-top: 15px;
    padding: 15px;
   
   
    font-size: 1rem;
    color: #333;
    line-height: 1.5;
    display: block;
    width: 100%;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10;
}

/* Add a subtle animation for the explanation appearance */
@keyframes fadeInExplanation {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.explanation-text {
    animation: fadeInExplanation 0.3s ease-out forwards;
}

/* Speaking Scores Styles */
.speaking-scores {
    position: relative;
    max-width: 800px;
    margin: 20px auto;
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.category {
    display: flex;
    align-items: center;
    
}

.left-bars {
    display: flex;
    gap: 5px;
    flex: 1;
}

.label {
    font-family: sans-serif;
    width: 150px;
    font-size: 10px;
    color: #333;
    text-align: center;
}

.bar-container {
    flex: 1;
    background-color: #f0f0f0;
    border-radius: 5px;
    height: 10px;
    display: flex;
    justify-content: flex-start;
}

.left-bars .bar-container {
    justify-content: flex-end;
}

/* Base bar styles */
.bar {
    height: 100%;
    border-radius: 5px;
    background-color: #00cc00 !important;
    transition: width 0.8s ease-in-out, opacity 0.8s ease-in-out;
    width: 0;
}

/* Opacity classes - these should transition smoothly */
.nothing { opacity: 0; }
.maybe { opacity: 0.33; }
.probably { opacity: 0.66; }
.definitely { opacity: 1; }

/* Points system - separate from opacity for smooth transitions */
.zero_points { width: 0 !important; }
.half_point { width: 10% !important; }
.one_point { width: 20% !important; }
.one_and_a_half_points { width: 30% !important; }
.two_points { width: 40% !important; }
.two_and_a_half_points { width: 50% !important; }
.three_points { width: 60% !important; }
.three_and_a_half_points { width: 70% !important; }
.four_points { width: 80% !important; }
.four_and_a_half_points { width: 90% !important; }
.five_points { width: 100% !important; }

#videoSection {
    position: relative;
    margin-bottom: 10em;
}

.name-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 12px;
    color: #333;
}

.category {
    display: flex;
    align-items: center;
   
}

.left-bars, .bar-container {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

/* Common styles for both containers */
.bar-container-left, .bar-container-right {
    flex: 1;
    background-color: #f0f0f0;
    border-radius: 5px;
    height: 10px;
    display: flex;
}

/* Exception for left container only */
.bar-container-left {
    justify-content: flex-end;
}

/* Replace the .bar.changing animation with this new highlight style */
.bar.highlight-change {
    outline: 2px solid rgb(255, 255, 255);
    box-shadow: 0 0 12px 4px rgba(0, 100, 0, 0.5);
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0% {
        outline: 2px solid rgba(255, 255, 255, 0);
        box-shadow: 0 0 0 0 rgba(0, 100, 0, 0);
    }
    20% {
        outline: 2px solid rgb(255, 255, 255);
        box-shadow: 0 0 12px 4px rgba(0, 100, 0, 0.5);
    }
    80% {
        outline: 2px solid rgb(255, 255, 255);
        box-shadow: 0 0 12px 4px rgba(0, 100, 0, 0.5);
    }
    100% {
        outline: 2px solid rgba(255, 255, 255, 0);
        box-shadow: 0 0 0 0 rgba(0, 100, 0, 0);
    }
}

/* Add these styles for the subtitle button */
#subtitleButton {
    transition: background-color 0.3s ease;
}

#subtitleButton.active {
    background-color: rgba(76, 188, 224, 0.2);
}

/* Update the subtitle container styles to ensure proper visibility transitions */
.subtitle-container {
    transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
    visibility: hidden;
}

.subtitle-container.subtitle-visible {
    visibility: visible;
}

/* Desktops */
@media only screen and (min-width: 1025px) {
    /* Base text sizes */
    body {
        font-size: 18px;
    }
    #examPartsNavWrapper{
        max-width: 880px;
    }

}
    /* Score section */
    .name-container {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .label {
        font-size: 14px;
        width: 180px;
    }

    .bar-container-left, .bar-container-right {
        height: 12px;
    }

    /* Controls */
    .custom-controls {
        min-height: 55px;
    }

    .control-button {
        width: 36px;
        height: 36px;
    }

    .control-icon {
        width: 24px;
        height: 24px;
    }

    .time-display {
        font-size: 0.8rem;
    }

    .progress-bar {
        height: 1rem;
    }

    /* Question overlay */
    #question-overlay {
        padding: 25px;
    }

    .question-text {
        font-size: 1.3em;
        margin-bottom: 25px;
    }

    #question-overlay button {
        padding: 8px 16px;
        font-size: 1em;
        min-height: 36px;
    }

    






/* MEDIA QUERIES ONLY BELOW THIS POINT */






/* Tablets and iPads */
@media only screen and (min-width: 481px) and (max-width: 768px) {
    /* Base text styles */
    body {
        font-size: 16px;
        line-height: 1.6;
    }


    /* Video container */
    .video-container {
        max-height: 33vh;
        width: auto;
        margin-bottom: 5rem;
    }

    /* Controls */
    .custom-controls {
        padding: 4px;
        min-height: 45px;
        max-height: 50px;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
    }
   

    /* Question overlay */
    #question-overlay {
        padding: 4px;
        max-height: 40vh;
        gap: 2px;
    }

    #question-overlay button {
        padding: 4px 8px;
        height: 26px;
        margin: 1px;
        font-size: 0.85em;
        min-height: 26px;
        max-height: 28px;
    }

    /* Sections */
    #videoSection {
        position: relative;
        margin-bottom: 2em;
        padding-bottom: 45px;
    }

    .speaking-scores {
        padding: 0rem 3rem;
    }

    .subtitle-container {
        bottom: 60px;
    }
}









    /* Mobile devices */
@media only screen and (max-width: 480px) {
    /* Base text styles */
    body {
        font-size: 14px;
        line-height: 1.6;
    }
    .video-container {
  
        width: 100%;
        
    }
    p, span {
        font-size: 0.8rem;
    }

    #question-overlay::after {
        height: 70vh;


    /* Container adjustments */
    #player {
        margin-bottom: 5px;
    }

    #textAndOptions {
        padding: 10px;
    }

    /* Controls */
    .custom-controls {
        padding: 3px;
        min-height: 40px;
        max-height: 45px;
    }

    .control-button {
        width: 24px;
        height: 24px;
        padding: 2px;
        margin: 0;
    }

    .control-icon {
        width: 18px;
        height: 18px;
    }

    .controls-bottom {
        margin-top: 2px;
    }

    .playback-controls {
        gap: 3px;
    }

    .progress-bar {
        height: 1rem;
        margin-bottom: 2px;
    }

    .time-display {
        font-size: 0.8em;
    }

    /* Question overlay */
    #question-overlay {
        padding: 3px;
        max-height: 35vh;
        gap: 2px;
    }

    #question-overlay::after {
        height: 70vh;
    }

    #question-overlay button {
        padding: 3px 6px;
        height: 24px;
        margin: 1px;
        font-size: 0.8em;
        min-height: 24px;
        max-height: 26px;
    }
    .explanation-text {
        font-size: 0.85em;
        padding: 8px;
        margin-top: 10px;
    }

    /* Buttons */
    button {
        padding: 2px 22px;
        margin: 8px 0;
        width: 100%;
        max-width: none;
    }

    /* Explanation */
    .explanation {
        padding: 15px;
        
    }

    .explanation-text {
        font-size: 0.85em;
        padding: 8px;
        margin-top: 10px;
    }

    .explanation-intro {
        padding: 10px;
        margin-bottom: 10px;
    }

    .explanation-item {
        padding: 10px;
        margin: 5px auto;
    }

    /* Subtitles */
    .subtitle-container {
        bottom: 75px;
        font-size: 0.8rem;
        padding: 12px 20px;
    }

    #subtitleContainer {
        font-size: 0.85em;
        padding: 3px;
    }

    /* Task sections */
    .task-instructions {
        padding: 15px;
        margin: 10px 0;
    }

    .writing-buttons {
        padding: 10px 0;
    }

    #completionSection .question {
        padding: 15px;
    }

    #nextButtonSection {
        padding: 10px;
        margin: 10px 0;
    }
}

} 

/* Toast message style */
.toast-message {
    position: fixed;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.toast-message.show {
    opacity: 1;
    visibility: visible;
}


