/*
Theme Name: Madarisy Unified
Theme URI: https://madarisy.com
Author: Madarisy Team
Description: قالب احترافي شامل لمنصة التعليم المغربي
Version: 3.0.0
License: GNU General Public License v2 or later
Text Domain: madarisy-unified
*/

/* ============================================================
   DESIGN TOKENS — Single source of truth for all colors/sizes
   ============================================================ */
:root {
  /* Brand colours */
  --clr-green: #059669;
  /* Emerald-600  */
  --clr-blue: #2563eb;
  /* Blue-600     */
  --clr-orange: #d97706;
  /* Amber-600    */
  --clr-teal: #0891b2;
  /* Cyan-600     */
  --clr-purple: #7c3aed;
  /* Violet-600   */

  /* Neutrals (Slate scale) */
  --clr-slate-50: #f8fafc;
  --clr-slate-100: #f1f5f9;
  --clr-slate-200: #e2e8f0;
  --clr-slate-300: #cbd5e1;
  --clr-slate-400: #94a3b8;
  --clr-slate-500: #64748b;
  --clr-slate-600: #475569;
  --clr-slate-700: #334155;
  --clr-slate-800: #1e293b;
  --clr-slate-900: #0f172a;

  /* Semantic aliases */
  --accent: var(--clr-green);
  --accent-dark: color-mix(in srgb, var(--accent) 80%, #000);
  --accent-light: color-mix(in srgb, var(--accent) 12%, #fff);
  --accent-border: color-mix(in srgb, var(--accent) 25%, var(--clr-slate-200));

  --bg: var(--clr-slate-50);
  --bg-card: #ffffff;
  --text: var(--clr-slate-800);
  --text-muted: var(--clr-slate-500);
  --border: var(--clr-slate-200);

  /* Elevation */
  --shadow-xs: 0 1px 2px rgb(0 0 0 / .05);
  --shadow-sm: 0 2px 6px rgb(0 0 0 / .07);
  --shadow-md: 0 6px 18px rgb(0 0 0 / .09);
  --shadow-lg: 0 12px 32px rgb(0 0 0 / .12);

  /* Shape */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  /* Container */
  --container: 1180px;
  --gap: clamp(14px, 2.5vw, 24px);
}

/* Cycle-level accent overrides */
body.cycle-primary {
  --accent: var(--clr-green);
}

body.cycle-college {
  --accent: var(--clr-blue);
}

body.cycle-lycee {
  --accent: var(--clr-orange);
}

/* edu-* aliases (legacy compat) */
:root {
  --edu-green: var(--clr-green);
  --edu-blue: var(--clr-blue);
  --edu-orange: var(--clr-orange);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: 'Tajawal', 'Cairo', system-ui, -apple-system, sans-serif;
  font-size: clamp(15px, 1.5vw, 16px);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 800;
  line-height: 1.3;
  color: var(--clr-slate-900);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.mx-container,
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 24px);
}

.mx-sections {
  padding-block: var(--gap);
}

/* ============================================================
   HEADER
   ============================================================ */
.mx-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

/* Top bar */
.mx-topbar {
  background: var(--accent);
  color: #fff;
  font-size: .85rem;
}

.mx-topbar .mx-container {
  padding-block: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mx-menu--topbar {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mx-menu--topbar a {
  color: rgba(255, 255, 255, .9);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  transition: background .18s;
}

.mx-menu--topbar a:hover {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.mx-topbar-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 4px;
}

/* Main bar */
.mx-mainbar {
  padding-block: 10px;
}

.mx-mainbar__inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Brand */
.mx-brand {
  flex-shrink: 0;
}

.mx-brand img,
.mx-brand .custom-logo {
  height: 44px;
  width: auto;
}

.mx-brand__title {
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--accent);
}

/* Primary nav */
.mx-primary-nav {
  flex: 1;
}

.mx-menu--primary {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mx-menu--primary>li {
  position: relative;
}

.mx-menu--primary>li>a {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: .95rem;
  color: var(--clr-slate-700);
  transition: background .18s, color .18s;
}

.mx-menu--primary>li>a:hover,
.mx-menu--primary>li.current-menu-item>a,
.mx-menu--primary>li.current-menu-ancestor>a {
  background: var(--accent-light);
  color: var(--accent);
}

/* Dropdown */
.mx-menu--primary .sub-menu {
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 200;
}

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

.mx-menu--primary .sub-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--clr-slate-700);
  font-weight: 600;
  border-radius: 0;
  transition: background .15s, color .15s;
}

.mx-menu--primary .sub-menu a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.mx-menu--primary .sub-menu li+li {
  border-top: 1px solid var(--border);
}

/* Hamburger toggle */
.mx-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.mx-toggle__bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transition: transform .25s;
}

