:root {
    --primary: #2563eb;       
    --dark: #0f172a;          
    --light: #f1f5f9;         
    --accent: #f59e0b;        
    --text-gray: #475569;
    --white: #ffffff;
}
/* الألوان الافتراضية (وضع النهار) */


/* ألوان الوضع المظلم (Dark Mode) */
body.dark-mode {
    --dark: #f1f5f9;          /* النصوص تصبح فاتحة */
    --light: #1e293b;         /* الخلفيات الفاتحة تصبح غامقة */
    --white: #0f172a;         /* الخلفية البيضاء تصبح كحلي غامق */
    --text-gray: #cbd5e1;     /* النصوص الرمادية تفتح */
    --header-bg: #1e293b;     /* الهيدر يصبح غامق */
}

/* تحديث لون الهيدر ليأخذ من المتغير */
.header-container {
    background-color: var(--header-bg); 
    /* باقي الخصائص كما هي... */
}
/* 1. داخل :root (وضع النهار) */
:root {
    /* ... المتغيرات القديمة ... */
    --header-bg-strip: rgba(255, 255, 255, 0.95); /* لون أبيض شفاف */
}

/* 2. داخل body.dark-mode (وضع الظلام) */
body.dark-mode {
    /* ... المتغيرات القديمة ... */
    --header-bg-strip: rgba(15, 23, 42, 0.95); /* لون كحلي غامق شفاف */
}

/* تنسيق أزرار التحكم الجديدة */
.controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 0 15px; /* مسافة بين اللوجو والروابط */
}

.lang-btn {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--dark);
    border: 2px solid var(--dark);
    padding: 2px 8px;
    border-radius: 5px;
    transition: 0.3s;
}

.lang-btn:hover {
    background: var(--dark);
    color: var(--white);
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--dark);
    transition: 0.3s;
}

.theme-btn:hover {
    color: var(--primary);
    transform: rotate(20deg);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--white);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

img { max-width: 100%; height: auto; }

.btn {
    padding: 12px 30px;
    border-radius: 6px;
    font-weight: 700;
    display: inline-block;
    cursor: pointer;
}

.btn.primary { background: var(--primary); color: var(--white); }
.btn.primary:hover { background: #1d4ed8; }
.btn.outline { border: 2px solid var(--primary); color: var(--primary); margin-right: 10px; }
.btn.outline:hover { background: var(--primary); color: var(--white); }

/* --- Header & Navigation --- */
header {
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    /* التعديل هنا: استخدام المتغير الجديد */
    background-color: var(--header-bg-strip); 
    backdrop-filter: blur(5px);
}
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

.logo { font-size: 1.8rem; font-weight: 900; color: var(--dark); }
.logo span { color: var(--primary); }

.nav-links { display: flex; gap: 2rem; }
.nav-links a { font-weight: 700; color: var(--dark); } /* جعلت اللون أغمق للوضوح */
.nav-links a:hover { color: var(--primary); }

/* زر القائمة (مخفي في الديسك توب) */
.menu-toggle {
    display: none;
    cursor: pointer;
}

.bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    transition: all 0.3s ease-in-out;
    background-color: var(--dark);
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    /* التعديل هنا: استخدام المتغيرات بدلاً من الألوان الثابتة */
    background: linear-gradient(to left, var(--light), var(--white));
    padding-top: 120px;
    padding-bottom: 50px;
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap-reverse;
}

.hero-text { flex: 1; min-width: 300px; padding: 20px; }
.hero-text .badge {
    background: #dbeafe;
    color: var(--primary);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
}

.hero-text h1 { font-size: 3rem; margin: 15px 0 5px; line-height: 1.2; }
.hero-text h2 { font-size: 1.2rem; color: var(--text-gray); margin-bottom: 20px; }
.hero-text p { color: var(--text-gray); margin-bottom: 30px; max-width: 500px; }

.social-links { margin-top: 30px; display: flex; gap: 15px; }
.social-links a {
    color: var(--text-gray);
    font-weight: 600;
    border-bottom: 2px solid transparent;
}
.social-links a:hover { color: var(--primary); border-color: var(--primary); }

.hero-img { flex: 1; display: flex; justify-content: center; min-width: 300px; margin-bottom: 30px; }
.img-border {
    width: 100%; max-width: 400px; height: auto; aspect-ratio: 1/1;
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    overflow: hidden; border: 5px solid var(--white);
    box-shadow: 10px 40px 80px rgba(0, 81, 255, 0.432);
    background: var(--light);
}
.img-border img { width: 100%; height: 130%; object-fit: cover; }

