/* css/view-grammar-mcq.css */

/* --- Main Container --- */
/* Use the main container class for global scope */
.ggm-mcq-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;
}

/* --- Title & Instructions --- */
.ggm-mcq-exercise-container .ggm-exercise-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 1.8em;
}
.ggm-mcq-exercise-container .ggm-exercise-instructions {
    text-align: center;
    color: #555;
    margin-bottom: 15px; /* Space before examples or first question */
    font-size: 1.1em;
    font-weight: bold;
    padding-bottom: 0;
}
.ggm-mcq-exercise-container .geg-error { /* Style for PHP errors */
     color: red;
     font-weight: bold;
     text-align: center;
}
.ggm-mcq-exercise-container .no-questions-info { /* Style for the "No questions found" message */
    text-align: center;
    color: #888;
    font-style: italic;
    margin-top: 20px;
}


/* --- Styling for the Example Section (The blue box and its contents) --- */
/* Target the div that wraps the example sentences */
.ggm-mcq-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 (adjust as needed) */
    margin-bottom: 25px; /* Space after the blue box before questions */
    box-sizing: border-box;
}

/* --- Styling for the Example Heading (INSIDE the blue box) --- */
/* Target the paragraph INSIDE .example-list */
.ggm-mcq-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 your desired text color */
    font-size: 1.1em; /* Match your desired font size */
    /* Inherits font-family and line-height */
}

/* --- Styling for Individual Example Sentences within the blue box --- */
/* Target the paragraphs INSIDE the blue box */
.ggm-mcq-exercise-container .example-list .example-sentence {
    margin-top: 0;
    margin-bottom: 5px; /* Small space between example sentences */
    line-height: 1.6;
    color: #333; /* Match your desired text color */
    /* Use flexbox to align number and sentence side-by-side */
    display: flex;
    align-items: baseline; /* Align text bases */
}

