/* */

/* === خط فاصل محسن بين الهيدر الأساسي والهيدر 2 - Desktop فقط === */
@media (min-width: 769px) {
    .header-divider {
        height: 3px;
        background: linear-gradient(90deg, 
            transparent 0%,
            rgba(0, 168, 89, 0.3) 20%,
            rgba(0, 168, 89, 0.6) 40%,
            rgba(0, 168, 89, 0.8) 50%,
            rgba(0, 168, 89, 0.6) 60%,
            rgba(0, 168, 89, 0.3) 80%,
            transparent 100%
        );
        margin: 0;
        border: none;
        width: 100%;
        box-shadow: 0 2px 4px rgba(0, 168, 89, 0.2);
    }
    
    /* التأكد من ظهور الخط الفاصل في الصفحة الرئيسية أيضاً */
    body.home .header-divider,
    body.front-page .header-divider,
    body.homepage .header-divider {
        height: 3px !important;
        background: linear-gradient(90deg, 
            transparent 0%,
            rgba(0, 168, 89, 0.3) 20%,
            rgba(0, 168, 89, 0.6) 40%,
            rgba(0, 168, 89, 0.8) 50%,
            rgba(0, 168, 89, 0.6) 60%,
            rgba(0, 168, 89, 0.3) 80%,
            transparent 100%
        ) !important;
        box-shadow: 0 2px 4px rgba(0, 168, 89, 0.2) !important;
    }
}

/* === الهيدر === */
.site-header {
    background: var(--primary, #1a1a1a);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    position: relative;
    z-index: 999997; /* أقل من شريط الأدوات */
}

/* === قاعدة عامة قوية للحواف - أولوية عالية جداً === */
@media (min-width: 769px) {
    /* قاعدة قوية لجميع الصفحات بدون استثناء */
    header.site-header,
    #page .site-header,
    .site .site-header,
    div#page header.site-header {
        border-bottom: 2px solid rgba(0, 168, 89, 0.3) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15),
                    0 2px 0 rgba(0, 168, 89, 0.15) !important;
    }
}

/* === حواف جميلة لربط الهيدرين - Desktop فقط === */
/* تطبيق الحواف على جميع الصفحات (الرئيسية وباقي الصفحات) */
@media (min-width: 769px) {
    /* قاعدة عامة لجميع الصفحات */
    .site-header {
        border-bottom: 2px solid rgba(0, 168, 89, 0.3) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15),
                    0 2px 0 rgba(0, 168, 89, 0.15) !important;
    }
    
    /* قواعد خاصة للصفحة الرئيسية - specificity عالية جداً */
    body.home .site-header,
    body.homepage .site-header,
    body.front-page .site-header,
    .homepage ~ .site-header,
    div.homepage ~ header.site-header,
    body.home .site .site-header,
    body.homepage .site .site-header,
    body.front-page .site .site-header {
        border-bottom: 2px solid rgba(0, 168, 89, 0.3) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15),
                    0 2px 0 rgba(0, 168, 89, 0.15) !important;
    }
    
    /* حتى لو كان هناك CSS آخر يحاول إزالته */
    body.home .site-header.sticky-header,
    body.homepage .site-header.sticky-header,
    body.front-page .site-header.sticky-header,
    body.home .site-header.is-sticky,
    body.homepage .site-header.is-sticky,
    body.front-page .site-header.is-sticky {
        border-bottom: 2px solid rgba(0, 168, 89, 0.3) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15),
                    0 2px 0 rgba(0, 168, 89, 0.15) !important;
    }
}

.site-header.sticky-header {
    position: sticky;
    top: 0;
}

/* إصلاح مشكلة تغطية شريط الووردبريس للهيدر الثابت */
body.admin-bar .site-header.sticky-header,
body.admin-bar .site-header.is-sticky {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header.sticky-header,
    body.admin-bar .site-header.is-sticky {
        top: 46px;
    }
}

/* لا نحتاج padding-top مع position: sticky */

/* إصلاح الـ z-index - شريط الأدوات يجب أن يكون فوق الهيدر */
#wpadminbar {
    z-index: 999999 !important;
    position: fixed !important;
}

.site-header {
    z-index: 999997 !important; /* أقل من شريط الأدوات */
}

.site-header.sticky-header,
.site-header.is-sticky {
    z-index: 999997 !important; /* أقل من شريط الأدوات */
}

