/* General Quiz Container */
.mehruedu-quiz-container {
    max-width: 700px;
    margin: 20px auto;
    padding: 20px;
    border: 2px solid #28a745; 
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    position: relative; /* Needed for positioning overlay */
    overflow: hidden; /* Helps contain child elements */
}

/* NEW: Style for the currently spoken word */
.reading-highlight {
    background-color: rgba(255, 230, 150, 0.6); /* A pleasant, light yellow highlight */
    border-radius: 3px;
    transition: background-color 0.2s ease-in-out;
}

/* --- Settings Icon and Panel --- */
.mehruedu-settings-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 110;
}

.mehruedu-settings-button {
    background: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 1.2em;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mehruedu-settings-button:hover {
    background: #e0e0e0;
}

.mehruedu-settings-panel {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    width: 250px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px;
    text-align: left;
}

.mehruedu-settings-panel .setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.mehruedu-settings-panel .setting-row label {
    font-size: 0.95em;
    color: #333;
    margin-right: 10px;
}

/* Toggle Switch Styles */
.mehruedu-toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.mehruedu-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mehruedu-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.mehruedu-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .mehruedu-slider {
    background-color: #28a745;
}

input:focus + .mehruedu-slider {
    box-shadow: 0 0 1px #28a745;
}

input:checked + .mehruedu-slider:before {
    transform: translateX(20px);
}

.slide-text-display br + br {
    display: none;   /* hide consecutive <br> */
}

/* Speech Speed Control */
#mehruedu-speech-controls {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

#mehruedu-speech-rate {
    width: 100%;
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #ccc;
}


/* Initial Quiz Info Styling */
.mehruedu-quiz-initial-info {
    margin-bottom: 20px;
    padding: 10px;
    background-color: #e9f5fe; 
    border: 1px solid #bde0fe; 
    border-radius: 6px;
    text-align: center; 
}

.mehruedu-quiz-initial-info p {
    margin: 5px 0;
    font-size: 1.1em;
    color: #0056b3; 
    font-weight: 500;
}

.mehruedu-quiz-initial-info p span {
    font-weight: bold;
    color: #004085; 
}

/* Slide Range Selector Styling */
.mehruedu-slide-range-selector {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #bde0fe;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.mehruedu-slide-range-selector label {
    font-size: 1em;
    color: #0056b3;
}

.mehruedu-slide-range-selector input[type="number"] {
    width: 60px;
    padding: 5px;
    text-align: center;
    border: 1px solid #bde0fe;
    border-radius: 4px;
    font-size: 1em;
}


/* --- Merged Top Bar (Progress + Timer) --- */
.mehruedu-top-bar {
    display: none; /* Hidden by default */
    align-items: center;
    padding: 5px 10px;
    background-color: #f1f1f1;
    border-radius: 6px;
    margin-bottom: 15px;
    height: auto;
    min-height: 40px;
    box-sizing: border-box;
    position: relative;
    z-index: 90; /* Lower than feedback overlay */
}

