/* 1. الإعدادات العامة والخطوط */
body {
    font-family: 'Cairo', sans-serif !important;
}

h1, h2, h3, .display-5 {
    font-family: 'Sultan Medium', 'Cairo', sans-serif !important;
}


@font-face {
    font-family: 'Sultan Medium';
    src: url('fonts/Sultan Medium Sultan Medium.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* تنسيق عنوان قسم الأخبار */
.container .display-5 {
    font-family: 'Sultan Medium', 'Roboto', sans-serif !important; 
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4), 0 0 10px rgba(255, 255, 255, 0.1);
    color: var(--bs-dark);
    font-weight: 700;
    letter-spacing: 0.5px;
}

/*** Spinner ***/
#spinner {
    opacity: 0;
    visibility: hidden;
    transition: opacity .5s ease-out, visibility 0s linear .5s;
    z-index: 99999;
}
#spinner.show {
    transition: opacity .5s ease-out, visibility 0s linear 0s;
    visibility: visible;
    opacity: 1;
}

.back-to-top {
    position: fixed;
    right: 30px;
    bottom: 30px;
    display: flex;
    width: 45px;
    height: 45px;
    align-items: center;
    justify-content: center;
    transition: 0.5s;
    z-index: 99;
}

/*** Buttons ***/
.btn { font-weight: 600; transition: .5s; }
.btn-square { width: 32px; height: 32px; }
.btn-sm-square { width: 34px; height: 34px; }
.btn-md-square { width: 44px; height: 44px; }
.btn-lg-square { width: 56px; height: 56px; }
.btn-xl-square { width: 66px; height: 66px; }
.btn-square, .btn-sm-square, .btn-md-square, .btn-lg-square, .btn-xl-square {
    padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.btn.btn-primary { background: var(--bs-primary) !important; color: var(--bs-white) !important; border: none; }
.btn.btn-primary:hover { background: var(--bs-dark) !important; }

/*** Topbar & Navbar ***/
.topbar { 
    padding: 2px 10px 2px 20px; 
    background: var(--bs-dark) !important; 
}

.sticky-top, .sticky-top .container { 
    transition: 0.5s !important; 
}

.navbar .navbar-nav .nav-link { 
    color: var(--bs-dark) !important; 
    padding: 20px 15px !important; /* زيادة الحشو ليعطي مساحة للخط السفلي */
    font-weight: 600;
    position: relative;
}

/* تعديل الخط ليظهر تحت الكلمة فقط وبطول متناسق */
.navbar .navbar-nav .nav-item { 
    position: relative; 
    margin: 0 5px !important; 
}

.navbar .navbar-nav .nav-item::after {
    position: absolute; 
    content: ""; 
    width: 0; 
    height: 3px; /* سمك الخط */
    bottom: 5px; /* المسافة من الأسفل */
    left: 50%; /* لبدء الحركة من المنتصف */
    transform: translateX(-50%); /* لضمان التوسط */
    background-color: var(--bs-primary); 
    transition: 0.4s ease; /* سرعة الحركة */
}

/* ظهور الخط عند تمرير الماوس */
.navbar .navbar-nav .nav-item:hover::after { 
    width: 80%; /* طول الخط بالنسبة للكلمة (يمكنك زيادتها لـ 100%) */
}

/* إزالة الخط العلوي القديم نهائياً */
.navbar .navbar-nav .nav-item::before {
    display: none !important;
}

/* تنسيق الرابط النشط (Active) ليظل الخط تحته ثابتاً */
.navbar .navbar-nav .nav-link.active::after {
    position: absolute;
    content: "";
    width: 80%;
    height: 3px;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bs-primary);
}

/* ----------------------------------------------------------- */
/* ** قسم السلايدر الرئيسي (Header Carousel) ** */
/* ----------------------------------------------------------- */

.header-carousel .owl-carousel-item {
    position: relative;
    height: 650px; 
    overflow: hidden;
}

/* تأكد من أن الصور داخل وسوم picture تأخذ كامل العرض */
.header-carousel picture img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* لضمان التغطية الكاملة */
}

