/* css/view-grammar-mcq.css */

/* --- Main Container --- */
.gap-fill-exercise-container {
    max-width: 800px; 
    margin: 0 auto; /* Center the wrapper */
    padding: 20px 25px; /* Restored padding */
    background-color: #fff; /* Restored background */
    border: 1px solid #e0e0e0; /* Restored border */
    border-radius: 8px; /* Restored border-radius */
    box-shadow: 0 3px 10px rgba(0,0,0,0.05); /* Restored box-shadow */
    font-family: sans-serif; 
    line-height: 1.6; 
}

/* --- Title & Instructions --- */
.gap-fill-exercise-container .exercise-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px; /* Reduced margin */
    color: #333;
    font-size: 1.8em;
}
.gap-fill-exercise-container .exercise-instructions {
    text-align: center;
    color: #555; /* Darker than example */
    margin-bottom: 15px; /* Space before word bank or first section */
    font-size: 1.1em; /* Larger than example */
    font-weight: bold; /* Added */
    padding-bottom: 0;
}
.gap-fill-exercise-container .no-questions-info {
    text-align: center;
    color: #888;
    font-style: italic;
    margin-top: 20px;
}

/* --- Vocabulary Word Bank (Styles kept for reference, but bank not used in grammar) --- */
.vocab-word-bank {
    /* Styles here are not directly used by grammar gapfill but kept for potential future use or reference */
    position: sticky; /* Make it sticky */
    top: 10px; /* Stick 10px from the top of the viewport */
    z-index: 100; /* Ensure it stays on top of other content */
    margin-bottom: 30px; /* Space before questions */
    padding: 15px 20px;
    background-color: #f8f9fa; /* Ensure background is solid */
    border: 1px solid #dee2e6;
    border-bottom: 2px solid #ced4da; /* Add slightly stronger bottom border */
    border-radius: 0 0 6px 6px; /* Optional: Round bottom corners only when stuck */
    text-align: center; /* Center align the list items */
}
.vocab-word-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex; /* Use flexbox for layout */
    flex-wrap: wrap; /* Allow items to wrap */
    justify-content: center; /* Center items horizontally */
    gap: 8px 15px; /* Row and column gap */
}
.vocab-word-list li {
    display: inline-block;
    background-color: #e9ecef; /* Slightly darker grey */
    color: #212529;
    padding: 4px 12px;
    border-radius: 15px; /* Pill shape */
    font-size: 0.95em;
    white-space: nowrap; /* Prevent wrapping within a word */
    border: 1px solid #ced4da;
    cursor: pointer; /* Indicate it's clickable */
    transition: background-color 0.2s ease, color 0.2s ease, text-decoration 0.2s ease; /* Smooth transition */
    user-select: none; /* Prevent text selection on click */
    text-decoration: none; /* Base state: no line-through */
}
.vocab-word-list li:hover,
.vocab-word-list li:focus {
    background-color: #dde2e6; /* Slightly darker on hover/focus */
    outline: 1px dotted #6f42c1; /* Accessibility focus indicator */
    outline-offset: 1px;
}
.vocab-word-list li.struck-out {
    text-decoration: line-through;
    text-decoration-color: #dc3545; /* Red line */
    text-decoration-thickness: 1.5px;
    color: #a9aeb3; /* Dim the text color slightly */
    background-color: #f1f3f5; /* Slightly different background */
    border-color: #e0e5e9;
    cursor: default; /* Optional: change cursor for struck-out items */
}


/* --- Form Area --- */
.gap-fill-form {
    margin-top: 20px; /* Space below instructions */
}


/* --- Styling for the Example Section (The blue box and its contents) --- */
/* Target the div that wraps the example sentences, based on the new PHP structure */
.gap-fill-exercise-container .example-list {
    background-color: #e0f2f7; /* Light blue background */
    border: 1px solid #b2ebf2; /* Matching blue border */
    padding: 15px; /* Space inside the box */
    border-radius: 5px; /* Rounded corners */
    margin-top: 25px; /* Space above the blue box */
    margin-bottom: 25px; /* Space after the blue box before regular questions */
    box-sizing: border-box; /* Include padding and border in the element's total size */
}

/* --- Styling for the Example Heading (NOW INSIDE the blue box) --- */
/* Target the paragraph INSIDE .example-list */
.gap-fill-exercise-container .example-list .examples-heading {
    font-weight: bold;
    margin-top: 0; /* Remove default top margin, uses box padding */
    margin-bottom: 10px; /* Space below the heading within the box */
    color: #555; /* Match the regular question number color */
    font-size: 1.1em; /* Match instruction size */
    /* Inherits font-family and line-height */
}