/* Close btn inside nav */
.mx-close-btn {
  display: none;
}

/* Overlay */
.mx-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 800;
  display: none;
}

body.mx-menu-open .mx-overlay {
  display: block;
}

/* Mobile topbar inside nav */
.mx-mobile-topbar-menu {
  display: none;
}

@media (max-width: 900px) {
  .mx-toggle {
    display: flex;
    order: -1;
  }

  .mx-topbar-toggle {
    display: flex;
  }

  .mx-primary-nav {
    position: fixed;
    inset-block: 0;
    inset-inline-end: -100%;
    width: min(320px, 85vw);
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 900;
    transition: inset-inline-end .3s ease;
    overflow-y: auto;
    padding: 20px 0 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  body.mx-menu-open .mx-primary-nav {
    inset-inline-end: 0;
  }

  .mx-close-btn {
    display: flex;
    align-self: flex-end;
    margin-bottom: 8px;
    margin-inline-end: 16px;
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 4px;
    color: var(--clr-slate-600);
  }

  .mx-menu--primary {
    flex-direction: column;
    gap: 0;
    padding: 0 12px 16px;
  }

  .mx-menu--primary>li>a {
    padding: 12px 14px;
    font-size: 1rem;
  }

  .mx-menu--primary .sub-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: 0;
    background: var(--clr-slate-50);
    border-radius: var(--radius-sm);
    margin: 4px 0 8px;
  }

  .mx-mobile-topbar-menu {
    display: block;
    border-bottom: 1px solid var(--border);
    padding: 12px 12px 8px;
  }

  .mx-menu--mobile-topbar {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .mx-menu--mobile-topbar a {
    display: block;
    padding: 8px 12px;
    color: var(--clr-slate-700);
    font-weight: 600;
    border-radius: var(--radius-sm);
  }

  .mx-menu--mobile-topbar a:hover {
    background: var(--accent-light);
    color: var(--accent);
  }
}

/* ============================================================
   BREADCRUMB
   ============================================================ */
.mx-breadcrumb,
.breadcrumb-wrap {
  background: var(--clr-slate-100);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  font-size: .875rem;
}

.mx-breadcrumb .mx-container,
.breadcrumb-wrap .container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.mx-breadcrumb a,
.breadcrumb-wrap a {
  color: var(--accent);
  font-weight: 600;
}

.mx-breadcrumb a:hover,
.breadcrumb-wrap a:hover {
  text-decoration: underline;
}

.mx-breadcrumb .sep,
.breadcrumb-wrap .sep {
  color: var(--clr-slate-400);
}

/* ============================================================
   FOOTER
   ============================================================ */
.mx-footer,
.site-footer {
  background: var(--clr-slate-900);
  color: var(--clr-slate-300);
  padding: 48px 0 0;
  margin-top: 60px;
}

.mx-footer__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  padding-bottom: 40px;
}

.mx-footer__brand-name {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 8px;
}

.mx-footer__brand-desc {
  font-size: .9rem;
  line-height: 1.7;
  color: var(--clr-slate-400);
}

.mx-footer__col-title {
  font-size: .9rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.mx-footer__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mx-footer__links a {
  color: var(--clr-slate-400);
  font-size: .9rem;
  transition: color .18s;
}

.mx-footer__links a:hover {
  color: #fff;
}

.mx-footer__bottom {
  border-top: 1px solid var(--clr-slate-700);
  padding: 16px 0;
  text-align: center;
  font-size: .85rem;
  color: var(--clr-slate-500);
}

.mx-footer__bottom a {
  color: var(--clr-slate-400);
}

.mx-footer__bottom a:hover {
  color: #fff;
}

/* ============================================================
   PAGE SHELL (wraps main content area)
   ============================================================ */
.site-main {
  min-height: 60vh;
}

.page-wrap {
  max-width: var(--container);
  margin-inline: auto;
  padding: 28px clamp(12px, 3vw, 24px) 48px;
}

/* Two-column: content + sidebar */
.page-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--gap);
  align-items: start;
}

@media (max-width: 960px) {
  .page-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   BOX / CARD CONTAINERS
   ============================================================ */
.box,
.mx-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: clamp(16px, 3vw, 24px);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 800;
  font-size: .95rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  white-space: nowrap;
}

.btn-primary,
.btn:not(.btn--light):not(.btn-secondary) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover,
.btn:not(.btn--light):not(.btn-secondary):hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn--light,
.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent-border);
}

