/* =========================================================
   صفحات القوالب المخصصة (فضاء التلميذ، فضاء الأستاذ، فضاء الطلبة)
   تصميم احترافي ومتناسق مع الموقع
   ========================================================= */

/* ===== CSS Variables ===== */
:root {
  --edu-green: #1b5e20;
  --edu-blue: #1976d2;
  --edu-orange: #ef6c00;
  --edu-purple: #9333ea;
  --edu-teal: #009688;
  --edu-grey: #6b7280;
  --text: #0f172a;
  --muted: #556376;
}

/* ===== Container & Sections ===== */
.mx-sections {
  padding-block: clamp(20px, 3vw, 28px);
  padding-inline: clamp(12px, 2vw, 20px);
  background: #f8fafc;
  min-height: 60vh;
}

.mx-container {
  width: min(1160px, 100%);
  max-width: 100%;
  margin-inline: auto;
  padding-inline: clamp(10px, 3vw, 20px);
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .mx-container {
    padding-inline: 12px;
  }
}

@media (max-width: 480px) {
  .mx-container {
    padding-inline: 10px;
  }
}

/* ===== Block Styles ===== */
.mx-block {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  padding: clamp(20px, 3vw, 28px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
  margin-bottom: clamp(16px, 2.5vw, 24px);
  box-sizing: border-box;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.mx-block:hover {
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.08);
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .mx-block {
    padding: 18px;
    margin-bottom: 18px;
  }
}

@media (max-width: 480px) {
  .mx-block {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 14px;
  }
}

/* ===== Header Styles ===== */
.mx-block__header {
  margin-bottom: clamp(20px, 3vw, 28px);
  padding-bottom: clamp(16px, 2.5vw, 24px);
  border-bottom: 2px solid #e5e7eb;
}

.mx-block__title {
  margin: 0 0 clamp(12px, 2vw, 16px);
  font-weight: 900;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  color: #0f172a;
  position: relative;
  line-height: 1.3;
}

.mx-block__title::after {
  content: "";
  display: block;
  height: 4px;
  width: 80px;
  border-radius: 999px;
  margin-top: 12px;
  background: linear-gradient(90deg, var(--edu-green, #16a34a), var(--edu-blue, #1d4ed8) 70%, var(--edu-orange, #f97316));
}

.mx-block__desc {
  margin: clamp(12px, 2vw, 16px) 0 0;
  color: #556376;
  line-height: 1.9;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  text-align: right;
  direction: rtl;
}

.mx-block__desc strong {
  color: var(--edu-green, #16a34a);
  font-weight: 800;
}

/* ===== Grid Layout ===== */
.mx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: clamp(12px, 2vw, 16px);
  margin-top: clamp(20px, 3vw, 28px);
}

@media (max-width: 768px) {
  .mx-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .mx-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ===== Button Styles ===== */
.mx-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: clamp(14px, 2vw, 18px);
  min-height: 64px;
  height: 64px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  text-decoration: none !important;
  font-weight: 800;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  color: #0f172a;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.mx-mini::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.mx-mini:hover::before {
  left: 100%;
}

.mx-mini:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--edu-green, #16a34a);
}

.mx-mini__emoji {
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  flex-shrink: 0;
  line-height: 1;
}

.mx-mini__text {
  flex: 1;
  min-width: 0;
  text-align: center;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  line-height: 1.4;
}

/* ===== Additional Content Sections ===== */
.mx-block__content {
  margin-top: clamp(24px, 3vw, 32px);
}

.mx-block__section {
  margin-bottom: clamp(20px, 3vw, 28px);
  padding: clamp(16px, 2.5vw, 24px);
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
}

.mx-block__section-title {
  margin: 0 0 clamp(12px, 2vw, 16px);
  font-weight: 800;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mx-block__section-title::before {
  content: "";
  display: block;
  width: 4px;
  height: 24px;
  background: var(--edu-green, #16a34a);
  border-radius: 2px;
}

.mx-block__section-content {
  color: #556376;
  line-height: 1.8;
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  text-align: right;
  direction: rtl;
}

.mx-block__section-content ul,
.mx-block__section-content ol {
  margin: 12px 0;
  padding-right: 20px;
  list-style-position: outside;
}

.mx-block__section-content li {
  margin-bottom: 8px;
}

.mx-block__section-content a {
  color: var(--edu-blue, #1d4ed8);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s ease;
}

.mx-block__section-content a:hover {
  border-bottom-color: var(--edu-blue, #1d4ed8);
}

/* ===== Stats Section ===== */
.mx-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(12px, 2vw, 16px);
  margin-top: clamp(20px, 3vw, 28px);
}

.mx-stat-card {
  background: linear-gradient(135deg, var(--edu-green, #16a34a) 0%, var(--edu-blue, #1d4ed8) 100%);
  border-radius: 14px;
  padding: clamp(16px, 2.5vw, 24px);
  text-align: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.mx-stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.mx-stat-card__number {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  line-height: 1;
  margin-bottom: 8px;
}

.mx-stat-card__label {
  display: block;
  font-size: clamp(0.9rem, 1.5vw, 1.1rem);
  font-weight: 700;
  opacity: 0.95;
}

/* ===== Quick Links Section ===== */
.mx-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(16px, 2.5vw, 24px);
}

.mx-quick-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #0f172a;
  text-decoration: none;
  transition: all 0.2s ease;
}

.mx-quick-link:hover {
  background: var(--edu-green, #16a34a);
  color: #fff;
  border-color: var(--edu-green, #16a34a);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== Responsive Adjustments ===== */
@media (max-width: 768px) {
  .mx-block__header {
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .mx-block__section {
    padding: 16px;
    margin-bottom: 20px;
  }

  .mx-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .mx-stats-grid {
    grid-template-columns: 1fr;
  }

  .mx-quick-links {
    flex-direction: column;
  }

  .mx-quick-link {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Color Variants for Different Pages ===== */
/* فضاء التلميذ - Orange Theme */
.page-template-page-student .mx-block__title::after {
  background: linear-gradient(90deg, var(--edu-orange, #f97316), var(--edu-green, #16a34a));
}

.page-template-page-student .mx-mini:hover {
  border-color: var(--edu-orange, #f97316);
  background: rgba(249, 115, 22, 0.05);
}

/* فضاء الأستاذ - Blue Theme */
.page-template-page-teacher .mx-block__title::after {
  background: linear-gradient(90deg, var(--edu-blue, #1d4ed8), var(--edu-green, #16a34a));
}

.page-template-page-teacher .mx-mini:hover {
  border-color: var(--edu-blue, #1d4ed8);
  background: rgba(29, 78, 216, 0.05);
}

/* فضاء الطلبة - Purple Theme */
.page-template-page-student-higher .mx-block__title::after {
  background: linear-gradient(90deg, var(--edu-purple, #9333ea), var(--edu-green, #16a34a));
}

.page-template-page-student-higher .mx-mini:hover {
  border-color: var(--edu-purple, #9333ea);
  background: rgba(147, 51, 234, 0.05);
}

/* =========================================================
   صفحة الأخبار والمستجدات - تصميم احترافي
   ========================================================= */

/* News Sections */
.mx-sections--news {
  background: #f8fafc;
  padding-block: clamp(24px, 4vw, 32px);
}

/* Hero Section */
.mx-block--news-hero {
  background: linear-gradient(135deg, rgba(27, 94, 32, 0.08) 0%, rgba(25, 118, 210, 0.08) 100%);
  border: 2px solid rgba(27, 94, 32, 0.15);
  margin-bottom: clamp(20px, 3vw, 24px);
}

.mx-block--news-hero .mx-block__header {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.mx-block--news-hero .mx-block__title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: clamp(12px, 2vw, 16px);
}

.mx-block--news-hero .mx-block__desc {
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  line-height: 1.8;
  color: #475569;
}

/* News Search Form */
.mx-block--news-search {
  background: #fff;
  margin-bottom: clamp(20px, 3vw, 24px);
  padding: clamp(20px, 3vw, 28px);
}

.mx-news-search-form {
  width: 100%;
}

.mx-news-search-wrapper {
  display: flex;
  gap: 12px;
  align-items: stretch;
  width: 100%;
}

.mx-news-search-input {
  flex: 1;
  padding: 14px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 1rem;
  font-family: 'Almarai', sans-serif;
  background: #fff;
  transition: all 0.3s ease;
}

.mx-news-search-input:focus {
  outline: none;
  border-color: var(--edu-green, #16a34a);
  box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.mx-news-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--edu-green, #16a34a);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.mx-news-search-btn:hover {
  background: var(--edu-blue, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mx-news-search-btn svg {
  width: 20px;
  height: 20px;
}

/* News Categories */
.mx-block--news-categories {
  background: #fff;
  margin-bottom: clamp(20px, 3vw, 24px);
}

.mx-categories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(16px, 2.5vw, 20px);
  padding-bottom: clamp(12px, 2vw, 16px);
  border-bottom: 2px solid #e5e7eb;
}

.mx-categories-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 800;
  color: #0f172a;
}

.mx-categories-count {
  font-size: 0.9rem;
  color: #6b7280;
  font-weight: 700;
}

.mx-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.mx-category-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 20px;
  background: #f8fafc;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
  text-align: center;
}

.mx-category-tag:hover {
  background: var(--edu-green, #16a34a);
  border-color: var(--edu-green, #16a34a);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(27, 94, 32, 0.2);
}

.mx-category-tag.active {
  background: var(--edu-green, #16a34a);
  border-color: var(--edu-green, #16a34a);
  color: #fff;
}

.mx-category-tag:hover .mx-category-tag__name,
.mx-category-tag.active .mx-category-tag__name {
  color: #fff;
}

.mx-category-tag__name {
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f172a;
  transition: color 0.3s ease;
}

/* Featured News Section */
.mx-block--news-featured {
  background: linear-gradient(135deg, rgba(239, 108, 0, 0.05) 0%, rgba(27, 94, 32, 0.05) 100%);
  border: 2px solid rgba(239, 108, 0, 0.2);
  margin-bottom: clamp(20px, 3vw, 24px);
}

.mx-block--news-featured .mx-block__section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--edu-orange, #ef6c00);
}

.mx-block--news-featured .mx-block__section-title svg {
  width: 24px;
  height: 24px;
  fill: var(--edu-orange, #ef6c00);
}

.mx-news-featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.mx-news-featured-item {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  transition: all 0.3s ease;
}

.mx-news-featured-item:hover {
  border-color: var(--edu-orange, #ef6c00);
  box-shadow: 0 8px 24px rgba(239, 108, 0, 0.15);
  transform: translateY(-4px);
}

.mx-news-featured-link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.mx-news-featured-thumb {
  width: 100%;
  height: 180px;
  overflow: hidden;
  background: #f3f4f6;
}

.mx-news-featured-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.mx-news-featured-item:hover .mx-news-featured-img {
  transform: scale(1.05);
}

.mx-news-featured-content {
  padding: 16px;
}

.mx-news-featured-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.4;
  color: #0f172a;
}

.mx-news-featured-excerpt {
  margin: 0;
  font-size: 0.9rem;
  color: #6b7280;
  line-height: 1.6;
}

/* News List */
.mx-block--news-list {
  background: #fff;
}

.mx-news-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: clamp(16px, 2.5vw, 20px);
  padding-bottom: clamp(12px, 2vw, 16px);
  border-bottom: 2px solid #e5e7eb;
  flex-wrap: wrap;
  gap: 12px;
}

.mx-news-list-title {
  margin: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 800;
  color: #0f172a;
}

.mx-news-list-info {
  font-size: 0.9rem;
  color: #6b7280;
  font-weight: 700;
}

.mx-news--archive {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mx-news__item {
  padding: 18px 20px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.mx-news__item::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--edu-green, #16a34a);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.mx-news__item:hover {
  border-color: var(--edu-green, #16a34a);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateX(-4px);
}

.mx-news__item:hover::before {
  transform: scaleY(1);
}

.mx-news__item--featured {
  background: linear-gradient(135deg, rgba(27, 94, 32, 0.03) 0%, rgba(25, 118, 210, 0.03) 100%);
  border-color: var(--edu-orange, #ef6c00);
}

.mx-news__item--featured::before {
  background: var(--edu-orange, #ef6c00);
}

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

.mx-news__title {
  font-weight: 800;
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.5;
  color: #0f172a;
  text-decoration: none;
  transition: color 0.2s ease;
}

.mx-news__title:hover {
  color: var(--edu-green, #16a34a);
}

.mx-news__badge {
  display: inline-block;
  margin-right: 6px;
  font-size: 0.9em;
  vertical-align: middle;
}

.mx-news__excerpt {
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.7;
  margin: 0;
}

.mx-empty {
  text-align: center;
  padding: clamp(40px, 6vw, 60px) 20px;
  color: #6b7280;
}

.mx-empty-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  color: #cbd5e1;
}

.mx-empty-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

.mx-empty-desc {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 24px;
}

.mx-empty-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--edu-green, #16a34a);
  color: #fff;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  transition: all 0.3s ease;
}

.mx-empty-link:hover {
  background: var(--edu-blue, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Pagination Enhanced */
.mx-pagination {
  margin-top: clamp(24px, 4vw, 32px);
  padding-top: clamp(20px, 3vw, 28px);
  border-top: 2px solid #e5e7eb;
  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;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 800;
  min-width: 44px;
  height: 44px;
  border: 2px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.mx-pagination a:hover {
  background: var(--edu-green, #16a34a);
  color: #fff;
  border-color: var(--edu-green, #16a34a);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mx-pagination .current {
  background: var(--edu-green, #16a34a);
  color: #fff;
  border-color: var(--edu-green, #16a34a);
}

.mx-pagination a svg {
  width: 16px;
  height: 16px;
}

/* Responsive for News Page */
@media (max-width: 768px) {
  .mx-news-search-wrapper {
    flex-direction: column;
  }

  .mx-news-search-btn {
    width: 100%;
  }

  .mx-categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
  }

  .mx-news-featured-grid {
    grid-template-columns: 1fr;
  }

  .mx-news-list-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .mx-news__item {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .mx-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .mx-news__item {
    padding: 14px;
  }

  .mx-news__excerpt {
    font-size: 0.9rem;
  }

  .mx-pagination a,
  .mx-pagination span {
    padding: 8px 12px;
    min-width: 40px;
    height: 40px;
    font-size: 0.85rem;
  }
}

