/* ElegantExam Frontend Styles */

/* Reset styles for compatibility with Elementor, Astra, and other themes */
.elegantexam-container * {
    box-sizing: border-box !important;
    margin: 0;
    padding: 0;
    font-family: inherit;
}

/* Import Roboto font with fallback */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

.elegantexam-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
    background: #F9FAFB;
    border-radius: 8px;
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', sans-serif;
    position: relative;
    padding-bottom: 80px;
}

@media (min-width: 769px) {
    .elegantexam-container {
        padding: 1.5rem;
        max-width: 960px;
        border-radius: 12px;
    }
}

@media (min-width: 1025px) {
    .elegantexam-container {
        padding: 2rem;
        max-width: 1140px;
    }
}

.elegantexam-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #E5E7EB;
}

.elegantexam-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.elegantexam-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1F2937;
}

@media (min-width: 769px) {
    .elegantexam-title {
        font-size: 1.25rem;
    }
}

#elegantexam-question-number {
    font-size: 1.125rem;
    color: #1F2937;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

#elegantexam-timer {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    background-color: #E5E7EB;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    line-height: 1;
    align-self: center;
}

.elegantexam-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.elegantexam-question-container {
    width: 100%;
    background-color: #FFFFFF;
    padding: 0rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow-x: auto;
    word-break: break-word;
}

@media (min-width: 769px) {
    .elegantexam-question-container {
        padding: 1.5rem;
        border-radius: 10px;
    }
}

.elegantexam-nav-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0rem;
    background-color: #FFFFFF;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    justify-content: flex-start;
}

@media (min-width: 769px) {
    .elegantexam-nav-grid {
        gap: 0.75rem;
        padding: 1rem;
        border-radius: 10px;
    }
}

.elegantexam-nav-box {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    background-color: #E5E7EB;
    border: 1px solid #D1D5DB;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1F2937;
    transition: all 0.3s ease;
    aspect-ratio: 1 / 1;
}

@media (min-width: 769px) {
    .elegantexam-nav-box {
        width: 2.25rem;
        height: 2.25rem;
        min-width: 2.25rem;
        min-height: 2.25rem;
        font-size: 0.875rem;
    }
}

.elegantexam-nav-box.active {
    background-color: #3B82F6;
    color: #FFFFFF;
    border-color: #3B82F6;
}

.elegantexam-nav-box.answered {
    background-color: #34D399;
    color: #FFFFFF;
    border-color: #34D399;
}

.elegantexam-nav-box.marked {
    border: 2px solid #F59E0B;
    background-color: #FEF3C7;
    color: #D97706;
}

.elegantexam-question-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: #1F2937;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 769px) {
    .elegantexam-question-text {
        font-size: 1.125rem;
        margin-bottom: 2rem;
    }
}

