/**
 * Frontend Styles for the Quiz.
 * All styles are scoped to the parent ID to prevent conflicts.
 */

#mmcqg-quiz-block {
    direction: rtl;
    font-family: 'Cairo', sans-serif;
    color: #ffffff;
    -webkit-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#mmcqg-quiz-block .quiz-wrapper {
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    background: linear-gradient(-45deg, #141e30, #243b55, #3a608a, #141e30);
    background-size: 400% 400%;
    animation: mmcqg-gradientBG 15s ease infinite;
    border-radius: 25px;
    overflow: hidden;
}

@keyframes mmcqg-gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#mmcqg-quiz-block .container {
    width: 100%;
    max-width: 1000px;
    padding: clamp(15px, 4vw, 30px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    text-align: center;
    animation: mmcqg-fadeIn 1s ease-out;
}

@keyframes mmcqg-fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* Question Styles */
#mmcqg-quiz-block .question-header { margin-bottom: 20px; }
#mmcqg-quiz-block .question-text-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    cursor: pointer;
}
#mmcqg-quiz-block .question-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
}
#mmcqg-quiz-block .audio-icon {
    font-size: clamp(1.5rem, 4vw, 2rem);
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
}
#mmcqg-quiz-block .audio-icon:hover { opacity: 1; transform: scale(1.1); }

/* Progress Bar (RTL) */
#mmcqg-quiz-block .progress-bar {
    width: 100%;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden;
    direction: rtl; /* Ensures bar grows from the right */
}
#mmcqg-quiz-block .progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: #ffc300;
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
    float: right; /* Aligns the inner bar to the right */
}

/* Options Grid */
#mmcqg-quiz-block .options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: clamp(15px, 3vw, 20px);
    justify-content: center;
    margin-top: 20px;
}
#mmcqg-quiz-block .option {
    background-color: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    flex-direction: column; /* Allow content to stack */
    justify-content: center;
    align-items: center;
    font-size: clamp(2.5rem, 8vw, 5rem); /* Adjusted for text options */
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* Allow text to wrap if needed */
    word-break: break-word; /* Break long words */
}
#mmcqg-quiz-block .option:hover { transform: scale(1.05); border-color: #ffc300; }
#mmcqg-quiz-block .option img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 10px;
}
#mmcqg-quiz-block .option audio {
    width: 80%; /* Adjust width for audio player */
    max-width: 250px;
    margin: 5px 0;
}

/* Feedback Styles */
#mmcqg-quiz-block .option.correct {
    background-color: #4CAF50;
    border-color: #fff;
    animation: mmcqg-correct-answer 0.5s ease;
}
#mmcqg-quiz-block .option.incorrect {
    background-color: #F44336;
    border-color: #fff;
    animation: mmcqg-incorrect-answer 0.5s ease;
}
@keyframes mmcqg-correct-answer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes mmcqg-incorrect-answer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* Buttons and Score */
#mmcqg-quiz-block .container h1, #mmcqg-quiz-block .container h2 { font-size: clamp(2rem, 5vw, 3rem); }
#mmcqg-quiz-block .quiz-button {
    background-color: #ffc300;
    color: #141e30;
    border: none;
    border-radius: 15px;
    padding: 15px 40px;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    font-weight: bold;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
#mmcqg-quiz-block .quiz-button:hover { transform: scale(1.05); box-shadow: 0 0 20px #ffc300; }
#mmcqg-quiz-block .score-container { display: none; flex-direction: column; align-items: center; justify-content: center; }
#mmcqg-quiz-block .final-score { font-size: clamp(3rem, 10vw, 5rem); font-weight: bold; color: #ffc300; margin: 20px 0; text-shadow: 0 0 10px rgba(255,195,0,0.5); }
#mmcqg-quiz-block .container p { color: #ffffff; }

/* New styles for user score updates */
#mmcqg-quiz-block .user-score-updates {
    font-size: 0.9em;
    color: #add8e6; /* Light blue color */
    margin-top: 10px;
    text-align: center;
    line-height: 1.5;
}