.btn--light:hover,
.btn-secondary:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================
   FORM INPUTS
   ============================================================ */
.input,
input[type="text"],
input[type="search"],
input[type="email"],
textarea,
select {
  width: 100%;
  height: 48px;
  padding-inline: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  transition: border-color .2s, box-shadow .2s;
}

.input:focus,
input[type="text"]:focus,
input[type="search"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea {
  height: auto;
  min-height: 120px;
  padding-block: 12px;
  resize: vertical;
}

.input::placeholder {
  color: var(--clr-slate-400);
  font-weight: 500;
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title,
.widget__title,
.mx-block__title {
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 900;
  color: var(--clr-slate-900);
  margin-bottom: 16px;
  position: relative;
  padding-inline-end: 16px;
}

.section-title::after,
.widget__title::after,
.mx-block__title::after {
  content: '';
  display: block;
  width: 52px;
  height: 4px;
  background: var(--accent);
  border-radius: 999px;
  margin-top: 8px;
}

.mx-block__desc,
.widget__desc {
  color: var(--text-muted);
  font-size: .97rem;
  line-height: 1.8;
  margin: 0 0 14px;
}

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination,
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}

.page-numbers {
  display: inline-flex;
  min-width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 800;
  font-size: .9rem;
  padding-inline: 10px;
  transition: all .18s;
}

.page-numbers:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.page-numbers.current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ============================================================
   SIDEBAR WIDGETS
   ============================================================ */
.sidebar .widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}

.sidebar .widget a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  color: var(--clr-slate-700);
  transition: background .15s, color .15s;
}

.sidebar .widget a:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.sidebar .widget ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* ============================================================
   HOMEPAGE — FRONT PAGE
   ============================================================ */
.mx-hero {
  background: linear-gradient(135deg, var(--clr-slate-900) 0%, color-mix(in srgb, var(--accent) 30%, var(--clr-slate-900)) 100%);
  color: #fff;
  padding: clamp(48px, 8vw, 80px) 0;
  text-align: center;
}
.mx-hero__title { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 900; margin-bottom: 16px; color: #fff; }
.mx-hero__desc { font-size: clamp(1rem, 2vw, 1.2rem); color: rgba(255,255,255,.8); max-width: 640px; margin: 0 auto 28px; }
.mx-hero__actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Homepage intro header (used in /lessons /devoirs /exams home pages) */
.mx-sections--intro-subjects { background: linear-gradient(135deg, var(--clr-slate-900), color-mix(in srgb, var(--accent) 25%, var(--clr-slate-900))); }
.mx-intro-header { text-align: center; padding: clamp(28px, 6vw, 56px) 0; }
.mx-intro-header__title { font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 900; color: #fff; margin-bottom: 14px; }
.mx-intro-header__desc { font-size: clamp(.95rem, 1.8vw, 1.1rem); color: rgba(255,255,255,.8); max-width: 680px; margin: 0 auto 20px; }
.mx-intro-header__badges { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.mx-intro-header__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px; border-radius: 999px;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22);
  color: #fff; font-weight: 700; font-size: .95rem;
}
.mx-intro-header__badge strong { font-weight: 900; color: #fff; }

/* Cycle cards on homepage */
.mx-cycles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--gap);
  margin-top: 24px;
}
.mx-cycle-card {
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 10px; padding: 24px; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text);
  transition: all .25s;
}
.mx-cycle-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.mx-cycle-card__icon { font-size: 2.8rem; line-height: 1; }
.mx-cycle-card__title { font-size: 1.2rem; font-weight: 900; color: var(--clr-slate-900); }
.mx-cycle-card__desc { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }
.mx-cycle-card__arrow { margin-top: auto; color: var(--accent); font-weight: 900; font-size: 1.1rem; }

/* Level buttons (used in lessons/exams/devoirs home) */
.mx-levels {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.mx-level-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius);
  background: var(--bg-card); border: 2px solid var(--lv, var(--border));
  color: var(--lv, var(--text)); font-weight: 800; font-size: .95rem;
  text-decoration: none; transition: all .2s; cursor: pointer;
}
.mx-level-btn:hover {
  background: var(--lv, var(--accent));
  color: #fff; border-color: var(--lv, var(--accent));
  transform: translateY(-3px); box-shadow: var(--shadow-md);
}
.mx-level-icon { flex-shrink: 0; font-size: 1.3em; }