.elegantexam-question-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.elegantexam-options {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.elegantexam-option {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.2rem;
    background-color: #F9FAFB;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    font-size: 0.875rem;
}

@media (min-width: 769px) {
    .elegantexam-option {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
}

.elegantexam-option:hover {
    background-color: #E5E7EB;
}

.elegantexam-option.selected {
    background-color: #DBEAFE;
}

.elegantexam-option.selected .option-circle {
    background-color: #3B82F6;
    color: #FFFFFF;
    transform: scale(1.05);
}

.option-circle {
    width: 1.75rem;
    height: 1.75rem;
    min-width: 1.75rem;
    min-height: 1.75rem;
    background-color: #FFFFFF;
    border: 2px solid #1F2937;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #1F2937;
    transition: all 0.3s ease;
    aspect-ratio: 1 / 1;
}

@media (min-width: 769px) {
    .option-circle {
        width: 2rem;
        height: 2rem;
        min-width: 2rem;
        min-height: 2rem;
        font-size: 1rem;
    }
}

.elegantexam-option:hover .option-circle {
    background-color: #D1D5DB;
}

.elegantexam-option.multiple-choice {
    padding: 0.5rem 0.75rem;
}

@media (min-width: 769px) {
    .elegantexam-option.multiple-choice {
        padding: 0.75rem 1rem;
    }
}

.elegantexam-option.multiple-choice input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    min-width: 1.5rem;
    min-height: 1.5rem;
    border: 2px solid #1F2937;
    border-radius: 4px;
    background-color: #FFFFFF;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    position: relative;
    margin-right: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (min-width: 769px) {
    .elegantexam-option.multiple-choice input[type="checkbox"] {
        width: 1.75rem;
        height: 1.75rem;
        min-width: 1.75rem;
        min-height: 1.75rem;
        margin-right: 0.75rem;
    }
}

.elegantexam-option.multiple-choice input[type="checkbox"]:checked {
    background-color: #34D399;
    border-color: #34D399;
}

.elegantexam-option.multiple-choice input[type="checkbox"]:checked::after {
    content: '\2714'; /* Unicode for checkmark (✔) */
    color: #FFFFFF;
    font-size: 0.875rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Roboto', 'Segoe UI Emoji', sans-serif;
}

@media (min-width: 769px) {
    .elegantexam-option.multiple-choice input[type="checkbox"]:checked::after {
        font-size: 1rem;
    }
}

.elegantexam-option.multiple-choice:hover input[type="checkbox"] {
    border-color: #60A5FA;
}

.elegantexam-option.multiple-choice.selected {
    background-color: #DBEAFE;
}

.elegantexam-free-text-container {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 1rem;
}

.elegantexam-free-text {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1F2937;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 769px) {
    .elegantexam-free-text {
        min-height: 100px;
        padding: 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
}

.elegantexam-free-text:focus {
    border-color: #34D399;
    background-color: #FFFFFF;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
}

.elegantexam-multi-free-text {
    width: 100%;
    margin-bottom: 1rem;
}

@media (min-width: 769px) {
    .elegantexam-multi-free-text {
        margin-bottom: 1.25rem;
    }
}

.elegantexam-multi-free-text-item {
    background-color: #F9FAFB;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

@media (min-width: 769px) {
    .elegantexam-multi-free-text-item {
        padding: 1rem;
        margin-bottom: 2rem;
        border-radius: 10px;
    }
}

.elegantexam-multi-free-text-item:hover {
    background-color: #E5E7EB;
    border-color: #D1D5DB;
}

.elegantexam-multi-free-text-statement-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1F2937;
    margin-bottom: 1rem;
    display: block;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 769px) {
    .elegantexam-multi-free-text-statement-text {
        font-size: 0.875rem;
        margin-bottom: 1.25rem;
    }
}

.elegantexam-multi-free-text-input-container {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 1rem;
}

.elegantexam-multi-free-text-input {
    width: 100%;
    min-height: 36px;
    padding: 0.5rem 0.75rem;
    border: 1px solid #34d399;
    border-radius: 9px;
    font-size: 0.875rem;
    color: #1F2937;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 769px) {
    .elegantexam-multi-free-text-input {
        min-height: 40px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
}

.elegantexam-multi-free-text-input:focus {
    border-color: #34D399;
    box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.2);
    outline: none;
}

.elegantexam-matrix-container {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 1rem;
    -webkit-overflow-scrolling: touch;
}

.elegantexam-matrix-table {
    width: 100%;
    border-collapse: collapse;
    background-color: #FFFFFF;
    border: 2px solid #2563EB;
    border-radius: 10px;
    overflow: hidden;
}

.elegantexam-matrix-table th,
.elegantexam-matrix-table td {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: #1F2937;
    border: 1px solid #E5E7EB;
    word-break: break-word;
    overflow-wrap: break-word;
    position: relative;
}

.elegantexam-matrix-table th {
    background-color: #F3F4F6;
    font-weight: 600;
}

.elegantexam-matrix-table td {
    background-color: #F9FAFB;
}

.elegantexam-matrix-table td.elegantexam-matrix-statement-text {
    text-align: left;
    font-weight: 500;
}

.elegantexam-matrix-radio-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    min-height: 24px;
}

.elegantexam-matrix-radio {
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 1rem;
    border: 2px solid #1F2937;
    border-radius: 50%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1 / 1;
}

.elegantexam-matrix-radio:checked {
    background-color: #34D399; /* Green fill for selected radio */
    border-color: #34D399;
    position: relative;
}

.elegantexam-matrix-radio:checked::after {
    content: ''; /* No checkmark */
}

.elegantexam-matrix-radio + .elegantexam-icon {
    position: absolute;
    right: 0.5rem; /* Position icon inside cell */
    top: 50%;
    transform: translateY(-50%);
}

@media (min-width: 1025px) {
    .elegantexam-matrix-table th,
    .elegantexam-matrix-table td {
        padding: 1rem;
        font-size: 0.875rem;
        min-width: 100px;
    }
    .elegantexam-matrix-table td.elegantexam-matrix-statement-text {
        min-width: 150px;
    }
    .elegantexam-matrix-radio {
        width: 1.25rem;
        height: 1.25rem;
        min-width: 1.25rem;
        min-height: 1.25rem;
    }
    .elegantexam-matrix-radio + .elegantexam-icon {
        right: 1rem;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .elegantexam-matrix-table th,
    .elegantexam-matrix-table td {
        padding: 0.75rem;
        font-size: 0.75rem;
        min-width: 80px;
    }
    .elegantexam-matrix-table td.elegantexam-matrix-statement-text {
        min-width: 120px;
    }
    .elegantexam-matrix-radio {
        width: 1rem;
        height: 1rem;
        min-width: 1rem;
        min-height: 1rem;
    }
    .elegantexam-matrix-radio + .elegantexam-icon {
        right: 0.75rem;
    }
}

@media (max-width: 768px) {
    .elegantexam-matrix-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .elegantexam-matrix-table {
        width: 100%;
        max-width: 100%;
        display: table;
        table-layout: auto;
    }
    .elegantexam-matrix-table th,
    .elegantexam-matrix-table td {
        min-width: 60px;
        font-size: 0.75rem;
        padding: 0.5rem;
        text-align: center;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }
    .elegantexam-matrix-table th.elegantexam-matrix-statement-text,
    .elegantexam-matrix-table td.elegantexam-matrix-statement-text {
        min-width: 100px;
        text-align: left;
    }
    .elegantexam-matrix-radio {
        width: 0.875rem;
        height: 0.875rem;
        min-width: 0.875rem;
        min-height: 0.875rem;
    }
    .elegantexam-matrix-radio + .elegantexam-icon {
        right: 0.5rem;
    }
}

.elegantexam-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    background: hsla(0, 0%, 100%, .4);
    padding: 0.75rem;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    z-index: 1000;
}

@media (min-width: 769px) {
    .elegantexam-button-container {
        max-width: 960px;
        left: 50%;
        transform: translateX(-50%);
        padding: 1rem;
        gap: 0.75rem;
    }
}

.elegantexam-button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

@media (min-width: 769px) {
    .elegantexam-button-group {
        gap: 0.75rem;
    }
}

.elegantexam-button {
    width: 120px;
    padding: 0.5rem;
    color: #FFFFFF;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
}

@media (min-width: 769px) {
    .elegantexam-button {
        width: 120px;
        padding: 0.5rem;
        font-size: 0.875rem;
        border-radius: 6px;
    }
}

.elegantexam-button#elegantexam-start {
    background-color: #34D399;
}

.elegantexam-button#elegantexam-prev {
    background-color: #60A5FA;
}

