/*
Theme Name: Madarisy
Theme URI: https://madarisy.com
Author: Madarisy Team
Author URI: https://madarisy.com
Description: قالب احترافي شامل لمنصة التعليم المغربي - دروس، فروض، امتحانات ووثائق تربوية لجميع المستويات من الابتدائي إلى البكالوريا. تصميم عصري ومتجاوب مع جميع الأجهزة.
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: madarisy
Requires at least: 5.0
Tested up to: 6.4
Requires PHP: 7.4
Tags: education, morocco, arabic, rtl, responsive, custom-post-types, custom-taxonomies
*/

/* =========================================================
   Madarisy — Pro UI Kit (from scratch)
   - ألوان حسب السلك عبر body.cycle-*
   - مكوّنات ثابتة الشكل، مرنة اللون
   - RTL جاهز
   ========================================================= */

/* متغيرات ألوان أساسية (للسلك + الاستعمال العام) */
:root{
  --edu-green:#2e7d32;
  --edu-blue:#1976d2;
  --edu-orange:#ef6c00;
  --edu-teal:#009688;
  --edu-purple:#673ab7;
  --edu-grey:#6b7280;

  --accent: var(--edu-green);
}

/* هوية لونية لكل سلك */
body.cycle-primary{ --accent: var(--edu-green); }
body.cycle-college{ --accent: var(--edu-blue); }
body.cycle-lycee{ --accent: var(--edu-orange); }

/* ==========================
   هوية لونية لكل سلك في الهيرو/العناوين
   ========================== */

