/* =========================================================
   الصفحة الرئيسية — التصميم الأصلي
   Original Homepage Design from style.css
   ========================================================= */

/* Hero Section - من style.css مع تحسين responsive */
.mx-hero{
  background: linear-gradient(180deg, rgba(27,94,32,.08) 0%, rgba(27,94,32,0) 100%);
  padding-block: clamp(20px, 4vw, 28px) clamp(18px, 3vw, 24px);
  padding-inline: clamp(12px, 2vw, 20px);
  border-block-end: 3px solid var(--edu-blue);
}
.mx-hero__inner{ 
  display:grid; 
  grid-template-columns: 1.3fr .7fr; 
  gap: clamp(16px, 3vw, 24px); 
  align-items:center; 
}
.mx-hero__title{ 
  margin:0 0 clamp(6px, 1vw, 8px); 
  font-size: clamp(1.25rem, 4vw, 2.2rem); 
  color:var(--text); 
  font-weight:900; 
  line-height:1.3 
}
.mx-hero__desc{ 
  margin:0 0 clamp(12px, 2vw, 16px); 
  color:var(--muted); 
  line-height:1.9;
  font-size: clamp(0.9rem, 1.5vw, 1rem);
}
.mx-hero__marketing{
  margin-bottom: clamp(16px, 2.5vw, 20px);
}
.mx-hero__tagline{
  margin: 0 0 clamp(10px, 1.5vw, 14px);
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 800;
  color: var(--edu-green);
  line-height: 1.5;
  text-align: right;
  direction: rtl;
}
.mx-hero__marketing .mx-hero__desc{
  margin-bottom: 0;
  text-align: center;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.mx-hero__art{ justify-self:center }

/* البحث - محسّن responsive - حجم مناسب لجميع الشاشات */
.mx-search{ 
  display:flex; 
  gap: clamp(8px, 1.5vw, 10px); 
  align-items:stretch;
  width: 100%;
  max-width: 100%;
}
.mx-search__input,
.mx-search__btn{
  -webkit-appearance:none;
  appearance:none;
  line-height:1.5;
  border-radius: clamp(10px, 1.5vw, 12px);
  box-sizing: border-box;
}
.mx-search__input{
  flex:1;
  border:1px solid #e5e7eb;
  padding-inline: clamp(16px, 2.5vw, 20px);
  background:#fff;
  height: 56px;
  min-height: 56px;
  font-size: 1rem;
  min-width: 0;
  width: 100%;
}
.mx-search__input::placeholder{
  font-size: 0.95rem;
}
.mx-search__btn{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border:0;
  background:var(--edu-orange);
  color:#fff;
  min-width: 120px;
  height: 56px;
  min-height: 56px;
  font-weight:900;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
}
.mx-search__btn:hover{
  background: #d84315;
}
.mx-search__btn svg{
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* إحصائيات ديناميكية - بديل mx-quick - محسّن responsive */
.mx-stats{
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.5vw, 12px);
  margin-top: clamp(12px, 2vw, 16px);
  justify-content: center;
  width: 100%;
}
.mx-stat{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 2vw, 16px) clamp(14px, 2.5vw, 20px);
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: clamp(10px, 1.5vw, 12px);
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  min-width: clamp(80px, 12vw, 100px);
  flex: 1 1 auto;
  max-width: 150px;
}
.mx-stat:hover{
  border-color: var(--edu-green);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46,125,50,.1);
}
.mx-stat__number{
  display: block;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 900;
  color: var(--edu-green);
  line-height: 1.2;
  margin-bottom: clamp(2px, 0.5vw, 4px);
}
.mx-stat__label{
  display: block;
  font-size: clamp(0.8rem, 1.5vw, 0.9rem);
  color: var(--muted);
  font-weight: 700;
}