/* --- Styling for Individual Example Sentences within the blue box --- */
/* Target the paragraphs INSIDE the blue box */
.gap-fill-exercise-container .example-list .example-sentence {
    margin-top: 0; /* Remove default top margin for the first paragraph in the box */
    margin-bottom: 5px; /* Small space between example sentences */
    line-height: 1.6; /* Keep readable line height */
    color: #333; /* Match the regular question text color */
    /* Inherits font-family */
    /* Removed flexbox properties */
    /* display: flex; */
    /* align-items: baseline; */
}

/* Style for the Example Number */
.gap-fill-exercise-container .example-list .example-sentence .example-number {
    font-weight: bold;
    margin-right: 8px; /* Space after the number */
    color: #555; /* Match the heading and regular question number color */
    display: inline-block; /* Ensure space works */
    min-width: 1.2em; /* Give single digits space */
    text-align: right; /* Align numbers nicely */
    /* flex-shrink: 0; */ /* Removed flex property */
}

/* Style for the sentence text part in examples (the rest of the paragraph after the number) */
/* This rule might not be needed anymore after removing flex */
/* .gap-fill-exercise-container .example-list .example-sentence span:not(.example-number):not(.revealed-answer) { */
    /* flex: 1; */ /* Removed flex property */
    /* min-width: 0; */ /* Removed flex property */
/* } */


/* Remove bottom margin from the very last example sentence within the blue box */
.gap-fill-exercise-container .example-list .example-sentence:last-child {
    margin-bottom: 0;
}


/* --- Style for the correct answer within examples (using .revealed-answer class) --- */
/* Target .revealed-answer specifically INSIDE .example-list .example-sentence */
.gap-fill-exercise-container .example-list .example-sentence .revealed-answer {
    display: inline; /* Crucial: Make it behave like inline text for wrapping */
    vertical-align: baseline; /* Align with surrounding text */

    /* Inherit or explicitly set box styles from the general .revealed-answer rule */
    font-weight: 500; /* Medium weight - matches previous reveal style */
    color: #0056b3; /* Dark blue - matches previous reveal style */
    background-color: #e7f3ff; /* Light blue background - matches previous reveal style */
    border-radius: 3px;
    border: 1px solid #b8d8f3;

    /* Adjust margin/padding for inline display */
    padding: 2px 6px; /* Keep padding */
    margin: 0 3px; /* Small horizontal margin, no vertical margin needed for inline */
    white-space: normal; /* Allow wrapping */
    line-height: 1.6; /* Inherit line height for consistency */
}


/* --- Optional separator line AFTER the blue box --- */
/* Target the hr that comes AFTER the example-list div */
.gap-fill-exercise-container .examples-separator {
    margin-top: 20px; /* Space above the separator */
    margin-bottom: 20px; /* Space below the separator */
    border: 0;
    border-top: 1px solid #e0e0e0; /* Match your main container border color */
    width: 100%;
    box-sizing: border-box;
}


/* --- Question Styling (for regular questions) --- */
/* Use the main container class for specificity */
.gap-fill-exercise-container .question-container {
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f9f9f9; /* Light grey background */
    border: 1px solid var(--steps-purple-dark, #800080); /* Dark purple border all around */
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center; /* Vertically center items in the flex line */
    position: relative;
}
.gap-fill-exercise-container .question-container:last-of-type {
    margin-bottom: 30px;
}

/* Normal Question Content Area */
.gap-fill-exercise-container .question-content {
    flex: 1; /* Take up remaining horizontal space */
    min-width: 0; /* Allow shrinking */
    margin-right: 20px; /* Increased Space before feedback */
}
.gap-fill-exercise-container .question-number {
    font-weight: bold;
    margin-right: 8px;
    color: #555;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.8;
    padding-bottom: 4px;
    flex-shrink: 0; /* Prevent number from shrinking */
}
.gap-fill-exercise-container .question-sentence {
     color: #333;
     display: inline; /* Changed from inline-block */
     word-break: normal;
     white-space: normal;
     vertical-align: middle; /* Adjusted */
     line-height: 1.8; /* Provides vertical space for inputs */
}
/* Use this class for the input field now */
.gap-fill-input {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 3px; /* Keep padding small */
    font-size: 0.8em; /* Smaller font size like vocab */
    margin: 0 1px 4px 1px; /* Adjust vertical margin */
    min-width: 40px; /* Slightly larger min-width */
    vertical-align: baseline; /* Align with text */
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.06);
    transition: border-color 0.3s ease, background-color 0.3s ease;
    line-height: normal; /* Reset line height */
    height: auto; /* Auto height */
    background-color: #fff;
    text-align: center; /* Center text in input */
}
.gap-fill-input:focus {
    border-color: #800080; /* Purple focus */
    outline: none;
    box-shadow: 0 0 0 2px rgba(128, 0, 128, 0.2), inset 0 1px 1px rgba(0,0,0,0.06);
}
/* Use these classes for correct/incorrect state */
.gap-fill-input.input-incorrect {
    border-color: #dc3545 !important; /* Red */
    background-color: #fff7f8; /* Light red */
    color: #721c24; /* Dark red text */
}
.gap-fill-input.input-correct {
    border-color: #28a745 !important; /* Green */
    background-color: #f8fff8; /* CHANGE 1: Correct background color - Light green */
    color: #155724; /* Dark green text */
}


