/* =========================================================
   RAPIDQUIZMAKER FRONTEND CSS
   ========================================================= */

/* --- 1. General and helper classes --- */
.rqm-noselect {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.rqm-cheat-warning { 
    display: none; 
    background: #dc3232; 
    color: white; 
    text-align: center; 
    padding: 10px; 
    font-weight: bold; 
    font-size: 14px; 
}

@keyframes blink { 
    50% { opacity: 0.7; } 
}

/* --- 2. Quiz completion interface --- */

.rqm-quiz-wrapper,
.rqm-quiz-wrapper * {
    box-sizing: border-box;
}

.rqm-quiz-wrapper,
.rqm-quiz-wrapper .rqm-question-title,
.rqm-quiz-wrapper .rqm-option,
.rqm-quiz-wrapper .rqm-option-text,
.rqm-quiz-wrapper .rqm-option-text strong,
.rqm-quiz-wrapper .rqm-btn,
.rqm-quiz-wrapper .rqm-circle,
.rqm-quiz-wrapper .rqm-header,
.rqm-quiz-wrapper .rqm-header-info,
.rqm-quiz-wrapper .rqm-timer {
    font-family: Arial, Helvetica, sans-serif !important;
    font-style: normal !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
.rqm-quiz-wrapper { 
    margin: 0 auto; 
    background: #fff; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); 
    border-radius: 1px; 
    border: 1px solid #f8f8f8; /* Missing # restored. */
    overflow: hidden; 
    outline: none; 
}

.rqm-header { 
    background: #f8f9fa; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    border-bottom: 2px solid #eee; 
    position: sticky; 
    top: 0; 
    z-index: 100; 
}
.rqm-header-info { font-size: 14px; color: #555; }

.rqm-timer { font-size: 20px; font-weight: bold; padding: 5px 15px; border-radius: 20px; background: #e9ecef; transition: color 0.3s; }
.rqm-timer.green { color: #008a20; }
.rqm-timer.orange { color: #d68b00; }
.rqm-timer.red { color: #dc3232; animation: blink 1s infinite; }

.rqm-progress { padding: 20px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; background: #fafafa; border-bottom: 1px solid #eee; }
.rqm-circle { width: 30px; height: 30px; border-radius: 50%; background: #e0e0e0; display: flex; justify-content: center; align-items: center; font-size: 13px; font-weight: bold; cursor: pointer; color: #555; border: 2px solid transparent; transition: 0.2s; }
.rqm-circle.answered { background: #008a20; color: white; }
.rqm-circle.active { border: 2px solid #2271b1; transform: scale(1.1); box-shadow: 0 0 5px rgba(34,113,177,0.5); }

.rqm-body { padding: 30px 20px; }
.rqm-question-title { font-size: 30px !important; line-height: 1.35 !important; font-weight: 700 !important; margin-bottom: 25px; color: #333; word-break: break-word; overflow-wrap: anywhere; }

.rqm-options-wrap { display: flex; justify-content: space-between; gap: 20px; }
.rqm-opt-col { width: 48%; display: flex; flex-direction: column; gap: 5px; }

.rqm-option { display: flex; align-items: center; padding: 12px 15px; margin-bottom: 10px; background: #f4f6f8; border: 2px solid transparent; border-radius: 6px; cursor: pointer; transition: 0.2s; min-width: 0; }
.rqm-option:hover { background: #e2e8f0; }
.rqm-option.focused { border-color: #8c8f94; background: #e2e8f0; } 
.rqm-option.selected { background: #d1e7dd; border-color: #0f5132; color: #0f5132; font-weight: bold; } 
.rqm-option input { margin-right: 15px; transform: scale(1.2); cursor: pointer; flex: 0 0 auto; }

.rqm-option-text {
    font-size: 18px !important;
    line-height: 1.45 !important;
    color: inherit;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.rqm-option-text strong {
    font-size: 18px !important;
    font-weight: 700 !important;
}

.rqm-option.rqm-answer-disabled { cursor: default; }
.rqm-option.rqm-answer-correct { background: #d1e7dd; border-color: #0f5132; color: #0f5132; font-weight: bold; }
.rqm-option.rqm-answer-wrong { background: #fde8e8; border-color: #dc3232; color: #8a1f11; font-weight: bold; }
.rqm-option.rqm-answer-wrong .rqm-option-text { text-decoration: line-through; }
.rqm-answer-icon { margin-left: auto; padding-left: 12px; font-weight: bold; font-size: 28px; line-height: 1; white-space: nowrap; flex: 0 0 auto; }

.rqm-footer { padding: 15px 20px; background: #f8f9fa; border-top: 1px solid #eee; display: flex; justify-content: space-between; }
.rqm-btn { padding: 10px 20px; font-size: 16px; font-weight: bold; border: none; border-radius: 4px; cursor: pointer; transition: 0.2s; }
.rqm-btn-prev { background: #6c757d; color: white; }
.rqm-btn-prev:disabled { opacity: 0.5; cursor: not-allowed; }
.rqm-btn-next { background: #2271b1; color: white; }
.rqm-btn-submit { background: #dc3232; color: white; }

/* --- 3. Result (final) interface --- */
.rqm-final-box { width: 100%; max-width: 800px; margin: 0 auto; background: #fff; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); overflow: hidden; }
.rqm-top-section { padding: 30px; }
.rqm-stats-row { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 10px; margin-bottom: 10px; font-size: 16px; flex-wrap: wrap; gap: 5px; }

.rqm-score-dashboard { display: flex; justify-content: space-around; align-items: center; margin-top: 25px; background: #fdfdfd; padding: 25px 20px; border-radius: 8px; border: 1px solid #eee; box-shadow: inset 0 2px 5px rgba(0,0,0,0.02); flex-wrap: wrap; gap: 20px; }
.rqm-score-info { text-align: center; }
.rqm-grade-info { text-align: center; border-left: 2px solid #eee; padding-left: 40px; }

.rqm-details-section { padding: 0 30px 30px 30px; border-top: 2px solid #eee; background: #fff; }
.rqm-q-block { padding: 20px; margin-top: 20px; border-radius: 4px; }

/* --- 4. Mobile view (always at the end of the file) --- */
@media (max-width: 600px) {
    /* Result page on mobile. */
    .rqm-top-section { padding: 20px 15px; }
    .rqm-details-section { padding: 0 15px 20px 15px; }
    .rqm-q-block { padding: 15px; }
    .rqm-score-dashboard { flex-direction: column; gap: 15px; padding: 15px; }
    .rqm-grade-info { border-left: none; padding-left: 0; border-top: 1px solid #eee; padding-top: 15px; width: 100%; }
    
    /* Quiz page on mobile. */
    .rqm-options-wrap { flex-direction: column; gap: 5px; }
    .rqm-opt-col { width: 100%; }
    .rqm-body { padding: 20px 14px; }
    .rqm-question-title { font-size: 18px !important; margin-bottom: 20px; }
    .rqm-option { padding: 12px 12px; }
    .rqm-option-text,
    .rqm-option-text strong { font-size: 16px !important; }
    .rqm-answer-icon { font-size: 24px; padding-left: 8px; }
    .rqm-btn { font-size: 14px; padding: 10px 14px; }
}
/* --- Selected topic list on the start screen --- */
.rqm-selected-topics {
    width: 100%;
    max-width: 80%;
    margin: 0 auto 20px;
    box-sizing: border-box;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    background: #fff;
    text-align: left;
}

.rqm-selected-topics summary {
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 600;
}

.rqm-selected-topics-list {
    margin: 0;
    padding: 10px 14px 12px 34px;
    border-top: 1px solid #e5e5e5;
}

.rqm-selected-topics-list li {
    padding: 3px 0;
    color: #555;
}

/* --- 5. Frontend category selector --- */
.rqm-start-form input[type="text"],
.rqm-category-selector {
    width: 100%;
    box-sizing: border-box;
}

/* Keep the quiz access field a normal text input while masking its characters. */
.rqm-start-form .rqm-masked-text-input {
    -webkit-text-security: disc;
}

.rqm-category-selector {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
}

.rqm-category-selector,
.rqm-category-selector summary,
.rqm-category-selector-list,
.rqm-category-selector-option {
    font-family: Arial, Helvetica, sans-serif !important;
    font-size: 16px !important;
    font-weight: 400;
    line-height: 1.4;
}

.rqm-category-selector-option span {
    font-family: Arial !important;
    font-size: 13px !important;
    font-weight: 400;
    line-height: 1.4;
}

.rqm-category-selector summary {
    padding: 10px;
    cursor: pointer;
}

.rqm-category-selector-list {
    padding: 8px 10px 10px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rqm-category-selector-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.rqm-category-selector-all {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid #e5e5e5;
}

/* --- 6. Multiple quiz instance start lock --- */
.rqm-start-locked-action {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-top: 10px;
}

.rqm-start-locked-button {
    max-width: 100%;
    background: #dcdcde;
    color: #50575e;
    padding: 5px 5px;
    border: none;
    border-radius: 2px;
    font-size: 10px;
    font-weight: bold;
    cursor: not-allowed;
    text-align: center;
}

.rqm-start-locked-helper {
    color: #646970;
    font-size: 9px;
    line-height: 1.4;
}

/* --- 7. Result grade animation --- */
@keyframes rqm-spin-3d {
    0% { transform: perspective(400px) rotateY(0deg); }
    100% { transform: perspective(400px) rotateY(360deg); }
}

.rqm-spinning-coin {
    animation: rqm-spin-3d 4s linear infinite;
    transform-style: preserve-3d;
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.rqm-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    min-height: 54px;
    padding: 10px 18px;
    border: 3px solid #2271b1;
    border-radius: 999px;
    background: #fff;
    color: #2271b1;
    box-shadow: 0 5px 15px rgba(0,0,0,0.12);
    font-size: clamp(20px, 4vw, 32px);
    font-weight: 700;
    line-height: 1.15;
    overflow-wrap: anywhere;
    text-align: center;
}

.rqm-grade-badge--coin {
    width: 82px;
    height: 82px;
    min-height: 82px;
    max-width: none;
    margin: 0 auto;
    padding: 0;
    border-radius: 50%;
    flex: 0 0 82px;
    font-size: 32px;
    line-height: 1;
    overflow-wrap: normal;
    white-space: nowrap;
}


.rqm-submission-rate-limit {
    max-width: 600px;
    margin: 20px auto;
    padding: 16px 20px;
    border: 1px solid #dba617;
    border-left-width: 5px;
    border-radius: 4px;
    background: #fff8e5;
    color: #5f4600;
    text-align: center;
}