/* Level colour tokens */
.level-1ap,.level-2ap,.level-3ap { --lv: #059669; }
.level-4ap,.level-5ap,.level-6ap { --lv: #0891b2; }
.level-1ac,.level-2ac,.level-3ac { --lv: #2563eb; }
.level-common-core,.level-1bac,.level-2bac { --lv: #d97706; }

/* Cycle cards for levels (mx-card variants used in cycle templates) */
.mx-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--radius-lg);
  background: var(--bg-card); border: 2px solid var(--border);
  text-decoration: none; color: var(--text); transition: all .25s;
  box-shadow: var(--shadow-xs);
}
.mx-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.mx-card__emoji { font-size: 2.8rem; flex-shrink: 0; transition: transform .3s; }
.mx-card:hover .mx-card__emoji { transform: scale(1.15) rotate(5deg); }
.mx-card__body { display: flex; flex-direction: column; gap: 4px; }
.mx-card__title { font-size: 1.1rem; font-weight: 900; color: var(--clr-slate-900); }
.mx-card__desc { font-size: .88rem; color: var(--text-muted); }
.mx-card--primary { border-color: #86efac; background: linear-gradient(135deg,#fff,#f0fdf4); }
.mx-card--primary:hover { background: var(--clr-green); border-color: var(--clr-green); }
.mx-card--primary:hover .mx-card__title, .mx-card--primary:hover .mx-card__desc { color: #fff; }
.mx-card--college { border-color: #93c5fd; background: linear-gradient(135deg,#fff,#eff6ff); }
.mx-card--college:hover { background: var(--clr-blue); border-color: var(--clr-blue); }
.mx-card--college:hover .mx-card__title, .mx-card--college:hover .mx-card__desc { color: #fff; }
.mx-card--lycee { border-color: #fcd34d; background: linear-gradient(135deg,#fff,#fffbeb); }
.mx-card--lycee:hover { background: var(--clr-orange); border-color: var(--clr-orange); }
.mx-card--lycee:hover .mx-card__title, .mx-card--lycee:hover .mx-card__desc { color: #fff; }

/* Resource tiles */
.mx-res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 12px; }
.mx-res-tile {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 60px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  font-weight: 800; color: var(--text); text-decoration: none;
  box-shadow: var(--shadow-xs); transition: all .18s;
}
.mx-res-tile:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.mx-res-cta { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--clr-slate-100); display: flex; align-items: center; justify-content: center; font-weight: 900; flex-shrink: 0; }

/* Search bar (wide) */
.mx-search-wide { margin-top: 12px; }
.mx-search-wide__row { display: flex; gap: 10px; flex-wrap: wrap; }
.mx-search-wide__input { flex: 1; min-width: 200px; }
.mx-search-wide__btn { height: 48px; padding-inline: 24px; background: var(--accent); color: #fff; border: 0; border-radius: var(--radius); font-weight: 800; cursor: pointer; transition: all .2s; white-space: nowrap; }
.mx-search-wide__btn:hover { background: var(--accent-dark); transform: translateY(-2px); }
.mx-search-wide__btn--light { background: var(--accent-light); color: var(--accent); border: 2px solid var(--accent-border); }
.mx-search-wide__btn--light:hover { background: var(--accent); color: #fff; }
.mx-search-wide__hint { font-size: .88rem; color: var(--text-muted); margin-top: 8px; }

/* Section separator */
.mx-section-separated { margin-block: 28px; }

/* SEO content blocks */
.mx-seo-content h2 { font-size: clamp(1.3rem,3vw,1.8rem); font-weight: 900; color: var(--clr-slate-900); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--accent); }
.mx-seo-content h3 { font-size: clamp(1.1rem,2.2vw,1.4rem); font-weight: 800; color: var(--clr-slate-800); margin: 22px 0 10px; }
.mx-seo-content p { font-size: 1rem; line-height: 1.9; color: var(--clr-slate-700); margin-bottom: 14px; }
.mx-seo-list { list-style: none; padding: 0; margin: 12px 0; }
.mx-seo-list li { padding: 8px 0 8px 30px; position: relative; font-size: 1rem; line-height: 1.8; color: var(--clr-slate-700); }
.mx-seo-list li::before { content: "✓"; position: absolute; left: 0; top: 8px; background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .82rem; font-weight: 900; }
html[dir="rtl"] .mx-seo-list li { padding: 8px 30px 8px 0; }
html[dir="rtl"] .mx-seo-list li::before { left: auto; right: 0; }

/* FAQ */
.faq-group { display: flex; flex-direction: column; gap: 10px; }
.faq { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; box-shadow: var(--shadow-xs); }
.faq__q { cursor: pointer; font-weight: 800; color: var(--accent); font-size: 1rem; padding: 14px 16px; display: block; list-style: none; }
.faq[open] .faq__q { border-bottom: 1px solid var(--border); }
.faq__a p { margin: 0; padding: 14px 16px; color: var(--clr-slate-700); line-height: 1.9; }

/* Back button */
.mx-back { margin-top: 24px; text-align: center; padding-top: 20px; border-top: 1px solid var(--border); }
.mx-back__btn, .mx-back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius);
  font-weight: 800; background: var(--bg-card); border: 2px solid var(--accent);
  color: var(--accent); cursor: pointer; transition: all .2s; font-size: .95rem;
}
.mx-back__btn:hover, .mx-back-btn:hover { background: var(--accent); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   SINGLE POST TEMPLATES (lesson / devoir / exam)
   Shared structure for all three single post types
   ============================================================ */

/* Main container */
.lesson-container,
.devoir-container,
.exam-container,
.single-post-container {
  max-width: min(900px, 100%);
  margin-inline: auto;
  padding: 28px clamp(14px,3vw,24px) 48px;
}

/* Page title */
.lesson-title,
.devoir-title,
.exam-title,
.single-post-title {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--clr-slate-900);
  line-height: 1.3;
  margin-bottom: 14px;
}

/* Meta row (level / subject / branch) */
.lesson-meta,
.devoir-meta,
.exam-meta,
.single-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 800;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

/* Intro paragraph */
.lesson-intro,
.devoir-intro,
.exam-intro {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-right: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 24px;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--clr-slate-700);
  box-shadow: var(--shadow-xs);
}
html[dir="rtl"] .lesson-intro,
html[dir="rtl"] .devoir-intro,
html[dir="rtl"] .exam-intro { border-right: none; border-left: 4px solid var(--accent); }

/* Section blocks inside single post */
.lesson-summary-section,
.lesson-exercises-section,
.devoir-section,
.exam-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(18px,3vw,28px);
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}

/* Section sub-titles */
.lesson-summary-title,
.lesson-summary-section h2,
.lesson-exercises-section h2,
.exam-section h2,
.devoir-section h2 {
  font-size: clamp(1.1rem,2.5vw,1.35rem);
  font-weight: 900;
  color: var(--clr-slate-900);
  margin-bottom: 12px;
  text-align: center;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

/* SEO paragraph inside sections */
.lesson-summary-seo {
  background: var(--clr-slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: .95rem;
  color: var(--clr-slate-600);
  line-height: 1.9;
}

/* Content blocks */
.lesson-content-block,
.exercise-content-block { margin-bottom: 18px; }
.lesson-content-block h2,
.exercise-content-block h2 { font-size: 1.1rem; font-weight: 800; color: var(--clr-slate-800); margin-bottom: 10px; }

/* File list */
.lesson-files,
.devoir-files,
.exam-files { margin-top: 8px; }
.lesson-files ul,
.devoir-files ul,
.exam-files ul { display: flex; flex-direction: column; gap: 12px; padding: 0; }

/* Each file row */
.lesson-file-row,
.devoir-file-row,
.exam-file-row {
  background: var(--clr-slate-50);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  list-style: none;
}

/* Button group per file */
.lesson-buttons-group,
.devoir-buttons-group,
.exam-buttons-group,
.solution-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* File label */
.file-label {
  flex: 1;
  min-width: 180px;
  font-weight: 700;
  font-size: .95rem;
  color: var(--clr-slate-700);
}

/* Download and view buttons */
.btn-download,
.btn-view {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: .9rem;
  text-decoration: none;
  transition: all .18s;
  cursor: pointer;
  white-space: nowrap;
  border: 2px solid transparent;
}
.btn-download {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-download:hover { background: var(--accent-dark); border-color: var(--accent-dark); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-view {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--accent-border);
}
.btn-view:hover { background: var(--accent-light); border-color: var(--accent); transform: translateY(-2px); }

/* Solution buttons (green tint) */
.solution-buttons .btn-download { background: var(--clr-green); border-color: var(--clr-green); }
.solution-buttons .btn-download:hover { background: color-mix(in srgb, var(--clr-green) 80%, #000); }
.solution-buttons .btn-view { color: var(--clr-green); border-color: color-mix(in srgb, var(--clr-green) 30%, var(--border)); }

/* No-content message */
.no-content-message { margin: 20px 0; }
.no-content-box {
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}
.no-content-box h2 { font-size: 1.3rem; font-weight: 800; color: var(--clr-slate-700); margin-bottom: 12px; }
.no-content-box p { color: var(--clr-slate-500); line-height: 1.8; }

/* Related lessons list */
.related-lessons {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.related-lessons h2 { font-size: 1.1rem; font-weight: 900; color: var(--clr-slate-900); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.related-lessons ul { display: flex; flex-direction: column; gap: 4px; }
.related-lessons li { list-style: none; }
.related-lessons a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  color: var(--clr-slate-700); font-weight: 700; font-size: .95rem;
  transition: background .15s, color .15s;
}
.related-lessons a::before { content: '›'; color: var(--accent); font-size: 1.2rem; font-weight: 900; flex-shrink: 0; }
.related-lessons a:hover { background: var(--accent-light); color: var(--accent); }

/* Enhanced related links section */
.related-links-section-enhanced {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.related-links-header { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--border); }
.related-links-title-enhanced { font-size: 1.15rem; font-weight: 900; color: var(--clr-slate-900); }
.related-links-category { margin-bottom: 18px; }
.related-links-category-title { font-size: .92rem; font-weight: 800; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.related-links-grid-enhanced {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 8px;
}
.related-link-item-enhanced {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius);
  background: var(--clr-slate-50); border: 1px solid var(--border);
  color: var(--clr-slate-700); font-weight: 700; font-size: .9rem;
  text-decoration: none; transition: all .18s;
}
.related-link-item-enhanced:hover { background: var(--accent); color: #fff; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.link-icon { font-size: 1.1em; flex-shrink: 0; }
.link-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lesson navigation (prev / next) */
.lesson-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  box-shadow: var(--shadow-xs);
}
.nav-item:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.nav-disabled { opacity: .4; pointer-events: none; }
.nav-next { justify-content: flex-end; text-align: end; }
.nav-arrow { font-size: 1.5rem; color: var(--accent); flex-shrink: 0; }
.nav-content { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.nav-title { font-weight: 800; font-size: .95rem; color: var(--clr-slate-800); }
@media (max-width: 600px) { .lesson-navigation { grid-template-columns: 1fr; } }

/* Back section */
.lesson-back-section { text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }
.back-button, .mx-back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: var(--radius);
  font-weight: 800; background: var(--bg-card); border: 2px solid var(--accent);
  color: var(--accent); cursor: pointer; transition: all .2s; font-size: .95rem;
  font-family: inherit;
}
.back-button:hover, .mx-back-btn:hover { background: var(--accent); color: #fff; transform: translateY(-2px); }

/* Single content (WP the_content) */
.single-content {
  font-size: 1rem;
  line-height: 2;
  color: var(--clr-slate-700);
}
.single-content h2 { font-size: 1.35rem; font-weight: 900; margin: 24px 0 10px; color: var(--clr-slate-900); }
.single-content h3 { font-size: 1.15rem; font-weight: 800; margin: 18px 0 8px; color: var(--clr-slate-800); }
.single-content p { margin-bottom: 14px; }
.single-content a { color: var(--accent); text-decoration: underline; font-weight: 600; }
.single-content a:hover { color: var(--accent-dark); }
.single-content ul, .single-content ol { padding-inline-start: 24px; margin-bottom: 14px; list-style: initial; }
.single-content li { margin-bottom: 6px; }
.single-content blockquote { border-inline-start: 4px solid var(--accent); margin: 18px 0; padding: 12px 20px; background: var(--clr-slate-50); border-radius: 0 var(--radius) var(--radius) 0; color: var(--clr-slate-600); font-style: italic; }
.single-content table { width: 100%; border-collapse: collapse; border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.single-content th, .single-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: start; }
.single-content thead th { background: var(--accent-light); color: var(--accent); font-weight: 800; }

/* ============================================================
   ARCHIVE / CATEGORY PAGES
   ============================================================ */
.archive-header, .page-head {
  padding: clamp(24px,4vw,40px) 0;
  background: linear-gradient(135deg, var(--clr-slate-900), color-mix(in srgb, var(--accent) 30%, var(--clr-slate-900)));
  color: #fff;
}
.archive-header .container, .page-head .mx-container { max-width: var(--container); margin-inline: auto; padding-inline: clamp(14px,3vw,24px); }
.page-title, .archive-title { font-size: clamp(1.5rem,4vw,2.2rem); font-weight: 900; color: #fff; margin-bottom: 8px; }
.page-subtitle, .archive-desc { font-size: .97rem; color: rgba(255,255,255,.82); line-height: 1.8; margin: 0; }

/* Cards grid */
.cards, .posts-grid, .items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all .25s;
  box-shadow: var(--shadow-xs);
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--accent); }
.card__thumb { aspect-ratio: 16/9; overflow: hidden; background: var(--clr-slate-100); }
.card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card:hover .card__thumb img { transform: scale(1.04); }
.card__body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.card__badge { align-self: flex-start; }
.card__title { font-size: 1.05rem; font-weight: 800; color: var(--clr-slate-900); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__title a { color: inherit; }
.card__title a:hover { color: var(--accent); }
.card__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--text-muted); font-size: .84rem; }
.card__more {
  margin-top: auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--clr-slate-50);
  color: var(--clr-slate-700); font-weight: 800; font-size: .88rem;
  transition: all .18s; text-decoration: none;
}
.card__more:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

/* Filter chips */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter {
  padding: 8px 18px; border-radius: 999px; font-weight: 700;
  border: 1.5px solid var(--border); background: var(--bg-card);
  color: var(--clr-slate-700); cursor: pointer; transition: all .2s; font-size: .9rem;
}
.filter:hover, .filter.is-active { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: var(--shadow-sm); }

/* Mini subject button */
.mx-mini {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 800; font-size: .95rem;
  text-decoration: none; text-align: center;
  background: var(--bg-card); border: 1.5px solid var(--border);
  color: var(--clr-slate-700); transition: all .18s;
}
.mx-mini:hover { border-color: var(--accent); background: var(--accent); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-wrap { max-width: var(--container); margin-inline: auto; padding: 28px clamp(14px,3vw,24px) 48px; }
.search-header { margin-bottom: 28px; }
.search-header h1 { font-size: clamp(1.4rem,3.5vw,1.9rem); font-weight: 900; color: var(--clr-slate-900); margin-bottom: 8px; }
.search-count { font-size: .9rem; color: var(--text-muted); font-weight: 600; }

.search-filters-bar {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 20px 24px; margin-bottom: 24px; box-shadow: var(--shadow-xs);
}
.search-filters-bar form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.search-filters-bar label { display: block; font-weight: 800; font-size: .85rem; color: var(--clr-slate-600); margin-bottom: 6px; }
.search-filters-bar select, .search-filters-bar input[type="search"] { height: 44px; border-radius: var(--radius-sm); font-size: .9rem; }
.search-filters-bar .field-wrap { display: flex; flex-direction: column; flex: 1; min-width: 150px; }
.search-filters-bar .field-search { flex: 2; min-width: 220px; }

.search-results { display: flex; flex-direction: column; gap: 12px; }
.search-item {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 22px; display: flex; gap: 16px; align-items: flex-start;
  transition: all .2s; box-shadow: var(--shadow-xs); text-decoration: none; color: var(--text);
}
.search-item:hover { border-color: var(--accent); transform: translateX(-4px); box-shadow: var(--shadow-md); }
html[dir="rtl"] .search-item:hover { transform: translateX(4px); }
.search-item__icon { font-size: 2rem; flex-shrink: 0; line-height: 1; padding-top: 2px; }
.search-item__body { flex: 1; }
.search-item__title { font-size: 1.05rem; font-weight: 800; color: var(--clr-slate-900); margin-bottom: 6px; line-height: 1.4; }
.search-title { font-size: 1.05rem; font-weight: 800; color: var(--clr-slate-900); margin-bottom: 6px; }
.search-excerpt { font-size: .92rem; color: var(--text-muted); line-height: 1.7; }
.search-item__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.search-empty { text-align: center; padding: 48px 20px; }
.search-empty h2 { font-size: 1.4rem; font-weight: 900; color: var(--clr-slate-700); margin-bottom: 10px; }
.search-empty p { color: var(--text-muted); line-height: 1.8; }

.advanced-search-panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-xs);
}
.advanced-search-panel h2 { font-size: 1.1rem; font-weight: 900; color: var(--clr-slate-900); margin-bottom: 18px; }

/* ============================================================
   STATIC / INNER PAGES (about, contact, teacher, student…)
   ============================================================ */
.page-container { max-width: 880px; margin-inline: auto; padding: 32px clamp(14px,3vw,24px) 48px; }

/* Page hero */
.page-hero {
  background: linear-gradient(135deg, var(--clr-slate-900), color-mix(in srgb, var(--accent) 30%, var(--clr-slate-900)));
  color: #fff; text-align: center; padding: clamp(36px,6vw,64px) 0;
}
.page-hero__icon { font-size: clamp(3rem,7vw,5rem); margin-bottom: 16px; }
.page-hero h1 { font-size: clamp(1.6rem,4vw,2.4rem); font-weight: 900; color: #fff; margin-bottom: 12px; }
.page-hero p { font-size: 1rem; color: rgba(255,255,255,.82); max-width: 580px; margin: 0 auto; line-height: 1.8; }

/* Info sections */
.page-section { margin-bottom: 32px; }
.page-section h2 { font-size: clamp(1.2rem,2.8vw,1.6rem); font-weight: 900; color: var(--clr-slate-900); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 3px solid var(--accent); }
.page-section h3 { font-size: 1.1rem; font-weight: 800; color: var(--clr-slate-800); margin: 18px 0 8px; }
.page-section p { color: var(--clr-slate-700); line-height: 1.9; margin-bottom: 12px; }

/* Cards grid inside pages */
.page-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.page-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 22px; text-align: center; transition: all .25s; box-shadow: var(--shadow-xs);
}
.page-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.page-card__icon { font-size: 2.5rem; margin-bottom: 14px; }
.page-card h3 { font-size: 1rem; font-weight: 900; color: var(--clr-slate-900); margin-bottom: 8px; }
.page-card p { font-size: .9rem; color: var(--text-muted); line-height: 1.7; }

/* Contact form */
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.contact-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .contact-form .form-row { grid-template-columns: 1fr; } }
.contact-form label { display: block; font-weight: 800; font-size: .9rem; color: var(--clr-slate-600); margin-bottom: 6px; }
.contact-form .form-submit { display: flex; justify-content: flex-end; }

/* Info box */
.info-box {
  background: var(--accent-light); border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg); padding: 20px 24px;
  display: flex; gap: 14px; align-items: flex-start; margin: 18px 0;
}
.info-box__icon { font-size: 1.8rem; flex-shrink: 0; }
.info-box__body p { margin: 0; color: var(--clr-slate-700); line-height: 1.8; font-size: .97rem; }
.info-box--warn { background: #fffbeb; border-color: #fcd34d; }
.info-box--success { background: #f0fdf4; border-color: #86efac; }

/* 404 page */
.page-404 { text-align: center; padding: 80px 20px; }
.page-404__code { font-size: clamp(5rem,15vw,10rem); font-weight: 900; color: var(--accent); line-height: 1; display: block; }
.page-404 h1 { font-size: clamp(1.5rem,4vw,2.2rem); margin: 8px 0 16px; }
.page-404 p { color: var(--text-muted); font-size: 1.1rem; margin-bottom: 28px; }

/* ============================================================
   CATEGORY / NEWS
   ============================================================ */
.cat-header {
  background: linear-gradient(135deg, var(--clr-slate-900), color-mix(in srgb, var(--accent) 28%, var(--clr-slate-900)));
  padding: clamp(28px,5vw,52px) 0; color: #fff;
}
.cat-header h1 { font-size: clamp(1.5rem,4vw,2.2rem); font-weight: 900; color: #fff; margin-bottom: 8px; }
.cat-header p { color: rgba(255,255,255,.8); }

/* ============================================================
   RESPONSIVE MEDIA TWEAKS
   ============================================================ */
@media (max-width: 768px) {
  .lesson-buttons-group, .devoir-buttons-group, .exam-buttons-group { flex-direction: column; align-items: stretch; }
  .btn-download, .btn-view { justify-content: center; width: 100%; }
  .file-label { min-width: 100%; }
  .related-links-grid-enhanced { grid-template-columns: repeat(2, 1fr); }
  .cards, .posts-grid, .items-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .related-links-grid-enhanced { grid-template-columns: 1fr; }
  .mx-cycles-grid, .page-cards { grid-template-columns: 1fr; }
  .search-filters-bar form { flex-direction: column; }
  .search-filters-bar .field-wrap { min-width: 100%; }
}

/* ============================================================
   CYCLE PAGES (lessons/exams/devoirs cycle template)
   ============================================================ */
.mx-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.mx-subject-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 12px; border-radius: var(--radius-lg); text-align: center;
  background: var(--bg-card); border: 1.5px solid var(--border);
  font-weight: 800; font-size: .9rem; color: var(--clr-slate-700);
  text-decoration: none; transition: all .2s; box-shadow: var(--shadow-xs);
}
.mx-subject-btn__icon { font-size: 2rem; }
.mx-subject-btn:hover { border-color: var(--accent); background: var(--accent); color: #fff; transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mx-subject-btn .mx-count { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.mx-subject-btn:hover .mx-count { color: rgba(255,255,255,.8); }

/* ============================================================
   PRINT FRIENDLY
   ============================================================ */
@media print {
  .mx-header, .mx-topbar, .mx-footer, .lesson-navigation, .related-links-section-enhanced { display: none !important; }
  body { background: #fff; }
  .lesson-container { max-width: 100%; }
  .btn-download, .btn-view { display: none !important; }
}