/* Question Feedback Area */
.gap-fill-exercise-container .question-feedback {
    display: flex;
    align-items: center;
    flex-shrink: 0; /* Prevent shrinking */
    flex-grow: 0; /* Prevent growing */
    margin-left: auto; /* Push to the right */
    padding-left: 10px; /* Space from content */
}
/* Feedback Icon (Tick/Cross) */
.feedback-icon {
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
    min-width: 1.2em; /* Ensure space */
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    line-height: 1; /* Keep icon tight */
    user-select: none;
}
.feedback-icon.correct::after { /* Use simple 'correct' class */
    content: '✔';
    color: #28a745; /* Green */
}
.feedback-icon.incorrect::after { /* Use simple 'incorrect' class */
    content: '✖';
    color: #dc3545; /* Red */
}

/* Single Check Button */
/* Use vocab button classes */
.check-single-answer {
    padding: 3px 8px; /* CHANGE 2 part 1: Match MCQ button padding */
    background-color: #800080; /* Purple */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8em; /* CHANGE 2 part 2: Match MCQ button font size */
    letter-spacing: 0.5px;
    border-radius: 4px;
    vertical-align: middle;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    line-height: normal;
    display: inline-block; /* Ensure it sits next to others if feedback is flex */
}
.check-single-answer:hover {
    background-color: #6a006a; /* Darker Purple */
}

/* Individual Show Answer Button */
.show-single-answer {
    padding: 3px 8px; /* CHANGE 2 part 1: Match MCQ button padding */
    background-color: #007bff; /* Blue */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8em; /* CHANGE 2 part 2: Match MCQ button font size */
    letter-spacing: 0.5px;
    border-radius: 4px;
    vertical-align: middle;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    line-height: normal;
    margin-left: 5px; /* Add space between Check and Show */
    display: inline-block; /* Ensure it sits next to others if feedback is flex */
    /* display: none; /* Initially hidden via inline style in PHP */
}
.show-single-answer:hover {
    background-color: #0056b3; /* Darker blue */
}

/* Correct Answer Display Area (Wrapper and Span) */
.correct-answer-wrapper {
    background-color: #f0f8ff; /* Alice blue */
    border-left: 4px solid #17a2b8; /* Info blue */
    padding: 8px 12px 8px 15px;
    margin-top: 8px;
    margin-bottom: 5px;
    width: 100%;
    box-sizing: border-box;
    order: 3; /* Ensure it appears below content and feedback on wrap */
    font-size: 0.9em;
    line-height: 1.5;
    /* display: none; /* Controlled by JS */
}
.correct-answer-label {
    font-weight: bold;
    color: #17a2b8;
    margin-right: 8px;
}
.correct-answer-text {
    display: inline;
    line-height: 1.4;
}
/* Styling for the revealed answer spans (used for both regular questions and examples) */
.revealed-answer {
    font-weight: 500; /* Medium weight - matches previous reveal style */
    color: #0056b3; /* Dark blue - matches previous reveal style */
    background-color: #e7f3ff; /* Light blue background - matches previous reveal style */
    border-radius: 3px;
    border: 1px solid #b8d8f3;

    /* Default display and margin/padding for .revealed-answer */
    display: inline-block; /* Keep this as default for other contexts */
    padding: 2px 6px;
    margin: 2px 3px; /* Add some vertical margin */
    white-space: normal; /* Allow wrapping */
    line-height: 1.4; /* Use line height appropriate for block/inline-block */
    vertical-align: middle; /* Align vertically */
}

