/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

/* الشاشات */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

/* ====== شاشة البداية ====== */
.header-section {
    text-align: center;
    margin-bottom: 40px;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-section h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
}

/* بطاقات المعلومات */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.info-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.info-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.info-icon {
    font-size: 2.5rem;
}

.info-content {
    flex: 1;
}

.info-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #2c3e50;
}

/* صندوق التعليمات */
.instructions-box {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.instructions-box h2 {
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 20px;
}

.instructions {
    list-style: none;
    margin-bottom: 30px;
}

.instructions li {
    padding: 12px 0;
    padding-right: 30px;
    position: relative;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #555;
    border-bottom: 1px solid #f0f0f0;
}

.instructions li:last-child {
    border-bottom: none;
}

.instructions li:before {
    content: "•";
    position: absolute;
    right: 10px;
    color: #3498db;
    font-size: 1.5rem;
}

/* الأزرار */
.btn-start {
    width: 100%;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    font-size: 1.3rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    font-weight: bold;
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-start:active {
    transform: translateY(0);
}

/* ====== شاشة الاختبار ====== */
.exam-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.exam-header h1 {
    font-size: 1.5rem;
    color: #2c3e50;
}

.exam-status {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-size: 0.95rem;
    color: #7f8c8d;
}

.status-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2c3e50;
}

.timer {
    color: #27ae60 !important;
    font-size: 1.3rem !important;
}

/* شريط التقدم */
.progress-container {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.progress-bar {
    background: #ecf0f1;
    height: 12px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
    transition: width 0.3s ease;
    width: 0%;
    border-radius: 10px;
}

.progress-label {
    text-align: center;
    font-size: 1rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* بطاقة السؤال */
.question-container {
    margin-bottom: 20px;
}

.question-card {
    background: white;
    padding: 35px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.question-number {
    font-size: 1rem;
    color: #3498db;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.question-text {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-bottom: 25px;
    line-height: 1.7;
    font-weight: 500;
}

/* خيارات الإجابة */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.option-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 18px 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-item:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.option-item.selected {
    background: #ebf5fb;
    border-color: #3498db;
    border-width: 3px;
}

.option-item input[type="radio"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #3498db;
}

.option-text {
    flex: 1;
    font-size: 1.1rem;
    color: #2c3e50;
}

.option-item.selected .option-text {
    font-weight: 600;
    color: #3498db;
}

/* أزرار التنقل */
.navigation-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-nav {
    background: white;
    color: #3498db;
    border: 2px solid #3498db;
    padding: 14px 30px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-nav:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-nav:disabled:hover {
    background: white;
    color: #3498db;
    transform: none;
}

.btn-next {
    background: #3498db;
    color: white;
}

.btn-next:hover {
    background: #2980b9;
}

.btn-submit {
    background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
    font-weight: bold;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}

/* ====== شاشة النتائج ====== */
.result-container {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.result-container h1 {
    font-size: 2rem;
    color: #2c3e50;
    margin-bottom: 30px;
}

/* عرض الدرجة */
.score-display {
    margin: 40px 0;
}

.score-percentage {
    font-size: 5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #3498db 0%, #2ecc71 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.score-label {
    font-size: 1.3rem;
    color: #7f8c8d;
}

/* بطاقات النتائج */
.result-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.result-card {
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.result-card.correct {
    background: linear-gradient(135deg, #d5f4e6 0%, #c3f0d8 100%);
}

.result-card.incorrect {
    background: linear-gradient(135deg, #fadbd8 0%, #f8ccc8 100%);
}

.result-card.unanswered {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe8a1 100%);
}

.result-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.result-label {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
}

.result-value {
    font-size: 2.5rem;
    font-weight: bold;
}

.result-card.correct .result-value {
    color: #27ae60;
}

.result-card.incorrect .result-value {
    color: #e74c3c;
}

.result-card.unanswered .result-value {
    color: #f39c12;
}

/* رسالة النتيجة */
.result-message {
    font-size: 1.4rem;
    padding: 25px;
    border-radius: 10px;
    background: #ebf5fb;
    color: #2c3e50;
    font-weight: 600;
    margin: 30px 0;
}

/* أزرار النتائج */
.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-review {
    background: #3498db;
    color: white;
    border: none;
    padding: 16px 35px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    font-weight: 600;
}

.btn-review:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-restart {
    background: white;
    color: #3498db;
    border: 2px solid #3498db;
    padding: 16px 35px;
    font-size: 1.1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.btn-restart:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* ====== شاشة المراجعة ====== */
.review-header {
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.review-header h1 {
    font-size: 1.8rem;
    color: #2c3e50;
}

.btn-back {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-back:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

#review-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.review-question {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.review-question.correct {
    border-right: 5px solid #27ae60;
}

.review-question.incorrect {
    border-right: 5px solid #e74c3c;
}

.review-question.unanswered {
    border-right: 5px solid #f39c12;
}

.review-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.review-question-number {
    font-weight: bold;
    color: #2c3e50;
}

.review-status {
    font-weight: bold;
}

.review-status.correct {
    color: #27ae60;
}

.review-status.incorrect {
    color: #e74c3c;
}

.review-status.unanswered {
    color: #f39c12;
}

.review-question-text {
    font-size: 1.15rem;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.6;
}

.review-option {
    padding: 12px 15px;
    margin: 8px 0;
    border-radius: 8px;
    background: #f8f9fa;
}

.review-option.user-answer {
    background: #fadbd8;
    border: 2px solid #e74c3c;
}

.review-option.correct-answer {
    background: #d5f4e6;
    border: 2px solid #27ae60;
    font-weight: 600;
}

.review-option.both {
    background: #d5f4e6;
    border: 2px solid #27ae60;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .header-section h1 {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .info-cards {
        grid-template-columns: 1fr;
    }

    .exam-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .exam-status {
        width: 100%;
        justify-content: space-between;
    }

    .question-card {
        padding: 25px 20px;
    }

    .question-text {
        font-size: 1.1rem;
    }

    .navigation-buttons {
        flex-direction: column;
    }

    .btn-nav,
    .btn-submit {
        width: 100%;
    }

    .score-percentage {
        font-size: 3.5rem;
    }

    .result-cards {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-review,
    .btn-restart {
        width: 100%;
    }
}

/* طباعة */
@media print {
    body {
        background: white;
    }

    .navigation-buttons,
    .exam-header,
    .result-actions {
        display: none;
    }
}
