/* ===================================
   THEME: PRESTIGE (v1.1 - Corrected & Enhanced)
   - Fixed Mobile Menu Scroll
   - Added Close Button & Overlay
   - Unified & Organized Styles
   =================================== */

/* --- 1. متغيرات وأساسيات الثيم --- */
:root {
    --prestige-primary: #0d47a1; /* أزرق داكن */
    --prestige-secondary: #ffc107; /* أصفر ذهبي */
    --prestige-dark: #1a237e; /* كحلي */
    --prestige-light: #e3f2fd; /* أزرق فاتح جداً */
    --prestige-text: #555;
    --prestige-heading: #222;
}

body.theme-prestige {
    font-family: 'Cairo', sans-serif;
    color: var(--prestige-text);
    background-color: #f8f9fa;
}

.theme-prestige .container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- 2. الشريط العلوي --- */
.top-bar {
    background-color: var(--prestige-dark);
    color: #fff;
    padding: 8px 0;
    font-size: 13px;
}
.top-bar .container { display: flex; justify-content: space-between; align-items: center; }
.top-bar a { color: #fff; margin: 0 10px; text-decoration: none; transition: color 0.3s; }
.top-bar a:hover { color: var(--prestige-secondary); }

/* --- 3. الهيدر الرئيسي --- */
.main-header { background-color: #fff; padding: 15px 0; }
.main-header .container { display: flex; justify-content: space-between; align-items: center; }

/* Logo with Text */
.logo a {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
}
.logo img {
    max-height: 60px;
    flex-shrink: 0;
}
.logo-text {
    display: flex;
    flex-direction: column;
}
.logo-text span {
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1.2;
    text-transform: uppercase;
    color: var(--prestige-heading);
}
.logo-text span:last-child {
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--prestige-text);
}

.header-info-blocks { display: flex; gap: 25px; }
.info-block { display: flex; align-items: center; gap: 10px; }
.info-block i { font-size: 28px; color: var(--prestige-primary); }
.info-block span { font-size: 13px; color: #777; }
.info-block strong { font-size: 15px; color: var(--prestige-heading); }
.btn-apply-now { background-color: var(--prestige-secondary); color: #000; padding: 12px 25px; font-weight: bold; border-radius: 5px; text-decoration: none; transition: all 0.3s; }
.btn-apply-now:hover { background-color: var(--prestige-primary); color: #fff; }

/* --- 4. شريط القوائم --- */
.main-navbar { background-color: var(--prestige-primary); box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.main-navbar .container { display: flex; justify-content: space-between; align-items: center; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; }
.nav-links > li > a { color: #fff; padding: 15px 20px; text-decoration: none; font-weight: 500; display: block; transition: background-color 0.3s; }
.nav-links > li > a:hover, .nav-links > li > a.active { background-color: var(--prestige-dark); }
.has-dropdown { position: relative; }
.sub-menu { display: none; position: absolute; top: 100%; left: 0; background-color: #fff; list-style: none; padding: 0; margin: 0; box-shadow: 0 5px 15px rgba(0,0,0,0.1); min-width: 220px; z-index: 100; }
.has-dropdown:hover .sub-menu { display: block; }
.sub-menu li a { color: var(--prestige-heading); padding: 12px 20px; display: block; text-decoration: none; }
.sub-menu li a:hover { background-color: var(--prestige-light); }
.nav-search { display: flex; }
.nav-search input { border: 1px solid #fff; background: transparent; color: #fff; padding: 8px; border-radius: 5px 0 0 5px; }
.nav-search input::placeholder { color: #eee; }
.nav-search button { background: var(--prestige-secondary); border: none; color: #000; padding: 8px 12px; border-radius: 0 5px 5px 0; cursor: pointer; }

/* --- 5. السلايدر الرئيسي --- */
.hero-slider { width: 100%; height: 500px; }
.hero-slider .swiper-slide { background-size: cover; background-position: center; }
.hero-slider .slide-content { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; text-align: center; background: rgba(0,0,0,0.4); padding: 20px; border-radius: 10px; }
.hero-slider h1 { font-size: 48px; color: #fff; text-shadow: 2px 2px 8px rgba(0,0,0,0.7); }
.hero-slider p { font-size: 20px; color: #fff; }

/* --- 6. قسم أيقونات الوصول السريع --- */
.prestige-quick-links {
    background-color: #fff;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.05);
    position: relative;
    z-index: 5;
    margin-top: -50px;
    border-radius: 10px;
}
.prestige-quick-links .container { display: grid; grid-template-columns: repeat(4, 1fr); }
.quick-link-item { padding: 25px 15px; text-align: center; text-decoration: none; color: var(--prestige-heading); border-left: 1px solid #eee; transition: all 0.3s ease; }
.quick-link-item:first-child { border-left: none; }
.quick-link-item:hover { background-color: var(--prestige-primary); color: #fff; }
.quick-link-item i { font-size: 32px; margin-bottom: 10px; display: block; color: var(--prestige-primary); transition: color 0.3s ease; }
.quick-link-item:hover i { color: #fff; }
.quick-link-item span { font-weight: bold; }

/* --- 7. قسم كلمة العميد والرؤية --- */
.prestige-welcome-section { padding: 60px 0; background-color: #fff; }
.welcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.welcome-block { text-align: center; }
.welcome-block .icon-box { width: 70px; height: 70px; background-color: var(--prestige-light); color: var(--prestige-primary); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 20px; }
.welcome-block h3 { font-size: 22px; margin-bottom: 15px; }
.welcome-block p { color: var(--prestige-text); line-height: 1.7; }
.read-more-link { color: var(--prestige-primary); font-weight: bold; text-decoration: none; }
.read-more-link:hover { text-decoration: underline; }

/* --- 8. قسم آخر الأخبار --- */
.prestige-latest-news { padding: 60px 0; }
.section-title { text-align: center; margin-bottom: 40px; }
.section-title h2 { font-size: 32px; color: var(--prestige-heading); }
.section-title p { color: var(--prestige-text); }
.news-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.news-card { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 5px 15px rgba(0,0,0,0.05); transition: all 0.3s ease; }
.news-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.news-card-image img { width: 100%; height: 200px; object-fit: cover; }
.news-card-content { padding: 20px; }
.news-date { font-size: 12px; color: #999; margin-bottom: 10px; display: block; }
.news-card-content h4 { font-size: 18px; margin: 0 0 10px 0; }
.news-card-content h4 a { color: var(--prestige-heading); text-decoration: none; }
.news-card-content p { margin: 0; font-size: 14px; }

/* --- 9. قسم الشركاء --- */
.prestige-partners { padding: 60px 0; background-color: #fff; }
.partners-slider .swiper-slide { text-align: center; }
.partners-slider img { max-height: 60px; width: auto; filter: grayscale(100%); opacity: 0.6; transition: all 0.3s ease; }
.partners-slider .swiper-slide:hover img { filter: grayscale(0%); opacity: 1; }

/* --- 10. تنسيق الصفحات الفرعية العام --- */
.page-container { padding: 40px 0; background-color: #fff; }
.page-title { text-align: center; padding: 30px 0; background-color: var(--prestige-light); margin-bottom: 40px; }
.page-title h1 { font-size: 36px; color: var(--prestige-primary); margin: 0; }
.page-title p { font-size: 16px; color: var(--prestige-text); margin-top: 10px; }
.page-content-wrapper { display: flex; gap: 30px; }
.main-page-content { flex-grow: 1; }
.page-content-body h1, .page-content-body h2, .page-content-body h3 { color: var(--prestige-primary); margin-top: 30px; margin-bottom: 15px; }
.page-content-body p { line-height: 1.8; margin-bottom: 20px; color: var(--prestige-text); }
.page-content-body ul, .page-content-body ol { padding-inline-start: 20px; margin-bottom: 20px; }
.page-content-body li { margin-bottom: 10px; }
.page-content-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 20px 0; }
.no-content-message, .error-message { text-align: center; padding: 40px; background-color: var(--prestige-light); border: 1px solid #ddd; border-radius: 8px; font-size: 1.1rem; }

/* --- 11. تنسيق صفحة اتصل بنا --- */
.page-header { padding: 60px 0; background-size: cover; background-position: center; background-color: #2c3e50; position: relative; text-align: center; color: #fff; }
.page-header::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); }
.page-header .container { position: relative; z-index: 2; }
.page-header h1 { font-size: 2.8rem; font-weight: 800; color: #fff; margin: 0; text-transform: uppercase; letter-spacing: 1px; }
.contact-page { padding: 80px 0; background-color: #f9f9f9; }
.contact-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 50px; align-items: flex-start; background-color: #fff; padding: 40px; border-radius: 12px; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08); }
.contact-form h3, .contact-info h3 { font-size: 1.8rem; margin-bottom: 30px; color: var(--prestige-heading); border-bottom: 2px solid var(--prestige-primary); padding-bottom: 10px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--prestige-text); }
.form-group input[type="text"], .form-group input[type="email"], .form-group textarea { width: 100%; padding: 15px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; font-family: 'Cairo', sans-serif; transition: all 0.3s ease; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--prestige-primary); box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.15); }
.form-group textarea { resize: vertical; }
button.btn-primary { display: inline-block; padding: 15px 35px; background-color: var(--prestige-primary); color: #fff; border: none; border-radius: 6px; font-size: 1rem; font-weight: 700; cursor: pointer; text-transform: uppercase; transition: all 0.3s ease; }
button.btn-primary:hover { background-color: var(--prestige-dark); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); }
.contact-info { padding: 20px; background-color: #f7f9fc; border-radius: 8px; border-left: 4px solid var(--prestige-primary); }
.contact-info p { font-size: 1rem; line-height: 1.8; color: #444; margin-bottom: 20px; }
.contact-info p strong { font-weight: 700; color: #222; display: block; margin-bottom: 5px; }
.social-icons-contact { margin-top: 30px; padding-top: 20px; border-top: 1px solid #e0e0e0; text-align: center; }
.social-icons-contact a { color: #555; text-decoration: none; font-weight: 600; margin: 0 10px; transition: color 0.3s ease; }
.social-icons-contact a:hover { color: var(--prestige-primary); }
.map-container { margin-top: 80px; text-align: center; }
.map-container h3 { font-size: 1.8rem; margin-bottom: 30px; color: var(--prestige-heading); }
.map-container iframe { border-radius: 12px; box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08); }

/* --- 12. الفوتر --- */
.site-footer { background-color: var(--prestige-dark); color: #ccc; padding: 50px 0; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.footer-title { color: var(--prestige-secondary); font-size: 18px; margin-bottom: 20px; }
.footer-description { line-height: 1.7; }
.social-icons a { color: #fff; background: rgba(255,255,255,0.1); width: 40px; height: 40px; display: inline-flex; justify-content: center; align-items: center; border-radius: 50%; text-decoration: none; margin: 0 5px; transition: all 0.3s; }
.social-icons a:hover { background: var(--prestige-secondary); color: #000; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: #ccc; text-decoration: none; }
.footer-links a:hover { color: #fff; text-decoration: underline; }

/* --- 13. شريط الحقوق --- */
.copyright-bar { background-color: #111; color: #888; padding: 15px 0; font-size: 13px; }
.copyright-bar .container { display: flex; justify-content: space-between; }
.copyright-bar a { color: #fff; }

/* ===================================
   14. التجاوب مع الموبايل (Mobile Responsive)
   =================================== */

/* زر وقائمة الموبايل */
.mobile-menu-toggle { display: none; } /* مخفي افتراضياً */
.mobile-menu-close { display: none; } /* مخفي افتراضياً */
.mobile-nav-overlay { display: none; } /* مخفي افتراضياً */

@media (max-width: 992px) {
    .logo-text, .header-info-blocks, .main-navbar .nav-search { display: none; }
    .main-header .container { justify-content: space-between; }
    .mobile-menu-toggle { display: block; background: none; border: none; font-size: 28px; cursor: pointer; color: var(--prestige-primary); }

    /* --- هذا هو الجزء الأهم للإصلاح --- */
    .main-navbar {
        display: block;
        position: fixed;
        top: 0;
        left: -100%; /* يبدأ مخفياً خارج الشاشة */
        width: 300px; /* عرض القائمة */
        height: 100%;
        background: var(--prestige-dark);
        z-index: 1001; /* يجب أن يكون فوق كل شيء ما عدا زر الإغلاق والخلفية */
        transition: left 0.35s ease-in-out;
        box-shadow: 5px 0 15px rgba(0,0,0,0.2);
        padding-top: 60px; /* مساحة لزر الإغلاق */
        overflow-y: auto; /* *** الإصلاح الرئيسي: السماح بالتمرير العمودي *** */
        padding-bottom: 50px; /* مساحة إضافية في الأسفل */
    }

    .main-navbar.active {
        left: 0; /* إظهار القائمة عند إضافة كلاس .active */
    }

    .main-navbar .container { display: block; padding: 0; height: 100%; }
    .nav-links { flex-direction: column; }
    .nav-links > li > a { border-bottom: 1px solid rgba(255,255,255,0.1); padding: 15px 25px; }
    
    /* القائمة المنسدلة داخل قائمة الموبايل */
    /* --- Dropdown Sub-Menu inside Mobile Nav (CORRECTED FOR CLARITY) --- */
.sub-menu {
    position: static;
    display: none;
    background: rgba(0, 0, 0, 0.25); /* جعل الخلفية أغمق قليلاً للتباين */
    box-shadow: none;
    min-width: 100%;
    padding-inline-start: 15px;
}

/* *** هذا هو الإصلاح الرئيسي للمشكلة *** */
.main-navbar .sub-menu li a {
    color: #e0e0e0; /* تغيير لون النص إلى رمادي فاتح جداً (شبه أبيض) */
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 0.9rem; /* تصغير الخط قليلاً لتمييزه */
}

/* استهداف الأيقونات داخل القائمة المنسدلة في الموبايل */
.main-navbar .sub-menu li a i {
    color: var(--prestige-secondary); /* إعطاء الأيقونة اللون الذهبي المميز */
    opacity: 0.8; /* شفافية بسيطة لتتناسق مع النص */
}

/* تغيير اللون عند النقر أو التمرير ليصبح أكثر سطوعاً */
.main-navbar .sub-menu li a:hover {
    background-color: rgba(0, 0, 0, 0.4);
    color: #ffffff; /* تغيير لون النص إلى أبيض ناصع */
}

.main-navbar .sub-menu li a:hover i {
    opacity: 1; /* إزالة الشفافية عن الأيقونة */
}
/* --- نهاية قسم الإصلاح --- */

.has-dropdown.open > .sub-menu {
    display: block; /* تظهر عند النقر */
}
.has-dropdown > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.has-dropdown > a::after {
    content: '▼';
    font-size: 0.8em;
    transition: transform 0.3s ease;
}
.has-dropdown.open > a::after {
    transform: rotate(180deg);
}

    .has-dropdown.open > .sub-menu {
        display: block; /* تظهر عند النقر */
    }
    .has-dropdown > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .has-dropdown > a::after {
        content: '▼';
        font-size: 0.8em;
        transition: transform 0.3s ease;
    }
    .has-dropdown.open > a::after {
        transform: rotate(180deg);
    }

    /* زر الإغلاق */
    .mobile-menu-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 20px;
        font-size: 30px;
        color: var(--prestige-secondary);
        background: none;
        border: none;
        cursor: pointer;
    }

    /* الخلفية الداكنة */
    .mobile-nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease-in-out;
    }
    .mobile-nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* تعديلات الأقسام الأخرى للموبايل */
    .prestige-quick-links .container, .welcome-grid, .news-grid { grid-template-columns: 1fr 1fr; }
    .contact-grid { grid-template-columns: 1fr; gap: 40px; }
    .contact-info { order: -1; }
}

@media (max-width: 767px) {
    .prestige-quick-links { margin-top: 0; border-radius: 0; }
    .prestige-quick-links .container, .welcome-grid, .news-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 2.2rem; }
    .contact-page { padding: 40px 0; }
    .contact-grid { padding: 20px; }
    .map-container { margin-top: 60px; }
    .footer-grid { text-align: center; }
    .social-icons { margin-top: 20px; }
    .copyright-bar .container { flex-direction: column; text-align: center; gap: 10px; }
}

/* ===================================
   15. إصلاح وإظهار معلومات الهيدر في الموبايل
   =================================== */
@media (max-width: 992px) {
    /* --- التعديل الثاني: تغيير تخطيط الهيدر ليصبح شبكة --- */
    .main-header .container {
        display: grid; /* استخدام الشبكة للتحكم الكامل */
        grid-template-columns: 1fr auto; /* عمود للشعار وعمود للزر */
        grid-template-rows: auto auto; /* صفين */
        gap: 15px; /* مسافة بين العناصر */
        align-items: center;
    }

    /* --- التعديل الثالث: تحديد أماكن العناصر في الشبكة --- */
    .main-header .logo {
        grid-column: 1 / 2; /* الشعار في العمود الأول، الصف الأول */
        grid-row: 1 / 2;
        justify-self: start; /* محاذاة لليسار */
    }

    .mobile-menu-toggle {
        grid-column: 2 / 3; /* زر القائمة في العمود الثاني، الصف الأول */
        grid-row: 1 / 2;
        justify-self: end; /* محاذاة لليمين */
    }

    .header-info-blocks {
        grid-column: 1 / 3; /* بلوكات المعلومات تمتد على العمودين */
        grid-row: 2 / 2; /* وتوضع في الصف الثاني */
        display: flex; /* عرضها كـ flex لتوزيعها بشكل جيد */
        justify-content: space-around; /* توزيع المسافة حولها */
        background-color: var(--prestige-light); /* خلفية مميزة */
        padding: 10px;
        border-radius: 8px;
        margin-top: 10px;
    }

    /* --- التعديل الرابع: تصغير حجم الخط والأيقونات داخل البلوكات --- */
    .info-block {
        gap: 8px;
    }
    .info-block i {
        font-size: 20px; /* تصغير حجم الأيقونة */
    }
    .info-block span {
        font-size: 11px; /* تصغير حجم النص الصغير */
    }
    .info-block strong {
        font-size: 13px; /* تصغير حجم النص الكبير */
    }
}

/* تعديل إضافي للشاشات الصغيرة جداً */
@media (max-width: 480px) {
    .header-info-blocks {
        flex-direction: column; /* وضع البلوكات فوق بعضها */
        align-items: center;
        gap: 15px;
    }
}


/* ===================================
   16. تنسيق محول اللغة (Language Switcher)
   =================================== */

/* --- الحاوية الرئيسية --- */
.language-switcher {
    position: relative; /* ضروري لتحديد موقع القائمة المنسدلة */
    z-index: 10; /* لضمان ظهوره فوق العناصر الأخرى */
}

/* --- زر اللغة الرئيسي --- */
.lang-button {
    display: flex;
    align-items: center;
    gap: 8px; /* مسافة بين العلم والنص والسهم */
    padding: 8px 12px;
    background-color: #f1f1f1; /* خلفية رمادية فاتحة */
    border: 1px solid #ddd;
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-button:hover {
    background-color: #e9e9e9;
    border-color: #ccc;
}

/* --- أيقونة العلم --- */
.flag-icon {
    width: 20px;
    height: 15px;
    object-fit: cover; /* لضمان ظهور العلم بشكل جيد */
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* --- سهم القائمة المنسدلة --- */
.lang-button .arrow {
    font-size: 10px;
    transition: transform 0.3s ease;
}

/* --- القائمة المنسدلة للغات --- */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 5px); /* تحديد موقع القائمة أسفل الزر مع مسافة 5px */
    right: 0; /* محاذاة لليمين */
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 160px; /* تحديد أقل عرض للقائمة */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    
    /* --- الجزء الأهم: إخفاء وإظهار القائمة --- */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px); /* تبدأ من الأعلى قليلاً للتأثير الحركي */
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
    z-index: 11; /* يجب أن تكون فوق كل شيء */
}

/* --- إظهار القائمة عند مرور الماوس فوق الحاوية الرئيسية --- */
.language-switcher:hover .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* --- تدوير السهم عند فتح القائمة --- */
.language-switcher:hover .lang-button .arrow {
    transform: rotate(180deg);
}

/* --- روابط اللغات داخل القائمة المنسدلة --- */
.lang-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* إزالة الخط السفلي من آخر عنصر */
.lang-dropdown a:last-child {
    border-bottom: none;
}

/* تغيير اللون عند مرور الماوس فوق أحد الخيارات */
.lang-dropdown a:hover {
    background-color: var(--prestige-light, #e3f2fd); /* استخدام لون الثيم الفاتح */
    color: var(--prestige-primary, #0d47a1); /* استخدام لون الثيم الأساسي */
}
