/* Styles pour le quiz Nawaat */
.nawaat-quiz-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 20px;
}

/* Styles pour l'arabe (RTL) */
.nawaat-quiz-container.rtl {
    direction: rtl;
    text-align: right;
    font-family: "Arial", "Tahoma", "Segoe UI", sans-serif;
}

.nawaat-quiz-container.rtl .nawaat-quiz-option {
    flex-direction: row-reverse;
}

.nawaat-quiz-container.rtl .nawaat-quiz-option .option-letter {
    margin-left: 15px;
    margin-right: 0;
}

.nawaat-quiz-container.rtl .nawaat-quiz-option .option-text {
    margin-left: 15px;
    margin-right: 0;
}

/* RTL alignment for question number and title on one line */
.nawaat-quiz-container.rtl .nawaat-quiz-question .question-number {
    margin-right: 0;
    margin-left: 10px;
}

.nawaat-quiz-container.rtl .nawaat-quiz-question h4 {
    display: inline-block;
    vertical-align: top;
}

/* Ensure RTL keeps number and text on one line with correct order */
.nawaat-quiz-container.rtl .nawaat-quiz-question {
    flex-direction: row-reverse;
}

.nawaat-quiz-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.nawaat-quiz-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.nawaat-quiz-content {
    margin-bottom: 30px;
}

.nawaat-quiz-question {
    margin-bottom: 15px;
    padding-bottom: 10px;
    display: flex;
    align-items: flex-start;
    column-gap: 10px;
    row-gap: 0;
    flex-wrap: wrap; /* allow options to move to next row */
}

.nawaat-quiz-question:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.nawaat-quiz-question .question-number {
    display: inline-block;
    background: #e99d25;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: 600;
    margin-bottom: 0;
    margin-right: 10px;
    vertical-align: top;
}

.nawaat-quiz-question h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 18px;
    line-height: 1.5;
    display: block;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    word-wrap: break-word;
    word-break: break-word;
    flex: 1 1 auto;
    width: auto !important;
}

.nawaat-quiz-options {
    margin: 10px 0 0 0;
    padding: 0;
    list-style: none;
    flex: 1 1 100%; /* take full width on next row */
    width: 100%;
}

.nawaat-quiz-option {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.nawaat-quiz-option:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.nawaat-quiz-option input[type="radio"] {
    display: none;
}

.nawaat-quiz-option input[type="radio"]:checked + .option-letter {
    background: #e99d25;
    color: white;
}

.nawaat-quiz-option .option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-right: 15px;
    background: #ddd;
    color: #666;
    border-radius: 50%;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.nawaat-quiz-option .option-text {
    flex: 1;
    color: #333;
    font-size: 16px;
    line-height: 1.4;
    margin-right: 15px;
}

.nawaat-quiz-option .check-icon {
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

/* États des réponses */
.nawaat-quiz-option.correct {
    background: #d4edda !important;
    border-color: #28a745 !important;
}

.nawaat-quiz-option.correct .option-letter {
    background: #28a745 !important;
    color: white !important;
}

.nawaat-quiz-option.incorrect {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
}

.nawaat-quiz-option.incorrect .option-letter {
    background: #dc3545 !important;
    color: white !important;
}

.nawaat-quiz-actions {
    text-align: center;
    margin-bottom: 20px;
}

.nawaat-quiz-btn {
    background: #e99d25;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.nawaat-quiz-btn:hover {
    background: #e49821;
}

.nawaat-quiz-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.nawaat-quiz-results {
    text-align: center;
    padding: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.nawaat-quiz-results h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
}

.nawaat-quiz-score {
    font-size: 36px;
    font-weight: 700;
    color: #e99d25;
    margin-bottom: 15px;
}

.nawaat-quiz-score .score-number {
    color: #28a745;
}

.nawaat-quiz-feedback {
    font-size: 18px;
    color: #666;
    line-height: 1.5;
}

.nawaat-quiz-credit {
    text-align: center;
    padding-top: 15px;
}

.nawaat-quiz-credit p {
    margin: 0;
    font-size: 14px;
    color: #999;
}

.nawaat-quiz-credit a {
    color: #007cba;
    text-decoration: none;
}

.nawaat-quiz-credit a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .nawaat-quiz-container {
        margin: 20px 10px;
        padding: 20px;
    }
    
    .nawaat-quiz-header h3 {
        font-size: 20px;
    }
    
    .nawaat-quiz-question {
        margin-bottom: 30px;
        padding-bottom: 20px;
    }
    
    .nawaat-quiz-question .question-number {
        width: 25px;
        height: 25px;
        line-height: 25px;
        font-size: 14px;
    }
    
    .nawaat-quiz-question h4 {
        font-size: 16px;
    }
    
    .nawaat-quiz-option {
        padding: 12px;
    }
    
    .nawaat-quiz-option .option-letter {
        width: 25px;
        height: 25px;
        font-size: 12px;
        margin-right: 10px;
    }
    
    .nawaat-quiz-option .option-text {
        font-size: 14px;
        margin-right: 10px;
    }
    
    .nawaat-quiz-option .check-icon {
        font-size: 16px;
    }
    
    .nawaat-quiz-score {
        font-size: 28px;
    }
    
    .nawaat-quiz-feedback {
        font-size: 16px;
    }
}

/* Styles pour l'éditeur de quiz dans l'admin */
.quiz-question-editor {
    border: 1px solid #ddd;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    background: #f9f9f9;
}

.quiz-question-editor h5 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.quiz-question-editor label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
    color: #555;
}

.quiz-question-text {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 8px;
    font-family: inherit;
    resize: vertical;
}

.quiz-option-text {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 5px 8px;
    font-family: inherit;
}

.quiz-preview {
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 5px;
    padding: 20px;
}

.preview-question {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 3px;
    border-left: 4px solid #e99d25;
}

.preview-question ul {
    margin: 10px 0;
    padding-left: 20px;
}

.preview-question li {
    margin-bottom: 5px;
    color: #555;
}

@media (max-width: 768px) {
    .quiz-question-editor {
        padding: 15px;
    }
    
    .quiz-option-text {
        width: 70% !important;
    }
}