/* Style for the Example Number */
.ggm-mcq-exercise-container .example-list .example-sentence .example-number {
    font-weight: bold;
    margin-right: 8px; /* Space after the number */
    color: #555; /* Match your desired color */
    display: inline-block;
    min-width: 1.2em; /* Ensure space */
    text-align: right; /* Align numbers */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Style for the sentence text part in examples (the rest of the paragraph after the number) */
/* This targets the span that wraps the sentence text and the revealed answer span */
.ggm-mcq-exercise-container .example-list .example-sentence span:not(.example-number) {
      /* Allow this part to take up the remaining space */
     min-width: 0; /* Allow shrinking */
}


/* Remove bottom margin from the very last example sentence within the blue box */
.ggm-mcq-exercise-container .example-list .example-sentence:last-child {
    margin-bottom: 0;
}

/* --- Optional separator line AFTER the blue box --- */
.ggm-mcq-exercise-container .examples-separator {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #e0e0e0; /* Match your main container border color */
    width: 100%;
    box-sizing: border-box;
}


/* --- Form Area --- */
.ggm-mcq-exercise-container .ggm-mcq-form {
    /* No specific styles needed here typically, just a container */
}


/* --- Question Styling (for regular questions) --- */
/* Use the main container class for specificity */
.ggm-mcq-exercise-container .ggm-question-container {
    margin-bottom: 15px;
    padding: 12px 15px;
    background-color: #f9f9f9;
    border: 1px solid #e8e8e8;
    border-radius: 5px;
    position: relative; /* For positioning answer wrapper below */
}
.ggm-mcq-exercise-container .ggm-question-container:last-of-type {
    margin-bottom: 30px;
}

/* Wrapper for the main question line (Number, Text+Dropdown, Buttons) */
.ggm-mcq-exercise-container .ggm-question-main {
    display: flex;
    /* CHANGED: Align items to the top when they wrap */
    align-items: flex-start;
    flex-wrap: wrap; /* Allow wrapping if needed */
    /* Removed: align-items: center; */
}

/* Normal Question Content Area (Number, Text+Dropdown) */
.ggm-mcq-exercise-container .ggm-question-content {
    flex: 1 1 0; /* Grow, Shrink, Basis 0 - allows text+dropdown to wrap internally */
    min-width: 0; /* Allow shrinking */
    margin-right: 20px; /* Space before feedback/buttons */
    /* Added: Add some bottom margin if it wraps below the buttons */
    margin-bottom: 10px; /* Space if the content wraps below buttons */
}
/* Remove bottom margin if it doesn't wrap (i.e., if buttons are on the same line) */
.ggm-mcq-exercise-container .ggm-question-main:not(.flex-wrap) .ggm-question-content { /* This selector might be complex */
    margin-bottom: 0; /* Reset if not wrapping */
}


.ggm-mcq-exercise-container .ggm-question-number {
    font-weight: bold;
    margin-right: 8px;
    color: #555;
    display: inline-block;
    vertical-align: middle; /* Align with text/dropdown */
    line-height: 1.8; /* Match line height of sentence */
    padding-bottom: 4px;
    flex-shrink: 0; /* Prevent number from shrinking */
    /* Added: Align number to the top if using flex-start */
    align-self: flex-start;
}
.ggm-mcq-exercise-container .ggm-question-text {
     color: #333;
     display: inline; /* Should be inline to wrap correctly with <select> */
     word-break: normal; /* Normal word wrapping */
     white-space: normal; /* Normal white space handling */
     vertical-align: middle; /* Align with number/dropdown */
     line-height: 1.8; /* Consistent line height */
}
/* Style the dropdown itself */
.ggm-mcq-exercise-container .ggm-select-answer {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 4px 6px; /* Adjusted padding */
    font-size: 1em; /* Keep font size readable */
    margin: 0 4px; /* Space around the dropdown */
    vertical-align: middle; /* Align with text */
    height: auto; /* Allow height to adjust */
    line-height: normal;
    cursor: pointer;
}
.ggm-mcq-exercise-container .ggm-select-answer:focus {
     border-color: #800080;
     outline: none;
     box-shadow: 0 0 0 2px rgba(128, 0, 128, 0.2);
}
.ggm-mcq-exercise-container .ggm-select-answer option[disabled] {
     color: #999; /* Style for the default placeholder option */
}

/* Styling for correct/incorrect select after checking */
.ggm-mcq-exercise-container .ggm-select-answer.ggm-correct {
    border-color: #28a745 !important; /* Green */
    background-color: #f8fff8;       /* CHANGE 1: Correct background color */
    color: #155724;                 /* Dark green text */
}
.ggm-mcq-exercise-container .ggm-select-answer.ggm-incorrect {
    border-color: #dc3545 !important; /* Red */
    background-color: #fff7f8;       /* CHANGE 2: Incorrect background color */
    color: #721c24;                 /* Dark red text */
}


/* Feedback and Buttons Area (to the right) */
.ggm-mcq-exercise-container .ggm-feedback-buttons {
    display: flex;
    align-items: center; /* Vertically align icon and buttons */
    flex-shrink: 0; /* Prevent shrinking */
    flex-grow: 0; /* Prevent growing */
    margin-left: auto; /* Push to the right */
    padding-left: 10px; /* Space from question content */
    /* Added: Ensure it starts at the top if using align-items: flex-start */
    align-self: flex-start;
    /* Added: Add bottom margin if the buttons wrap below the content */
    margin-bottom: 10px;
}
/* Remove bottom margin if it doesn't wrap */
.ggm-mcq-exercise-container .ggm-question-main:not(.flex-wrap) .ggm-feedback-buttons { /* This selector might be complex */
     margin-bottom: 0; /* Reset if not wrapping */
}

/* Feedback Icon (Tick/Cross) */
.ggm-mcq-exercise-container .ggm-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;
    user-select: none;
}
/* Style for the actual tick/cross character using ::after */
.ggm-mcq-exercise-container .ggm-feedback-icon.correct::after {
    content: '✔';
    color: #28a745; /* Green */
}
.ggm-mcq-exercise-container .ggm-feedback-icon.incorrect::after {
    content: '✖';
    color: #dc3545; /* Red */
}