/* تحسين قوي للموبايل - responsive محسّن */
@media (max-width: 1200px){
  .mx-search__input{
    height: 58px !important;
    min-height: 58px !important;
    font-size: 1.05rem !important;
    padding-inline: 18px !important;
  }
  .mx-search__btn{
    height: 58px !important;
    min-height: 58px !important;
    font-size: 1.05rem !important;
    min-width: 110px !important;
  }
  .mx-search__input::placeholder{
    font-size: 1rem !important;
  }
}
@media (max-width: 992px){ 
  .mx-hero__inner{ 
    grid-template-columns:1fr;
    gap: clamp(12px, 2vw, 20px);
  } 
  .mx-hero__art{
    display:none;
  } 
  .mx-search{
    flex-direction:column;
    gap: clamp(8px, 1.5vw, 10px);
    width: 100%;
    max-width: 100%;
  }
  .mx-search__input{
    height: 60px !important;
    min-height: 60px !important;
    font-size: 1.1rem !important;
    padding-inline: 20px !important;
    width: 100% !important;
  }
  .mx-search__btn{
    width: 100% !important;
    min-width: 100% !important;
    height: 60px !important;
    min-height: 60px !important;
    font-size: 1.1rem !important;
  }
  .mx-search__input::placeholder{
    font-size: 1.05rem !important;
  }
  .mx-stats{
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(8px, 1.5vw, 10px);
  }
  .mx-stat{
    min-width: auto;
    max-width: 100%;
  }
}
@media (max-width: 768px){
  .mx-hero{
    padding-block: clamp(16px, 3vw, 20px) clamp(14px, 2.5vw, 18px);
  }
  .mx-hero__title{
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }
  .mx-hero__desc{
    font-size: clamp(0.85rem, 2vw, 0.95rem);
  }
  .mx-search{
    width: 100%;
    max-width: 100%;
  }
  .mx-search__input{ 
    height: 62px !important; 
    min-height: 62px !important;
    font-size: 1.12rem !important; 
    padding-inline: 22px !important;
    width: 100% !important;
    line-height: 1.5 !important;
  }
  .mx-search__btn{ 
    height: 62px !important; 
    min-height: 62px !important;
    font-size: 1.12rem !important;
    width: 100% !important;
  }
  .mx-search__input::placeholder{ 
    font-size: 1.05rem !important;
  }
  .mx-stats{
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(8px, 1.5vw, 10px);
  }
  .mx-stat{
    padding: clamp(12px, 2vw, 14px) clamp(10px, 1.8vw, 16px);
  }
  .mx-stat__number{
    font-size: clamp(1.3rem, 3.5vw, 1.6rem);
  }
  .mx-stat__label{
    font-size: clamp(0.75rem, 1.8vw, 0.85rem);
  }
}
@media (max-width: 600px){
  .mx-search__input{ 
    height: 64px !important; 
    min-height: 64px !important;
    font-size: 1.15rem !important; 
    padding-inline: 24px !important;
  }
  .mx-search__btn{ 
    height: 64px !important; 
    min-height: 64px !important;
    font-size: 1.15rem !important;
  }
  .mx-search__input::placeholder{ 
    font-size: 1.08rem !important;
  }
}
@media (max-width: 480px){
  .mx-hero{
    padding-inline: clamp(10px, 2vw, 14px);
  }
  .mx-hero__title{
    font-size: clamp(1.1rem, 5.5vw, 1.5rem);
    line-height: 1.4;
  }
  .mx-hero__desc{
    font-size: clamp(0.8rem, 2.2vw, 0.9rem);
    line-height: 1.7;
  }
  .mx-search{
    width: 100%;
    max-width: 100%;
  }
  .mx-search__input{ 
    height: 66px !important; 
    min-height: 66px !important;
    font-size: 1.18rem !important; 
    padding-inline: 26px !important;
    width: 100% !important;
    line-height: 1.5 !important;
  }
  .mx-search__btn{ 
    height: 66px !important; 
    min-height: 66px !important;
    font-size: 1.18rem !important;
    width: 100% !important;
  }
  .mx-search__input::placeholder{ 
    font-size: 1.1rem !important;
  }
  .mx-stats{
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(6px, 1.5vw, 8px);
  }
  .mx-stat{
    padding: clamp(10px, 2vw, 12px) clamp(8px, 1.5vw, 12px);
    min-width: auto;
  }
  .mx-stat__number{
    font-size: clamp(1.2rem, 4vw, 1.5rem);
  }
  .mx-stat__label{
    font-size: clamp(0.7rem, 2vw, 0.8rem);
  }
}
@media (max-width: 400px){
  .mx-search__input{ 
    height: 68px !important; 
    min-height: 68px !important;
    font-size: 1.2rem !important; 
    padding-inline: 28px !important;
  }
  .mx-search__btn{ 
    height: 68px !important; 
    min-height: 68px !important;
    font-size: 1.2rem !important;
  }
  .mx-search__input::placeholder{ 
    font-size: 1.12rem !important;
  }
}
@media (max-width: 360px){
  .mx-search__input{ 
    height: 70px !important; 
    min-height: 70px !important;
    font-size: 1.22rem !important; 
    padding-inline: 30px !important;
  }
  .mx-search__btn{ 
    height: 70px !important; 
    min-height: 70px !important;
    font-size: 1.22rem !important;
}
  .mx-search__input::placeholder{ 
    font-size: 1.15rem !important;
  }
  .mx-stats{
    grid-template-columns: 1fr;
  }
  .mx-stat{
    max-width: 100%;
  }
}