.question-type-display {
    font-weight: bold;
    font-size: 0.9em;
    color: #555;
    margin-right: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

.timer-display {
    font-size: 1em;
    font-weight: bold;
    color: #ff5722;
    margin-left: 0;
    white-space: nowrap;
}

/* Progress Bar Container within Top Bar */
.progress-bar {
    flex-grow: 0;
    flex-shrink: 1;
    flex-basis: 40%;
    height: 18px;
    background-color: #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

/* Progress Indicator */
.progress-bar .progress {
    height: 100%;
    width: 0; 
    background-color: #28a745; /* Default color, JS will override */
    transition: width 0.4s ease, background-color 0.4s ease;
}

/* NEW Brand Style */
.qsh-in-brand {
    font-weight: bold;
    color: #555;
    white-space: nowrap;
    margin-left: auto; /* Pushes brand, timer, settings to the right */
    margin-right: 15px;
}

/* NEW: Reset settings container position when inside top bar */
.mehruedu-top-bar .mehruedu-settings-container {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    margin-left: 10px;
}

/* Each Quiz Question */
.mehruedu-quiz-question {
    display: none; 
    padding: 15px;
    border: 1px solid #ccc;
    background-color: #fff;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: left; 
}

/* Styling for the top line of each question */
.question-top-line {
    font-size: 1.25em;
    font-weight: bold;
    margin-bottom: 10px;
    color: #aa2394;
}

/* Description line styling */
.question-description {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #666;
}

/* Standard True/False Radio Buttons */
.mehruedu-quiz-question label { 
    display: block;
    margin: 10px 0;
    cursor: pointer;
}

.mehruedu-quiz-question input[type="radio"] { 
    margin-right: 10px;
    vertical-align: middle;
}

/* Fill in the Blanks Input */
.mehruedu-quiz-question input.fill-blank {
    width: 100px;
    padding: 5px;
    margin: 0 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Pair Matching */
.pair-matching-container {
    display: flex;
    justify-content: space-between;
}

.left-pairs, .right-pairs {
    width: 48%;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #f1f1f1;
    border-radius: 6px;
    min-height: 100px;
}

.pair-item {
    padding: 8px;
    background-color: #fff;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.pair-item.selected {
    background-color: #ffd700; 
}

.pair-item.correct { 
    color: white; 
}

.pair-item.incorrect { 
    background-color: #dc3545; 
    color: white;
}

/* Rearrange */
.re-disordered, .re-order-target { 
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap; 
    padding: 10px;    
    min-height: 50px; 
    border-radius: 6px;
}

.re-disordered {
    background-color: #e9ecef; 
    border: 1px solid #ced4da;
}

.re-order-target { 
    margin-top: 15px; 
    border: 2px dashed #007bff; 
    background-color: #f8f9fa; 
}

.re-item {
    padding: 8px 12px; 
    background-color: #fff; 
    border: 1px solid #adb5bd; 
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, transform 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: inline-block; 
}

.re-item:hover {
    background-color: #007bff;
    color: #fff;
    transform: translateY(-2px); 
    border-color: #0056b3;
}

.re-order-container p { 
    margin-bottom: 5px;
    font-weight: bold;
    color: #495057;
}


/* MCQ Button Styling */
.mehruedu-mcq-option {
    display: block;
    padding: 10px 20px;
    margin-bottom: 10px;
    background-color: #b1cfec;
    border-color: #a1c4e4; 
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s, font-size 0.3s, color 0.3s, border-color 0.3s;
    text-align: center;
    font-size: 1em;
    border: 1px solid #a1c4e4; 
}

.mehruedu-mcq-option:hover {
    background-color: #cf7de7;
    color: #fff;
}

.mehruedu-mcq-option.selected {
    background-color: #e754cf; 
    color: #fff; 
    font-size: 1.1em; 
    border-color: #c445b0; 
}

.mehruedu-mcq-option input[type="radio"] {
    display: none;
}

/* "Review and Next" Button */
.mehruedu-submit-quiz {
    display: block;
    width: 100%;
    padding: 12px; 
    background-color: #28a745; 
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em; 
    transition: background-color 0.3s;
    margin-top: 20px; 
}

.mehruedu-submit-quiz:hover {
    background-color: #218838; 
}

/* "Understood" Button Styling */
.mehruedu-understood-button {
    display: block;
    width: 100%; 
    padding: 12px;
    background-color: #007bff; 
    color: #fff;
    text-align: center;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.3s;
    margin-top: 20px; 
    margin-bottom: 10px; 
}

.mehruedu-understood-button:hover {
    background-color: #0056b3; 
}

/* "Play Again" Button Styling */
.mehruedu-play-again-button {
    display: block;
    width: 50%; 
    margin: 25px auto 10px auto; 
    padding: 12px 20px;
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    background-color: #17a2b8; 
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mehruedu-play-again-button:hover {
    background-color: #138496; 
    transform: translateY(-1px);
}


/* Feedback Messages */
.feedback-message {
    display: none; 
    margin-top: 15px; 
    margin-bottom: 10px; 
    padding: 12px 15px; 
    border-radius: 6px; 
    font-size: 1em;
    text-align: center; 
}

.feedback-correct {
    background-color: #d4edda; 
    color: #155724; 
    border: 1px solid #c3e6cb;
}

.feedback-incorrect {
    background-color: #f8d7da; 
    color: #721c24; 
    border: 1px solid #f5c6cb;
}

/* Inactive "Review and Next" Button */
.mehruedu-submit-quiz[disabled] {
    background-color: #e9ecef; 
    color: #6c757d; 
    cursor: not-allowed;
    border: 1px solid #ced4da;
}

/* Scorecard Styling */
.mehruedu-scorecard {
    margin-top: 20px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    text-align: left; 
}

.scorecard-content h2 {
    text-align: center;
    color: #007bff; 
    margin-bottom: 20px;
}

.scorecard-content p {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 10px;
    color: #495057;
}

.scorecard-content p strong {
    color: #343a40;
}

/* Question and Answer Review List in Scorecard */
.question-answer-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.question-answer-list h3 {
    text-align: center;
    color: #28a745; 
    margin-bottom: 20px;
}

.question-answer-list ul {
    list-style-type: none;
    padding-left: 0;
}

.question-answer-list li {
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    font-size: 1em;
    line-height: 1.5;
}
.question-answer-list li strong {
    color: #007bff;
}


/* Social Share Section */
.social-share {
    margin-top: 30px; 
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee; 
}

.social-share p {
    font-size: 1.1em; 
    font-weight: bold;
    margin-bottom: 15px; 
    color: #343a40; 
}

.social-share-btn {
    display: inline-flex; 
    align-items: center; 
    margin: 5px 8px; 
    padding: 10px 18px; 
    font-size: 0.95em; 
    font-weight: 500; 
    color: #fff;
    border-radius: 5px;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
}

.social-share-btn i { 
    margin-right: 8px;
    font-size: 1.2em; 
}

/* Facebook Button */
.social-share-btn[data-platform="facebook"] {
    background-color: #3b5998;
}
.social-share-btn[data-platform="facebook"]:hover {
    background-color: #304a7d;
}

/* WhatsApp Button */
.social-share-btn[data-platform="whatsapp"] {
    background-color: #25D366;
}
.social-share-btn[data-platform="whatsapp"]:hover {
    background-color: #1da851;
}

/* X (Twitter) Button */
.social-share-btn[data-platform="x"] {
    background-color: #000000;
}
.social-share-btn[data-platform="x"]:hover {
    background-color: #333333;
}


/* Hover Effects for social buttons */
.social-share-btn:hover {
    transform: translateY(-2px); 
    opacity: 0.95;
}

/* Start Quiz Button (Main button, text is dynamic) */
.start-quiz {
    display: block;
    width: auto;
    min-width: 200px;
    margin: 20px auto; 
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: bold;
    color: #fff;
    background-color: #007bff; 
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.start-quiz:hover {
    background-color: #0056b3; 
    transform: translateY(-2px);
}

/* --- Styles for Knowledge Slides --- */
.mehruedu-knowledge-slides-area {
    padding: 20px;
    border: 1px dashed #007bff;
    background-color: #f0f8ff;
    margin-bottom: 20px;
    text-align: center;
    border-radius: 6px;
}

.slide-text-display {
    padding: 25px; 
    margin-bottom: 20px; 
    border: 1px solid #bde0fe; 
    background: #e7f5ff;
    color: #004085;
    min-height: 80px;
    border-radius: 6px;
    font-size: 1.4em;
    text-align: left;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Clickable word style */
.mehruedu-clickable-word {
    color: #28a745; /* Green color */
    font-weight: bold;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
}
.mehruedu-clickable-word:hover {
    color: #218838;
}

/* Container for slide control buttons */
.slide-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px; /* Increased gap */
}

/* Default style for icon buttons */
.slide-controls button {
    margin: 0;
    font-size: 1.6em; /* Larger font for icons */
    font-weight: bold;
    cursor: pointer;
    border: none;
    color: white;
    transition: background-color 0.2s ease, transform 0.1s ease;
    width: 44px; /* Fixed width */
    height: 44px; /* Fixed height */
    border-radius: 50%; /* Circular buttons */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* Adjust line-height for vertical center */
}

.slide-controls button:hover {
    transform: translateY(-2px);
}

/* Override for buttons that contain text */
.slide-controls button.text-button {
    width: auto;
    height: auto;
    border-radius: 5px; /* Revert to rounded rectangle */
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 500;
}

/* Specific colors for icon buttons */
.mehruedu-replay-slide-button {
    background-color: #fd7e14; /* Orange color */
}
.mehruedu-replay-slide-button:hover {
    background-color: #e66a00;
}

.mehruedu-previous-slide-button {
    background-color: #6c757d;
}
.mehruedu-previous-slide-button:hover {
    background-color: #5a6268;
}

.mehruedu-next-slide-button {
    background-color: #28a745;
}
.mehruedu-next-slide-button:hover {
    background-color: #218838;
}

/* Specific colors for text buttons */
.mehruedu-skip-slides-button {
    background-color: #ffc107;
    color: #212529;
}
.mehruedu-skip-slides-button:hover {
    background-color: #e0a800;
}

.mehruedu-explain-button {
    background-color: #17a2b8; /* A distinct cyan color */
}
.mehruedu-explain-button:hover {
    background-color: #138496;
}

/* "See Knowledge Slides Again" Button Styling */
.mehruedu-see-slides-again-button {
    display: block;
    width: auto;
    min-width: 250px;
    margin: 25px auto 10px auto; 
    padding: 12px 20px;
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    background-color: #17a2b8;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.mehruedu-see-slides-again-button:hover {
    background-color: #138496; 
    transform: translateY(-1px);
}

/* Top Explanation Overlay (For Slides and Quizzes) */
.mehruedu-explanation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background: rgba(40, 167, 69, 0.95); /* Semi-transparent green background */
    color: #fff;
    padding: 20px;
    box-sizing: border-box;
    border-bottom: 3px solid #1e7e34;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.mehruedu-explanation-content {
    font-size: 1.2em;
    line-height: 1.5;
    text-align: center;
    padding-right: 30px; /* Space for close button */
    white-space: pre-wrap; /* Also respect spaces/newlines here */
}

.mehruedu-explanation-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    font-weight: bold;
    line-height: 1;
    color: #fff;
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.mehruedu-explanation-close:hover {
    opacity: 1;
}

/* --- NEW: Quiz Feedback Overlay --- */
.mehruedu-feedback-overlay {
    display: none; /* Hidden by default */
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 105; /* Above progress bar, below settings */
    color: #fff;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    text-align: center;
}

.mehruedu-feedback-overlay.correct {
    background: rgba(40, 167, 69, 0.95); /* Green */
    border-bottom: 3px solid #1e7e34;
}

.mehruedu-feedback-overlay.incorrect {
    background: rgba(220, 53, 69, 0.95); /* Red */
    border-bottom: 3px solid #a71d2a;
}

.mehruedu-feedback-overlay-content {
    font-size: 1.2em;
    line-height: 1.5;
    margin-bottom: 15px;
}


/* --- MODIFIED: Sound Wave Animation for Explanations --- */
.mehruedu-explanation-animation-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* MODIFIED: No background color */
    z-index: 95; /* Above content, below other overlays */
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Allows clicks to pass through */
}

.sound-wave {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100px;
    height: 60px;
}

.sound-wave .bar {
    width: 6px;
    height: 10px;
    border-radius: 3px;
    background-color: rgba(23, 162, 184, 0.35); /* MODIFIED: Lighter, more transparent */
    animation: wave-animation 1.2s ease-in-out infinite;
}

/* Stagger the animation for each bar */
.sound-wave .bar:nth-child(2) { animation-delay: 0.1s; }
.sound-wave .bar:nth-child(3) { animation-delay: 0.2s; }
.sound-wave .bar:nth-child(4) { animation-delay: 0.3s; }
.sound-wave .bar:nth-child(5) { animation-delay: 0.4s; }
.sound-wave .bar:nth-child(6) { animation-delay: 0.5s; }
.sound-wave .bar:nth-child(7) { animation-delay: 0.6s; }
.sound-wave .bar:nth-child(8) { animation-delay: 0.7s; }
.sound-wave .bar:nth-child(9) { animation-delay: 0.8s; }
.sound-wave .bar:nth-child(10){ animation-delay: 0.9s; }

@keyframes wave-animation {
    0% { height: 10px; }
    50% { height: 50px; }
    100% { height: 10px; }
}

/* --- MODIFIED: Leaderboard Styles --- */
.mehruedu-leaderboard-container {
    max-width: 700px;
    margin: 40px auto 20px;
    padding: 20px;
    border: 1px solid #d1e7dd;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
    overflow: hidden;
}
.mehruedu-leaderboard-container h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #0a58ca;
    font-weight: 600;
}
.mehruedu-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}
.mehruedu-leaderboard-table th, 
.mehruedu-leaderboard-table td {
    padding: 12px 8px;
    border: none;
    text-align: left;
    vertical-align: middle;
}
.mehruedu-leaderboard-table th {
    color: #fff;
    background: #28a745;
    background: -webkit-linear-gradient(to right, #28a745, #218838);
    background: linear-gradient(to right, #28a745, #218838);
}
.mehruedu-leaderboard-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease-in-out;
}
.mehruedu-leaderboard-table tbody tr:last-child {
    border-bottom: none;
}
.mehruedu-leaderboard-table tbody tr:hover {
    background-color: #f8f9fa;
}
.mehruedu-leaderboard-table tbody tr:first-child {
    background-color: #fffbe6;
    font-weight: bold;
    color: #664d03;
}
.mehruedu-leaderboard-table tbody tr:first-child td:first-child::before {
    content: '\f091'; /* Font Awesome trophy icon */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #ffc107;
    margin-right: 8px;
}
.mehruedu-leaderboard-table td:first-child,
.mehruedu-leaderboard-table th:first-child {
    font-weight: bold;
    text-align: center;
    width: 65px;
}
.mehruedu-leaderboard-see-more {
    margin-top: 20px;
    padding: 8px 16px;
    background-color: #f1f1f1;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9em;
}
.mehruedu-leaderboard-see-more:hover {
    background-color: #e7e7e7;
}