@media (max-width: 768px) {
    .header-carousel .owl-carousel-item {
        height: 70vh !important; /* يمكنك تقليل الارتفاع قليلاً لأن الصورة أصبحت طولية */
    }
}

.header-carousel .carousel-caption, .carousel-caption-right {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    z-index: 10;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7)); 
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.header-carousel .carousel-caption { align-items: center; }
.carousel-caption-right { align-items: flex-start; }

.carousel-caption-inner {
    text-align: center;
    max-width: 900px;
}
.carousel-caption-right .carousel-caption-inner {
    text-align: right;
    padding: 0 100px;
}

/* نصوص السلايدر المتجاوبة */
.carousel-caption-inner h1 {
    font-size: clamp(1.5rem, 5vw, 3.5rem) !important;
    line-height: 1.3;
    margin-bottom: 20px;
}
.carousel-caption-inner h4 {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    color: #e2e2e2;
}
.carousel-caption-inner p {
    font-size: clamp(0.85rem, 2vw, 1.1rem) !important;
    max-width: 800px;
    margin: 0 auto 30px auto;
}

/* أنيميشن السلايدر */
.header-carousel .owl-carousel-item .carousel-caption-inner h1,
.header-carousel .owl-carousel-item .carousel-caption-inner h4,
.header-carousel .owl-carousel-item .carousel-caption-inner p,
.header-carousel .owl-carousel-item .carousel-caption-inner .btn {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.5s ease;
}

@keyframes fadeInUpSmooth {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

.header-carousel .owl-item.active .carousel-caption-inner h1,
.header-carousel .owl-item.active .carousel-caption-inner h4,
.header-carousel .owl-item.active .carousel-caption-inner p,
.header-carousel .owl-item.active .carousel-caption-inner .btn {
    animation: fadeInUpSmooth 1s ease-out forwards;
}
.header-carousel .owl-item.active .carousel-caption-inner h1 { animation-delay: 0.3s; }
.header-carousel .owl-item.active .carousel-caption-inner h4 { animation-delay: 0.6s; }
.header-carousel .owl-item.active .carousel-caption-inner p { animation-delay: 0.9s; }
.header-carousel .owl-item.active .carousel-caption-inner .btn { animation-delay: 1.2s; }

/* ----------------------------------------------------------- */
/* ** تعديلات التجاوب مع الهاتف (Mobile Responsive) ** */
/* ----------------------------------------------------------- */

@media (max-width: 768px) {
    .topbar { display: none; }
    
    /* ضبط السلايدر للهاتف */
    .header-carousel .owl-carousel-item {
        height: 80vh !important; /* طول مناسب لشاشة الهاتف */
    }

    .carousel-caption-right, .carousel-caption {
        padding: 20px !important;
        align-items: center !important; /* توسيط النصوص في الجوال أفضل */
    }

    .carousel-caption-right .carousel-caption-inner, .carousel-caption-inner {
        padding: 0 !important;
        text-align: center !important;
        max-width: 100%;
    }

    .carousel-caption-inner h1 { font-size: 1.8rem !important; }
    .carousel-caption-inner p { font-size: 0.95rem !important; padding: 0 10px; }
    
    /* شريط الأيقونات المتحرك */
    .icon-group img { width: 50px; height: 50px; }
}

/* ----------------------------------------------------------- */
/* ** بقية أقسام الموقع والفوتر ** */
/* ----------------------------------------------------------- */

.service .service-item, .project .project-item, .team .team-item {
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.3);
    transition: 0.5s;
}
.service-item:hover, .project-item:hover { transform: translateY(-10px); }

.site-footer {
    background-color: #172A52;
    color: #ffffff;
    padding: 60px 0 20px 0;
    text-align: right;
}

