/* إعدادات المتغيرات والألوان */
:root {
    --main-color: #f5d908;
    --dark-bg: #323330;
    --text-color: #333;
    --code-bg: #282c34;
    --code-text: #9ba3b3;
    --code-textt: #5e5b4e;
}

/* تقوية الخط وجعله عريضاً وواضحاً */
.comp-card p,
.comp-card h3,
.comp-card code {
    font-weight: 700 !important;
    /* لجعل الخط عريضاً جداً */
    color: #817676 !important;
    /* للتأكد أن اللون أبيض ناصع وليس رمادي */
    letter-spacing: 0.5px;
    /* مسافة بسيطة بين الحروف لزيادة الوضوح */
}
* {
    box-sizing: border-box;
}



h1 {
    color: var(--dark-bg);
    border-bottom: 4px solid var(--main-color);
    display: inline-block;
    padding-bottom: 10px;
}

h2 {
    color: #2c3e50;

    margin-top: 30px;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    border-right: 5px solid var(--main-color);
}

p {
    font-size: 1.1em;
    margin-bottom: 15px;
}

.note {
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    padding: 15px;
    border-radius: 5px;
    color: #856404;
    margin: 20px 0;
}

pre {
    background-color: var(--code-bg);
    color: var(--code-text);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    font-family: 'Courier New', Courier, monospace;
}

code {
    font-family: 'Courier New', Courier, monospace;
}



tr:nth-child(even) {
    background-color: #f2f2f2;
}

.btn-test {
    background-color: var(--dark-bg);
    color: var(--main-color);
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    cursor: pointer;
    border-radius: 5px;
    font-family: 'Cairo', sans-serif;
    font-weight: bold;
    display: block;
    width: 100%;
    margin-top: 30px;
    transition: 0.3s;
}

.btn-test:hover {
    background-color: #000;
    transform: translateY(-2px);
}

.hidden-text {
    text-align: center;
    color: green;
    font-weight: bold;
    margin-top: 10px;
    display: none;
    /* مخفي افتراضياً */
}


/* ألوان الأزرار التفاعلية */
.btn-test.secondary {
    background-color: #3b82f6;
    color: white;
}

.btn-test.danger {
    background-color: #ef4444;
    color: white;
}

.btn-test.warning {
    background-color: #f97316;
    color: white;
}

