@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&display=swap');

:root {
    --primary-color: #ffc300;
    --secondary-color: #ff6b6b;
    --correct-color: #4CAF50;
    --incorrect-color: #F44336;
    --background-start: #141e30;
    --background-end: #243b55;
    --text-color: #333; /* Adjusted for better visibility on light background */
    --card-bg: transparent; /* Removed background */
    --leaderboard-bg: rgba(0, 0, 0, 0.4);
    --leaderboard-header-bg: rgba(0, 0, 0, 0.6);
}

/* Ensure Cairo font is used for all plugin content */
body {
    font-family: 'Cairo', sans-serif !important;
}

.mqcg-frontend-quiz-wrapper,
.mqcg-leaderboard-container {
    direction: rtl;
    text-align: right;
}

.container {
    font-family: 'Cairo', sans-serif;
    margin: 0 auto; /* Center the container */
    padding: 0; /* Removed padding */
    background: none; /* Removed background */
    border-radius: 0; /* Removed border-radius */
    backdrop-filter: none; /* Removed backdrop-filter */
    border: none; /* Removed border */
    box-shadow: none; /* Removed box-shadow */
    text-align: center;
    animation: none; /* Removed animation */
    margin: 0; /* Removed margin */
    width: 100%;
    max-width: 100%; /* Ensure it takes full available width */
    color: var(--text-color);
}

/* Question Styles */
.question-header {
    margin-bottom: 20px;
    cursor: pointer;
}
.question-text-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}
.question-text {
    font-size: clamp(1.2rem, 3.5vw, 2.2rem);
    font-weight: 700;
    margin: 0;
    animation: none; /* Removed animation */
    line-height: 1.3;
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
}
.audio-icon {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    opacity: 0.7;
    transition: opacity 0.3s, transform 0.3s;
    flex-shrink: 0;
}
.audio-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Question Image */
.question-image-container {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}
.question-image {
    max-width: 100%;
    max-height: min(30vh, 300px);
    width: auto;
    height: auto;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    object-fit: contain;
}

/* Added style for question image as text/emoji */
.question-image-text {
    font-size: clamp(3rem, 10vw, 8rem); /* Larger font for emojis/text */
    line-height: 1;
    display: block; /* Ensure it takes its own line and centers */
    text-align: center;
    padding: 10px; /* Add some padding around the text/emoji */
}


/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden;
}
.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: var(--primary-color);
    border-radius: 5px;
    transition: width 0.5s ease-in-out;
}

/* Options Grid */
.options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(150px, 40vw), 1fr));
    gap: clamp(10px, 2.5vw, 20px);
    justify-content: center;
    margin-top: 20px;
    max-width: 100%;
}
.option {
    background-color: transparent;
    border: 1px solid #AFDBF5; /* Subtle border */
    border-radius: 8px; /* Slightly rounded corners */
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(2.5rem, 8vw, 6rem); /* Default for emojis/large text */
    overflow: hidden;
    position: relative;
    min-height: 80px;
    padding: 10px; /* Add padding for content */
    box-sizing: border-box; /* Include padding in element's total width and height */
    color: var(--text-color); /* Ensure text color is readable */
}

.option-content {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.1;
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
    font-size: clamp(1rem, 3.5vw, 1.8rem); /* Adjust font size for text options */
    color: var(--text-color);
}

.option-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px; /* Slightly smaller border-radius for images inside options */
}


/* Adjustments for options containing images */
.option.option-has-image {
    font-size: 1rem; /* Reset font size if it's an image option */
    padding: 5px; /* Reduce padding for images if needed */
}


.option:hover {
    transform: scale(1.03); /* Slightly less dramatic hover */
    border-color: var(--primary-color);
    background-color: #e0e0e0; /* Slightly darker on hover */
}

/* Answer Feedback Styles */
.option.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
    animation: correct-answer 0.5s ease;
    color: #fff; /* White text for correct answer */
}
.option.incorrect {
    background-color: var(--incorrect-color);
    border-color: var(--incorrect-color);
    animation: incorrect-answer 0.5s ease;
    color: #fff; /* White text for incorrect answer */
}
@keyframes correct-answer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); } /* Reduced scale */
}
@keyframes incorrect-answer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); } /* Reduced shake */
    40%, 80% { transform: translateX(5px); }
}

/* Start and Score Screens */
.start-container h1, .score-container h2 {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    line-height: 1.3;
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
}

.start-container p, .score-container p {
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    margin: 20px 0;
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
}

#start-btn, #restart-btn {
    background-color: var(--primary-color);
    color: #fff; /* Changed to white for better contrast */
    border: none;
    border-radius: 8px; /* Slightly less rounded */
    padding: clamp(12px, 3vw, 18px) clamp(25px, 6vw, 45px);
    font-size: clamp(1rem, 2.8vw, 1.4rem);
    font-weight: bold;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 20px;
}
#start-btn:hover, #restart-btn:hover {
    transform: scale(1.03); /* Reduced scale */
    box-shadow: 0 0 10px rgba(255, 195, 0, 0.5); /* Less intense shadow */
}

