/*
=====================================================
تنظيم الستايل العام والخطوط
=====================================================
*/
/* استخدام خط عربي مناسب مع الخطوط الاحتياطية */
/*
تم تحديث هذا السطر لاستيراد خط Merriweather أيضاً
*/
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700&family=Merriweather:wght@400;700&display=swap');

:root {
    --primary-color: #007bff;
    --secondary-color: #28a745;
    --text-color: #333;
    --background-light: #f4f4f9;
    --background-dark: #333;
    --code-bg: #e9ecef;
}

/* تطبيق التدرج اللوني المتحرك على خلفية الصفحة */
body {
    margin: 0;
    /* تم تحديث هذه الخاصية: Merriweather أولاً للغة الإنجليزية (LTR) 
    */
    font-family: 'Merriweather', 'Cairo', sans-serif, Arial; 
    color: var(--text-color);
    background: linear-gradient(45deg, #adf371, #71f3d3, #f39f71, #7178f3, #f371e0);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite; /* وقت الحركة تم تعديله ليكون أطول وأكثر سلاسة */
    text-align: right; /* دعم اللغة العربية */
}

@keyframes gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/*
تم إضافة هذه القاعدة لضمان استخدام Cairo عندما تكون اللغة عربية (RTL)
*/
[dir="rtl"] {
    font-family: 'Cairo', 'Merriweather', sans-serif, Arial;
}


.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/*
=====================================================
ستايل الرأس والقائمة (Header & Nav)
=====================================================
*/
header {
    background: rgba(255, 255, 255, 0.95); /* خلفية بيضاء شفافة قليلاً */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky; /* لجعل الشريط ثابتاً أثناء التمرير */
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    color: var(--primary-color);
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 25px;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    padding: 10px 0;
    transition: color 0.3s, border-bottom 0.3s;
}

nav ul li a:hover {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

#language-select {
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #ccc;
    cursor: pointer;
    margin-right: 15px; /* تباعد عن القائمة في وضع RTL */
}

/*
=====================================================
ستايل الأقسام الرئيسية والمحتوى (Main Sections)
=====================================================
*/
main section {
    padding: 60px 0;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.9); /* خلفية شفافة للمحتوى فوق التدرج اللوني */
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

#home.hero {
    min-height: 70vh;
    display: flex;
    align-items: center;
    text-align: center;
}

#home h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

#home p {
    font-size: 1.2rem;
    color: var(--text-color);
}

.cta-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 15px 30px;
    margin-top: 30px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.3s;
}

.cta-button:hover {
    background-color: #1e7e34;
    transform: translateY(-3px);
}

/*
=====================================================
ستايل الدورات وبطاقات المشاريع (Courses & Cards)
=====================================================
*/
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.project-card, .course {
    background: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    border-right: 5px solid var(--primary-color); /* شريط جانبي للتأثير */
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.course-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.3rem;
    display: block;
    margin-bottom: 10px;
}

.course-link:hover {
    text-decoration: underline;
}

/*
=====================================================
ستايل الكود والأمثلة (Code & Examples)
=====================================================
*/
.course-example, pre {
    background: #282c34; /* خلفية داكنة للكود */
    color: #abb2bf;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    font-family: 'Consolas', 'Courier New', monospace;
    overflow-x: auto;
}

.course-example code, pre code {
    white-space: pre-wrap;
    direction: ltr; /* لضمان عرض الكود بشكل صحيح */
    text-align: left;
    display: block;
}

/*
=====================================================
ستايل صفحة التواصل (Contact Form)
=====================================================
*/
form {
    max-width: 600px;
    margin: 40px auto 0 auto;
    padding: 30px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

form input, form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box;
}

form button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

form button[type="submit"]:hover {
    background-color: #0056b3;
}

.social-media {
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 20px 0;
    list-style: none;
    margin: 20px 0;
}

.social-media li a {
    color: var(--primary-color);
    font-size: 2.5rem;
    transition: color 0.3s, transform 0.3s;
}

.social-media li a:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

/*
=====================================================
ستايل التذييل (Footer)
=====================================================
*/
footer {
    background: var(--background-dark);
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 30px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

footer a {
    color: #71f3d3; /* لون الروابط من التدرج الأصلي */
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover {
    text-decoration: underline;
    color: #adf371;
}


/*
=====================================================
تحسين التجاوب (Media Queries)
=====================================================
*/
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        text-align: center;
    }
    nav {
        margin-top: 15px;
    }
    nav ul {
        gap: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
    #language-select {
        margin-top: 15px;
        margin-right: 0;
    }
    #home h2 {
        font-size: 2rem;
    }
    .courses-grid {
        grid-template-columns: 1fr;
    }
}