/* الابتدائي — أخضر */
body.cycle-primary .mx-hero,
body.cycle-primary .mx-block__title::after{
  border-color: var(--edu-green);
  background: linear-gradient(90deg, var(--edu-green), #43a047);
}
body.cycle-primary .mx-mini{
  background: var(--edu-green);
  border-color: var(--edu-green);
  color: #fff;
}
body.cycle-primary .mx-mini:hover{
  background: rgba(46,125,50,.1);
  color: #14532d;
  border-color: rgba(46,125,50,.25);
}

/* الإعدادي — أزرق */
body.cycle-college .mx-hero,
body.cycle-college .mx-block__title::after{
  border-color: var(--edu-blue);
  background: linear-gradient(90deg, var(--edu-blue), #1e88e5);
}
body.cycle-college .mx-mini{
  background: var(--edu-blue);
  border-color: var(--edu-blue);
  color: #fff;
}
body.cycle-college .mx-mini:hover{
  background: rgba(25,118,210,.1);
  color: #0c3c71;
  border-color: rgba(25,118,210,.25);
}

/* التأهيلي — برتقالي */
body.cycle-lycee .mx-hero,
body.cycle-lycee .mx-block__title::after{
  border-color: var(--edu-orange);
  background: linear-gradient(90deg, var(--edu-orange), #f57c00);
}
body.cycle-lycee .mx-mini{
  background: var(--edu-orange);
  border-color: var(--edu-orange);
  color: #fff;
}
body.cycle-lycee .mx-mini:hover{
  background: rgba(239,108,0,.1);
  color: #5b2b00;
  border-color: rgba(239,108,0,.25);
}

/* =========================================================
   استايل عام لبقية الصفحات: أرشيف، مفرد، نتائج بحث، 404، ثابتة
   ========================================================= */

/* 1) هيدر الصفحة الداخلية (عنوان + وصف قصير + مسارات تنقّل) */
.page-head{
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 12%, #fff) 0%, #fff 100%);
  border-block-end: 1px solid color-mix(in oklab, var(--accent) 25%, #fff);
  padding: 18px 0;
}
.page-head__inner{
  width:min(1160px,92%);
  margin-inline:auto;
}
.page-title{
  margin: 0 0 6px;
  font-weight: 900;
  line-height:1.3;
  font-size: clamp(1.25rem, 2.8vw, 1.8rem);
  color: var(--text);
}
.page-subtitle{
  margin: 0;
  color:#556376;
  line-height:1.8;
  font-size: .98rem;
}

/* Breadcrumbs */
.breadcrumbs{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
  margin-top:10px;
  font-size:.92rem;
  color:#6b7280;
}
.breadcrumbs a{
  color: color-mix(in oklab, var(--accent) 65%, #000);
  text-decoration:none;
  border-radius:999px;
  padding:6px 10px;
  background: color-mix(in oklab, var(--accent) 8%, #fff);
  border:1px solid color-mix(in oklab, var(--accent) 18%, #e5e7eb);
  font-weight:800;
}
.breadcrumbs a:hover{
  background: var(--accent);
  color:#fff;
  border-color: var(--accent);
}
.breadcrumbs .sep{
  opacity:.35;
  padding-inline:2px;
}

/* 2) تخطيط الصفحات (شبكة المحتوى + الشريط الجانبي) */
.page-wrap{
  width:min(1160px,92%);
  margin-inline:auto;
  padding: 16px 0 24px;
}
.page-grid{
  display:grid;
  grid-template-columns: 1fr 300px;
  gap: 22px;
}
@media (max-width: 992px){
  .page-grid{ grid-template-columns: 1fr; }
}

/* 3) صندوق عام */
.box{
  background:#fff;
  border:1px solid #e8edf3;
  border-radius:16px;
  box-shadow:0 6px 18px rgba(15,23,42,.03);
  padding:18px;
}

/* 4) بطاقات الأرشيف */
.cards{
  display:grid;
  grid-template-columns: repeat(3,1fr);
  gap:12px;
}
@media (max-width:1100px){
  .cards{ grid-template-columns: repeat(2,1fr); }
}
@media (max-width:560px){
  .cards{ grid-template-columns: 1fr; }
}

.card{
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border-radius:14px;
  border:1px solid #e8edf3;
  background:#fff;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.card__thumb{
  aspect-ratio: 16/9;
  background:#f3f4f6;
  overflow:hidden;
}
.card__thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.card__body{
  padding:12px 14px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.card__title{
  font-weight:900;
  line-height:1.5;
  color:#0f172a;
  font-size:1rem;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.card__meta{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  color:#6b7280;
  font-size:.88rem;
}
.card__badge{
  padding:4px 8px;
  border-radius:999px;
  font-weight:800;
  font-size:.8rem;
  background: color-mix(in oklab, var(--accent) 8%, #f3f4f6);
  color: color-mix(in oklab, var(--accent) 70%, #000);
  border:1px solid color-mix(in oklab, var(--accent) 18%, #e5e7eb);
}
.card:hover{
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--accent) 35%, #e8edf3);
  box-shadow: 0 14px 30px color-mix(in oklab, var(--accent) 16%, rgba(0,0,0,.06));
}
.card__more{
  margin-top:auto;
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:900;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
}
.card__more:hover{
  border-color: var(--accent);
  color: var(--accent);
}

/* 4.1) لائحة بسيطة */
.list{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.list__item{
  display:flex;
  gap:10px;
  align-items:flex-start;
  padding:12px;
  border:1px solid #e8edf3;
  border-radius:12px;
  background:#fff;
}
.list__dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background: var(--accent);
  margin-top:8px;
  flex-shrink:0;
}
.list__title{
  font-weight:900;
  color:#111827;
  line-height:1.6;
}
.list__title:hover{
  color: var(--accent);
}
.list__meta{
  color:#6b7280;
  font-size:.88rem;
}

/* 5) الشريط الجانبي */
.sidebar .widget{
  background:#fff;
  border:1px solid #e8edf3;
  border-radius:16px;
  padding:14px;
  margin-bottom:12px;
}
.widget__title{
  margin:0 0 10px;
  font-weight:900;
  color:#0f172a;
  font-size:1.02rem;
  position:relative;
}
.widget__title::after{
  content:"";
  display:block;
  height:3px;
  width:56px;
  border-radius:999px;
  margin-top:6px;
  background: var(--accent);
}
.widget ul{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.widget a{
  color:#334155;
  padding:6px 0;
  display:block;
  border-radius:8px;
  font-weight:800;
}
.widget a:hover{
  color:#fff;
  background: color-mix(in oklab, var(--accent) 85%, #000);
}

/* 6) عناوين الأقسام */
.section-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:10px;
}
.section-title{
  margin:0;
  font-weight:900;
  color:#0f172a;
  font-size:1.1rem;
  position:relative;
}
.section-title::after{
  content:"";
  display:block;
  height:4px;
  width:72px;
  border-radius:999px;
  margin-top:8px;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 55%, #1976d2) 70%, var(--edu-orange));
}
.section-action{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 12px;
  border-radius:10px;
  font-weight:900;
  background:#f3f4f6;
  color:#0f172a;
  border:1px solid #e5e7eb;
}
.section-action:hover{
  border-color: var(--accent);
  color: var(--accent);
}

/* 7) أزرار عامة */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:12px 16px;
  border-radius:12px;
  font-weight:900;
  text-align:center;
  border:1px solid transparent;
  background: var(--accent);
  color:#fff;
  transition: background .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover{
  background: color-mix(in oklab, var(--accent) 88%, #000);
  box-shadow:0 8px 24px color-mix(in oklab, var(--accent) 20%, rgba(0,0,0,.08));
  transform: translateY(-2px);
}
.btn--light{
  background: color-mix(in oklab, var(--accent) 10%, #fff);
  color: color-mix(in oklab, var(--accent) 85%, #000);
  border-color: color-mix(in oklab, var(--accent) 25%, #e5e7eb);
}
.btn--light:hover{
  background:#fff;
  border-color: var(--accent);
  color: var(--accent);
}

/* 8) الجداول */
.table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  border-radius:12px;
  border:1px solid #e8edf3;
  background:#fff;
}
.table th,
.table td{
  padding:12px 14px;
  text-align:start;
}
.table thead th{
  background: color-mix(in oklab, var(--accent) 12%, #f8fafc);
  color:#0f172a;
  font-weight:900;
  border-bottom:1px solid color-mix(in oklab, var(--accent) 22%, #e8edf3);
}
.table tbody tr + tr td{
  border-top:1px solid #eef2f7;
}
.table tbody tr:hover td{
  background:#fafafa;
}

/* 9) Pagination */
.pagination{
  margin-top:14px;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  justify-content:center;
}
.page-numbers{
  display:inline-flex;
  min-width:42px;
  height:42px;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  padding:0 10px;
  font-weight:900;
  border:1px solid #e5e7eb;
  background:#fff;
  color:#0f172a;
}
.page-numbers:hover{
  border-color: var(--accent);
  color: var(--accent);
}
.page-numbers.current{
  background: var(--accent);
  color:#fff;
  border-color: var(--accent);
}

/* 10) صفحات المفرد */
.single-head{
  margin-bottom:12px;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.single-title{
  margin:0;
  font-weight:900;
  color:#0f172a;
  font-size: clamp(1.3rem, 3vw, 2rem);
}
.single-meta{
  color:#6b7280;
  font-size:.9rem;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.single-cover{
  margin: 10px 0 14px;
  border-radius:14px;
  overflow:hidden;
}
.single-cover img{
  width:100%;
  height:auto;
  display:block;
}
.single-content{
  line-height:2;
  color:#0f172a;
  font-size:1rem;
}
.single-content h2,
.single-content h3{
  margin:18px 0 8px;
  font-weight:900;
  color:#0f172a;
}
.single-content a{
  color: var(--accent);
  text-decoration:underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
}
.single-content a:hover{
  color: color-mix(in oklab, var(--accent) 88%, #000);
}

/* تنبيهات */
.alert{
  padding:12px 14px;
  border-radius:10px;
  border:1px solid transparent;
  margin:10px 0;
  background: color-mix(in oklab, var(--accent) 10%, #fff);
  color: color-mix(in oklab, var(--accent) 85%, #000);
  border-color: color-mix(in oklab, var(--accent) 20%, #ddd);
}
.alert--warn{
  background:#fff7ed;
  color:#92400e;
  border-color:#fdba74;
}
.alert--info{
  background:#eff6ff;
  color:#1e40af;
  border-color:#93c5fd;
}

/* 11) نتائج البحث */
.search-form{ margin-bottom:12px; }
.search-hits{
  display:flex;
  flex-direction:column;
  gap:10px;
}
.search-item{
  padding:12px;
  border-radius:12px;
  border:1px solid #e8edf3;
  background:#fff;
  transition: border-color .2s, transform .2s;
}
.search-item:hover{
  border-color: var(--accent);
  transform: translateY(-2px);
}
.search-title{
  margin:0 0 6px;
  font-weight:900;
  font-size:1.02rem;
  color:#0f172a;
}
.search-excerpt{
  margin:0;
  color:#6b7280;
  line-height:1.8;
}

/* 12) صفحة ثابتة عامة */
.page-content.box{ padding:20px; }
.page-content h2,
.page-content h3{
  color:#0f172a;
  font-weight:900;
  margin:16px 0 8px;
}

/* 13) 404 */
.notfound{
  text-align:center;
  padding: 28px 0;
}
.notfound h1{
  font-size: clamp(2rem, 6vw, 3rem);
  margin:0 0 8px;
  font-weight:900;
  color:#0f172a;
}
.notfound p{
  color:#6b7280;
}

/* 14) شرائط تصفية */
.filters{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  margin:0 0 12px;
}
.filter{
  padding:8px 12px;
  border-radius:999px;
  font-weight:800;
  border:1px solid color-mix(in oklab, var(--accent) 18%, #e5e7eb);
  background: color-mix(in oklab, var(--accent) 6%, #fff);
  color:#0f172a;
}
.filter.is-active,
.filter:hover{
  background: var(--accent);
  color:#fff;
  border-color: var(--accent);
}

/* 15) روابط داخلية بين درس/فرض/امتحان/وثيقة */
.relations{
  display:grid;
  grid-template-columns: repeat(3,1fr);
  gap:12px;
  margin-top:12px;
}
.relations a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px;
  border-radius:12px;
  border:1px solid #e5e7eb;
  background:#fff;
  font-weight:900;
}
.relations a:hover{
  border-color: var(--accent);
  color: var(--accent);
}
@media (max-width: 768px){
  .relations{ grid-template-columns: 1fr; }
}

/* 16) عناصر تحكم */
.form-row{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
}
.select,
select,
.input,
input[type="text"],
input[type="search"]{
  height: 44px;
  padding-inline:12px;
  border-radius:10px;
  border:1px solid #e5e7eb;
  background:#fff;
  font-family: inherit;
}
.select:focus,
select:focus,
.input:focus,
input[type="text"]:focus,
input[type="search"]:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, #cfe8ff);
}

/* 17) تحسينات RTL */
html[dir="rtl"] .card__more::after{ content:"↤"; }
html[dir="ltr"] .card__more::after{ content:"↦"; }

/* 18) طباعة */
@media print{
  .site-header,
  .site-footer,
  .sidebar,
  .breadcrumbs,
  .pagination{ display:none !important; }
  .page-wrap{ width:100%; padding:0 }
  .box{ box-shadow:none; border-color:#ddd }
}

/* =========================================================
   استايل صفحة السلك (lessons-cycle.php)
   ========================================================= */

/* هنا نصحح التكرار: هذه النسخة مخصصة لصفحات السلك فقط */
.page-cycle .page-head {
  background: linear-gradient(180deg, rgba(0,0,0,.02) 0%, #fff 100%);
  border-block-end: 1px solid rgba(0,0,0,.08);
  padding: 18px 0;
}
.page-cycle .page-head__inner {
  width: min(1160px, 92%);
  margin-inline: auto;
}
.page-cycle .page-title {
  margin: 0;
  font-weight: 900;
  font-size: clamp(1.3rem, 3vw, 2rem);
  color: var(--text);
}

/* شبكة المستويات - تم تعطيلها لصالح التصميم في ملفات القوالب */
.mx-levels {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  list-style: none;
  padding: 0;
}

/* بطاقة المستوى للدروس */
.mx-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 14px;
  background: #fff;
  border: 2px solid var(--accent);
  font-weight: 900;
  font-size: 1.1rem;
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(0,0,0,.05);
  transition: all .25s ease;
}
.mx-card__title { margin: 0; }

.mx-card::after {
  content: "›";
  font-size: 22px;
  line-height: 1;
  color: var(--accent);
  transition: transform .2s ease, color .2s ease;
}
html[dir="rtl"] .mx-card::after { transform: scaleX(-1); }

.mx-card:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}
.mx-card:hover::after {
  color: #fff;
  transform: translateX(-6px) scaleX(-1);
}
html[dir="ltr"] .mx-card:hover::after { transform: translateX(6px); }

/* الشريط الجانبي لصفحات السلك */
.sidebar .widget {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}
.sidebar .widget__title {
  margin: 0 0 8px;
  font-weight: 900;
  color: #0f172a;
  font-size: 1.05rem;
  position: relative;
}
.sidebar .widget__title::after {
  content: "";
  display: block;
  height: 3px;
  width: 48px;
  border-radius: 999px;
  margin-top: 6px;
  background: var(--accent);
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar a {
  color: #374151;
  font-weight: 700;
  border-radius: 8px;
  padding: 6px 8px;
  display: block;
}
.sidebar a:hover {
  background: var(--accent);
  color: #fff;
}

/* ===========================
   Madarisy — Breadcrumb (soft)
   =========================== */
.breadcrumbs{
  background: linear-gradient(180deg, color-mix(in oklab, var(--edu-green) 6%, #fff) 0%, #fff 100%);
  border-block-end: 1px solid color-mix(in oklab, var(--edu-blue) 16%, #fff);
}
.breadcrumbs .bc-inner{
  width: min(1160px, 92%);
  margin-inline: auto;
  padding: 10px 0 14px;
  direction: rtl;
}
.bc-list{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-weight: 800;
  font-size: .98rem;
  color: #475569;
}
.bc-item{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bc-link{
  color: color-mix(in oklab, var(--edu-green) 70%, #000);
  text-decoration: none;
  border-radius: 8px;
  padding: 4px 2px;
  transition: color .2s, background .2s;
}
.bc-link:hover{
  color: var(--edu-green);
  background: color-mix(in oklab, var(--edu-green) 6%, #fff);
}
.bc-current{
  color: #0f172a;
  font-weight: 900;
  padding: 4px 2px;
}
.sep{
  color: color-mix(in oklab, var(--edu-blue) 70%, #000);
  opacity: .45;
  font-weight: 900;
  line-height: 1;
}
html[dir="rtl"] .sep{ transform: scaleX(-1); }

/* ألوان حسب السلك */
body.cycle-college .bc-link{
  color: color-mix(in oklab, var(--edu-blue) 70%, #000);
}
body.cycle-college .bc-link:hover{
  color: var(--edu-blue);
  background: color-mix(in oklab, var(--edu-blue) 6%, #fff);
}
body.cycle-lycee .bc-link{
  color: color-mix(in oklab, var(--edu-orange) 70%, #000);
}
body.cycle-lycee .bc-link:hover{
  color: var(--edu-orange);
  background: color-mix(in oklab, var(--edu-orange) 6%, #fff);
}

@media (max-width:640px){
  .bc-list{ font-size: .94rem; }
}

/* ===== Lessons Cycle Page polish (scoped) ===== */
.page-head + .page-wrap { margin-top: .5rem; }
.page-grid .box > .widget { margin-bottom: 1rem; }
.page-grid .box > .widget:last-child { margin-bottom: 0; }

.page-grid .box .mx-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  padding: 0;
  margin: .5rem 0 1rem;
  list-style: none;
}
.page-grid .box .mx-level { margin: 0; }
.page-grid .box .mx-level .mx-card {
  display: block;
  min-height: 56px;
  padding: .75rem 1rem;
}
.page-grid .box .mx-card__title {
  display: block;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-grid .box .widget .mx-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
}
.page-grid .box .widget .mx-links li { margin: 0; }
.page-grid .box .widget .faq {
  margin: .5rem 0;
  padding: .6rem .8rem;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: .75rem;
}
.page-grid .box .widget .faq__q { font-weight: 700; }
.page-grid .box .widget .faq__a { margin-top: .5rem; opacity: .9; }
.page-grid .sidebar .widget { margin-bottom: 1rem; }

html[dir="rtl"] .page-grid .box .mx-links { gap: .5rem 1rem; }

@media (max-width: 640px) {
  .page-grid .box .mx-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
  .page-grid .box .mx-level .mx-card {
    padding: .65rem .8rem;
    min-height: 52px;
  }
}

/* ===== Final Harmonize — Lessons Cycle (scoped) ===== */
.page-cycle .page-head + .page-wrap { margin-top: .25rem; }
.page-cycle .page-grid .box > .widget { margin-bottom: .8rem; }
.page-cycle .page-grid .box > .widget:last-child { margin-bottom: 0; }
/* تم تعطيل grid layout لصالح التصميم العمودي في ملفات القوالب */
.page-cycle .mx-levels{
  display:flex !important;
  flex-direction:column !important;
  gap: 16px !important;
  list-style:none;
  margin: 20px 0 0 !important;
  padding:0;
}
.page-cycle .mx-level .mx-card{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: 56px;
  text-align:center;
  padding: 14px 16px;
}
.page-cycle .mx-card__title{
  display:block;
  max-width:100%;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  line-height:1.35;
}
.page-cycle .mx-level .mx-card::after{
  content:"›";
  font-size: 20px;
  line-height:1;
  margin-inline-start: 8px;
  transform: none;
}
html[dir="rtl"] .page-cycle .mx-level .mx-card::after{ transform: scaleX(-1); }
.page-cycle .mx-level .mx-card:hover::after{
  transform: translateX(6px);
}
html[dir="rtl"] .page-cycle .mx-level .mx-card:hover::after{
  transform: translateX(-6px) scaleX(-1);
}
.page-cycle .box .widget .mx-links{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:.5rem .75rem;
  list-style:none;
  margin:.5rem 0 0;
  padding:0;
}
.page-cycle .box .widget .mx-links li{ margin:0; }
@media (max-width:640px){
  .page-cycle .box .widget .mx-links{ grid-template-columns: 1fr; }
}
.page-cycle .box .widget .faq{
  margin:.5rem 0;
  padding:.6rem .8rem;
  border:1px solid rgba(0,0,0,.08);
  border-radius:.75rem;
}
.page-cycle .box .widget .faq__q{ font-weight:900; line-height:1.4; }
.page-cycle .box .widget .faq__a{ margin-top:.45rem; opacity:.9; }
.page-cycle .page-grid .sidebar .widget{ margin-bottom: .9rem; }

/* شبكة mx-cards عامة */
.mx-cards{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:16px;
  grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
}
.mx-card{
  background:#fff;
  border:1px solid #eee;
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 6px 20px rgba(0,0,0,.04);
  transition:transform .15s;
}
.mx-card:hover{ transform:translateY(-3px); }
.mx-card__link{
  display:block;
  color:inherit;
  text-decoration:none;
}
.mx-card__media img{
  display:block;
  width:100%;
  height:170px;
  object-fit:cover;
}
.mx-card__body{ padding:12px 14px; }
.mx-card__title{
  font-size:18px;
  line-height:1.5;
  margin:0 0 6px;
  font-weight:800;
}
.mx-card__meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:6px;
}
.mx-pill{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
}
.mx-pill--subject{
  border-color:#dbeafe;
  background:#eff6ff;
}
.mx-pill--level{
  border-color:#dcfce7;
  background:#f0fdf4;
}
.mx-card__excerpt{
  margin:6px 0 0;
  color:#475569;
  line-height:1.7;
}
.mx-pagination{
  margin-top:16px;
  text-align:center;
}

/* =========================================================
   Home Page — تحسين خاص
   ========================================================= */

/* البحث في الهوم */
.mx-search{
  display:flex;
  gap:10px;
  align-items:stretch;
}
.mx-search__input,
.mx-search__btn{
  -webkit-appearance:none;
  appearance:none;
  line-height:1;
  border-radius:12px;
}
.mx-search__input{
  flex:1;
  border:1px solid #e5e7eb;
  padding-inline:16px;
  background:#fff;
}
.mx-search__btn{
  border:0;
  background:var(--edu-orange);
  color:#fff;
  min-width:120px;
  font-weight:900;
}

@media (max-width: 920px){
  .mx-search{
    flex-direction:column;
    gap:12px;
  }
}
@media (max-width: 768px){
  .mx-search__input{
    height:62px!important;
    font-size:1.12rem;
    padding-inline:18px;
  }
  .mx-search__btn{
    height:62px!important;
    font-size:1.12rem;
    width:100%;
  }
  .mx-search__input::placeholder{
    font-size:1.02rem;
  }
}
@media (max-width: 540px){
  .mx-search__input{
    height:68px!important;
    font-size:1.18rem;
    padding-inline:20px;
  }
  .mx-search__btn{
    height:68px!important;
    font-size:1.18rem;
  }
}

/* خط سفلي ملوّن أسفل H2 في البلوكات */
.mx-block__title{
  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-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-block--levels .mx-levels .mx-card,
.mx-block--levels .mx-levels .mx-card *{
  text-decoration:none!important;
}

/* أزرار mx-mini في الهوم — نفس الحجم، سطر واحد */
body.home .mx-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap:10px;
}
body.home .mx-grid .mx-mini{
  min-height:50px;
  max-height:50px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:0.95rem;
  padding-inline:12px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* المستجدات في الهوم — بدون تاريخ وبشكل أنيق */
body.home .mx-news{
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:8px;
}
body.home .mx-news__item{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #e8edf3;
  background:#fff;
  box-shadow:0 4px 12px rgba(15,23,42,.03);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
body.home .mx-news__title{
  display:inline-flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  color:#0f172a;
  text-decoration:none;
  line-height:1.6;
}
body.home .mx-news__title::before{
  content:"";
  width:8px;
  height:8px;
  border-radius:999px;
  background:var(--accent, var(--edu-blue));
  flex-shrink:0;
}
body.home .mx-news__item:hover{
  border-color: color-mix(in oklab, var(--accent, var(--edu-blue)) 35%, #e8edf3);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
  transform: translateY(-2px);
}
body.home .mx-news__item:hover .mx-news__title{
  color:var(--accent, var(--edu-blue));
}

/* زر المزيد من الأخبار */
.mx-more-wrap{
  margin-top:10px;
}
.mx-more{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid #e5e7eb;
  background:#f9fafb;
  font-weight:800;
  color:#0f172a;
  text-decoration:none;
}
.mx-more:hover{
  border-color:var(--accent);
  color:var(--accent);
}

/* ===== إصلاح محرك البحث في صفحة الدروس (/lessons) ===== */

.mx-search-wide{
  margin-top: 12px;
}

/* صف البحث: حاسوب / تابلت */
.mx-search-wide .form-row{
  display: grid;
  grid-template-columns: 1fr 140px 160px;
  gap: 10px;
  align-items: stretch;
}

/* خانة البحث */
.mx-search-wide__input{
  height: 68px;
  border-radius: 14px;
  padding-inline: 18px;
  font-size: 1.1rem;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(15,23,42,.03);
}

/* الزرين: بحث + بحث متقدم */
.mx-search-wide__btn,
.mx-search-wide__btn--light{
  height: 68px;
  border-radius: 14px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

/* في الهاتف: عناصر تحت بعض وبعرض 100% */
@media (max-width: 768px){
  .mx-search-wide .form-row{
    grid-template-columns: 1fr;
  }

  .mx-search-wide__btn,
  .mx-search-wide__btn--light{
    width: 100%;
  }

  .mx-search-wide__input{
    height: 72px;
    font-size: 1.05rem;
  }
}