.score-container {
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.final-score {
    font-size: clamp(2.5rem, 8vw, 4.5rem);
    font-weight: bold;
    color: var(--primary-color);
    margin: 20px 0;
    animation: none; /* Removed animation */
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
}

.daily-stats {
    margin-top: 15px;
    font-size: clamp(0.8rem, 2vw, 1rem);
    opacity: 0.8;
    line-height: 1.4;
    font-family: 'Cairo', sans-serif; /* Explicitly apply Cairo */
}

.daily-ranking, .daily-points {
    margin: 5px 0;
}

/* Login Message - This CSS might not be directly used anymore if the shortcode doesn't return it, but keeping it for consistency if similar messages are added via JS */
.mqcg-login-message {
    font-family: 'Cairo', sans-serif;
    text-align: center;
    padding: 20px;
    border: 1px solid #ffc300;
    border-radius: 10px;
    background-color: rgba(255, 195, 0, 0.1);
    color: var(--text-color);
    margin: 20px auto;
    max-width: 600px;
}

.mqcg-login-message p {
    font-size: 1.2rem;
    color: #fff;
    margin: 10px 0;
}

.mqcg-login-message a {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--background-end);
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    margin: 5px;
    font-weight: bold;
    font-family: 'Cairo', sans-serif;
    transition: background-color 0.3s;
}

.mqcg-login-message a:hover {
    background-color: darken(var(--primary-color), 10%);
}

/* New style for the not logged in message */
.daily-stats .not-logged-in-message {
    color: red;
    font-size: 0.9em;
    margin-top: 10px;
}



/* Leaderboard Styles - Minimal & Elegant */
.mqcg-leaderboard-container {
    padding: 0;
    margin: 40px auto;
    max-width: 800px;
    color: var(--text-color);
    text-align: center;
    font-family: 'Cairo', sans-serif;
}

.mqcg-leaderboard-title {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: 600;
}

.mqcg-leaderboard-filters,
.mqcg-leaderboard-limit {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.mqcg-filter-btn,
.mqcg-limit-btn {
    background-color: transparent;
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    padding: 8px 18px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background-color 0.3s, color 0.3s;
    font-family: 'Cairo', sans-serif;
}

.mqcg-filter-btn:hover,
.mqcg-limit-btn:hover {
    background-color: var(--primary-color);
    color: var(--background-end);
}

.mqcg-filter-btn.active,
.mqcg-limit-btn.active {
    background-color: var(--primary-color);
    color: var(--background-end);
    border-color: var(--primary-color);
}

.mqcg-leaderboard-table-wrapper {
    overflow-x: auto;
    margin-top: 20px;
}

.mqcg-leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 400px;
}

.mqcg-leaderboard-table th,
.mqcg-leaderboard-table td {
    padding: 12px 15px;
    text-align: center;
    font-family: 'Cairo', sans-serif;
    color: var(--text-color);
}

.mqcg-leaderboard-table thead th {
    color: var(--primary-color);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.mqcg-leaderboard-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.mqcg-leaderboard-table tbody tr:nth-child(odd) {
    background-color: rgba(0, 0, 0, 0.015);
}

.mqcg-leaderboard-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.mqcg-leaderboard-table tbody tr:first-child td {
    color: gold;
    background: darkgreen;
    font-weight: bold;
    font-size: 1.1em;
}
.mqcg-leaderboard-table tbody tr:nth-child(2) td {
    color: #fff;
    background: green;
    font-weight: bold;
}
.mqcg-leaderboard-table tbody tr:nth-child(3) td {
    color: #fff; /* Bronze */
    background: #4CBB17;
    font-weight: bold;
}

#mqcg-leaderboard-loading,
#mqcg-leaderboard-no-data {
    color: var(--text-color);
    font-family: 'Cairo', sans-serif;
    margin-top: 20px;
}


/* Responsive adjustments */
@media (max-width: 480px) {
    .container {
        padding: 0;
        margin: 0;
        border-radius: 0;
    }

    .options-container {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
    }

    .option {
        min-height: 70px;
        border-radius: 12px;
    }

    .question-text-wrapper {
        gap: 10px;
    }

    .mqcg-leaderboard-container {
        padding: 15px;
        border-radius: 10px;
    }

    .mqcg-leaderboard-title {
        font-size: 2rem;
    }

    .mqcg-filter-btn,
    .mqcg-limit-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }
}

@media (max-width: 320px) {
    .options-container {
        grid-template-columns: repeat(2, 1fr);
    }
}