/* ============================================================== */
/* 1. إصلاحات الموبايل الآمنة (منع التراقص بدون تدمير القالب) */
/* ============================================================== */
html, body { overflow-x: hidden !important; width: 100%; position: relative; margin: 0; padding: 0; }
.custom-home-section, .custom-home-section * { box-sizing: border-box; }

/* ============================================================== */
/* 2. التوب بار (Top Bar) */
/* ============================================================== */
.top-bar { background-color: var(--topbar-bg); color: var(--topbar-text); font-size: 0.9em; padding: var(--topbar-padding-y, 8px) 0 !important; border-bottom: 2px solid var(--theme-color); }
.top-bar-container { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.top-bar-links-wrapper { display: flex; align-items: center; flex-wrap: nowrap; overflow: hidden; white-space: nowrap; gap: 15px; }
.tb-menu-wrapper ul { margin: 0; padding: 0; display: flex; align-items: center; gap: 15px; list-style: none; }
.tb-contact-info { display: flex; align-items: center; gap: 15px; }
.tb-icon { color: var(--topbar-icon); margin-inline-end: 6px; font-size: 1.1em; }
.top-bar-actions-wrapper { display: flex !important; align-items: center !important; gap: 30px !important; }
.social-icons { display: flex !important; align-items: center !important; gap: var(--social-gap, 15px) !important; margin: 0 !important; padding: 0 !important; }
.social-icons a { color: var(--social-color, var(--topbar-text)) !important; font-size: var(--social-size, 1.2em) !important; transition: transform 0.2s ease, color 0.3s ease !important; display: flex !important; align-items: center !important; justify-content: center !important; text-decoration: none !important; padding: 5px !important; }
.social-icons a:hover { color: var(--social-hover, var(--theme-color)) !important; transform: translateY(-2px) scale(1.15) !important; text-decoration: none !important; }
.top-bar-links-wrapper a { color: var(--topbar-text); text-decoration: none; font-weight: 500; transition: opacity 0.3s; }
.top-bar-links-wrapper a:hover { opacity: 0.8; }
.tb-menu-wrapper li:not(:last-child)::after { content: '|'; color: var(--topbar-icon); margin-inline-start: 15px; opacity: 0.5; }
.tb-contact-info span:not(:last-child)::after { content: '|'; color: var(--topbar-icon); margin-inline-start: 15px; opacity: 0.5; }

/* ============================================================== */
/* 3. اللغات (Language Switcher) */
/* ============================================================== */
.lang-switcher-wrapper { position: relative; display: inline-block; z-index: 99999; }
.lang-active-btn { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,0.05); color: #1e293b; padding: 5px 12px; border-radius: 4px; font-weight: bold; font-size: 0.95em; cursor: pointer; transition: background 0.3s; }
.lang-dropdown-bridge { display: none; position: absolute; top: 100%; left: auto; right: auto; padding-top: 10px; z-index: 9999; min-width: 150px; }
html[dir="rtl"] .lang-dropdown-bridge { left: 0; } html[dir="ltr"] .lang-dropdown-bridge { right: 0; }
.lang-switcher-wrapper:hover .lang-dropdown-bridge { display: block; }
.lang-dropdown-menu { background: #ffffff; box-shadow: 0 10px 25px rgba(0,0,0,0.15); border-radius: 6px; overflow: hidden; border: 1px solid #e2e8f0; }
.lang-item-link { display: flex; align-items: center; gap: 10px; padding: 10px 15px; text-decoration: none; color: #1e293b; transition: background 0.2s; }
.lang-item-link:hover { background: #f0fdf4; color: var(--theme-color); }
.lang-flag-icon { object-fit: cover; border: 1px solid #cbd5e1; }
.flag-shape-circle { border-radius: 50%; } .flag-shape-rounded { border-radius: 3px; } .flag-shape-rectangle { border-radius: 0; }

/* ============================================================== */
/* 4. الهيدر والموبايل (Header & Mobile Nav) */
/* ============================================================== */
.main-header { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 1000; }
.header-container { display: flex; justify-content: space-between; align-items: center; padding: var(--header-height) 20px; max-width: 1200px; margin: 0 auto; position: relative;}
.logo img { max-height: var(--logo-size); object-fit: contain; }
.mobile-toggle-btn, .mobile-lang-switcher { display: none; }
.desktop-lang-switcher { display: flex; align-items: center; gap: 15px; }

@media (max-width: 991px) {
    .desktop-lang-switcher, .top-bar { display: none !important; }
    .mobile-toggle-btn { display: flex !important; align-items: center; justify-content: center; background: transparent; border: none; font-size: var(--burger-size); color: var(--burger-color); cursor: pointer; order: var(--burger-order); padding: 5px; }
    .main-nav { position: absolute; top: 100%; left: 0; width: 100%; background-color: var(--mobile-bg); box-shadow: 0 15px 20px rgba(0,0,0,0.1); display: none; padding: 20px; z-index: 999; border-top: 1px solid #e2e8f0; }
    .main-nav.active { display: block; animation: slideDown 0.3s ease; }
    @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
    .main-nav ul[id^="menu_"] { flex-direction: column !important; align-items: flex-start !important; width: 100% !important; gap: 15px !important; }
    .main-nav ul[id^="menu_"] li { width: 100%; border-bottom: 1px solid #f1f5f9; padding-bottom: 12px; }
    .main-nav ul[id^="menu_"] li:last-child { border-bottom: none; padding-bottom: 0; }
    .main-nav ul[id^="menu_"] a::after { display: none !important; }
    .main-nav ul[id^="menu_"] a { width: 100%; font-size: 1.1rem; }
    .mobile-lang-switcher { display: block; margin-top: 20px; padding-top: 20px; border-top: 2px dashed #cbd5e1; }
}

/* ============================================================== */
/* 5. منشئ القوائم الديناميكي المتقدم (Advanced Menu Builder) */
/* ============================================================== */
.dyn-menu-list { list-style: none; padding: 0; margin: 0; display: flex; align-items: center; font-family: var(--m-ff, inherit); font-size: var(--m-fs, 16px); background-color: var(--m-bg, transparent); border-radius: 8px; }
.custom-menu-horizontal { flex-direction: row; gap: var(--m-gap, 25px); flex-wrap: wrap; }
.custom-menu-vertical { flex-direction: column; align-items: flex-start; gap: var(--m-gap, 15px); }
.dyn-menu-list li { margin: 0; position: relative; display: flex; align-items: center; }
.dyn-menu-list a { text-decoration: none; display: flex; align-items: center; gap: 8px; color: var(--m-txt, #1e293b); font-weight: var(--m-fw, normal) !important; transition: all 0.3s ease; position: relative; padding: 5px 0; width: fit-content; }

/* المؤثرات الحركية والرابط الفعال */
.effect-fade a:hover, .effect-fade a.active-menu-item { color: var(--m-hov); }
.effect-fade a.active-menu-item { color: var(--m-act) !important; }
.effect-underline_grow a::after { content: ''; position: absolute; bottom: 0; left: 0; width: 0%; height: 2px; background: var(--m-hov); transition: width 0.3s ease; }
html[dir="rtl"] .effect-underline_grow a::after { left: auto; right: 0; }
.effect-underline_grow a:hover { color: var(--m-hov); }
.effect-underline_grow a:hover::after { width: 100%; }
.effect-underline_grow a.active-menu-item { color: var(--m-act) !important; }
.effect-underline_grow a.active-menu-item::after { width: 100%; background: var(--m-act) !important; }
.effect-bg_pill { gap: var(--m-gap, 10px); }
.effect-bg_pill a { padding: 8px 16px; border-radius: 30px; z-index: 1; }
.effect-bg_pill a::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: var(--m-hov); border-radius: 30px; z-index: -1; transform: scale(0.8); opacity: 0; transition: all 0.3s ease; }
.effect-bg_pill a:hover { color: #fff; }
.effect-bg_pill a:hover::before { transform: scale(1); opacity: 1; }
.effect-bg_pill a.active-menu-item { color: #fff !important; }
.effect-bg_pill a.active-menu-item::before { transform: scale(1); opacity: 1; background: var(--m-act) !important; }
.effect-scale_up a:hover { color: var(--m-hov); transform: scale(1.1); }
.effect-scale_up a.active-menu-item { color: var(--m-act) !important; transform: scale(1.1); }

.dyn-menu-list.has-divider li:not(:last-child)::after { position: absolute; color: var(--m-div-c); top: 50%; transform: translateY(-50%); opacity: 0.6; pointer-events: none; }
html[dir="rtl"] .dyn-menu-list.has-divider li:not(:last-child)::after { left: calc(var(--m-gap, 25px) * -0.5); } 
html[dir="ltr"] .dyn-menu-list.has-divider li:not(:last-child)::after { right: calc(var(--m-gap, 25px) * -0.5); }
.dyn-menu-list.has-divider li:has(+ li a.menu-custom-btn)::after { display: none !important; }

.div-pipe li:not(:last-child)::after { content: '|'; }
.div-dot li:not(:last-child)::after { content: '•'; font-size: 1.2em; }
.div-slash li:not(:last-child)::after { content: '/'; font-size: 0.9em; }

.custom-menu-vertical.has-divider li:not(:last-child)::after { display: none; }
.custom-menu-vertical.has-divider li { border-bottom: 1px solid var(--m-div-c); width: 100%; padding-bottom: calc(var(--m-gap, 15px) * 0.5); }

/* الأزرار المخصصة في المنيو */
.dyn-menu-list a.menu-custom-btn { box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: auto !important; border: none !important; }
.dyn-menu-list a.menu-custom-btn:hover { filter: brightness(1.1); transform: translateY(-2px) !important; color: inherit !important; }
.dyn-menu-list a.menu-custom-btn::after, .dyn-menu-list a.menu-custom-btn::before { display: none !important; }

/* شريط الموبايل السفلي */
.custom-menu-app_bottom_bar { display: none; }
@media (max-width: 991px) {
    .custom-menu-app_bottom_bar { display: flex !important; justify-content: space-around; align-items: center; position: fixed; bottom: 0; left: 0; width: 100%; height: var(--bb-height, 70px); background: var(--bb-bg, #fff); box-shadow: 0 -4px 15px rgba(0,0,0,0.08); padding: 0; z-index: 9999; flex-direction: row; gap: 0; font-family: var(--bb-font, inherit); border-radius: 0; }
    .custom-menu-app_bottom_bar li { flex: 1; text-align: center; height: 100%; border-inline-end: var(--bb-div, none); }
    .custom-menu-app_bottom_bar li:last-child { border-inline-end: none !important; }
    .custom-menu-app_bottom_bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--bb-color); font-size: var(--bb-f-size, 12px); font-weight: 600; gap: 5px; padding: 5px 0; transition: all 0.3s; width: 100%; }
    .custom-menu-app_bottom_bar a i { font-size: var(--bb-i-size, 22px); transition: transform 0.2s; color: var(--bb-color); }
    .custom-menu-app_bottom_bar a:hover i, .custom-menu-app_bottom_bar a:active i, .custom-menu-app_bottom_bar a:hover span, .custom-menu-app_bottom_bar a:active span, .custom-menu-app_bottom_bar a.active-menu-item i, .custom-menu-app_bottom_bar a.active-menu-item span { color: var(--bb-act-color) !important; }
    .custom-menu-app_bottom_bar a:hover i, .custom-menu-app_bottom_bar a.active-menu-item i { transform: translateY(-3px); }
    .hide-bb-text.custom-menu-app_bottom_bar a span { display: none !important; }
}

/* ============================================================== */
/* 6. تصميمات الأقسام (Section Renderer Grid) */
/* ============================================================== */
.custom-home-section { position: relative; background-color: var(--sec-bg); padding-top: var(--sec-pt); padding-bottom: var(--sec-pb); margin-top: var(--sec-mt); margin-bottom: var(--sec-mb); }
.custom-section-container { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* إعدادات الشبكة التلقائية */
.text-grid { display: grid !important; gap: var(--sec-gap) !important; grid-template-columns: repeat(var(--sec-cols, 3), minmax(0, 1fr)) !important; width: 100%; }
.custom-home-section[id="partners"] .text-grid, #partners .text-grid { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
.text-card { display: flex; overflow: hidden; transition: transform 0.3s; height: 100%; min-width: 0 !important; }
.media-wrapper-dynamic { overflow: hidden; display: flex; align-items: center; justify-content: center; flex-shrink: 0; max-width: 100%; min-width: 0; }
.media-wrapper-dynamic img { max-width: 100%; height: auto; object-fit: contain; }
.media-link-wrapper { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; text-decoration: none; outline: none; border: none; }
.tinymce-content p { margin-top: 0; margin-bottom: 0px !important; }
.tinymce-content h1, .tinymce-content h2, .tinymce-content h3, .tinymce-content h4 { margin-top: 0; margin-bottom: 10px; }
.side-cover-wrapper { flex: 0 0 40%; position: relative; min-height: 250px; overflow: hidden; }
.side-cover-wrapper img { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

/* تأثيرات التحويم للبلوكات */
.effect-grayscale { filter: grayscale(100%); transition: all 0.5s ease; } .effect-grayscale:hover { filter: grayscale(0%); }
.effect-zoom { transition: transform 0.5s ease; } .effect-zoom:hover { transform: scale(1.1); }
.effect-glow { transition: all 0.4s ease; } .effect-glow:hover { filter: drop-shadow(0 0 15px rgba(59, 130, 246, 0.6)); }
.effect-lift { transition: transform 0.4s ease, box-shadow 0.4s ease; } .effect-lift:hover { transform: translateY(-8px); box-shadow: 0 15px 30px rgba(0,0,0,0.15); }
.dynamic-btn-hover { transition: all 0.3s ease; }
.dynamic-btn-hover:hover { background: var(--btn-h-bg) !important; color: var(--btn-h-txt) !important; border-color: var(--btn-h-bg) !important; }

/* استجابة الشاشات للشبكة العادية */
@media (max-width: 991px) { .hide-on-mobile { display: none !important; } }
@media (min-width: 992px) { .hide-on-pc { display: none !important; } }
@media (max-width: 1024px) { .text-grid, .custom-home-section[id="partners"] .text-grid, #partners .text-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 768px) {
    .text-grid, .custom-home-section[id="partners"] .text-grid, #partners .text-grid { grid-template-columns: 1fr !important; justify-items: center !important; width: 100% !important; gap: 20px !important; }
    .text-card { width: 100% !important; max-width: 450px !important; margin: 0 auto !important; }
    .card-body-flex { flex-direction: column !important; text-align: center !important; justify-content: center !important; align-items: center !important; }
    .media-wrapper-dynamic { max-width: 100% !important; margin: 0 auto 15px auto !important; order: 1 !important; }
    .text-wrapper-dynamic { order: 2 !important; align-items: center !important; }
    .section-title, .section-subtitle { text-align: center !important; margin-left: auto !important; margin-right: auto !important; }
    .card-row-layout { flex-direction: column !important; }
    .side-cover-wrapper { flex: auto; height: 220px; width: 100%; position: static; }
    .side-cover-wrapper img { position: static; height: 220px; width: 100%; }
}

/* ============================================================== */
/* 7. الفوتر (Footer Styles) */
/* ============================================================== */
.site-footer-wrapper { margin-top: 40px; }
.site-footer { background-color: var(--f-bg, #1e293b); color: var(--f-text, #ffffff); padding: 60px 0; text-align: var(--f-align, start); }
.footer-grid-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; }
@media (min-width: 992px) { .footer-grid-container { grid-template-columns: repeat(var(--f-cols, 3), 1fr); } }
.footer-bottom-bar { background-color: var(--fb-bg, #0f172a); color: var(--fb-text, #94a3b8); padding: 20px 0; text-align: center; font-size: 0.9em; }
@media (max-width: 768px) { .hide-footer-on-mobile { display: none !important; } }
.footer-links-list { list-style: none; padding: 0; margin: 0; opacity: 0.9; line-height: 2.2; }
.footer-links-list a { color: var(--f-text, #ffffff); text-decoration: none; transition: color 0.3s; }
.footer-links-list a:hover { color: var(--theme-color, #10b981); }
.footer-social-icons { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; justify-content: var(--f-social-justify, flex-start); }
.footer-social-icons a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(255, 255, 255, 0.1); color: #ffffff; border-radius: 6px; text-decoration: none; font-size: 1.2em; transition: all 0.3s ease; }
.footer-social-icons a:hover { background: var(--theme-color, #10b981); transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

/* ============================================================== */
/* 🚀 8. نظام السلايدر التفاعلي للأقسام (Native CSS Scroll-Snap) */
/* ============================================================== */
.section-blocks-container.is-slider-active { position: relative; width: 100%; margin: 0 auto; padding-bottom: 50px; }

.is-slider-active .text-grid {
    display: flex !important; flex-wrap: nowrap !important; gap: var(--sec-gap, 30px) !important;
    overflow-x: auto !important; scroll-behavior: smooth; scroll-snap-type: x mandatory;
    scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 15px;
}
.is-slider-active .text-grid::-webkit-scrollbar { display: none; }

.is-slider-active .text-card {
    scroll-snap-align: start; flex-shrink: 0; min-width: 0 !important;
    width: calc((100% - ((var(--sec-cols, 3) - 1) * var(--sec-gap, 30px))) / var(--sec-cols, 3)) !important;
}

@media (max-width: 1024px) {
    .is-slider-active .text-card, .custom-home-section[id="partners"] .is-slider-active .text-card, #partners .is-slider-active .text-card { width: calc((100% - var(--sec-gap, 30px)) / 2) !important; }
}
@media (max-width: 768px) {
    .is-slider-active .text-card, .custom-home-section[id="partners"] .is-slider-active .text-card, #partners .is-slider-active .text-card { width: 100% !important; }
}

/* ================= أزرار الأسهم الذكية ================= */
.slider-btn {
    position: absolute; top: calc(50% - 25px); transform: translateY(-50%);
    width: 45px; height: 45px; background: var(--arr-bg); color: var(--arr-c);
    border: none; border-radius: var(--arr-rad); font-size: 1.2rem; cursor: pointer;
    z-index: 10; box-shadow: 0 4px 10px rgba(0,0,0,0.2); transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
}
.slider-btn:hover { filter: brightness(1.1); transform: translateY(-50%) scale(1.1); }

/* موقع الأسهم (داخل / خارج) */
.arr-pos-inside .slider-prev { left: 15px; }
.arr-pos-inside .slider-next { right: 15px; }
.arr-pos-outside .slider-prev { left: -20px; }
.arr-pos-outside .slider-next { right: -20px; }

html[dir="rtl"] .arr-pos-inside .slider-prev { left: auto; right: 15px; transform: translateY(-50%) rotate(180deg); }
html[dir="rtl"] .arr-pos-inside .slider-next { right: auto; left: 15px; transform: translateY(-50%) rotate(180deg); }
html[dir="rtl"] .arr-pos-outside .slider-prev { left: auto; right: -20px; transform: translateY(-50%) rotate(180deg); }
html[dir="rtl"] .arr-pos-outside .slider-next { right: auto; left: -20px; transform: translateY(-50%) rotate(180deg); }
html[dir="rtl"] .slider-btn:hover { transform: translateY(-50%) rotate(180deg) scale(1.1); }

/* ================= نقاط الترقيم (Bullets) ================= */
.slider-pagination {
    position: absolute; bottom: 0; left: 0; width: 100%;
    display: flex; justify-content: center; gap: 8px; margin-top: 20px;
}
.slider-dot { width: 10px; height: 10px; background: #cbd5e1; border-radius: 50%; cursor: pointer; transition: all 0.3s ease; border: none; padding: 0; }
.slider-dot.active { background: var(--dot-c); width: 30px; border-radius: 6px; }

/* ================= شروط الظهور والإخفاء (PC / Mobile) ================= */
@media (max-width: 768px) { 
    .hide-arr-mob .slider-btn { display: none !important; } 
    .hide-dot-mob .slider-pagination { display: none !important; }
}
@media (min-width: 769px) { 
    .hide-arr-pc .slider-btn { display: none !important; } 
    .hide-dot-pc .slider-pagination { display: none !important; }
}