/* Single Check/Show Button (use button class directly) */
.ggm-mcq-exercise-container button.ggm-check-single-answer,
.ggm-mcq-exercise-container button.ggm-show-single-answer {
    padding: 5px 10px; /* Adjusted padding */
    font-size: 0.9em; /* Adjusted font size */
    letter-spacing: 0.5px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    line-height: normal;
    margin-left: 5px; /* Space between buttons */
    display: inline-block; /* Ensure they sit next to each other */
}
.ggm-mcq-exercise-container button.ggm-check-single-answer {
    background-color: #800080; /* Purple */
    color: white;
}
.ggm-mcq-exercise-container button.ggm-check-single-answer:hover {
    background-color: #6a006a; /* Darker Purple */
}
.ggm-mcq-exercise-container button.ggm-show-single-answer {
    background-color: #007bff; /* Blue */
    color: white;
    /* display: none; /* Initially hidden via inline style in PHP */
}
.ggm-mcq-exercise-container button.ggm-show-single-answer:hover {
    background-color: #0056b3; /* Darker Blue */
}


/* Correct Answer Display Area (below main question line) */
.ggm-mcq-exercise-container .ggm-correct-answer-wrapper {
    background-color: #f0f8ff; /* Alice blue */
    border-left: 4px solid #17a2b8; /* Info blue */
    padding: 8px 12px 8px 15px;
    margin-top: 8px; /* Space above this block */
    margin-bottom: 5px;
    width: 100%; /* Ensure it takes full width below */
    box-sizing: border-box;
    /* No order needed here if it's already after ggm-question-main in HTML */
    font-size: 0.9em;
    line-height: 1.5;
    /* display: none; /* Controlled by JS */
}
.ggm-mcq-exercise-container .ggm-correct-answer-label {
    font-weight: bold;
    color: #17a2b8;
    margin-right: 8px;
}
.ggm-mcq-exercise-container .ggm-correct-answer-text {
    display: inline;
    line-height: 1.4;
}
/* Styling for the revealed answer span (used for both regular questions and examples) */
.ggm-mcq-exercise-container .revealed-answer {
    font-weight: 500; /* Medium weight */
    color: #0056b3; /* Dark blue */
    background-color: #e7f3ff; /* Light blue background */
    border-radius: 3px;
    border: 1px solid #b8d8f3;
    width: 10;
    /* Default display and margin/padding for .revealed-answer */
    display: inline-block; /* Default for most uses */
    padding: 2px 6px;
    margin: 2px 3px; /* Default 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 */
.ggm-mcq-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 */
}


/* --- Main Buttons Area --- */
.ggm-mcq-exercise-container .ggm-main-buttons {
    margin-top: 30px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}