.elegantexam-button#elegantexam-review {
    background-color: #E5E7EB;
    color: #1F2937;
}

.elegantexam-button#elegantexam-review.marked {
    background-color: #F59E0B;
    color: #FFFFFF;
}

.elegantexam-button#elegantexam-review:hover:not(:disabled) {
    background-color: #D97706;
    color: #FFFFFF;
}

.elegantexam-button#elegantexam-next {
    background-color: #60A5FA;
}

.elegantexam-button#elegantexam-skip {
    background-color: #F59E0B;
}

.elegantexam-button#elegantexam-check {
    background-color: #14B8A6;
}

.elegantexam-button#elegantexam-submit {
    background-color: #1E3A8A;
}

.elegantexam-button#elegantexam-view-explanation {
    background-color: #6B7280;
    display: flex;
    justify-content: center;
    align-items: center;
}

.elegantexam-button#elegantexam-retake {
    background-color: #F59E0B;
    color: #FFFFFF;
    width: 120px;
    margin: 1.5rem auto 0;
    display: block;
}

.elegantexam-button#elegantexam-retake:hover:not(:disabled) {
    background-color: #D97706;
}

.elegantexam-button:disabled {
    background-color: #D1D5DB;
    cursor: not-allowed;
}

.elegantexam-button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.elegantexam-results-header {
    text-align: center;
    margin: 1.5rem auto;
    padding: 1rem;
    background-color: #2563EB;
    color: #FFFFFF;
    border-radius: 8px;
    max-width: 960px;
    width: 100%;
}

