/* Quiz Page Specific Styles */

/* Quiz Container */
.quiz-container {
    max-width: 900px;
    margin: 0 auto;
}

/* Quiz Progress Bar */
.quiz-progress {
    position: relative;
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--aus-green) 0%, var(--aus-green-light) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 1px 3px rgba(0, 132, 61, 0.3);
}

/* Quiz Header */
.quiz-header {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbfd 100%);
    border: 1px solid #e0e7ed;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: slideInFromRight 0.5s ease;
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quiz-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
}

/* Timer */
.timer {
    background: linear-gradient(135deg, var(--aus-green) 0%, var(--aus-green-dark) 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 132, 61, 0.2);
    transition: all 0.3s ease;
}

.timer::before {
    content: '⏱';
    font-size: 20px;
}

.timer.warning {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff5252 100%);
    animation: pulseGlow 1.5s infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
}

.question-number {
    font-size: 18px;
    color: var(--aus-green);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-number::before {
    content: '📝';
    font-size: 20px;
}

.cancel-button {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cancel-button:hover {
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

/* Question Card */
.question-card {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
    animation: slideInFromRight 0.6s ease;
}

.question-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--aus-green) 0%, var(--aus-green-light) 50%, var(--aus-green) 100%);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.question-text {
    font-size: 24px;
    line-height: 1.6;
    color: #1a1a2e;
    font-weight: 500;
    margin-bottom: 24px;
    padding: 10px 0;
}

.translation-text {
    background: linear-gradient(135deg, #f8fbfd 0%, #e6f3f9 100%);
    border-left: 4px solid var(--aus-green);
    padding: 20px;
    border-radius: 8px;
    font-size: 20px;
    color: #2c3e50;
    margin-bottom: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Options */
.options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option {
    background: white;
    border: 2px solid #e0e7ed;
    border-radius: 12px;
    padding: 20px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-size: 18px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.option::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.option:hover {
    border-color: var(--aus-green);
    background: linear-gradient(135deg, #ffffff 0%, #f0f8fb 100%);
    transform: translateX(8px);
    box-shadow: 0 4px 16px rgba(0, 105, 143, 0.15);
}

.option:hover::before {
    background: var(--aus-green);
}

.option.selected {
    border-color: var(--aus-green);
    background: linear-gradient(135deg, #e6f3f9 0%, #d1e9f3 100%);
    box-shadow: 0 4px 16px rgba(0, 105, 143, 0.2);
    transform: translateX(8px);
}

.option.selected::before {
    background: var(--aus-green);
    width: 6px;
}

.option.correct {
    border-color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.2);
    animation: correctPulse 0.5s ease;
}

@keyframes correctPulse {
    0%, 100% { transform: scale(1) translateX(8px); }
    50% { transform: scale(1.02) translateX(8px); }
}

.option.correct::before {
    background: #4caf50;
    width: 6px;
}

.option.correct::after {
    content: '✓';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #4caf50;
    font-weight: bold;
}

.option.incorrect {
    border-color: #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    box-shadow: 0 4px 16px rgba(244, 67, 54, 0.2);
    animation: incorrectShake 0.5s ease;
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.option.incorrect::before {
    background: #f44336;
    width: 6px;
}

.option.incorrect::after {
    content: '✗';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: #f44336;
    font-weight: bold;
}

.option-translation {
    font-size: 16px;
    color: #5a6c7d;
    font-style: italic;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e0e7ed;
}

/* Clickable Words */
.clickable-word {
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    background-color: #e8f4fd;
    border-bottom: 2px dotted #3498db;
    transition: all 0.2s ease;
    display: inline-block;
    margin: 1px;
}

.clickable-word:hover {
    background-color: #3498db;
    color: white;
    border-bottom-color: #2980b9;
    transform: translateY(-1px);
}

/* Word Popup */
.word-popup {
    position: absolute;
    background: white;
    border: 2px solid var(--aus-green);
    border-radius: 8px;
    padding: 12px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 300px;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    animation: popupFadeIn 0.2s ease;
}

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

.word-popup::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--aus-green);
}

/* Explanation Box */
.explanation {
    margin-top: 24px;
    padding: 24px;
    background: linear-gradient(135deg, #f0f8fb 0%, #e1f2f8 100%);
    border-radius: 12px;
    border: 1px solid #b3d9e8;
    box-shadow: 0 4px 12px rgba(0, 105, 143, 0.1);
    animation: slideIn 0.4s ease;
}

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

.explanation h4 {
    margin-bottom: 12px;
    color: var(--aus-green);
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation h4::before {
    content: '💡';
    font-size: 24px;
}

.explanation p {
    color: #4a5f7a;
    line-height: 1.8;
}

.translated-explanation {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #b3d9e8;
    font-style: italic;
    color: #4a5f7a;
}

/* Navigation Buttons */
.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
}

.nav-button {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.prev-button {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
}

.prev-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.next-button, .submit-button {
    background: linear-gradient(135deg, var(--aus-green) 0%, var(--aus-green-dark) 100%);
    color: white;
}

.next-button:hover:not(:disabled), .submit-button:hover {
    background: linear-gradient(135deg, var(--aus-green-dark) 0%, #005025 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 105, 143, 0.3);
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Results Container */
.results-container {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1);
    animation: slideInFromRight 0.5s ease;
}

.results-container h2 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #1a1a2e;
}

.score {
    font-size: 72px;
    font-weight: bold;
    margin: 30px 0;
    display: inline-block;
    padding: 20px 40px;
    border-radius: 16px;
    position: relative;
}

.score.pass {
    color: #4caf50;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.2);
}

.score.fail {
    color: #f44336;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    box-shadow: 0 8px 24px rgba(244, 67, 54, 0.2);
}

.results-message {
    font-size: 24px;
    margin-bottom: 40px;
    color: #2c3e50;
    font-weight: 500;
}

/* Results Details */
.results-details {
    text-align: left;
    max-width: 600px;
    margin: 0 auto 30px;
    padding: 30px;
    background: linear-gradient(135deg, #f8fbfd 0%, #e6f3f9 100%);
    border-radius: 12px;
    border: 1px solid #d1e9f3;
    box-shadow: 0 4px 12px rgba(0, 105, 143, 0.1);
}

.results-details h3 {
    margin-bottom: 20px;
    color: var(--aus-green);
    font-size: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-details h3::before {
    content: '📊';
    font-size: 24px;
}

.results-details ul {
    list-style: none;
    padding: 0;
}

.results-details li {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--aus-green);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    font-size: 17px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-details li span:last-child {
    font-weight: 600;
    color: var(--aus-green);
}

/* Detailed Results */
.detailed-results {
    margin-top: 40px;
    max-height: 600px;
    overflow-y: auto;
    padding: 30px;
    background: #f8fbfd;
    border-radius: 12px;
    border: 1px solid #e0e7ed;
}

.detailed-results::-webkit-scrollbar {
    width: 8px;
}

.detailed-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.detailed-results::-webkit-scrollbar-thumb {
    background: var(--aus-green);
    border-radius: 4px;
}

.result-item {
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border-left: 5px solid #ddd;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.result-item.correct {
    border-left-color: #4caf50;
}

.result-item.incorrect {
    border-left-color: #f44336;
}

.result-item h4 {
    margin-bottom: 16px;
    color: #1a1a2e;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-item p {
    margin-bottom: 12px;
    line-height: 1.7;
    color: #4a5f7a;
}

.result-item strong {
    color: var(--aus-green);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .quiz-container {
        padding: 0 16px;
    }
    
    .question-text {
        font-size: 20px;
    }
    
    .translation-text {
        font-size: 18px;
        padding: 16px;
    }
    
    .option {
        font-size: 16px;
        padding: 16px 20px;
    }
    
    .option:hover {
        transform: translateX(4px);
    }
    
    .nav-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    .score {
        font-size: 56px;
    }
    
    .quiz-header {
        padding: 16px;
    }
    
    .quiz-info {
        flex-direction: column;
        gap: 16px;
    }
    
    .timer {
        padding: 10px 20px;
        font-size: 24px;
    }
    
    .quiz-navigation {
        padding: 16px;
        gap: 12px;
    }
}

/* RTL Text Direction Fixes for Arabic and other RTL languages */
/* Add this to the end of your quiz-enhanced.css file */

/* Force English content to always display LTR */
[dir="rtl"] .question-text,
[dir="rtl"] .option,
[dir="rtl"] .explanation p,
[dir="rtl"] .timer,
[dir="rtl"] .question-number,
[dir="rtl"] .nav-button,
[dir="rtl"] .results-message,
[dir="rtl"] .results-details {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: embed !important;
}

/* Keep Arabic translations RTL */
[dir="rtl"] .translation-text,
[dir="rtl"] .option-translation,
[dir="rtl"] .translated-explanation {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: embed !important;
}

/* Fix for mixed content containers */
[dir="rtl"] .question-card,
[dir="rtl"] .options,
[dir="rtl"] .explanation {
    direction: ltr;
}

/* Ensure proper text flow for English content in RTL context */
[dir="rtl"] .question-text * {
    direction: ltr;
    unicode-bidi: embed;
}

[dir="rtl"] .option * {
    direction: ltr;
    unicode-bidi: embed;
}

/* Special handling for punctuation and mixed content */
[dir="rtl"] .question-text,
[dir="rtl"] .option {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix navigation buttons text alignment */
[dir="rtl"] .nav-button {
    text-align: center !important;
}

/* Fix results display */
[dir="rtl"] .score {
    direction: ltr !important;
}

/* Ensure proper display of English words with Arabic context */
[dir="rtl"] .clickable-word {
    direction: ltr;
    unicode-bidi: embed;
    display: inline;
}

/* Fix for headers and navigation in RTL */
[dir="rtl"] .quiz-header,
[dir="rtl"] .quiz-info {
    text-align: left;
}

/* Override any inherited RTL styles for English content */
[dir="rtl"] .question-text::before,
[dir="rtl"] .option::before {
    direction: ltr;
}

/* Specific fix for question text containing English */
[dir="rtl"] #questionText {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate !important;
}

[dir="rtl"] .option[data-index] {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: isolate !important;
}

/* Mobile responsive fixes for RTL */
@media (max-width: 768px) {
    [dir="rtl"] .question-text,
    [dir="rtl"] .option {
        text-align: left !important;
        direction: ltr !important;
    }
    
    [dir="rtl"] .translation-text,
    [dir="rtl"] .option-translation {
        text-align: right !important;
        direction: rtl !important;
    }
}