/* شريط الأيقونات المتحرك */
.scrolling-icons-wrapper { background: var(--bs-dark); padding: 30px 0; overflow: hidden; white-space: nowrap; }
.icon-group { display: inline-block; animation: scroll-left 30s linear infinite; }
@keyframes scroll-left { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/*** Swiper News ***/
.newsSwiper { width: 100%; height: 500px; border-radius: 15px; overflow: hidden; }
.news-text-overlay {
    position: absolute; bottom: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 3rem !important; text-align: right;
}

@media (max-width: 768px) {
    .newsSwiper { height: 350px !important; }
    .news-text-overlay h3 { font-size: 1.4rem !important; }
}

/* تنسيق القائمة النقطية RTL */
.carousel-caption-inner .list-rtl-indent {
    text-align: right; padding-right: 0; margin: 20px auto;
}
.carousel-caption-inner .list-rtl-indent li p {
    text-indent: -1.5em; padding-right: 1.5em; color: #fff !important;
}
/* =========================================================== */
/* ** إعادة ضبط قسم مشاريع تابعة للهيئة (Project Section) ** */
/* =========================================================== */

.project .project-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.08); /* ظل خفيف وأنيق */
    transition: 0.5s;
    background: var(--bs-white);
    margin-bottom: 15px;
}

.project .project-item:hover {
    transform: translateY(-10px); /* حركة الرفع عند التحويم */
    box-shadow: 0 0 45px rgba(0, 0, 0, 0.2);
}

.project .project-item .project-img {
    position: relative;
    width: 100%;
    height: 250px; /* ارتفاع موحد لصور المشاريع */
    overflow: hidden;
}

.project .project-item .project-img img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* لضمان عدم تشوه صور المشاريع */
    transition: 0.5s;
}

.project .project-item:hover .project-img img {
    transform: scale(1.1); /* زووم خفيف للصورة عند التحويم */
}

.project .project-item .project-content {
    padding: 25px;
    text-align: center;
    background: var(--bs-light) !important;
    border-top: 3px solid var(--bs-primary); /* خط ملون لتمييز المشروع */
}

.project .project-item .project-content h4 {
    font-family: 'Sultan Medium', sans-serif !important;
    margin-bottom: 10px;
}

/* ضبط استجابة قسم المشاريع في الهاتف */
@media (max-width: 768px) {
    .project .project-item .project-img {
        height: 200px; /* تقليل الارتفاع قليلاً في الجوال */
    }
    
    .project .project-content {
        padding: 15px;
    }
    
    .project .project-content h4 {
        font-size: 1.2rem;
    }
    /* 1. تصفير أي حدود أو خطوط قديمة لمنع التداخل */
.navbar .navbar-nav .nav-item::before, 
.navbar .navbar-nav .nav-item::after,
.navbar .navbar-nav .nav-link::before {
    display: none !important;
    content: none !important;
}

/* 2. توحيد تنسيق جميع روابط المنيو لتبدو مثل "خدماتنا" */
.navbar .navbar-nav .nav-link {
    position: relative !important;
    padding: 15px 20px !important;
    color: #172A52 !important; /* لون كحلي رسمي */
    font-weight: 600 !important;
    transition: 0.3s ease !important;
}

/* 3. إضافة الخط السفلي لجميع العناصر (بما فيها الرئيسية ومن نحن) */
.navbar .navbar-nav .nav-link::after {
    content: "" !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 50% !important; /* يبدأ من المنتصف */
    width: 0 !important;    /* يبدأ بعرض صفر لعمل الأنيميشن */
    height: 3px !important;
    background-color: #2b9ec3 !important; /* لون البوابة الإلكترونية */
    transform: translateX(-50%) !important;
    transition: width 0.4s ease-in-out !important; /* هذا هو "الافيكت" الحركي */
    display: block !important;
}

/* 4. تفعيل الحركة عند مرور الماوس (Hover) لجميع الروابط */
.navbar .navbar-nav .nav-link:hover::after {
    width: 80% !important; /* يتمدد الخط بنعومة */
}

/* 5. الرابط النشط (مثل الرئيسية حالياً) يظل خطه ظاهراً وثابتاً */
.navbar .navbar-nav .nav-link.active::after {
    width: 80% !important;
    background-color: #172A52 !important; /* لون داكن للتمييز */
}

/* 6. استثناء خاص لمنع تكرار الخط في "خدماتنا" إذا كانت Dropdown */
.nav-item.dropdown:hover > .nav-link::after {
    width: 80% !important;
}
}