/* --- Specific styling for .revealed-answer inside example sentences --- */
/* Override default display/margin for better inline behavior within text */
.gap-fill-exercise-container .example-list .example-sentence .revealed-answer {
    display: inline; /* Make it behave like inline text */
    vertical-align: baseline; /* Align with surrounding text */
    margin: 0 3px; /* Adjust margins for inline display */
    /* padding and border are inherited */
}


.revealed-answer-missing {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    font-style: italic;
}


/* --- Main Buttons Area --- */
.main-buttons {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
/* Use these classes for main buttons */
.check-all-answers,
.show-all-answers {
    padding: 10px 25px;
    background-color: #800080; /* Purple */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    border-radius: 5px;
    margin: 5px 8px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    letter-spacing: 0.5px;
}
.check-all-answers:hover,
.show-all-answers:hover {
    background-color: #6a006a; /* Darker Purple */
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.show-all-answers {
    background-color: #007bff; /* Blue */
}
.show-all-answers:hover {
    background-color: #0056b3; /* Darker Blue */
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) { /* Tablet breakpoint */
    .gap-fill-exercise-container .question-content {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
    }
     /* Example sentence structure adjustment for smaller screens */
     .gap-fill-exercise-container .example-list .example-sentence {
        display: block; /* Revert to block on small screens if needed */
        margin-bottom: 10px; /* Adjust space between examples */
     }
     .gap-fill-exercise-container .example-list .example-sentence .example-number {
        display: block; /* Number on its own line */
        text-align: left; /* Align number left */
        margin-right: 0;
        margin-bottom: 5px; /* Space below number */
     }
     /* Ensure the revealed answer span can wrap naturally within the block paragraph */
     .gap-fill-exercise-container .example-list .example-sentence .revealed-answer {
          display: inline; /* Keep inline */
          margin: 0 2px; /* Smaller margins for tighter fit */
     }


    .gap-fill-exercise-container .question-feedback {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
        padding-left: 0;
        margin-top: 5px;
    }
    .gap-fill-input {
        /* Adjust input size for tablet if needed */
         /* Example: max-width: 120px; width: 80px; */
    }
}

@media (max-width: 480px) { /* Mobile breakpoint */
    .gap-fill-exercise-container {
        padding: 15px;
    }
    .gap-fill-exercise-container .exercise-title {
        font-size: 1.5em;
    }
    .gap-fill-exercise-container .exercise-instructions {
        font-size: 1em; /* Adjusted */
        margin-bottom: 20px;
        padding-bottom: 0;
    }

    /* Adjust example list padding/margins for mobile */
    .gap-fill-exercise-container .example-list {
        padding: 10px;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    .gap-fill-exercise-container .example-list .examples-heading {
        font-size: 1em;
        margin-bottom: 8px;
    }
     .gap-fill-exercise-container .example-list .example-sentence {
        /* display: block; */ /* Should already be block from 768px rule */
        margin-bottom: 8px; /* More space between example sentences */
     }
     .gap-fill-exercise-container .example-list .example-sentence:last-child {
        margin-bottom: 0;
     }
     .gap-fill-exercise-container .example-list .example-sentence .example-number {
         /* display: block; */ /* Should already be block from 768px rule */
         /* Keep mobile number styling */
     }
     .gap-fill-exercise-container .example-list .example-sentence .revealed-answer {
         display: inline; /* Keep inline */
         margin: 0 1px; /* Even smaller margins for tighter fit on very small screens */
     }


    .gap-fill-exercise-container .question-container {
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .gap-fill-exercise-container .question-content {
        margin-bottom: 15px;
    }
    .gap-fill-exercise-container .question-feedback {
        justify-content: center;
        padding-top: 5px;
    }
    .gap-fill-input {
        min-width: 50px;
        width: auto; /* Allow natural sizing */
        max-width: 120px; /* Prevent becoming too wide */
        font-size: 0.85em; /* Slightly smaller font */
        padding: 4px 6px; /* Reduced padding */
        /* Inherits other properties like border, text-align, vertical-align from base style */
    }
    /* Adjusted for mobile */
    .check-single-answer, .show-single-answer {
        font-size: 0.8em; /* Keep small on mobile */
        padding: 3px 8px; /* Keep small on mobile */
    }
    .main-buttons button { /* Target both main buttons */
        width: calc(100% - 16px);
        margin-left: 8px;
        margin-right: 8px;
        margin-bottom: 10px;
        font-size: 0.9em;
        padding: 10px 15px;
    }
    .correct-answer-wrapper {
        font-size: 0.85em;
    }
    .revealed-answer {
        padding: 1px 4px; /* Adjusted padding */
        margin-right: 5px;
        white-space: normal;
    }
}
