/* --- Main Container --- */
.vgf-gap-fill-exercise-container {
    max-width: 850px;
    margin: 2em auto;
    padding: 20px 25px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    font-family: sans-serif;
    line-height: 1.6;
}

/* This ensures that no parent element interferes with the sticky positioning */
.vfg-sticky-parent {
    overflow: visible !important;
}

/* --- Title & Instructions --- */
.vgf-gap-fill-exercise-container .vgf-exercise-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px; /* Reduced margin */
    color: #333;
    font-size: 1.8em;
}
.vgf-gap-fill-exercise-container .vgf-exercise-instructions {
    text-align: center;
    color: #555; /* Darker than example */
    margin-bottom: 15px; /* Space before word bank */
    font-size: 1.1em; /* Larger than example */
    font-weight: bold; /* Added */
    /* Removed border from example */
    padding-bottom: 0;
}
.vgf-gap-fill-exercise-container .vgf-no-questions-info {
    text-align: center;
    color: #888;
    font-style: italic;
    margin-top: 20px;
}

/* --- Vocabulary Word Bank (Added Back) --- */
.vgf-vocab-word-bank {
    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 */
    /* Remove top border-radius if you want it flush when stuck */
    /* border-top-left-radius: 0; */
    /* border-top-right-radius: 0; */
}
.vgf-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 */
}
.vgf-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 */
}
.vgf-vocab-word-list li:hover,
.vgf-vocab-word-list li:focus {
    background-color: #dde2e6; /* Slightly darker on hover/focus */
    outline: 1px dotted #6f42c1; /* Accessibility focus indicator */
    outline-offset: 1px;
}
/* Style for struck-out words */
.vgf-vocab-word-list li.vgf-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 --- */
.vgf-gap-fill-form {
    margin-top: 20px; /* Space below word bank/instructions */
}

/* --- Question Styling --- */
.vgf-gap-fill-exercise-container .vgf-question-container {
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    display: flex;
    flex-wrap: wrap;
    align-items: center; /* Vertically center items in the flex line */
    position: relative;
}
.vgf-gap-fill-exercise-container .vgf-question-container:last-of-type {
    margin-bottom: 30px;
}

/* Example Specific Styling (Keep commented out or remove if definitely not needed) */
/*
.vgf-gap-fill-exercise-container .vgf-question-container.example { ... }
.vgf-gap-fill-exercise-container .example-label { ... }
.vgf-gap-fill-exercise-container .example-answer { ... }
*/

/* Normal Question Content Area */
.vgf-gap-fill-exercise-container .vgf-question-content {
    flex: 1; /* Take up remaining horizontal space */
    min-width: 0; /* Allow shrinking */
    margin-right: 20px; /* Increased Space before feedback */
}
.vgf-gap-fill-exercise-container .vgf-question-number {
    font-weight: bold;
    margin-right: 8px;
    color: #555;
    display: inline-block;
    vertical-align: middle;
    line-height: 1.8;
    padding-bottom: 4px;
}
.vgf-gap-fill-exercise-container .vgf-question-sentence {
     color: #333;
     display: inline;
     word-break: normal;
     white-space: normal;
     vertical-align: middle;
     line-height: 1.8; /* Provides vertical space for inputs */
}

/* Input Field Styling (Using smaller style from example) */
.vgf-gap-fill-input {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 1px 3px; /* Keep padding small */
    font-size: 0.8em;
    margin: 0 1px 4px 1px;
    min-width: 40px; /* Slightly larger min-width */
    /* Remove fixed width and max-width, will be set by inline style */
    /* width: 60px; */
    /* max-width: 85px; */
    vertical-align: baseline;
    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;
    height: auto;
    background-color: #fff;
}
.vgf-gap-fill-input:focus {
    border-color: #800080;
    outline: none;
    box-shadow: 0 0 0 2px rgba(128, 0, 128, 0.2), inset 0 1px 1px rgba(0,0,0,0.06);
}
.vgf-gap-fill-input.vgf-input-incorrect {
    border-color: #dc3545 !important;
    background-color: #fff7f8;
}
.vgf-gap-fill-input.vgf-input-correct {
    border-color: #28a745 !important;
    /* background-color: #f8fff8; */
}


/* Question Feedback Area */
.vgf-gap-fill-exercise-container .vgf-question-feedback {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 10px;
}
/* Feedback Icon (Tick/Cross) */
.vgf-feedback-icon {
    font-size: 1.2em;
    font-weight: bold;
    margin-right: 8px;
    min-width: 1.2em;
    text-align: center;
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
    user-select: none;
    transition: color 0.3s ease;
}

.vgf-feedback-icon.correct {
    color: green;
}