@media (min-width: 769px) {
    .elegantexam-results-header {
        padding: 1.25rem;
        max-width: 960px;
    }
}

.elegantexam-results-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

@media (min-width: 769px) {
    .elegantexam-results-header h2 {
        font-size: 1.75rem;
    }
}

.elegantexam-score-table {
    width: 100%;
    max-width: 960px;
    margin: 1.5rem auto;
    border-collapse: separate;
    border-spacing: 0;
    background-color: #FFFFFF;
    border: 2px solid #2563EB;
    border-radius: 12px;
    overflow: hidden;
}

.elegantexam-score-table th,
.elegantexam-score-table td {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: #1F2937;
    border: 1px solid #E5E7EB;
    min-width: 100px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.elegantexam-score-table th {
    background-color: #2563EB;
    color: #FFFFFF;
    font-weight: 600;
    text-transform: uppercase;
}

.elegantexam-score-table td {
    background-color: #F9FAFB;
}

.elegantexam-score-table th:first-child {
    border-top-left-radius: 10px;
}

.elegantexam-score-table th:last-child {
    border-top-right-radius: 10px;
}

.elegantexam-score-table tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}

.elegantexam-score-table tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

@media (max-width: 768px) {
    .elegantexam-score-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .elegantexam-score-table th,
    .elegantexam-score-table td {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

.elegantexam-results-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 960px;
    margin: 1.5rem auto;
    width: 100%;
}

@media (min-width: 769px) {
    .elegantexam-results-list {
        gap: 1.25rem;
        max-width: 960px;
    }
}

.elegantexam-result-card {
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 1rem;
    position: relative;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    word-break: break-word;
    overflow-wrap: break-word;
}

.elegantexam-result-card.elegantexam-correct {
    border-color: #10B981;
    background-color: #D1FAE5;
}

.elegantexam-result-card.elegantexam-incorrect {
    border-color: #EF4444;
    background-color: #FEE2E2;
}

.elegantexam-result-card.elegantexam-unanswered {
    border-color: #6B7280;
    background-color: #E5E7EB;
}

.elegantexam-result-card::before {
    content: '';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 1.25rem;
    height: 1.25rem;
    font-family: 'Roboto', 'Segoe UI Emoji', sans-serif;
    font-size: 1rem;
    line-height: 1.25rem;
    text-align: center;
}

.elegantexam-result-card.elegantexam-correct::before {
    content: '\2714'; /* Unicode for checkmark (✔) */
    color: #10B981;
}

.elegantexam-result-card.elegantexam-incorrect::before {
    content: '\2718'; /* Unicode for cross (✘) */
    color: #EF4444;
}

.elegantexam-result-card.elegantexam-unanswered::before {
    content: '\2212'; /* Unicode for minus (−) */
    color: #6B7280;
}

.elegantexam-result-card-header {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #E5E7EB;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 769px) {
    .elegantexam-result-card-header {
        font-size: 1.25rem;
    }
}

.elegantexam-result-card-body {
    font-size: 0.875rem;
    color: #1F2937;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 769px) {
    .elegantexam-result-card-body {
        font-size: 0.875rem;
    }
}

.elegantexam-result-question-text {
    margin-bottom: 0.75rem;
    font-weight: 500;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.elegantexam-result-answer-container {
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background-color: #F3F4F6;
    border-radius: 6px;
}

.elegantexam-result-answer-container p {
    margin: 0.5rem 0;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.elegantexam-result-answer-container p strong {
    font-weight: 600;
    color: #1F2937;
    min-width: 120px;
    display: inline-block;
}

.elegantexam-explanation-button {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 120px;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #FFFFFF;
    background-color: #4B5563;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    margin: 0.75rem auto;
}

@media (min-width: 769px) {
    .elegantexam-explanation-button {
        width: 120px;
        padding: 0.75rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
}

.elegantexam-explanation-button:hover {
    background-color: #374151;
    transform: translateY(-1px);
}

.elegantexam-back-button-container {
    text-align: center;
    margin: 1.5rem auto;
    max-width: 960px;
}

.elegantexam-back-button {
    width: 120px;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #FFFFFF;
    background-color: #2563EB;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

@media (min-width: 769px) {
    .elegantexam-back-button {
        width: 120px;
        padding: 0.75rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
}

.elegantexam-back-button:hover {
    background-color: #1E40AF;
    transform: translateY(-1px);
}

.elegantexam-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.elegantexam-popup {
    background: #FFFFFF;
    border-radius: 8px;
    width: auto;
    max-width: 90vw;
    min-width: 300px; /* Minimum width for small content */
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
}

.elegantexam-popup:has(video),
.elegantexam-popup:has(iframe) {
    padding: 0;
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
}

@media (max-width: 768px) {
    .elegantexam-popup {
        min-width: 250px; /* Smaller min-width for mobile */
        max-width: 95vw;
        max-height: 95vh;
    }
    .elegantexam-popup:has(video),
    .elegantexam-popup:has(iframe) {
        max-width: 95vw;
        max-height: 95vh;
        overflow: hidden;
    }
}

.elegantexam-popup-content {
    display: inline-block; /* Adjust width to content */
    text-align: left;
    word-break: break-word;
    overflow-wrap: break-word;
    padding: 1rem; /* Consistent padding for content */
}

.elegantexam-explanation-body {
    font-size: 0.875rem;
    color: #1F2937;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.elegantexam-explanation-body:has(video),
.elegantexam-explanation-body:has(iframe) {
    padding: 0; /* Remove padding for video/iframe */
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (min-width: 769px) {
    .elegantexam-explanation-body {
        font-size: 0.875rem;
    }
    .elegantexam-explanation-body:has(video),
    .elegantexam-explanation-body:has(iframe) {
        padding: 0;
    }
}

.elegantexam-explanation-body video,
.elegantexam-explanation-body iframe {
    width: 100%;
    height: auto;
    max-height: 90vh;
    border-radius: 8px; /* Apply border-radius to video/iframe */
    aspect-ratio: 16 / 9;
    box-sizing: border-box;
    object-fit: contain;
    margin: 0;
    padding: 0;
}

.mejs__container {
    width: 100% !important;
    height: auto !important;
    max-height: 90vh;
    border-radius: 8px;
    margin: 0 !important;
    padding: 0 !important;
}

.mejs__controls {
    background: #1F2937;
    padding: 0.5rem;
    border-radius: 0 0 8px 8px;
}

.mejs__time {
    color: #FFFFFF;
    font-family: 'Roboto', sans-serif;
}

.mejs__playpause-button > button,
.mejs__volume-button > button,
.mejs__fullscreen-button > button {
    background-color: transparent;
    border: none;
    color: #FFFFFF;
    transition: color 0.3s ease;
}

.mejs__playpause-button > button:hover,
.mejs__volume-button > button:hover,
.mejs__fullscreen-button > button:hover {
    color: #60A5FA;
}

.mejs__time-slider {
    background: #FFFFFF;
    border-radius: 2px;
}

.mejs__time-current {
    background-color: #34D399;
}

.elegantexam-popup-content p {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
    margin: 0.5rem 0;
    padding: 0.25rem;
    background-color: #F3F4F6;
    border-radius: 6px;
    white-space: normal;
}

@media (min-width: 769px) {
    .elegantexam-popup-content p {
        font-size: 0.875rem;
        padding: 0.5rem;
    }
}

.elegantexam-popup-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem !important;
    height: 1.5rem !important;
    min-width: 1.5rem !important;
    min-height: 1.5rem !important;
    background-color: #EF4444;
    border: none;
    border-radius: 50% !important;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 2020;
    outline: none;
    transition: background-color 0.3s ease;
    color: #FFFFFF;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    line-height: 1;
    box-sizing: border-box !important;
    aspect-ratio: 1 / 1 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.elegantexam-popup-close::after {
    content: '\2716'; /* Unicode for cross (✖) */
}

.elegantexam-popup-close:hover {
    background-color: #CC0000;
}

.elegantexam-icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
}

.elegantexam-icon.correct-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="green"><path d="M20.285 2l-11.285 11.567-5.286-5.011-3.714 3.716 9 8.728 15-15.285z"/></svg>');
}

.elegantexam-icon.incorrect-icon {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="red"><path d="M24 2.4l-2.4-2.4-9.6 9.6-9.6-9.6-2.4 2.4 9.6 9.6-9.6 9.6 2.4 2.4 9.6-9.6 9.6 9.6 2.4-2.4-9.6-9.6z"/></svg>');
}

@media (min-width: 769px) {
    .elegantexam-icon {
        width: 1.25rem;
        height: 1.25rem;
    }
}

@media (max-width: 768px) {
    .elegantexam-icon {
        width: 0.875rem;
        height: 0.875rem;
    }
}

.elegantexam-leaderboard-table {
    width: 100%;
    max-width: 960px;
    margin: 1.5rem auto;
    border-collapse: collapse;
    background-color: #FFFFFF;
    border: 2px solid #2563EB;
    border-radius: 12px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .elegantexam-leaderboard-table {
        width: 100%;
        max-width: 100%;
        display: table;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.elegantexam-leaderboard-table th,
.elegantexam-leaderboard-table td {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    color: #1F2937;
    border: 0.5px solid #000;
    min-width: 100px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.elegantexam-leaderboard-table th {
    background-color: #000;
    color: #FFFFFF;
    font-weight: 600;
    text-transform: uppercase;
}

.elegantexam-leaderboard-table td {
    background-color: #F9FAFB;
}

.elegantexam-leaderboard-table tr.rank-1 td:first-child::before,
.elegantexam-leaderboard-table tr.rank-2 td:first-child::before,
.elegantexam-leaderboard-table tr.rank-3 td:first-child::before {
    content: '';
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
    vertical-align: middle;
    font-family: 'Segoe UI Emoji', 'Noto Color Emoji', 'Roboto', sans-serif;
}

.elegantexam-leaderboard-table tr.rank-1 td:first-child::before {
    content: '\1F947'; /* Unicode for 1st place medal (🏅) */
    font-size: 1.25rem;
}

.elegantexam-leaderboard-table tr.rank-2 td:first-child::before {
    content: '\1F948'; /* Unicode for 2nd place medal (🥈) */
    font-size: 1.25rem;
}

.elegantexam-leaderboard-table tr.rank-3 td:first-child::before {
    content: '\1F949'; /* Unicode for 3rd place medal (🥉) */
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .elegantexam-leaderboard-table th,
    .elegantexam-leaderboard-table td {
        min-width: 80px;
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    .elegantexam-leaderboard-table tr.rank-1 td:first-child::before,
    .elegantexam-leaderboard-table tr.rank-2 td:first-child::before,
    .elegantexam-leaderboard-table tr.rank-3 td:first-child::before {
        width: 1rem;
        height: 1rem;
        font-size: 1rem;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}