/* --- General Sections --- */
section { padding: 60px 0; }
.section-title { text-align: center; margin-bottom: 50px; }
.section-title h2 { font-size: 2.5rem; color: var(--dark); position: relative; display: inline-block; }
.section-title h2::after {
    content: ''; width: 50px; height: 4px; background: var(--primary);
    position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
}

/* About Section */
.about-grid { display: flex; gap: 50px; align-items: center; flex-wrap: wrap; justify-content: center; }
.about-img-real { flex: 1;  min-width: 280px; max-width: 350px; display: flex; justify-content: center; }
.about-img-real img { width: 100%;  border-radius: 10px; box-shadow: 15px 15px 0 var(--primary); object-fit: cover; }
.about-img-real:hover { transform: translateY(-10px); transition: 0.3s; }
.about-info { flex: 1; min-width: 300px; }
.philosophy-list { margin: 20px 0; }
.philosophy-list li { margin-bottom: 10px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.philosophy-list i { color: var(--accent); }

/* Services */
.services { background: var(--light); }
.services-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.service-card {
    background: var(--white); padding: 30px; border-radius: 10px;
    text-align: center; transition: 0.3s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.service-card:hover { transform: translateY(-10px); }
.service-card i { font-size: 2.5rem; color: var(--primary); margin-bottom: 20px; }

/* Timeline */
.timeline { position: relative; max-width: 800px; margin: 0 auto; }
.timeline::after { content: ''; position: absolute; width: 4px; background: var(--primary); top: 0; bottom: 0; right: 50%; margin-right: -2px; }
.timeline-item { padding: 10px 40px; position: relative; width: 50%; box-sizing: border-box; }
.timeline-item:nth-child(odd) { right: 0; }
.timeline-item:nth-child(even) { right: 50%; text-align: left; }
.timeline-item::after {
    content: ''; position: absolute; width: 20px; height: 20px;
    right: -10px; background: var(--white); border: 4px solid var(--accent);
    top: 15px; border-radius: 50%; z-index: 1;
}
.timeline-item:nth-child(even)::after { right: -10px; left: auto; }
[dir="rtl"] .timeline::after { right: 50%; }
[dir="rtl"] .timeline-item:nth-child(odd) { right: 0; text-align: right; }
[dir="rtl"] .timeline-item:nth-child(odd)::after { right: -12px; }
[dir="rtl"] .timeline-item:nth-child(even) { right: 50%; text-align: left; }
[dir="rtl"] .timeline-item:nth-child(even)::after { right: auto; left: -8px; }
.timeline-content { padding: 20px; background: var(--white); border-radius: 6px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.timeline-content .company { display: block; font-size: 0.9rem; color: var(--primary); font-weight: bold; margin-bottom: 10px; }

/* Portfolio */
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.project-card { 
    background: var(--dark); 
    color: var(--white); 
    border-radius: 15px; 
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.project-image {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: var(--light);
}
.project-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.project-card:hover .project-cover-img {
    transform: scale(1.05);
}
.project-content {
    padding: 30px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.project-card h3 { color: var(--accent); margin-bottom: 10px; }
.project-link { display: inline-block; margin-top: 15px; color: var(--white); text-decoration: underline; }

/* Contact & Footer */
.contact { background: var(--primary); color: var(--white); text-align: center; }
.contact-details { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; margin-bottom: 40px; }
.contact-details .detail { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.freelance-platforms a { display: inline-block; background: rgba(255,255,255,0.2); padding: 10px 20px; border-radius: 30px; margin: 5px; color: var(--white); }
footer { 
    
    background: #0b1120; color: #64748b; padding: 40px 0; text-align: center;
    }
.quote { 
    font-style: italic; 
    color: #ffffff; /* جعلنا اللون أبيض ثابت بدلاً من المتغير */
    font-size: 1.2rem; 
    margin-bottom: 20px;
    
}
    


/* =========================================
   MEDIA QUERIES (RESPONSIVE)
   ========================================= */
/* =========================================
 تعديلات الريسبونسف (للموبايل والتابلت)
   ========================================= */
@media (max-width: 768px) {
    /* تعديل الهيدر (كما هو سابقاً) */
    .menu-toggle { display: block; }
    .nav-links {
        position: absolute; top: 100%; left: 0; width: 100%;
        background-color: #a7adb4; flex-direction: column;
        align-items: center; padding: 20px 0; gap: 20px;
        display: none; border-radius: 0 0 10px 10px;
        box-shadow: 0 10px 15px rgba(0,0,0,0.1);
    }
    .nav-links.active { display: flex; }
    html[dir="ltr"] .timeline-item,
    html[dir="ltr"] .timeline-item:nth-child(even), /* نستهدف الزوجي تحديداً */
    html[dir="ltr"] .timeline-item:nth-child(odd)   /* نستهدف الفردي تحديداً */
    {
        left: 0 !important;      /* إلغاء الإزاحة لليسار */
        right: 0 !important;     /* إلغاء الإزاحة لليمين */
        width: 100% !important;  /* العرض كامل */
        padding: 0 !important;   /* إلغاء الحشوة */
        text-align: center !important; /* توسيط النص */
        margin-bottom: 20px;
    }
    /* --- إصلاح مشكلة الخط الأزرق (التايم لاين) --- */
    
    /* 1. إخفاء الخط العمودي والدوائر البرتقالية */
    .timeline::after { display: none; }
    .timeline-item::after { display: none; }

    /* 2. ضبط الكروت لتأخذ العرض الكامل وتكون مرتبة */
    .timeline-item { 
        width: 100%; 
        padding: 0; /* إزالة الهوامش الجانبية التي كانت مخصصة للخط */
        margin-bottom: 20px;
        right: 0 !important; 
        text-align: center !important; /* توسيط النص أو جعله يمين حسب رغبتك */
    }

    /* التأكد من اتجاه النص في العربي */
    [dir="rtl"] .timeline-item, 
    [dir="rtl"] .timeline-item:nth-child(even), 
    [dir="rtl"] .timeline-item:nth-child(odd) { 
        text-align: center; /* يفضل التوسيط في الموبايل */
        padding-right: 0;
        padding-left: 0;
    }

    /* تعديلات عامة أخرى */
    .hero-text h1 { font-size: 2rem; }
    .section-title h2 { font-size: 2rem; }
    .about-grid, .hero-content { flex-direction: column-reverse; text-align: center; }
    .hero-content { flex-direction: column-reverse; }
    .philosophy-list li { justify-content: center; }
    .about-img-real img { margin: 0 auto; }
}
/* ========================================= إصلاح التايم لاين للنسخة الإنجليزية (LTR Fix)
   ========================================= */

/* 1. نقل الخط الفاصل للمنتصف بناءً على اليسار */
html[dir="ltr"] .timeline::after {
    left: 50%;
    right: auto;
}

/* 2. إعادة ضبط العناصر لتعتمد على اليسار */
html[dir="ltr"] .timeline-item {
    right: auto; /* إلغاء محاذاة اليمين */
}

/* 3. العناصر الفردية (تكون على اليسار في الإنجليزي) */
html[dir="ltr"] .timeline-item:nth-child(odd) {
    left: 0;
    text-align: right; /* النص يكون محاذاة للخط */
    padding-right: 40px;
    padding-left: 0;
}

/* ضبط مكان الدائرة للعناصر الفردية */
html[dir="ltr"] .timeline-item:nth-child(odd)::after {
    right: -12px; /* الدائرة على يمين الصندوق */
    left: auto;
}

/* 4. العناصر الزوجية (تكون على اليمين في الإنجليزي) */
html[dir="ltr"] .timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
    padding-left: 40px;
    padding-right: 0;
}

/* ضبط مكان الدائرة للعناصر الزوجية */
html[dir="ltr"] .timeline-item:nth-child(even)::after {
    left: -8px; /* الدائرة على يسار الصندوق */
    right: auto;
}

/* 5. إصلاح الموبايل في الإنجليزي */
@media (max-width: 768px) {
    /* 1. ضبط حاوية الهيدر للموبايل */
    .header-container {
        padding: 0.5rem 5px; /* تقليل الحواف الداخلية */
        gap: 1px; /* تقليل المسافة بين العناصر */
        flex-wrap: nowrap; /* منع العناصر من النزول سطر جديد */
    }

    /* 2. تصغير حجم اللوجو قليلاً */
    .logo {
        font-size: 1.2rem; /* تصغير الخط ليناسب الموبايل */
        white-space: nowrap; /* منع التفاف النص */
        margin-right: 10px; /* تقليل المسافة من اليمين */
        
    }

    /* 3. ضبط المسافات بين أزرار التحكم (اللغة والظلام) */
    .controls {
        gap: 8px; /* تقريب الأيقونات من بعضها */
        margin: 0 5px; /* تقليل الهوامش الجانبية */
    }

    /* 4. تصغير زر اللغة */
    .lang-btn {
        padding: 2px 5px;
        font-size: 0.8rem;
    }

    /* 5. ضبط مكان زر القائمة */
    .menu-toggle {
        margin: 0 5px;
    }
    
    /* التأكد أن القائمة المنسدلة لا تغطي الهيدر */
    .nav-links {
        top: 100%; /* تظهر أسفل الهيدر بالضبط */
        margin-top: 10px; /* مسافة بسيطة */
        width: 100%;
        left: 0;
    }
}