/* تنسيق الجدول ليصبح في المنتصف */
table {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    border-collapse: collapse;
    background-color: #1e293b;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}


th {
    background: #0f172a;
    color: #facc15;
    padding: 12px;
}

td {
    padding: 12px;
    border: 1px solid #334155;
    text-align: center;
    color: #5b5e63;
}

/* لضمان توسيط النصوص داخل الخلايا أيضاً */
th,
td {
    text-align: center;
    padding: 15px;
    border: 1px solid #334155;
}

/* جعل الحاوية مرنة لتناسب أحجام الشاشات */
.container,
.lesson-card {
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    padding: 15px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}




/* --- تنسيقات الدرس الثالث --- */

/* الشبكة التفاعلية للأخطاء */
.interactive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.card-item {
    background: #0f172a;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #334155;
    text-align: center;
    transition: 0.3s;
}

.card-item:hover {
    border-color: #facc15;
    transform: translateY(-5px);
}

/* تنسيقات الجدول الفاخر */
.luxury-table {
    width: 100%;
    margin: 20px 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #1e293b;
}

.luxury-table th {
    background: #0f172a;
    color: #facc15;
    padding: 15px;
}

.luxury-table td {
    padding: 15px;
    border-bottom: 1px solid #334155;
    text-align: center;
    color: #cbd5e1;
}

/* Badges لأنواع البيانات */
.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.badge.string {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

/* أخضر */
.badge.number {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

/* أزرق */
.badge.boolean {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
}

/* برتقالي */

/* مقارنة المتغيرات */
.comparison-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.comp-card {
    flex: 1;
    background: #1e293b;
    padding: 20px;
    border-radius: 10px;
    border-top: 5px solid;
    min-width: 200px;
}

.comp-card.gold {
    border-color: #facc15;
}

.comp-card.blue {
    border-color: #3b82f6;
}

.comp-card.red {
    border-color: #ef4444;
    opacity: 0.7;
}

/* جعلنا var باهت قليلاً */

/* صندوق الكونسول المحاكي */
.console-box {
    background: #000;
    color: #4ade80;
    /* أخضر مثل الهاكرز */
    font-family: 'Courier New', monospace;
    padding: 20px;
    margin-top: 20px;
    border-radius: 5px;
    white-space: pre-line;
    /* يحافظ على الأسطر الجديدة */
    text-align: left;
    direction: ltr;
}

/* مجموعة الأزرار */
.btn-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 15px;
}



/* التصميم الفخم للدرس الرابع */
.luxury-design {
    background-color: #ffffff;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.bold-text {
    font-weight: 800 !important;
    /* عريض جداً */
    color: #1a202c;
    line-height: 1.7;
}

.main-title {
    font-size: 2.2rem;
    text-align: center;
    color: #111;
    border-bottom: 4px solid #facc15;
    padding-bottom: 15px;
}

.section-head {
    color: #2d3748;
    border-right: 5px solid #3b82f6;
    padding-right: 15px;
    margin: 25px 0 15px 0;
}

.decision-box {
    background: #f7fafc;
    border: 2px dashed #cbd5e0;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.example-box,
.code-wrapper {
    background: #2d3748;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.example-box code,
.code-wrapper code {
    color: #facc15 !important;
    font-weight: 900 !important;
    direction: ltr;
    display: block;
}

.highlight {
    color: #3b82f6;
    font-size: 1.1rem;
}

.red-alert {
    color: #e53e3e;
}

.btn-test {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.3s;
}

.btn-test.success {
    background: #48bb78;
    color: white;
}

.btn-test.secondary {
    background: #4a5568;
    color: white;
}

.btn-test.primary {
    background: #facc15;
    color: #000;
}

.btn-test.warning {
    background: #ed8936;
    color: white;
}

.golden-summary {
    background: linear-gradient(135deg, #fefce8 0%, #fef9c3 100%);
    border: 2px solid #facc15;
    padding: 25px;
    border-radius: 12px;
    margin-top: 40px;
    text-align: center;
}




/*  تحدي الif   */
.challenge-card {
    border: 3px solid #facc15 !important;
    background: #1a202c !important;
    padding: 25px;
    margin-top: 30px;
    position: relative;
    overflow: hidden;
}

.challenge-card::before {
    content: "CHALLENGE";
    position: absolute;
    top: 10px;
    right: -30px;
    background: #facc15;
    color: #000;
    padding: 5px 40px;
    transform: rotate(45deg);
    font-weight: 900;
    font-size: 0.8rem;
}

.explanation-persistent {
    margin-top: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-right: 5px solid #f44336;
    /* لون أحمر للتنبيه */
    border-radius: 8px;
    color: #fff;
    line-height: 1.8;
    animation: fadeIn 0.5s ease-in;
    /* حركة ظهور ناعمة */
}

.error-header {
    color: #f44336;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.correct-answer {
    color: #4caf50;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}




/* تنسيق العناوين داخل البطاقة */
.challenge-card h2 {
    color: #ffcc00 !important;
    /* أصفر ذهبي */
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.challenge-card li {
    color: #ffffff !important;
    /* لون أبيض صريح للظهور */
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.6;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    direction: rtl;
}

.challenge-card li strong {
    color: #ffcc00 !important;
    /* تمييز الكلمات المفتاحية بالأصفر */
    margin: 0 5px;
}


/* --- تنسيق الشرح الذي يظهر تحت الزرار --- */
.persistent-explain {
    background: rgba(255, 204, 0, 0.1);
    border-right: 4px solid #ffcc00;
    padding: 15px;
    margin-top: 15px;
    color: #e2e8f0;
    line-height: 1.6;
    border-radius: 4px;
    display: none;
    /* يظهر بالـ JS فقط */
}


/* خلفية النافذة (تغطي الشاشة بالكامل) */
.modal-overlay {
    display: none;
    /* مخفية افتراضياً */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    /* تعتيم الخلفية */
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

/* صندوق النافذة */
.modal-content {
    background: #1e293b;
    /* لون داكن متناسق مع تصميمك */
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #facc15;
    /* إطار ذهبي */
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

/* حقل الإدخال */
#modalInput {
    width: 100%;
    padding: 12px;
    margin: 20px 0;
    border-radius: 8px;
    border: 2px solid #334155;
    background: #0f172a;
    color: white;
    text-align: center;
    font-size: 1.2rem;
}

#modalInput:focus {
    border-color: #facc15;
    outline: none;
}

@keyframes fadeIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}


/* تعديل العناوين لتصغر في الموبايل */
@media (max-width: 600px) {
    .lesson-card h1 {
        font-size: 1.5rem;
        /* تصغير العنوان الرئيسي */
    }

    .lesson-card h2 {
        font-size: 1.2rem;
        /* تصغير العناوين الجانبية */
    }

    .header h1 {
        font-size: 2rem;
    }
}



/* جعل الأكواد (Code Blocks) متجاوبة */
pre {
    max-width: 100%;
    overflow-x: auto;
    /* شريط تمرير للكود الطويل */
    word-wrap: normal;
    white-space: pre;
}

/* تعديل أزرار التنبيهات ونظام التنبيهات للموبايل */
@media (max-width: 480px) {
    #notification-container {
        width: 90%;
        right: 5%;
        /* توسيط التنبيه في الموبايل */
        top: 10px;
    }

    .notification {
        min-width: auto;
        width: 100%;
    }
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Challenge Card */
.challenge-card {
    background: #1e293b;
    border: 2px solid #facc15;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    text-align: center;
}

/* العنوان */
.challenge-card h2 {
    font-size: 28px;
    margin-bottom: 15px;
}

/* النص */
.challenge-card p {
    color: #e5e7eb;
    line-height: 1.8;
    font-size: 16px;
}

/* عنوان for */
.challenge-card strong {
    color: #facc15;
}

/* break */
.challenge-card .break {
    color: #f87171;
    font-weight: bold;
}

/* continue */
.challenge-card .continue {
    color: #60a5fa;
    font-weight: bold;
}

/* تحذير */
.challenge-card .warning {
    color: #facc15;
    font-weight: bold;
}