/* =========================================
   🧢 4. تصميم الهيدر (Header Styles)
   ========================================= */

/* --- 1. الإطار العام للهيدر --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 9999;
    background: #fff;
    box-shadow: 0 2px 20px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.site-header.scrolled {
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.header-spacer {
    height: 120px;
}

/* --- 2. الشريط العلوي (Top Bar) --- */
.top-bar {
    background: var(--primary-dark);
    color: #fff;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: 0.3s;
}

.site-header.scrolled .top-bar {
    height: 0;
    padding: 0;
    overflow: hidden;
    border: none;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-info span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.top-info .divider {
    margin: 0 10px;
    opacity: 0.5;
}

.top-social a {
    color: #fff;
    text-decoration: none;
    opacity: 0.8;
    transition: 0.3s;
}

.top-social a:hover {
    opacity: 1;
}

/* --- 3. الناف بار الرئيسي (Main Navbar) --- */
.main-navbar {
    padding: 15px 0;
    background: #fff;
    transition: 0.3s;
}

.site-header.scrolled .main-navbar {
    padding: 10px 0;
}

/* 📐 توزيع الهيدر بنظام التوسيط المطلق (Absolute Centering) */
.header-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    position: relative !important; /* مهم جداً عشان التوسيط المطلق يشتغل جواه */
    width: 100% !important;
}

.site-logo img {
    max-height: 50px;
    width: auto;
    transition: 0.3s;
}

.site-header.scrolled .site-logo img {
    max-height: 45px;
}

.text-logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

/* --- 4. القائمة (Desktop Menu) --- */
.desktop-nav {
    display: none;
}

@media (min-width: 992px) {
    .desktop-nav {
        display: flex !important;
        /* السر هنا: فصلنا المنيو عن اللوجو والزرار، وقولنالها اقفي في نص الشاشة بالمللي */
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 5;
    }
    
    .nav-links {
        display: flex;
        gap: 30px;
        list-style: none;
        margin: 0;
        padding: 0;
        align-items: center;
    }

    .nav-links > li {
        position: relative;
        padding: 10px 0;
    }

    .nav-links > li > a {
        text-decoration: none;
        color: var(--text-main);
        font-weight: 600;
        font-size: 16px;
        position: relative;
        transition: 0.3s;
        display: block;
    }

    .nav-links > li > a::after {
        content: '';
        position: absolute;
        bottom: -5px;
        right: 0;
        width: 0;
        height: 2px;
        background: var(--secondary-color);
        transition: 0.3s;
    }

    .nav-links > li:hover > a {
        color: var(--primary-color);
    }

    .nav-links > li:hover > a::after {
        width: 100%;
        left: 0;
    }

    /* 🔽 Dropdowns Desktop */
    .nav-links .menu-item-has-children > a::after {
        content: '\f140';
        font-family: 'dashicons';
        margin-right: 5px;
        font-size: 12px;
        vertical-align: middle;
        display: inline-block;
        transition: 0.3s;
    }

    .nav-links .menu-item-has-children:hover > a::after {
        transform: rotate(180deg);
    }

    .nav-links ul.sub-menu {
        display: block;
        position: absolute;
        top: 100%;
        right: 0;
        background: #fff;
        min-width: 240px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
        border-radius: 0 0 8px 8px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 9999;
        padding: 10px 0;
        border-top: 3px solid var(--secondary-color);
        list-style: none;
    }

    .nav-links li:hover > ul.sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-links ul.sub-menu li {
        display: block;
        margin: 0;
        text-align: right;
        padding: 0;
    }

    .nav-links ul.sub-menu a {
        display: block;
        padding: 12px 20px;
        color: var(--primary-dark);
        font-size: 14px;
        font-weight: 600;
        border-bottom: 1px solid #f9f9f9;
        transition: 0.3s;
        white-space: nowrap;
    }

    .nav-links ul.sub-menu a::after {
        content: none !important; 
    }

    .nav-links ul.sub-menu a:hover {
        background: var(--bg-light);
        color: var(--secondary-color);
        padding-right: 25px;
    }
}

/* --- 5. زر الاتصال --- */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10; /* عشان يفضل قابل للضغط فوق القائمة لو الشاشة صغرت */
}

.btn-call {
    font-size: 15px;
    padding: 10px 24px;
}

@media (max-width: 991px) {
    .btn-call .text { display: none; }
    .btn-call { padding: 0; width: 45px; height: 45px; border-radius: 50%; justify-content: center; }
    .btn-call i { margin: 0; }
}

/* --- 6. هامبرغر منيو --- */
.mobile-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    z-index: 10001;
}

@media (min-width: 992px) {
    .mobile-toggle { display: none; }
}

.mobile-toggle .bar {
    width: 25px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: 0.3s;
}

.mobile-toggle.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.mobile-toggle.active .bar:nth-child(2) { opacity: 0; }
.mobile-toggle.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* =========================================
   📱 7. القائمة الجانبية (Mobile Drawer & Accordion)
   ========================================= */