.site-header.is-sticky {
    box-shadow: 0 6px 30px rgba(0,0,0,0.25);
}

/* === حواف جميلة للهيدر Sticky - Desktop فقط === */
@media (min-width: 769px) {
    .site-header.is-sticky,
    header.site-header.is-sticky,
    #page .site-header.is-sticky,
    body .site-header.is-sticky,
    body.home .site-header.is-sticky,
    body.homepage .site-header.is-sticky,
    body.front-page .site-header.is-sticky {
        box-shadow: 0 6px 30px rgba(0,0,0,0.25),
                    0 2px 0 rgba(0, 168, 89, 0.2) !important;
        border-bottom: 2px solid rgba(0, 168, 89, 0.3) !important;
    }
    
    /* حافة سفلية محسنة للهيدر الأول عند الالتصاق */
    .site-header.is-sticky::after,
    header.site-header.is-sticky::after,
    #page .site-header.is-sticky::after,
    body .site-header.is-sticky::after,
    body.home .site-header.is-sticky::after,
    body.homepage .site-header.is-sticky::after,
    body.front-page .site-header.is-sticky::after {
        content: '' !important;
        position: absolute !important;
        bottom: -2px !important;
        left: 0 !important;
        right: 0 !important;
        height: 3px !important;
        background: linear-gradient(90deg, 
            transparent 0%,
            rgba(0, 168, 89, 0.4) 10%,
            rgba(0, 168, 89, 0.6) 20%,
            rgba(0, 168, 89, 0.8) 30%,
            rgba(0, 168, 89, 1) 40%,
            rgba(0, 168, 89, 1) 60%,
            rgba(0, 168, 89, 0.8) 70%,
            rgba(0, 168, 89, 0.6) 80%,
            rgba(0, 168, 89, 0.4) 90%,
            transparent 100%
        ) !important;
        z-index: 10 !important;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    min-height: 70px;
    max-height: 70px;
}

.site-header,
.site-header.is-sticky,
.site-header.sticky-header,
.header-content,
.site-logo,
.site-logo img,
.custom-logo-link img {
    transition: none !important;
    transform: none !important;
    animation: none !important;
}

/* منع أي حركة على الموبايل */
@media (max-width: 768px) {
    .site-header,
    .site-header *,
    .site-header .container,
    .site-header .header-content,
    .site-header .site-logo,
    .site-header .header-right,
    .site-header .mobile-toggle,
    .site-header .search-btn {
        transform: none !important;
        animation: none !important;
        transition: none !important;
        will-change: auto !important;
    }
    
    /* أبعاد الشعار للموبايل */
    .site-logo img,
    .custom-logo-link img {
        height: var(--mobile-logo-height, 50px) !important;
        max-height: var(--mobile-logo-height, 50px) !important;
        width: var(--mobile-logo-width, auto) !important;
    }
}

/* === Logo === */
.site-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: var(--header-height, 70px);
}

.site-logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 100%;
}

.site-logo img,
.custom-logo-link img {
    height: var(--logo-height, 70px) !important;
    max-height: var(--logo-height, 70px) !important;
    width: var(--logo-width, auto) !important;
    display: block !important;
    object-fit: contain !important;
    transition: none !important;
    transform: none !important;
    animation: none !important;
}

.site-logo:hover img,
.custom-logo-link:hover img,
.site-header.is-sticky .site-logo img {
    height: var(--logo-height, 70px) !important;
    max-height: var(--logo-height, 70px) !important;
    width: var(--logo-width, auto) !important;
    transform: none !important;
    scale: 1 !important;
    opacity: 1 !important;
}

.site-title {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    letter-spacing: 1px;
}

/* === Navigation === */
.main-nav {
    flex: 1;
}

.main-nav .menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
    justify-content: center;
}

.main-nav .menu > li {
    position: relative;
}

.main-nav .menu > li > a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    position: relative;
}

.main-nav .menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--accent, #ff6b00);
    transform: scaleX(0);
    transition: transform 0.3s;
}

.main-nav .menu > li > a:hover,
.main-nav .menu > li.current-menu-item > a {
    background: rgba(255,255,255,0.1);
}

.main-nav .menu > li > a:hover::after,
.main-nav .menu > li.current-menu-item > a::after {
    transform: scaleX(1);
}