/* Use these classes for main buttons */
.ggm-mcq-exercise-container button.ggm-check-all-answers,
.ggm-mcq-exercise-container button.ggm-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;
}
.ggm-mcq-exercise-container button.ggm-check-all-answers:hover,
.ggm-mcq-exercise-container button.ggm-show-all-answers:hover {
    background-color: #6a006a; /* Darker Purple */
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.ggm-mcq-exercise-container button.ggm-show-all-answers {
    background-color: #007bff; /* Blue */
}
.ggm-mcq-exercise-container button.ggm-show-all-answers:hover {
    background-color: #0056b3; /* Darker Blue */
}

/* Optional: Style for the score display */
.ggm-mcq-exercise-container .ggm-score-display {
     margin-top: 15px;
     font-size: 1.1em;
     font-weight: bold;
     color: #555;
}
.ggm-mcq-exercise-container .ggm-score-value,
.ggm-mcq-exercise-container .ggm-score-total {
     color: #800080; /* Purple */
}


/* =========================================
   Media Query for Smaller Screens
   ========================================= */
@media (max-width: 768px) { /* Tablet breakpoint */
    .ggm-mcq-exercise-container {
        padding: 15px; /* Reduce padding on smaller screens */
    }

    .ggm-mcq-exercise-container .ggm-exercise-instructions {
        font-size: 1em;
    }

    /* Example list adjustments for smaller screens */
    .ggm-mcq-exercise-container .example-list {
        padding: 10px;
        margin-top: 20px;
        margin-bottom: 20px;
    }
    .ggm-mcq-exercise-container .example-list .examples-heading {
        font-size: 1em;
        margin-bottom: 8px;
    }
    .ggm-mcq-exercise-container .example-list .example-sentence {
        flex-direction: column; /* Stack number and sentence */
        align-items: flex-start; /* Align to the left */
        margin-bottom: 8px; /* More space between examples */
    }
     .ggm-mcq-exercise-container .example-list .example-sentence:last-child {
        margin-bottom: 0;
     }
    .ggm-mcq-exercise-container .example-list .example-sentence .example-number {
        text-align: left; /* Align number left */
        margin-right: 0;
        margin-bottom: 5px; /* Space below number */
    }
    .ggm-mcq-exercise-container .example-list .example-sentence span:not(.example-number) {
         /* Ensure text takes full width below number */
     }
     .ggm-mcq-exercise-container .example-list .example-sentence .revealed-answer {
         margin: 0 2px; /* Smaller margins for tighter fit */
     }


    /* Regular question container adjustments */
    .ggm-mcq-exercise-container .ggm-question-container {
        padding: 10px;
    }

    /* Main question line layout on smaller screens */
    .ggm-mcq-exercise-container .ggm-question-main {
        flex-direction: column; /* Stack content and buttons */
        align-items: stretch; /* Stretch items to fill width */
    }

    .ggm-mcq-exercise-container .ggm-question-content {
        margin-right: 0;
        margin-bottom: 15px; /* Space below content when stacked */
        width: 100%; /* Ensure it takes full width */
        flex-basis: auto; /* Reset basis when stacked */
    }

     .ggm-mcq-exercise-container .ggm-question-number {
         align-self: flex-start; /* Ensure number stays top-left */
     }

    .ggm-mcq-exercise-container .ggm-feedback-buttons {
        margin-left: 0; /* Remove auto margin when stacked */
        padding-left: 0; /* Remove padding when stacked */
        justify-content: center; /* Center buttons horizontally when stacked */
        width: 100%; /* Ensure it takes full width */
        flex-basis: auto; /* Reset basis when stacked */
        margin-bottom: 0; /* Remove bottom margin when stacked */
        /* Add a top border or margin if needed to separate from content */
    }

    .ggm-mcq-exercise-container .ggm-select-answer {
         width: auto; /* Allow width to be natural or set a specific width */
         /* Consider setting a max-width if they become too wide */
    }

    /* Adjust buttons */
    .ggm-mcq-exercise-container button.ggm-check-single-answer,
    .ggm-mcq-exercise-container button.ggm-show-single-answer {
        padding: 4px 10px;
        font-size: 0.85em;
    }

    .ggm-mcq-exercise-container .ggm-correct-answer-wrapper {
        padding: 8px 10px 8px 12px; /* Adjust padding */
        font-size: 0.85em;
    }

    .ggm-mcq-exercise-container .revealed-answer {
        margin: 1px 2px; /* Tighter margin on very small screens */
    }
}

@media (max-width: 480px) { /* Mobile breakpoint */
     /* Keep adjustments from 768px unless specific mobile overrides are needed */

     .ggm-mcq-exercise-container .ggm-select-answer {
        /* Further adjust dropdown width if needed */
     }

     /* Adjust main buttons for full width on mobile */
     .ggm-mcq-exercise-container .ggm-main-buttons button {
         width: calc(100% - 16px); /* Adjust width for mobile */
         margin-left: 8px;
         margin-right: 8px;
         margin-bottom: 10px; /* Space between stacked buttons */
         font-size: 0.9em;
         padding: 10px 15px;
     }
      .ggm-mcq-exercise-container .ggm-main-buttons {
          padding-top: 15px; /* Adjust padding */
      }
      .ggm-mcq-exercise-container .ggm-score-display {
          margin-top: 10px;
      }
}