.vgf-feedback-icon.incorrect {
    color: red;
}
/* Single Check Button */
.vgf-check-single-answer {
    padding: 3px 8px;
    background-color: #800080; /* Match main button purple */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    /* text-transform: uppercase; */ /* Removed */
    letter-spacing: 0.5px;
    border-radius: 4px;
    vertical-align: middle;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    line-height: normal;
}
.vgf-check-single-answer:hover {
    background-color: #6a006a; /* Match main button hover purple */
}

/* Individual Show Answer Button */
.vgf-show-single-answer {
    padding: 3px 8px;
    background-color: #007bff; /* Blue like main show button */
    color: white;
    border: none;
    cursor: pointer;
    font-size: 0.8em;
    /* text-transform: uppercase; */ /* Removed */
    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: none; /* Initially hidden via inline style in PHP */
}
.vgf-show-single-answer:hover {
    background-color: #0056b3; /* Darker blue */
}

/* Correct Answer Display Area (Wrapper and Span) */
.vgf-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;
    font-size: 0.9em;
    line-height: 1.5;
    /* display: none; /* Controlled by JS */
}
.vgf-correct-answer-label {
    font-weight: bold;
    color: #17a2b8;
    margin-right: 8px;
}
.vgf-correct-answer-text {
    display: inline;
    line-height: 1.4;
}
/* Styling for the revealed answer spans */
.vgf-revealed-answer {
    font-weight: 500;
    color: #0056b3;
    margin-right: 10px;
    padding: 2px 6px;
    background-color: #e7f3ff;
    border-radius: 3px;
    display: inline-block;
    margin-top: 3px;
    margin-bottom: 3px;
    white-space: normal;
    border: 1px solid #b8d8f3;
}
.vgf-revealed-answer-missing {
    color: #6c757d;
    background-color: #f8f9fa;
    border-color: #dee2e6;
    font-style: italic;
}


/* --- Main Buttons Area --- */
.vgf-main-buttons {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
.vgf-check-all-answers,
.vgf-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;
    /* text-transform: uppercase; */ /* Removed */
    letter-spacing: 0.5px;
}
.vgf-check-all-answers:hover,
.vgf-show-all-answers:hover {
    background-color: #6a006a;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.vgf-show-all-answers {
    background-color: #007bff; /* Blue */
}
.vgf-show-all-answers:hover {
    background-color: #0056b3; /* Darker Blue */
}


/* --- Responsive Adjustments --- */
@media (max-width: 768px) { /* Tablet breakpoint */
    .vgf-vocab-word-list {
        gap: 6px 10px; /* Slightly smaller gap */
    }
    .vgf-vocab-word-list li {
        padding: 3px 10px;
        font-size: 0.9em;
    }
    .vgf-gap-fill-exercise-container .vgf-question-content {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
    }
    .vgf-gap-fill-exercise-container .vgf-question-feedback {
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
        padding-left: 0;
        margin-top: 5px;
    }
    .vgf-gap-fill-input {
        max-width: 120px;
        width: 80px;
    }
}

@media (max-width: 480px) { /* Mobile breakpoint */
    .vgf-gap-fill-exercise-container {
        padding: 15px;
    }
    .vgf-gap-fill-exercise-container .vgf-exercise-title {
        font-size: 1.5em;
    }
    .vgf-gap-fill-exercise-container .vgf-exercise-instructions {
        font-size: 1em; /* Adjusted */
        margin-bottom: 20px;
        padding-bottom: 0;
    }
    .vgf-vocab-word-bank {
        padding: 10px;
        margin-bottom: 20px;
    }
    .vgf-vocab-word-list {
        gap: 5px 8px;
    }
    .vgf-vocab-word-list li {
        padding: 2px 8px;
        font-size: 0.85em;
    }
    .vgf-gap-fill-exercise-container .vgf-question-container {
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .vgf-gap-fill-exercise-container .vgf-question-content {
        margin-bottom: 15px;
    }
    .vgf-gap-fill-exercise-container .vgf-question-feedback {
        justify-content: center;
        padding-top: 5px;
    }
    .vgf-gap-fill-input {
        min-width: 50px;
        width: calc(100% - 12px);
        max-width: none;
        font-size: 0.9em;
        padding: 5px 8px;
    }
    .vgf-check-single-answer {
        font-size: 0.8em;
        padding: 4px 10px;
    }
    .vgf-main-buttons button {
        width: calc(100% - 16px);
        margin-left: 8px;
        margin-right: 8px;
        margin-bottom: 10px;
        font-size: 0.9em;
        padding: 10px 15px;
    }
    .vgf-correct-answer-wrapper {
        font-size: 0.85em;
    }
    .vgf-revealed-answer {
        padding: 1px 4px;
        margin-right: 5px;
        white-space: normal;
    }
}