/* أقسام الصفحة */
.mx-sections .mx-block{
  background:#fff; border:1px solid #e8edf3; border-radius:var(--radius-lg);
  padding:24px; box-shadow:var(--shadow-sm); margin-block:14px 18px;
}
.mx-block__title{
  margin:0 0 10px; font-size: clamp(1.2rem, 2.8vw, 1.6rem); font-weight:900; color:var(--text);
  position:relative;
}
.mx-block__title::after{
  content:""; display:block; height:4px; width:72px; border-radius:999px; margin-top:8px;
  background:linear-gradient(90deg, var(--edu-green), var(--edu-blue) 70%, var(--edu-orange));
}
.mx-block__desc{ margin:0; color:#475569; line-height:1.9 }
.mx-block__seo-desc{
  margin: 12px 0 20px;
  color: #475569;
  line-height: 1.8;
  font-size: clamp(0.9rem, 1.4vw, 1rem);
  text-align: right;
  direction: rtl;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

/* تلوين وصف الأقسام (عناوين فرعية) */
.mx-sections .mx-block:nth-of-type(1) .mx-block__desc{ color:#27664b } /* مستويات */
.mx-sections .mx-block:nth-of-type(2) .mx-block__desc{ color:#9c4a05 } /* التلميذ */
.mx-sections .mx-block:nth-of-type(3) .mx-block__desc{ color:#0c4a8a } /* الأستاذ */
.mx-sections .mx-block:nth-of-type(4) .mx-block__desc{ color:#066a63 } /* مسار */
.mx-sections .mx-block:nth-of-type(5) .mx-block__desc{ color:#4a2aa6 } /* الطلبة */
.mx-sections .mx-block:nth-of-type(6) .mx-block__desc{ color:#374151 } /* الأخبار */

/* الشبكات (افتراضي) */
.mx-levels{ 
  margin-top:12px; 
  display:grid; 
  grid-template-columns:repeat(3,1fr); 
  gap:16px;
  align-items: stretch;
}
.mx-grid{   
  margin-top:12px; 
  display:grid !important; 
  grid-template-columns:repeat(4,1fr) !important; 
  gap:10px !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* ضمان أن جميع الأزرار بنفس الطول */
.mx-grid .mx-mini {
  height: 100% !important;
  min-height: 56px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

/* الشاشات الكبيرة جداً: 4 أزرار في الصف (افتراضي) */
@media (min-width: 1201px) {
  .mx-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* الشاشات الكبيرة: 4 أزرار في الصف */
@media (max-width: 1200px) and (min-width: 993px) {
  .mx-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    max-width: 100%;
  }
}

/* الشاشات المتوسطة: 3 أزرار في الصف */
@media (max-width: 992px) and (min-width: 769px) {
  .mx-levels {
    grid-template-columns: 1fr !important;
  }
  .mx-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .mx-block--levels .mx-levels .mx-card {
    padding: 24px 20px;
  }
  .mx-card__emoji {
    font-size: 3rem;
  }
}

/* الشاشات الصغيرة: 2 أزرار في الصف */
@media (max-width: 768px) and (min-width: 561px) {
  .mx-levels {
    grid-template-columns: 1fr !important;
  }
  .mx-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .mx-block--levels .mx-levels .mx-card {
    padding: 20px 18px;
    gap: 14px;
  }
  .mx-card__emoji {
    font-size: 2.5rem;
  }
  .mx-block--levels .mx-levels .mx-card__title {
    font-size: 1.1rem;
  }
  .mx-block--levels .mx-levels .mx-card__desc {
    font-size: 0.9rem;
  }
}

/* الشاشات الصغيرة جداً: زر واحد في السطر */
@media (max-width: 560px) {
  .mx-levels,
  .mx-grid {
    grid-template-columns: 1fr !important;
  }
  .mx-grid .mx-mini {
    width: 100%;
  }
}

/* بطاقات المستويات — تصميم احترافي جديد مع أيقونات emoji */
.mx-block--levels{
  position:relative; overflow:hidden; padding:28px; border-color:rgba(46,125,50,.22);
  background:
    radial-gradient(1200px 300px at 100% -20%, rgba(25,118,210,.06), transparent 60%),
    radial-gradient(1000px 280px at -10% 110%, rgba(46,125,50,.08), transparent 60%),
    #fff;
  box-shadow:0 12px 30px rgba(46,125,50,.08);
}
.mx-block--levels .mx-block__title{ font-size: clamp(1.4rem, 3.5vw, 1.9rem) }
.mx-block--levels .mx-block__title::after{ background:linear-gradient(90deg, var(--edu-green), #2e7d32 60%, var(--edu-blue)) }

.mx-block--levels .mx-levels .mx-card{
  display:flex; align-items:center; gap:16px; padding:28px 24px;
  border-radius:20px; background:#fff;
  position:relative; overflow:visible; text-decoration:none !important;
  transition:all .3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
  direction: rtl;
  text-align: right;
  min-height: auto;
  height: auto;
}
.mx-block--levels .mx-levels .mx-card *{ text-decoration:none !important }

/* أيقونة emoji */
.mx-card__emoji{
  font-size: 3.5rem;
  line-height: 1;
  flex-shrink: 0;
  transition: transform .3s ease;
  filter: grayscale(0);
}
.mx-card__body{ 
  flex:1; 
  display:flex; 
  flex-direction:column;
  gap: 6px;
  text-align: right;
  direction: rtl;
  min-width: 0;
}
.mx-block--levels .mx-levels .mx-card__title{ 
  font-size: clamp(1.1rem, 2vw, 1.3rem); 
  font-weight:900; 
  margin:0;
  transition:color .3s ease;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.mx-block--levels .mx-levels .mx-card__desc{ 
  font-size: clamp(0.85rem, 1.3vw, 0.95rem); 
  line-height:1.6; 
  transition:color .3s ease;
  opacity: 0.8;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ألوان منفصلة: (1) أخضر (2) أزرق (3) برتقالي */
.mx-card--primary{ 
  border-color: rgba(46,125,50,.3) !important; 
  box-shadow: 0 8px 24px rgba(46,125,50,.12);
  background: linear-gradient(135deg, #fff 0%, #f0f9f2 100%);
}
.mx-card--primary .mx-card__title{ color:#14532d }
.mx-card--primary .mx-card__desc{ color:#2e7d32 }
.mx-card--primary:hover{
  background:var(--edu-green) !important; 
  border-color:var(--edu-green) !important; 
  box-shadow:0 12px 36px rgba(46,125,50,.3); 
  transform:translateY(-6px) scale(1.02);
}
.mx-card--primary:hover .mx-card__title,
.mx-card--primary:hover .mx-card__desc{ color:#fff !important; opacity: 1; }
.mx-card--primary:hover .mx-card__emoji{ transform: scale(1.15) rotate(5deg); }

.mx-card--college{ 
  border-color: rgba(25,118,210,.3) !important; 
  box-shadow: 0 8px 24px rgba(25,118,210,.12);
  background: linear-gradient(135deg, #fff 0%, #f0f7ff 100%);
}
.mx-card--college .mx-card__title{ color:#0c3c71 }
.mx-card--college .mx-card__desc{ color:#155b9a }
.mx-card--college:hover{
  background:var(--edu-blue) !important; 
  border-color:var(--edu-blue) !important; 
  box-shadow:0 12px 36px rgba(25,118,210,.3); 
  transform:translateY(-6px) scale(1.02);
}
.mx-card--college:hover .mx-card__title,
.mx-card--college:hover .mx-card__desc{ color:#fff !important; opacity: 1; }
.mx-card--college:hover .mx-card__emoji{ transform: scale(1.15) rotate(5deg); }

.mx-card--lycee{ 
  border-color: rgba(239,108,0,.3) !important; 
  box-shadow: 0 8px 24px rgba(239,108,0,.12);
  background: linear-gradient(135deg, #fff 0%, #fff8f0 100%);
}
.mx-card--lycee .mx-card__title{ color:#5b2b00 }
.mx-card--lycee .mx-card__desc{ color:#7a3a00 }
.mx-card--lycee:hover{
  background:var(--edu-orange) !important; 
  border-color:var(--edu-orange) !important; 
  box-shadow:0 12px 36px rgba(239,108,0,.3); 
  transform:translateY(-6px) scale(1.02);
}
.mx-card--lycee:hover .mx-card__title,
.mx-card--lycee:hover .mx-card__desc{ color:#fff !important; opacity: 1; }
.mx-card--lycee:hover .mx-card__emoji{ transform: scale(1.15) rotate(5deg); }

/* أزرار أقسام أخرى — ممتلئة افتراضياً + قلب عند hover */
.mx-grid .mx-mini{
  display:flex !important; 
  align-items:center; 
  justify-content:center; 
  text-align:center;
  gap: 6px;
  padding:12px 16px; 
  min-height:56px; 
  height:100%; 
  border-radius:12px; 
  font-weight:700;
  font-size: clamp(0.9rem, 1.2vw, 0.95rem);
  transition: transform .2s, box-shadow .2s, background .2s, color .2s, border-color .2s;
  border:1px solid transparent;
  text-decoration: none;
  width: 100%;
  box-sizing: border-box;
  line-height: 1.4;
}
.mx-mini__emoji{
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
}
.mx-mini__text{
  line-height: 1.4;
  white-space: nowrap;
}
/* التلميذ */
.mx-sections .mx-block:nth-of-type(2) .mx-mini{ background:var(--edu-orange); color:#fff; border-color:var(--edu-orange) }
.mx-sections .mx-block:nth-of-type(2) .mx-mini:hover{ background:rgba(239,108,0,.10); color:#5b2b00; border-color:rgba(239,108,0,.25); transform:translateY(-2px) }
/* الأستاذ */
.mx-sections .mx-block:nth-of-type(3) .mx-mini{ background:var(--edu-blue); color:#fff; border-color:var(--edu-blue) }
.mx-sections .mx-block:nth-of-type(3) .mx-mini:hover{ background:rgba(25,118,210,.10); color:#0c3c71; border-color:rgba(25,118,210,.25); transform:translateY(-2px) }
/* مسار */
.mx-sections .mx-block:nth-of-type(4) .mx-mini{ background:var(--edu-teal); color:#fff; border-color:var(--edu-teal) }
.mx-sections .mx-block:nth-of-type(4) .mx-mini:hover{ background:rgba(0,150,136,.10); color:#014b48; border-color:rgba(0,150,136,.25); transform:translateY(-2px) }
/* الطلبة */
.mx-sections .mx-block:nth-of-type(5) .mx-mini{ background:var(--edu-purple); color:#fff; border-color:var(--edu-purple) }
.mx-sections .mx-block:nth-of-type(5) .mx-mini:hover{ background:rgba(103,58,183,.10); color:#311b92; border-color:rgba(103,58,183,.25); transform:translateY(-2px) }
/* الأخبار */
.mx-sections .mx-block:nth-of-type(6) .mx-mini{ background:var(--edu-grey); color:#fff; border-color:var(--edu-grey) }
.mx-sections .mx-block:nth-of-type(6) .mx-mini:hover{ background:rgba(107,114,128,.08); color:#1f2937; border-color:rgba(107,114,128,.25); transform:translateY(-2px) }

/* الأخبار (قائمة) */
.mx-news{ margin-top:12px; display:grid; grid-template-columns:repeat(3,1fr); gap:12px }
.mx-news__item{ border:1px solid #e8edf3; border-radius:12px; background:#fff; padding:12px 14px; display:flex; flex-direction:column; gap:6px }
.mx-news__title{ font-weight:800; line-height:1.6; text-decoration:none; color:inherit }
.mx-news__title:hover{ color:var(--edu-orange) }
.mx-news__excerpt{ 
  color:#6b7280; 
  font-size:0.9rem; 
  line-height:1.6; 
  margin:4px 0 0;
}
.mx-news__date{ color:#9aa3af; font-size:.85rem; margin-top:auto }
.mx-news--archive .mx-news__item{
  padding:16px 18px;
  min-height: auto;
}
.mx-news--archive .mx-news__title{
  font-size: 1.05rem;
}
.mx-pagination{
  grid-column: 1 / -1;
  margin-top: 24px;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.mx-pagination a,
.mx-pagination span{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  min-width: 40px;
  height: 40px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: var(--text);
  transition: all 0.2s ease;
}
.mx-pagination a:hover{
  background: var(--edu-green);
  color: #fff;
  border-color: var(--edu-green);
}
.mx-pagination .current{
  background: var(--edu-green);
  color: #fff;
  border-color: var(--edu-green);
}
.mx-more-wrap{ margin-top:10px; text-align:center }
.mx-more{ display:inline-flex; align-items:center; gap:8px; padding:10px 14px; border-radius:10px; text-decoration:none; font-weight:900;
  background:#f3f4f6; color:var(--text); border:1px solid #e5e7eb }
.mx-more:hover{ border-color:var(--edu-blue); background:var(--edu-blue); color:#fff }
@media (max-width:1100px){ .mx-news{ grid-template-columns:repeat(2,1fr) } }
@media (max-width:560px){ .mx-news{ grid-template-columns:1fr } }