.mobile-menu-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background: #fff;
    z-index: 10000;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    transition: 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-menu-drawer.active { right: 0; }

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

/* --- Overlay --- */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.drawer-overlay.active { opacity: 1; visibility: visible; }

/* -------------------------------------------
   ✨ تنسيق الأكورديون (القوائم المنسدلة بالموبايل)
   ------------------------------------------- */

.mobile-menu-drawer ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-drawer ul li a {
    text-decoration: none;
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.mobile-menu-drawer ul li.menu-item-has-children > a::after {
    content: '\f140';
    font-family: 'dashicons';
    font-size: 20px;
    color: #aaa;
    transition: transform 0.3s ease;
}

.mobile-menu-drawer ul li.menu-item-has-children > a.open {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.mobile-menu-drawer ul li.menu-item-has-children > a.open::after {
    transform: rotate(180deg);
    color: #fff;
}

.mobile-menu-drawer ul.sub-menu {
    display: none;
    background: #fff;
    margin-top: -5px !important;
    margin-right: 15px !important;
    border-right: 3px solid var(--secondary-color);
    border-radius: 0 0 8px 8px;
    gap: 0;
}

.mobile-menu-drawer ul.sub-menu li a {
    font-size: 14px;
    font-weight: 500;
    color: #555;
    background: transparent;
    border: none;
    border-bottom: 1px solid #f9f9f9;
    border-radius: 0;
    padding: 12px 15px;
    justify-content: flex-start;
}

.mobile-menu-drawer ul.sub-menu li a::after {
    display: none !important;
}

.mobile-menu-drawer ul.sub-menu li a:hover {
    color: var(--primary-color);
    background: #fafafa;
    padding-right: 20px;
}

/* =========================================
   🏗️ تنسيق اللوجو والبراندينج
   ========================================= */

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 10; /* عشان يفضل قابل للضغط فوق القائمة لو الشاشة صغرت */
}

/* الخط الذهبي الطولي */
.header-v-line {
    width: 2px;
    height: 45px;
    background: linear-gradient(to bottom, transparent, var(--secondary-color), transparent);
    border-radius: 2px;
}

/* حاوية النصوص */
.company-branding {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
    white-space: nowrap !important; /* حماية النص من العصر والانقسام */
}

/* اسم "عنادل الخير" */
.brand-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}

/* جملة "للمقاولات العامة" */
.brand-subtext {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    letter-spacing: 1px;
    display: block;
}

/* لمسة جمالية عند الهوفر على منطقة اللوجو */
.logo-container:hover .header-v-line {
    background: var(--secondary-color);
    box-shadow: 0 0 10px var(--secondary-color);
    transition: 0.3s;
}

/* التجاوب مع الموبايل */
@media (max-width: 991px) {
    .brand-name { font-size: 18px; }
    .brand-subtext { font-size: 11px; }
    .header-v-line { height: 35px; }
    .company-branding { display: none !important; } /* إخفاء النص في التابلت والموبايل لتوفير مساحة للوجو والزرار */
}

/* =========================================
   🎯 تعديل خاص لإلغاء هوامش الكونتينر في الهيدر
   ========================================= */

/* هذا الكود يجبر الكونتينر داخل الناف بار الرئيسي على إلغاء الهوامش الجانبية */
.main-navbar .container.header-container {
    padding-right: 0 !important; /* إلغاء الفراغ الأيمن عشان اللوجو يلزق */
    padding-left: 0 !important;  /* إلغاء الفراغ الأيسر بالمرة عشان الزرار يلزق برضه */
    max-width: 100% !important;  /* اختياري: لو عايزه ياخد عرض الشاشة بالكامل حتى في الشاشات الكبيرة جداً */
}

/* لو عايز الزرار اللي ع الشمال يفضل سايب مسافة، واللوجو بس اللي يلزق يمين، استخدم الكود ده بدلاً من اللي فوق:
.main-navbar .container.header-container {
    padding-right: 0 !important;
}
*/

/* ==========================================================
   ✨ إضافة مسافة راحة العين (5px) في حواف الهيدر لجميع الشاشات
   ========================================================== */
/* ==========================================================
   ✨ التحكم الذكي في حواف الهيدر (راحة العين)
   ========================================================== */

/* 1. للموبايل والتابلت: مسافة 5 بيكسل تكفي حتى لا تضيق الشاشة */
.main-navbar .container.header-container {
    padding-right: 5px !important; 
    padding-left: 5px !important;  
}

/* 2. للشاشات الكبيرة (الكمبيوتر): زيادة المسافة من اليمين للوجو واليسار للزرار */
@media (min-width: 992px) {
    .main-navbar .container.header-container {
        padding-right: 25px !important; /* زيادة ممتازة للوجو من اليمين */
        padding-left: 15px !important;  /* مسافة متناسقة لزر الاتصال من اليسار */
    }
}