/* سهم القوائم الفرعية */
.main-nav .menu > li.menu-item-has-children > a::before {
    content: '▼';
    font-size: 9px;
    margin-left: 6px;
    transition: transform 0.3s;
    order: 2;
}

.main-nav .menu > li.menu-item-has-children:hover > a::before {
    transform: rotate(180deg);
}

/* القوائم الفرعية */
.main-nav .sub-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 15px 60px rgba(0,0,0,0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    padding: 12px 0;
    margin-top: 0;
    border-top: 5px solid var(--primary, #00A859);
    list-style: none;
}

.main-nav .menu > li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.main-nav .sub-menu li {
    position: relative;
}

.main-nav .sub-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 25px;
    color: #1a1a1a;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
    position: relative;
}

.main-nav .sub-menu li a::before {
    content: '→';
    color: var(--primary, #00A859);
    font-weight: 900;
    font-size: 16px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s;
}

.main-nav .sub-menu li a:hover {
    background: linear-gradient(90deg, rgba(0,168,89,0.1), transparent);
    color: var(--primary, #00A859);
    padding-right: 35px;
}

.main-nav .sub-menu li a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* القوائم الفرعية - المستوى الثاني */
.main-nav .sub-menu .sub-menu {
    top: 0;
    right: 100%;
    margin-top: 0;
    margin-right: 8px;
}

.main-nav .sub-menu li.menu-item-has-children > a::after {
    content: '◄';
    margin-right: auto;
    font-size: 12px;
    color: #999;
}

/* أيقونات الأقسام */
.menu-item-icon {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: linear-gradient(135deg, var(--primary, #00A859), #00c46e);
    color: #fff;
    border-radius: 6px;
    padding: 3px;
}

/* === Header Right === */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Search Button */
.search-btn {
    background: var(--button-bg);
    border: 2px solid var(--button-border);
    color: var(--button-text);
    width: var(--button-size, 45px) !important;
    height: var(--button-size, 45px) !important;
    border-radius: var(--button-radius, 12px) !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--button-shadow);
    backdrop-filter: blur(10px);
    font-weight: 600;
}

.search-btn:hover {
    background: var(--button-bg-hover);
    border-color: var(--button-border-hover);
    color: var(--button-text-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--button-shadow-hover);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 8px;
    padding-right: 15px;
    margin-right: 15px;
    border-right: 2px solid rgba(255,255,255,0.2);
}

.social-icons a {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.3s;
}

.social-icons a:hover {
    background: #fff;
    transform: translateY(-4px);
}

.social-icons a:nth-child(1):hover {
    color: #1877f2;
}

.social-icons a:nth-child(2):hover {
    color: #000;
}

.social-icons a:nth-child(3):hover {
    color: #e1306c;
}

.social-icons a:nth-child(4):hover {
    color: #ff0000;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: var(--button-bg);
    border: 2px solid var(--button-border);
    color: var(--button-text);
    width: var(--button-size, 45px) !important;
    height: var(--button-size, 45px) !important;
    border-radius: var(--button-radius, 12px) !important;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--button-shadow);
    backdrop-filter: blur(10px);
}

.mobile-toggle:hover {
    background: var(--button-bg-hover);
    border-color: var(--button-border-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--button-shadow-hover);
}

.mobile-toggle span {
    width: 20px;
    height: 3px;
    background: var(--button-text);
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-toggle:hover span {
    background: var(--button-text-hover);
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translateY(10px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translateY(-10px);
}

/* === Search Overlay === */
.search-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(10px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.search-overlay.active {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.search-box {
    background: #fff;
    padding: 50px;
    border-radius: 20px;
    max-width: 700px;
    width: 100%;
    position: relative;
    animation: zoomIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

@keyframes zoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.search-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0 0 25px;
    text-align: center;
}

.close-search {
    position: absolute;
    left: 20px;
    top: 20px;
    background: #ff4444;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 36px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.4);
    font-weight: bold;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-search:hover {
    background: #dc3545;
    color: #fff;
    transform: rotate(90deg) scale(1.15);
    box-shadow: 0 6px 25px rgba(220, 53, 69, 0.6);
}

.search-box form {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

.search-box input[type="search"] {
    flex: 1;
    padding: 18px 25px;
    border: 3px solid #e0e0e0;
    border-radius: 50px;
    font-size: 18px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s;
    font-weight: 600;
}

.search-box input[type="search"]:focus {
    outline: none;
    border-color: var(--primary, #00A859);
    box-shadow: 0 0 0 4px rgba(0,168,89,0.1);
    transform: scale(1.02);
}

.search-box input[type="search"]::placeholder {
    color: #999;
}

.search-box button[type="submit"] {
    padding: 18px 40px;
    background: linear-gradient(135deg, var(--primary, #00A859), #00c46e);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 18px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 5px 20px rgba(0,168,89,0.3);
}

.search-box button[type="submit"]:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,168,89,0.4);
}

.search-hint {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin: 0;
}

/* Mobile Search */
@media (max-width: 768px) {
    .search-box {
        padding: 40px 25px;
        border-radius: 15px;
    }
    
    .search-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    
    .search-box form {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box input[type="search"] {
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .search-box button[type="submit"] {
        width: 100%;
        justify-content: center;
        padding: 16px;
    }
    
    .close-search {
        width: 40px;
        height: 40px;
        left: 15px;
        top: 15px;
    }
}

/* === Desktop - إظهار القائمة === */
@media (min-width: 769px) {
    .main-nav {
        display: block;
    }
    
    .main-nav .menu {
        display: flex;
    }
}

/* === Mobile === */
@media (max-width: 768px) {
    /* إصلاح عرض الهيدر على الموبايل */
    .site-header {
        width: 100vw !important;
        max-width: 100vw !important;
        padding: 0 !important;
        margin: 0 !important;
        left: 0 !important;
        right: 0 !important;
        position: relative !important;
        overflow: hidden !important;
    }
    
    .site-header .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 15px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    .header-content {
        gap: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    
    .site-logo {
        flex: 0 0 auto !important;
        max-width: 150px !important;
    }
    
    .site-logo img {
        max-width: 100% !important;
        height: 50px !important;
    }
    
    .main-nav {
        display: none !important;
    }
    
    .header-right {
        flex: 0 0 auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .mobile-toggle {
        display: flex !important;
        width: 40px !important;
        height: 40px !important;
        padding: 8px !important;
    }
    
    .search-btn,
    .dark-mode-toggle {
        width: 42px !important;
        height: 42px !important;
        padding: 8px !important;
        border-radius: 10px !important;
        box-shadow: var(--button-shadow) !important;
    }
    
    .search-btn:hover,
    .dark-mode-toggle:hover {
        transform: scale(1.05) !important;
    }
    
    .social-icons {
        display: none !important;
    }
    
    .search-box {
        padding: 30px 20px;
    }
    
    /* إزالة أي padding أو margin خارجي */
    body > .site-header {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* إصلاح الهيدر 2 على الموبايل */
    .header-2-modern {
        width: 100vw !important;
        max-width: 100vw !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .header-2-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px 15px !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }
    
    /* منع تحرك الهيدر يمين وشمال */
    body {
        position: relative !important;
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
    }
    
    .site {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        position: relative !important;
    }
    
    /* منع أي حركة جانبية */
    .site-header,
    .site-header * {
        transform: none !important;
        animation: none !important;
        transition: none !important;
    }
    
    .site-header.is-sticky,
    .site-header.sticky-header {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        z-index: 999997 !important; /* أقل من شريط الأدوات */
        transform: none !important;
        animation: none !important;
    }
    
    /* ✅ إصلاح مشكلة الهيدر - يجب أن يكون تحت شريط الأدوات على الموبايل */
    body.admin-bar .site-header.is-sticky,
    body.admin-bar .site-header.sticky-header {
        top: 46px !important;
        border-top: 2px solid #ddd !important; /* خط فوق الهيدر */
        border-bottom: 2px solid #ddd !important; /* خط أسفل الهيدر */
    }
    
    /* على الشاشات الكبيرة (أكبر من 782px) */
    @media screen and (min-width: 783px) {
        body.admin-bar .site-header.is-sticky,
        body.admin-bar .site-header.sticky-header {
            top: 32px !important;
            border-top: 2px solid #ddd !important; /* خط فوق الهيدر */
            border-bottom: 2px solid #ddd !important; /* خط أسفل الهيدر */
        }
    }
    
    /* إضافة خط فوق وأسفل الهيدر على الموبايل حتى بدون admin-bar */
    @media (max-width: 768px) {
        .site-header.is-sticky,
        .site-header.sticky-header {
            border-top: 2px solid #ddd !important;
            border-bottom: 2px solid #ddd !important;
        }
    }
}

