/* ====== ألوان وقيم عامة ====== */
:root{
  --edu-green: #1b5e20;   /* أخضر أساسي للتوب بار */
  --edu-blue:  #1976d2;   /* الخط السفلي للهيدر */
  --edu-orange:#ef6c00;   /* تمييز (الهامبرغر/هوفر) */
  --text-on:   #ffffff;
  --text:      #0f172a;
  --bg:        #fff;

  --mx-container-max: 1200px;
  --mx-gap: 16px;

  --mx-topbar-h: 40px;
  --mx-mainbar-h-desktop: 80px;
  --mx-mainbar-h-mobile: 66px;

  --mx-header-offset: 0px; /* يحدَّث بالـ JS لو احتجناه */
}

*,*::before,*::after{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body.mx-nav-open{ overflow: hidden; }

.mx-container{
  max-width: var(--mx-container-max);
  margin-inline: auto;
  padding-inline: var(--mx-gap);
}

/* خط العامري لموقع كامل */
body {
  font-family: 'Almarai', sans-serif;
}

/* عنوان رئيسية بخط ثقيل */
body, p, a, li, h1, h2, h3, h4, h5, h6, button, input, textarea {
  font-family: 'Almarai', sans-serif !important;
}

/* ====== الهيكل ====== */
.mx-header{ position: relative; z-index: 1000; background: var(--bg); }

/* ====== Topbar: أخضر صافي ====== */
.mx-topbar{
  background: var(--edu-green);
  color: var(--text-on);
}
.mx-topbar .mx-container{
  min-height: var(--mx-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mx-topbar-nav .mx-menu{
  display: flex; gap: 16px;
  margin: 0; padding: 0; list-style: none;
  white-space: nowrap; overflow-x: auto;
  overscroll-behavior-inline: contain;
}
.mx-menu--topbar a{
  color: var(--text-on);
  text-decoration: none;
  padding: 8px 0;
  font-weight: 700;
  letter-spacing: .2px;
}
.mx-menu--topbar a:hover{ text-decoration: underline; }

.mx-menu--topbar a:hover,
.mx-menu--topbar a:focus,
.mx-menu--topbar .current-menu-item > a{
  color: var(--edu-orange);     /* برتقالي عند hover/active */
}

/* ====== Fix: enforce topbar link colors ====== */

/* لون افتراضي أبيض لكل روابط الشريط العلوي */
.mx-topbar,
.mx-topbar a,
.mx-topbar-nav .mx-menu--topbar > li > a,
.mx-topbar-nav nav .mx-menu--topbar > li > a {
  color: #ffffff !important;
}

/* عند hover/ focus/ active والصفحة الحالية → برتقالي */
.mx-topbar-nav .mx-menu--topbar > li > a:hover,
.mx-topbar-nav .mx-menu--topbar > li > a:focus,
.mx-topbar-nav .mx-menu--topbar > li.current-menu-item > a,
.mx-topbar-nav .mx-menu--topbar > li.current_page_item > a,
.mx-topbar-nav .mx-menu--topbar > li.current-menu-ancestor > a {
  color: var(--edu-orange) !important;
}

/* ألغِ أي تلوين مُوروث لحالات visited/active */
.mx-topbar-nav .mx-menu--topbar > li > a:visited,
.mx-topbar-nav .mx-menu--topbar > li > a:active {
  color: #ffffff !important;
}

/* خلفية الشريط العلوي (أخضر متناسق مع اللوجو) */
.mx-topbar{
  background: #1b5e20 !important;
}


/* ====== Mainbar ====== */
.mx-mainbar{
  background: var(--bg);
  border-block-end: 3px solid var(--edu-blue); /* الخط الأزرق السفلي (يبقى كما هو) */
}
.mx-mainbar__inner{
  min-height: var(--mx-mainbar-h-desktop);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mx-gap);
}

.mx-brand{ display: flex; align-items: center; justify-content: center; }
.mx-brand img{ height: 50px; width: auto; display: block; }
.mx-brand__title{
  color: var(--edu-green); font-weight: 800; font-size: 1.25rem; text-decoration: none;
}

/* زر الهامبرغر: ثلاث شرائط برتقالية متوازية */
.mx-toggle{
  width: 44px; height: 44px;
  display: none;
  border: 0; background: transparent; cursor: pointer;
  align-items: center; justify-content: center;
  padding: 0; appearance: none; -webkit-appearance: none;
  flex-direction: column;       /* ترتيب عمودي */
  gap: 5px;                     /* المسافة بين الخطوط */

}

.mx-toggle__bar{
  background: var(--edu-orange) !important;
  display: block; margin-block: 4px;
  transition: transform .3s, opacity .2s;
  width: 26px;                  /* طول الخط */
  height: 3px;                  /* سمك الخط */
  border-radius: 2px;           /* زوايا مستديرة بسيطة */
}

.mx-toggle.is-open .mx-toggle__bar:nth-child(1){ transform: translateY(6px) rotate(45deg); }
.mx-toggle.is-open .mx-toggle__bar:nth-child(2){ opacity: 0; }
.mx-toggle.is-open .mx-toggle__bar:nth-child(3){ transform: translateY(-6px) rotate(-45deg); }

/* قائمة الديسكتوب */
.mx-primary-nav{ display: flex; align-items: center; }
.mx-menu{ list-style: none; margin: 0; padding: 0; display: flex; }
.mx-menu--primary{ gap: 10px; }
.mx-menu--primary > li{ position: relative; }
.mx-menu--primary > li > a{
  color: var(--text); text-decoration: none; font-weight: 800;
  padding: 12px 10px; border-block-end: 2px solid transparent;
  line-height: 1.6;
}
.mx-menu--primary > li > a:hover{ border-color: var(--edu-orange); }

/* دروبداون ديسكتوب */
.mx-menu--primary li:hover > ul{ display: block; }
.mx-menu--primary ul{
  display: none; position: absolute; inset-block-start: 100%;
  min-width: 200px; background: var(--bg);
  border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  z-index: 10;
}
.mx-menu--primary ul li a{ display: block; padding: 10px 12px; white-space: nowrap; line-height: 1.7; }
.mx-menu--primary ul ul{ inset-inline-start: 100%; inset-block-start: 0; }
html[dir="rtl"] .mx-menu--primary ul ul{ inset-inline-start: auto; inset-inline-end: 100%; }

/* ====== موبايل (إصلاحاتك) ====== */
@media (max-width: 768px){
  .mx-mainbar__inner{
    min-height: var(--mx-mainbar-h-mobile);
    display: grid;
    grid-template-columns: 1fr auto 1fr;  /* زر | شعار | فراغ */
    align-items: center;
  }

  /* زر القائمة: في RTL يكون يمين الشاشة */
  .mx-toggle{ display: flex; grid-column: 1; justify-self: start; }
  html[dir="ltr"] .mx-toggle{ justify-self: end; }

  /* الشعار وسط */
  .mx-brand{ grid-column: 2; justify-content: center; }

  /* الحالة الافتراضية قبل جاهزية JS: مخفية تماماً */
  .mx-primary-nav{ display: none; }

  /* بعد جاهزية JS: لوحة من اليمين مع إخفاء كامل بدون خط أزرق */
  .mx-js .mx-primary-nav{
    position: fixed !important;
    top: 0; bottom: 0;
    right: 0 !important; left: auto !important;   /* تأكيد أنها من اليمين */
    inset-inline-end: 0;
    width: min(86vw, 360px);
    height: 100vh;
    background: #f9fafb;

    /* مخفية افتراضياً: لا حدود ولا ظل */
    border-inline-start: 0 !important;
    box-shadow: none !important;

    transform: translateX(100%) !important; /* خارج يمين الشاشة */
    transition: transform .28s ease;
    display: block;
    z-index: 1100;
    overflow-y: auto;
    visibility: hidden;
    will-change: transform;
  }

  /* عند الفتح: تظهر من اليمين، وتظهر الحدود/الظل فقط هنا */
  .mx-js .mx-primary-nav.is-open{
    transform: translateX(0) !important;
    visibility: visible;
    border-inline-start: 3px solid var(--edu-blue) !important; /* لا خط هابط عند الإخفاء */
    box-shadow: -12px 0 24px rgba(0,0,0,.1) !important;
  }

  /* تحسين القراءة بالموبايل */
  .mx-menu--primary{
    flex-direction: column; gap: 0; padding-block: 8px;
  }
  .mx-menu--primary > li > a{
    font-size: 1.05rem; line-height: 1.8;
    padding: 12px calc(var(--mx-gap) + 4px);
    border: 0; border-inline-start: 4px solid transparent;
  }
  .mx-menu--primary > li > a:hover{
    border-inline-start-color: var(--edu-orange);
  }
  .mx-menu--primary ul{
    position: static; display: none; border: 0; box-shadow: none; background: transparent;
  }
  .mx-menu--primary li.open > ul{ display: block; }
  .mx-menu--primary ul li a{
    padding: 10px calc(var(--mx-gap) + 16px);
    font-size: 1rem; line-height: 1.8;
  }
}

/* Overlay */
.mx-overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1090;
}
.mx-overlay[hidden]{ display: none !important; }

/* حالات تفعيل ووصولية */
.mx-menu--primary > li.current-menu-item > a,
.mx-menu--primary > li.current_page_parent > a{ border-color: var(--edu-green); }
a:focus, button:focus{ outline: 3px solid var(--edu-orange); outline-offset: 2px; }

