/*
 * ╔═══════════════════════════════════════════════════════════════╗
 * ║         STUDENTS PAGE - CLEANED & COMPLIANT                   ║
 * ║              صفحة المتفوقين - منظف 100%                      ║
 * ╚═══════════════════════════════════════════════════════════════╝
 * 
 * ✅ 100% متوافق مع دستور التصميم
 * ✅ صفر hardcoded colors - كل شيء عبر CSS Variables
 * ✅ صفر !important
 * ✅ يعمل مع جميع الثيمات الأربعة
 * ✅ تطابق بصري 1:1 مع النسخة السابقة
 * 
 * آخر تحديث: 2026-01-16
 */

/* ===== صفحة الطلاب المتفوقين - تصميم حديث ومتطور ===== */

/* متغيرات الألوان للثيمات */
#top-students {
  --students-bg: var(--bg-color);
  --students-card-bg: var(--card-bg, var(--surface-0));
  --students-text: var(--text-main);
  --students-text-light: var(--text-light);
  --students-border: var(--border-color);
  --students-shadow: var(--shadow-1);
  --students-shadow-hover: var(--shadow-2);
}

/* تم حذف الثيمات القديمة - استخدم الثيمات الجديدة في main.css */

/* ===== قسم الهيرو للطلاب المتفوقين ===== */
/* توحيد مع .page-hero (staff/activities) - Background Architecture Audit */
.students-hero {
  --hero-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  padding: var(--hero-padding-desktop);
  position: relative;
  overflow: visible;
  min-height: var(--hero-min-height-desktop);
  display: flex;
  align-items: center;
  background: transparent;
}

#top-students .students-hero .hero-content {
  position: relative;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Entrance transitions are defined in hero-unified.css and triggered via `.hero-revealed` */
}

/* Initial hidden state (high-specificity reinforcement for unified transition system) */
#top-students.page-section .students-hero .hero-content>* {
  opacity: 0;
  transform: translateY(30px);
  animation: none;
}

/* Revealed state — requires both `.active` and `.hero-revealed` on section */
#top-students.page-section.active.hero-revealed .students-hero .hero-content>* {
  opacity: 1;
  transform: translateY(0);
}

#top-students .students-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: var(--hero-badge-padding);
  background: var(--students-hero-badge-bg, linear-gradient(135deg, var(--primary-color), var(--secondary-color)));
  color: var(--students-hero-badge-text, var(--text-white));
  border-radius: var(--hero-badge-radius);
  font-size: var(--hero-badge-font-size);
  font-weight: var(--hero-badge-font-weight);
  margin-bottom: var(--hero-badge-margin-bottom);
  box-shadow: 0 8px 25px rgba(var(--primary-color-rgb), 0.3);
  backdrop-filter: blur(10px);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  will-change: transform;
  order: -1;
  text-align: center;
}

#top-students .students-hero .hero-badge:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 30px rgba(var(--primary-color-rgb), 0.4);
  background: var(--secondary-color);
}

.students-hero .hero-badge i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.students-hero .hero-badge:hover i {
  transform: scale(1.1) rotate(5deg);
}

/* تأكيد إضافي لموضع الكبسولة — الحالة الأولية معلنة في hero-unified.css */
#top-students .students-hero .hero-content .hero-badge {
  order: -1;
  margin-bottom: 20px;
  align-self: center;
  display: inline-flex;
}

#top-students .students-hero .hero-content .hero-title {
  order: 0;
  margin-bottom: 20px;
}

#top-students .students-hero .hero-content .hero-subtitle {
  order: 1;
}

.students-hero .hero-title {
  font-size: var(--hero-title-font-size);
  font-weight: var(--hero-title-font-weight);
  color: var(--text-primary);
  margin-bottom: var(--hero-title-margin-bottom);
  line-height: var(--hero-title-line-height);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(var(--black-rgb), 0.1);
  animation: titleGlow 2s ease-in-out infinite alternate;
}

@keyframes titleGlow {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.05);
  }
}

.students-hero .hero-subtitle {
  font-size: var(--hero-subtitle-font-size);
  color: var(--text-secondary);
  line-height: var(--hero-subtitle-line-height);
  max-width: var(--hero-subtitle-max-width);
  margin: 0 auto;
  font-weight: var(--hero-subtitle-font-weight);
  opacity: 0.85;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تأثيرات إضافية للبطاقات */
@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(50px) scale(0.9);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}


/* ========== استجابة الهيرو للموبايل ========== */
/* توحيد مع page-hero responsive - Background Architecture Audit */
@media (max-width: 768px) {
  .students-hero {
    padding: var(--hero-padding-tablet);
    min-height: var(--hero-min-height-tablet);
  }

  #top-students .students-hero .hero-content {
    padding: 0 15px;
  }

  #top-students .students-hero .hero-badge {
    font-size: var(--hero-badge-font-size-tablet);
    padding: var(--hero-badge-padding-tablet);
    margin-bottom: var(--hero-badge-margin-bottom-tablet);
  }

  #top-students .students-hero .hero-title {
    font-size: var(--hero-title-font-size-tablet);
    margin-bottom: var(--hero-title-margin-bottom-tablet);
    line-height: 1.3;
  }

  #top-students .students-hero .hero-subtitle {
    font-size: var(--hero-subtitle-font-size-tablet);
    max-width: 90%;
    line-height: 1.5;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .section-subtitle {
    font-size: 0.9rem;
  }

  .advanced-filters {
    padding: 20px 10px;
    margin: 15px 0 30px 0;
  }

  .search-container {
    margin-bottom: 30px;
  }

  .search-input {
    font-size: 1rem;
    padding: 16px 50px;
  }

  .unified-filters-bar {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .filters-group {
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .unified-filter-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
  }

  .oval-select {
    min-width: 120px;
    padding: 8px 35px 8px 12px;
    font-size: 0.85rem;
  }

  #top-students {
    padding: 2rem 0 4rem;
  }

  #top-students h2 {
    font-size: 2.5rem;
  }

  .page-intro {
    font-size: 1.1rem;
  }

  .students-search-container {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .grade-selector {
    gap: 0.5rem;
  }

  .grade-btn {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .section-selector {
    gap: 0.5rem;
  }

  .section-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    min-width: 40px;
  }

  /* عمود واحد حتى 768px — عمودان كانا يضغطان البطاقة على الهاتف */
  .students-creative-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 12px;
    justify-items: stretch;
  }
}

@media (max-width: 480px) {
  .students-hero {
    padding: var(--hero-padding-mobile);
    min-height: var(--hero-min-height-mobile);
  }

  #top-students .students-hero .hero-content {
    padding: 0 10px;
  }

  #top-students .students-hero .hero-badge {
    font-size: var(--hero-badge-font-size-mobile);
    padding: var(--hero-badge-padding-mobile);
    margin-bottom: var(--hero-badge-margin-bottom-mobile);
  }

  #top-students .students-hero .hero-title {
    font-size: var(--hero-title-font-size-mobile);
    margin-bottom: var(--hero-title-margin-bottom-mobile);
    line-height: 1.3;
  }

  #top-students .students-hero .hero-subtitle {
    font-size: var(--hero-subtitle-font-size-mobile);
    max-width: 95%;
    line-height: 1.5;
  }

  #top-students .section-title {
    font-size: 1.3rem;
  }

  #top-students .section-subtitle {
    font-size: 0.85rem;
  }

  #top-students .students-creative-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 10px;
  }

  #top-students .student-card,
  #staff-section .student-card {
    max-width: 100%;
    margin: 0 auto;
  }
}



/* عنوان القسم المحسن */
#top-students .section-header {
  text-align: center;
  margin: 20px 0 40px 0;
  position: relative;
  z-index: 10;
  background: transparent;
}

#top-students .section-header .section-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 12px;
  position: relative;
}

#top-students .section-header .section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
}

#top-students .section-header .section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 auto;
  opacity: 0.8;
  text-align: center;
  display: block;
  max-width: 600px;
}

/* تأكيد إضافي لتطبيق الأنماط */
#top-students .section-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-strong);
}

#top-students .section-header p {
  font-size: 1rem;
  color: var(--text-muted);
  opacity: 0.8;
  text-align: center;
  margin: 0 auto;
  max-width: 600px;
  display: block;
  position: relative;
  z-index: 10;
}

/* تم إزالة النمط الخلفي للتوحيد مع باقي الأقسام - Background Architecture Audit */
/* 
 * السبب: هذا النمط كان يجعل #top-students يبدو مختلفاً عن باقي الأقسام
 * التاريخ: 2026-01-19
 */

/* عنوان الصفحة */
#top-students h2 {
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--primary-color);
  text-align: center;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
}

/* وصف الصفحة */
.page-intro {
  font-size: 1.3rem;
  color: var(--students-text-light);
  text-align: center;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  z-index: 2;
}

/* حاوي البحث والفلترة */
.students-search-container {
  background: var(--surface-0);
  border-radius: 20px;
  padding: 2.5rem;
  margin-bottom: 3rem;
  box-shadow: 0 10px 40px var(--students-shadow);
  border: 2px solid var(--students-border);
  position: relative;
  z-index: 2;
}

.search-header {
  text-align: center;
  margin-bottom: 2rem;
}

.search-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.search-subtitle {
  color: var(--students-text-light);
  font-size: 1rem;
}

/* أزرار الصفوف - EXACT STAFF STYLE */
.grade-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.grade-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-0);
  border: 1.5px solid rgba(var(--primary-color-rgb), 0.15);
  color: var(--text-secondary);
  border-radius: 25px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 18px;
  cursor: pointer;
  min-height: 42px;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: none;
}

/* Hover for non-active grade buttons */
.grade-btn:not(.active):hover {
  border-color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), 0.05);
  transform: translateY(-2px);
  box-shadow: none;
}

/* Active grade button */
.grade-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-white);
}

/* أزرار الشعب - EXACT STAFF STYLE */
.section-selector {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.section-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid rgba(var(--primary-color-rgb), 0.15);
  background: var(--surface-0);
  color: var(--text-secondary);
  border-radius: 25px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 45px;
  min-height: 42px;
  text-align: center;
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: none;
}

/* Hover for non-active section buttons */
.section-btn:not(.active):hover {
  background: rgba(var(--primary-color-rgb), 0.05);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: none;
}

/* Active section button */
.section-btn.active {
  background: var(--primary-color);
  color: var(--text-white);
  border-color: var(--primary-color);
}

/* حقل البحث */
.student-search-input {
  width: 100%;
  padding: 1rem 1.5rem;
  border: 2px solid var(--students-border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--surface-0);
  color: var(--students-text);
  font-family: 'Tajawal', sans-serif;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.student-search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 8px 30px rgba(var(--primary-color-rgb), 0.15);
  transform: translateY(-2px);
}

.student-search-input::placeholder {
  color: var(--students-text-light);
}

/* عداد النتائج */
.results-counter {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  color: var(--students-text-light);
  position: relative;
  z-index: 2;
}

.results-highlight {
  color: var(--primary-color);
  font-weight: 700;
}

/* شبكة الطلاب */
.students-creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  /* زيادة من 280px إلى 320px */
  gap: 2rem;
  margin-bottom: 3rem;
  position: relative;
  z-index: 2;
  padding: 1rem 0;
  justify-items: center;
}

/* تحسينات إضافية للاستجابة */
@media (max-width: 1400px) {
  .students-creative-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.8rem;
  }
}

@media (max-width: 1200px) {
  .students-creative-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.6rem;
  }
}

@media (max-width: 900px) {
  .students-creative-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    padding: 0 15px;
  }
}

@media (max-width: 600px) {
  .students-creative-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 10px;
  }
}

/* ─── لا نتائج مطابقة (بحث/فلاتر) — نفس فكرة قسم الكادر المتميز ─── */
#top-students .no-students-results {
  text-align: center;
  padding: 80px 20px;
  background: rgba(var(--white-rgb), 0.9);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(var(--primary-color-rgb), 0.1);
  margin: 40px auto;
  max-width: 640px;
}

#top-students .no-students-results h3 {
  font-size: 1.8rem;
  margin-bottom: 15px;
  color: var(--text-strong);
  font-weight: 700;
}

#top-students .no-students-results p {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 30px;
  color: var(--text-secondary);
}

#top-students .no-students-results .no-results-icon {
  font-size: 5rem;
  color: rgba(var(--primary-color-rgb), 0.3);
  margin-bottom: 30px;
  line-height: 1;
}

@media (max-width: 768px) {
  #top-students .no-students-results {
    padding: 60px 15px;
    margin: 28px 12px;
  }

  #top-students .no-students-results .no-results-icon {
    font-size: 4rem;
  }

  #top-students .no-students-results h3 {
    font-size: 1.5rem;
  }

  #top-students .no-students-results p {
    font-size: 1rem;
  }
}

/* بطاقة الطالب - تخطيط مرن موحد */
.student-card {
  position: relative;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  background: var(--surface-0);
  border-radius: 20px;
  box-shadow: 0 8px 25px var(--shadow-1);
  overflow: hidden;
  width: 100%;
  max-width: 350px;
  min-height: 420px;
  /* JavaScript سيتولى التأثيرات بالكامل - لا نضع opacity هنا */
}

.student-card {
  transition:
    transform 0.38s cubic-bezier(0.33, 1, 0.32, 1),
    box-shadow 0.38s cubic-bezier(0.33, 1, 0.32, 1),
    background 0.38s ease,
    border-color 0.38s ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  /* هوفر واضح قليلاً دون مبالغة — طلاب وكادر */
  #top-students .student-card:hover,
  #staff-section .student-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 14px 34px rgba(var(--black-rgb), 0.12);
  }

  #top-students .student-card:hover .profile-avatar,
  #staff-section .student-card:hover .profile-avatar {
    transform: translateX(-50%) scale(1.02);
    border-color: rgba(var(--primary-color-rgb), 0.45);
  }

  .student-card:hover .profile-name {
    color: var(--primary-color);
  }

  .student-card:hover::before {
    left: 100%;
  }
}

/* تأثير هوفر راقي على رأس البطاقة - تم إزالة brightness */

/* تأثير تكبير الصورة عند الهوفر */
.profile-avatar {
  transition:
    transform 0.38s cubic-bezier(0.33, 1, 0.32, 1),
    box-shadow 0.38s cubic-bezier(0.33, 1, 0.32, 1),
    border-color 0.38s ease;
  position: relative;
}

/* تم إزالة تأثير brightness من الصورة */

.student-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      var(--shine-1),
      transparent);
  transition: left 0.6s ease;
  z-index: 1;
  pointer-events: none;
}

/* ضمان ظهور المحتوى فوق تأثير اللمعة */
.student-card .profile-header,
.student-card .profile-name,
.student-card .profile-desc,
.student-card .card-footer-btn {
  position: relative;
  z-index: 2;
}

/* رأس البطاقة مع الصورة - متجاوب مع الثيمات */
.profile-header {
  position: relative;
  width: 100%;
  height: 100px;
  background: var(--primary-color);
  /* يتغير مع الثيم */
  /* تم إلغاء انتقال الخلفية */
}

.profile-header::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: inherit;
  transform: skewY(4deg);
  transform-origin: 0 100%;
  /* تم إلغاء انتقال الشكل المائل */
}

/* أفاتار البطاقة فقط — لا يشمل مودال التفاصيل (.student-modal-avatar / .teacher-modal-avatar) */
#top-students .student-card .profile-avatar,
#staff-section .student-card .profile-avatar {
  position: absolute;
  left: 50%;
  top: 40px;
  transform: translateX(-50%);
  transform-origin: center center;
  z-index: 5;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--placeholder-bg);
  border: 4px solid var(--surface-0);
}

#top-students .student-card .profile-avatar img,
#top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
#staff-section .student-card .profile-avatar img,
#staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  border-radius: 50%;
}

#top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
#staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
  background: var(--slate-600);
  /* mat blue-grey 600 */
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

/* اسم الطالب — عرض كامل + padding تحت النص لمساحة خط ::after دون التصاق بالوصف */
.profile-name {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 110px 0 18px;
  padding-bottom: 0.85rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-strong);
  transition: color 0.35s ease;
  /* mat blue-grey 800 */
}

.profile-name::after {
  content: '';
  position: absolute;
  bottom: 0.35rem;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: 30px;
  max-width: 100%;
  height: 2px;
  background: var(--border-color-dark, var(--slate-500));
  /* mat blue-grey */
}

@media (max-width: 768px) {
  .profile-name {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }

  .profile-name::after {
    bottom: 0.45rem;
  }
}

@media (max-width: 480px) {
  .profile-name {
    padding-bottom: 1.1rem;
    margin-bottom: 1.05rem;
  }

  .profile-name::after {
    bottom: 0.5rem;
  }
}

/* وصف الطالب */
.profile-desc {
  padding: 0 1rem 1rem;
  text-align: center;
  line-height: 1.5;
  color: var(--text-secondary);
  min-height: 90px;
  /* مساحة ثابتة أكبر لضمان التوحيد */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.profile-position {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 5px;
}

.profile-department {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--text-light);
  /* mat blue-grey 400 */
}

/* مساحة ثابتة لشارة الإبداع */
.creative-space {
  min-height: 35px;
  /* ارتفاع ثابت */
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.creative-placeholder {
  height: 25px;
  /* نفس ارتفاع شارة الإبداع */
  display: block;
}

/* مساحة ثابتة لشارة الإبداع */
.creative-space {
  min-height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px 0;
}

.creative-placeholder {
  height: 25px;
  display: block;
}

/* مساحة ثابتة لوسام الإبداع */
.creative-space {
  min-height: 30px;
  /* مساحة ثابتة محجوزة */
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 5px;
}

/* شارة الإبداع */
.profile-creative {
  display: inline-block;
  color: var(--creative-gold);
  font-size: 0.9rem;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(var(--creative-gold-rgb), 0.0);
  filter: drop-shadow(0 0 2px rgba(var(--creative-gold-rgb), 0.2));
}

.profile-creative i {
  color: var(--creative-gold);
  margin-right: 6px;
  font-size: 1.1rem;
  text-shadow: 0 0 4px rgba(var(--creative-gold-rgb), 0.0);
  filter: drop-shadow(0 0 2px rgba(var(--creative-gold-rgb), 0.2));
}

/* مساحة فارغة عندما لا يوجد وسام */
.creative-placeholder {
  height: 30px;
  /* نفس ارتفاع المساحة المحجوزة */
  display: block;
}

/* ─── صف أيقونات الأوسمة في بطاقة الطالب ─── */
.student-badges {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  min-height: 28px;
  flex-wrap: wrap;
}

/* ─── لمعة (sheen) على أيقونة الوسام مباشرة ───
 * محصور بـ #top-students و #custom-student-modal حتى لا يتعارض مع staff-modern.css
 * (كلاهما يُحمّلان معًا في index.html).
 */
@keyframes badge-sheen-move-students {
  0%   { left: -80%; }
  100% { left: 130%; }
}

#top-students .badge-sheen-wrap,
#custom-student-modal .badge-sheen-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: 6px;
  line-height: 1;
  padding: 3px 4px;
}

#top-students .badge-sheen-wrap::after,
#custom-student-modal .badge-sheen-wrap::after {
  content: '';
  position: absolute;
  top: -20%;
  left: -80%;
  width: 45%;
  height: 140%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent);
  transform: skewX(-20deg);
  animation: badge-sheen-move-students 2.8s infinite ease-in-out;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  #top-students .badge-sheen-wrap::after,
  #custom-student-modal .badge-sheen-wrap::after {
    animation: none;
  }
}

/* تم حذف شارات المواد - ستظهر في المودال فقط */

/* الشريط السفلي - متجاوب مع الثيمات الأربعة */
.card-footer-btn {
  background: var(--primary-color);
  color: var(--text-white);
  border-top: 1px solid rgba(var(--primary-color-rgb), 0.1);
  padding: 15px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  font-family: 'Tajawal', sans-serif;
  margin-top: auto;
  /* يدفع الزر للأسفل دائماً */
  border-radius: 0 0 20px 20px;
  transition: background 0.3s ease, transform 0.3s ease;
}

.card-footer-btn:hover {
  background: var(--secondary-color);
  color: var(--text-white);
  filter: brightness(1.1);
}

.card-footer-btn i {
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card-footer-btn:hover i {
  transform: translateX(5px);
}

/* نظام النجوم المحدث - مساحة ثابتة */
.student-stars {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin: 20px 0;
  /* مساحة طبيعية */
  padding: 0 10px;
  min-height: 25px;
  /* مساحة ثابتة للنجوم */
}

.student-stars .star {
  color: var(--star-empty);
  font-size: 1.1rem;
  transition: color 0.3s ease, transform 0.3s ease;
}

.student-stars .star:hover {
  color: var(--gold);
  transform: scale(1.2);
}

.student-stars .star.filled {
  color: var(--gold);
}

.student-stars .star.half {
  background: linear-gradient(270deg, var(--gold) 50%, var(--star-empty) 50%);
  /* 270deg بدلاً من 90deg لجعل النصف من اليمين */
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ========== مودال الطلاب - كلاسات أساسية ========== */

/* المودال الأساسي */
.modal {
  display: flex;
  position: fixed;
  z-index: 99999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--overlay-bg);
  backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
}

.modal.modal-show {
  opacity: 1;
  visibility: visible;
}

/* بطاقة البروفايل */
.profile-card {
  position: relative;
  background: var(--surface-0);
  margin: 2vh auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 400px;
  height: auto;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 25px var(--shadow-3);
  transform: scale(0.8);
  opacity: 0;
}

.modal.modal-show .profile-card {
  transform: scale(1);
  opacity: 1;
}

/* حماية الفوتر من التأثر بالمودال */
.main-footer {
  position: relative;
  z-index: 1;
}

/* ========== نظام الفلترة المتقدم ========== */
.advanced-filters {
  background: transparent;
  backdrop-filter: none;
  border-radius: 0;
  box-shadow: none;
  border: none;
  padding: 0;
  margin: 20px 0 40px 0;
}

/* شريط البحث البيضاوي - نسخة مطابقة من صفحة المجلة */
.search-container {
  margin-bottom: 25px;
}

.search-box-oval {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  background: var(--surface-0);
  border: 2px solid rgba(var(--primary-color-rgb), 0.15);
  border-radius: 25px;
  padding: 12px 50px 12px 20px;
  box-shadow: 0 2px 8px rgba(var(--black-rgb), 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-box-oval:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.15);
  transform: translateY(-2px);
}

.search-input-oval {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  font-family: 'Tajawal', sans-serif;
  color: var(--text-strong);
  font-weight: 500;
}

.search-input-oval::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-icon-oval {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-size: 1rem;
  opacity: 0.7;
}

.clear-search {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--accent-soft-bg);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--accent-color);
  font-size: 0.9rem;
  font-weight: 600;
}

.clear-search:hover {
  background: var(--accent-color);
  color: var(--text-white);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 12px var(--accent-shadow-soft);
}

.search-box.has-text .clear-search {
  display: flex;
}

/* ========== نظام البحث والفلترة المتقدم ========== */
#top-students .section-header {
  text-align: center;
  margin-bottom: 30px;
}

/* ========== شريط الفلاتر الموحد ========== */
/* ========== شريط الفلاتر الموحد ========== */
.unified-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(var(--primary-color-rgb), 0.02);
  border-radius: 25px;
  padding: 12px 15px;
  margin: 25px 0;
  box-shadow: 0 4px 20px rgba(var(--black-rgb), 0.06);
  border: 1px solid rgba(var(--primary-color-rgb), 0.08);
}

/* أزرار الفلاتر الموحدة - EXACT COPY FROM STAFF */
.unified-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-0);
  border: 1.5px solid rgba(var(--primary-color-rgb), 0.15);
  border-radius: 25px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  backdrop-filter: none;
  box-shadow: none;
  white-space: nowrap;
  min-height: 42px;
  flex-shrink: 0;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
  will-change: transform;
}

.unified-filter-btn i {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* Hover for non-active buttons */
.unified-filter-btn:not(.active):hover {
  border-color: var(--cat-color, var(--primary-color));
  background: rgba(var(--primary-color-rgb), 0.05);
  transform: translateY(-2px);
  box-shadow: none;
}

/* Active button */
.unified-filter-btn.active {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
}

.unified-filter-btn.active i {
  opacity: 1;
  color: var(--text-white);
}

/* ========== Dynamic Grade Buttons [data-grade] - CRITICAL FOR API BUTTONS ========== */
/* These selectors target dynamic buttons generated from School Structure API */

[data-grade] {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-0);
  border: 1.5px solid rgba(var(--primary-color-rgb), 0.15);
  border-radius: 25px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  backdrop-filter: none;
  box-shadow: none;
  white-space: nowrap;
  min-height: 42px;
  flex-shrink: 0;
  transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease;
  will-change: transform;
}

[data-grade]:not(.active):hover {
  border-color: var(--cat-color, var(--primary-color));
  background: rgba(var(--primary-color-rgb), 0.05);
  transform: translateY(-2px);
  box-shadow: none;
}

/* الزر النشط - تنسيق قوي مع دعم الثيمات */
.unified-filters-bar [data-grade].active,
.unified-filters-bar .unified-filter-btn.active,
.unified-filter-btn.active,
[data-grade].active {
  background: var(--primary-color);
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-white);
  box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.3);
}

.unified-filters-bar [data-grade].active i,
.unified-filters-bar .unified-filter-btn.active i,
.unified-filter-btn.active i,
[data-grade].active i {
  opacity: 1;
  color: var(--text-white);
}

.unified-filters-bar [data-grade].active span,
.unified-filters-bar .unified-filter-btn.active span,
.unified-filter-btn.active span,
[data-grade].active span {
  color: var(--text-white);
}

/* زر إعادة التعيين الموحد - مطابق لصفحة المجلة */
#top-students .unified-reset-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  color: var(--text-white);
  cursor: pointer;
  box-shadow: none;
  transition: all 0.4s ease;
  flex-shrink: 0;
  margin: 0;
  overflow: visible;
}

#top-students .unified-reset-btn i {
  font-size: 1.1rem;
  transition: transform 0.4s ease;
  display: block;
  line-height: 1;
  color: var(--text-white);
  opacity: 1;
}

#top-students .unified-reset-btn:hover {
  background: var(--accent-color-hover);
  box-shadow: 0 4px 12px rgba(var(--accent-color-rgb), 0.3);
}

#top-students .unified-reset-btn.spinning {
  animation: resetSpin 0.5s ease-in-out;
}

@keyframes resetSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* زر إعادة التعيين الدائري */
/* زر إعادة التعيين الدائري */
#top-students .unified-filters-bar .unified-reset-btn.circular {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 0;
  display: flex;
  /* Kept only if absolutely necessary due to inline styles */
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-color);
  border: none;
  color: var(--text-white);
  cursor: pointer;
  box-shadow: none;
  transition: all 0.4s ease;
  flex-shrink: 0;
  margin: 0;
  overflow: visible;
  /* Allow transforms to work freely */
}

#top-students .unified-filters-bar .unified-reset-btn.circular span {
  display: none;
}

#top-students .unified-filters-bar .unified-reset-btn.circular i {
  font-size: 1.1rem;
  transition: transform 0.4s ease;
  display: block;
  line-height: 1;
  color: var(--text-white);
  opacity: 1;
  -webkit-text-fill-color: var(--surface-0);
}

#top-students .unified-filters-bar .unified-reset-btn.circular:hover {
  background: var(--accent-color-hover);
  box-shadow: 0 4px 12px rgba(var(--accent-color-rgb), 0.3);
}

/* No counter-rotation needed if we rotate the whole button, 
   but if you want Icon to stay upright, uncomment below */
/* 
.unified-filters-bar .unified-reset-btn.circular:hover i {
  transform: rotate(-180deg);
} 
*/

/* عداد النتائج */
.unified-results-count {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  margin: 0 auto;
  min-width: 180px;
  width: 100%;
  max-width: 100%;
  justify-content: center;
  flex-shrink: 0;
  text-align: center;
  padding: 8px 0;
  margin-top: 12px;
}

.unified-results-count::before {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  content: '\f0c0';
  color: var(--primary-color);
  font-size: 0.85rem;
}

/* حذف .filters-group - لم تعد مطلوبة */

/* القائمة المنسدلة البيضاوية - EXACT STAFF STYLE */
.oval-select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-0);
  border: 1.5px solid rgba(var(--primary-color-rgb), 0.15);
  border-radius: 25px;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
  min-height: 42px;
  flex-shrink: 0;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  width: auto;
  min-width: 130px;
  max-width: 200px;
  margin: 0 4px;
}

.oval-select-wrapper:hover {
  border-color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), 0.05);
  transform: translateY(-2px);
  box-shadow: none;
}

.oval-select-wrapper:focus-within {
  border-color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), 0.05);
  box-shadow: none;
  transform: translateY(0);
}

.oval-select {
  width: 100%;
  padding: 10px 18px 10px 40px;
  /* Text padding */
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Tajawal', sans-serif;
  color: var(--text-secondary);
  background: transparent;
  /* Transparent inner */
  border: none;
  /* No border on select */
  outline: none;
  border-radius: 25px;
  cursor: pointer;
  appearance: none;
  min-height: 100%;
  text-overflow: ellipsis;
  overflow: hidden;
  direction: rtl;
}

.oval-select:focus {
  outline: none;
  /* Focus ring handled by wrapper */
  border: none;
  background: transparent;
  box-shadow: none;
}

.oval-select-arrow {
  position: absolute;
  left: 15px;
  /* Arrow on left for RTL */
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-size: 0.8rem;
  pointer-events: none;
}

.oval-select:focus+.oval-select-arrow {
  color: var(--secondary-color);
  transform: translateY(-50%) rotate(180deg);
}

/* كلاسات المودال المفقودة */
.profile-position {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 5px;
}

.profile-department {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

.profile-ejada {
  display: inline-block;
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 5px;
  text-shadow: 0 0 4px rgba(var(--gold-rgb), 0.0);
  filter: drop-shadow(0 0 2px rgba(var(--gold-rgb), 0.2));
}

.profile-ejada i {
  color: var(--gold);
  margin-left: 6px;
  font-size: 1.1rem;
  text-shadow: 0 0 4px rgba(var(--gold-rgb), 0.0);
  filter: drop-shadow(0 0 2px rgba(var(--gold-rgb), 0.2));
}

.profile-details {
  padding: 1rem 1.5rem 1.5rem;
  background: var(--surface-muted);
  margin: 0 1rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-soft);
}

.detail-item {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: var(--surface-0);
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--text-strong);
  box-shadow: 0 1px 3px rgba(var(--black-rgb), 0.05);
}

.detail-item:hover {
  box-shadow: 0 2px 6px rgba(var(--black-rgb), 0.1);
  transform: translateY(-2px);
}

.detail-item:last-child {
  margin-bottom: 0;
}

.detail-item strong {
  color: var(--text-strong);
  font-weight: 600;
  margin-right: 8px;
}

.detail-icon {
  color: var(--text-muted);
  font-size: 1rem;
  margin-left: 12px;
  width: 20px;
  text-align: center;
}

.profile-footer {
  padding: 1rem;
  text-align: center;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-muted);
}

/* الفلاتر الموحدة - سطر واحد */
.unified-filters-row {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
  background: rgba(var(--primary-color-rgb), 0.02);
  border-radius: 25px;
  padding: 15px 20px;
  margin: 25px 0;
  box-shadow: 0 4px 20px rgba(var(--black-rgb), 0.06);
  border: 1px solid rgba(var(--primary-color-rgb), 0.08);
}


.clear-search.show {
  display: flex;
}


/* Enhanced Grades Dropdown Styling */
.grades-dropdown {
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.grades-dropdown option {
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Tajawal', sans-serif;
  color: var(--text-strong);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-soft);
  transition: all 0.2s ease;
}

.grades-dropdown option:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-white);
}

.grades-dropdown option:checked {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-white);
  font-weight: 700;
}

.grades-dropdown option[disabled] {
  color: var(--text-disabled);
  font-weight: 700;
  background: var(--surface-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Enhanced Sections Dropdown Styling */
#sectionSelect {
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

#sectionSelect option {
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Tajawal', sans-serif;
  color: var(--text-strong);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-soft);
  transition: all 0.2s ease;
}

#sectionSelect option:hover {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-white);
}

#sectionSelect option:checked {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  color: var(--text-white);
  font-weight: 700;
}

#sectionSelect option[value="all"] {
  color: var(--text-disabled);
  font-weight: 700;
  background: var(--surface-muted);
  font-size: 0.9rem;
}


/* زر إعادة التعيين */
#top-students .unified-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--accent-soft-bg);
  border: 2px solid rgba(var(--accent-color-rgb), 0.2);
  border-radius: 25px;
  font-family: 'Tajawal', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(var(--accent-color-rgb), 0.1);
  flex-shrink: 0;
}

/* زر إعادة التعيين الدائري */
#top-students .unified-reset-btn.circular {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  gap: 0;
}

#top-students .unified-reset-btn.circular i {
  font-size: 0.9rem;
}

/* عداد النتائج */
.unified-results-count {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-subtle);
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.unified-results-count::before {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  content: '\f0c0';
  /* أيقونة المجموعة/الأشخاص */
  color: var(--primary-color);
  font-size: 0.8rem;
}


/* شارة الإبداع - بدون تأثيرات متحركة */
.creative-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--creative-badge-1), var(--creative-badge-2));
  color: var(--text-white);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 10px 0 15px;
  box-shadow: 0 4px 12px var(--creative-badge-shadow);
  position: relative;
  overflow: hidden;
}

.creative-badge i {
  font-size: 1rem;
  filter: drop-shadow(0 1px 2px rgba(var(--black-rgb), 0.2));
}


/* معلومات سريعة بتصميم إبداعي */
.student-quick-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg,
      rgba(var(--primary-color-rgb), 0.05) 0%,
      rgba(var(--secondary-color-rgb), 0.03) 100%);
  padding: 1rem;
  border-radius: 16px;
  border-left: 4px solid var(--primary-color);
}

.quick-info-item {
  text-align: center;
  flex: 1;
}

.quick-info-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
}

.quick-info-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary-color);
  display: block;
  margin-bottom: 0.2rem;
}

.quick-info-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* محتوى البطاقة - مثل card-content في الصفحة الرئيسية */
.student-card-content {
  flex: 1;
}

.student-card-content p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* إحصائيات الطالب - مثل education-stats في الصفحة الرئيسية */
.student-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.student-stat-box {
  background: rgba(var(--primary-color-rgb), 0.1);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
  flex: 1;
}

.student-stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.25rem;
}

.student-stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* حاوية الكبسولات - الصف والمواد */
.student-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  align-items: center;
}

/* زر الثيم - مثل الأزرار في التصميم الأصلي */
.student-theme-btn {
  border: none;
  border-radius: 100px;
  padding: 8px 20px;
  color: var(--text-white);
  margin-bottom: 15px;
  text-transform: uppercase;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

/* أزرار الثيمات الأربعة */
.student-theme-btn.fire {
  background: linear-gradient(to left, var(--fire-gradient-color1), var(--fire-gradient-color2));
}

.student-theme-btn.purple {
  background: linear-gradient(to left, var(--purple-gradient-color1), var(--purple-gradient-color2));
}

.student-theme-btn.sky {
  background: linear-gradient(to left, var(--sky-gradient-color1), var(--sky-gradient-color2));
}

.student-theme-btn.nature {
  background: linear-gradient(to left, var(--nature-gradient-color1), var(--nature-gradient-color2));
}

/* كبسولة الصف والشعبة - بدون تأثيرات متحركة */
.grade-section-tag {
  display: inline-block;
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  color: var(--text-white);
  padding: 6px 12px;
  border-radius: 18px;
  font-size: 0.8rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(var(--white-rgb), 0.3);
  box-shadow: 0 3px 10px rgba(var(--primary-color-rgb), 0.2);
}

/* تم إزالة .grade-section-tag::before - تأثير الضوء المتحرك */
/* تم إزالة .grade-section-tag:hover::before - التحريك عند الهوفر */

/* تم حذف تأثيرات الهوفر للمواد - غير مستخدمة */

/* وصف الطالب - مخفي في التصميم الجديد لتوفير مساحة */
.student-description {
  display: none;
}

/* زر عرض المزيد */
.load-more-container {
  text-align: center;
  margin-top: 3rem;
  position: relative;
}

.load-more-btn {
  background: var(--primary-color);
  color: var(--text-white);
  border: none;
  padding: 1rem 2.5rem;
  border-radius: 12px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
}

.load-more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* أنيميشن التحميل */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(var(--white-rgb), 0.3);
  border-top: 2px solid var(--surface-0);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.close-modal {
  position: absolute;
  top: 15px;
  left: 20px;
  width: 35px;
  height: 35px;
  background: rgba(var(--white-rgb), 0.2);
  border: none;
  border-radius: 50%;
  color: var(--text-white);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.close-modal:hover {
  background: rgba(var(--white-rgb), 0.3);
  transform: scale(1.1);
}

/* رأس المودال */
.modal-student-header {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  padding: 2rem;
  color: var(--text-white);
  text-align: center;
  position: relative;
}

.modal-student-avatar {
  margin-bottom: 1rem;
}

.modal-student-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(var(--white-rgb), 0.3);
}

.modal-student-avatar-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(var(--white-rgb), 0.15);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-white);
  border: 4px solid rgba(var(--white-rgb), 0.3);
}

.modal-student-basic-info h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.modal-student-position {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 0.3rem;
}

.modal-student-department {
  font-size: 1rem;
  opacity: 0.8;
  margin-bottom: 1rem;
}

.modal-student-experience {
  display: inline-block;
  background: rgba(var(--white-rgb), 0.2);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
}

/* محتوى المودال */
.modal-student-bio,
.modal-student-qualifications,
.modal-student-contact {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--students-border);
}

.modal-student-bio h3,
.modal-student-qualifications h3,
.modal-student-contact h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-color);
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.modal-student-bio p {
  color: var(--students-text-light);
  line-height: 1.7;
  font-size: 1rem;
}

.qualifications-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.qualification-badge {
  background: var(--students-border);
  color: var(--students-text);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 500;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  color: var(--students-text-light);
}

.contact-item i {
  color: var(--primary-color);
  width: 20px;
}

/* تأثيرات إضافية للبطاقات - تم إلغاء تأثيرات الضوء المتحرك */
/* تم إزالة .student-card::after - تأثير الضوء الدائري */
/* تم إزالة .student-card:hover::after - التحريك عند الهوفر */

/* تأثير الضوء المتحرك - تم إلغاؤه */
/* تم إزالة .student-card-header::after - تأثير الضوء القطري */
/* تم إزالة .student-card:hover .student-card-header::after - التحريك عند الهوفر */

/* الاستجابة للشاشات */
@media (max-width: 1200px) {
  .students-creative-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
  }
}

/* تم دمج هذا التكرار مع media query الرئيسي */
@media (max-width: 768px) {
  /* بطاقات الطلاب/الكادر: بدون حشو على حواف البطاقة — الرأس بعرض كامل والنص يتنفس */
  #top-students .student-card,
  #staff-section .student-card {
    max-width: none;
    width: 100%;
    min-height: 0;
    padding: 0;
    margin-inline: auto;
  }

  #top-students .student-card .profile-header,
  #staff-section .student-card .profile-header {
    height: 88px;
  }

  #top-students .student-card .profile-avatar,
  #staff-section .student-card .profile-avatar {
    width: 118px;
    height: 118px;
    top: 30px;
    border-width: 3px;
  }

  #top-students .student-card .profile-avatar img,
  #top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
  #staff-section .student-card .profile-avatar img,
  #staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
    width: 118px;
    height: 118px;
  }

  #top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
  #staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
    font-size: 3rem;
  }

  #top-students .student-card .profile-name,
  #staff-section .student-card .profile-name {
    margin: 78px 0 18px;
    padding-inline: 12px;
    padding-bottom: 1rem;
    font-size: 1.25rem;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #top-students .student-card .profile-desc,
  #staff-section .student-card .profile-desc {
    padding: 0.35rem 1rem 0.75rem;
    min-height: auto;
  }

  #top-students .student-card .creative-space,
  #staff-section .student-card .creative-space {
    margin-top: 6px;
    margin-bottom: 4px;
    min-height: 26px;
  }

  #top-students .student-card .student-stars {
    margin: 12px 0;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  #staff-section .student-card .teacher-badges {
    margin: 10px 0;
    padding-inline: 8px;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  #top-students .student-card .card-footer-btn,
  #staff-section .student-card .card-footer-btn {
    padding: 12px 16px;
    font-size: 0.9rem;
    border-radius: 0 0 20px 20px;
  }

  .student-avatar {
    width: 100px;
    /* حجم موحد للصورة في الموبايل */
    height: 100px;
    margin-bottom: 20px;
  }

  .student-avatar i {
    font-size: 40px;
  }

  .student-name {
    font-size: 1.2rem;
    margin-bottom: 8px;
  }

  .student-position {
    font-size: 0.9rem;
    margin-bottom: 15px;
  }

  .student-stars i {
    font-size: 1rem;
  }

  /* تم حذف أنماط المواد من media queries */

  .modal-content {
    width: 95%;
    margin: 0 auto;
  }

  .modal-student-header {
    padding: 1.5rem;
  }

  .modal-student-photo {
    width: 80px;
    height: 80px;
  }

  .modal-student-avatar-placeholder {
    width: 80px;
    height: 80px;
    font-size: 2.5rem;
  }

  .modal-student-basic-info h2 {
    font-size: 1.5rem;
  }

  .modal-student-bio,
  .modal-student-qualifications,
  .modal-student-contact {
    padding: 1rem 1.5rem;
  }
}

@media (max-width: 480px) {
  #top-students h2 {
    font-size: 2rem;
  }

  .students-search-container {
    padding: 1rem;
    margin-bottom: 1.5rem;
  }

  .search-title {
    font-size: 1.2rem;
  }

  .grade-btn {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  /* شريط الفلاتر للموبايل الصغير */
  .unified-filters-bar {
    margin: 15px 10px;
    padding: 16px 12px;
    gap: 10px;
    flex-direction: column;
    min-height: auto;
  }

  /* أزرار الفلاتر محسنة للموبايل الصغير */
  .unified-filter-btn {
    font-size: 0.9rem;
    padding: 12px 16px;
    min-width: 120px;
    width: 100%;
    max-width: none;
    justify-content: center;
    border-radius: 22px;
    min-height: 44px;
  }

  .unified-reset-btn {
    font-size: 0.9rem;
    padding: 12px 16px;
    min-height: 44px;
    width: 100%;
    margin: 8px 0 0 0;
  }

  /* زر إعادة التعيين - موبايل */
  .unified-reset-btn.circular {
    width: 44px;
    height: 44px;
    align-self: center;
    margin: 8px 0 0 0;
  }

  /* القائمة المنسدلة - موبايل */
  .oval-select-wrapper {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .oval-select {
    font-size: 0.85rem;
    padding: 12px 16px 12px 35px;
    direction: rtl;
  }

  .oval-select-arrow {
    right: 12px;
  }

  .section-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    min-width: 44px;
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .students-creative-grid {
    gap: 1.25rem;
    padding: 0 10px;
  }

  /* تضييق إضافي للهاتف الصغير — نفس النموذج: عمود واحد + بطاقة بعرض الشبكة */
  #top-students .student-card .profile-header,
  #staff-section .student-card .profile-header {
    height: 80px;
  }

  #top-students .student-card .profile-avatar,
  #staff-section .student-card .profile-avatar {
    width: 104px;
    height: 104px;
    top: 26px;
  }

  #top-students .student-card .profile-avatar img,
  #top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
  #staff-section .student-card .profile-avatar img,
  #staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
    width: 104px;
    height: 104px;
  }

  #top-students .student-card .profile-avatar .modal-student-avatar-placeholder,
  #staff-section .student-card .profile-avatar .modal-teacher-avatar-placeholder {
    font-size: 2.65rem;
  }

  #top-students .student-card .profile-name,
  #staff-section .student-card .profile-name {
    margin: 68px 0 16px;
    padding-inline: 10px;
    padding-bottom: 1.1rem;
    font-size: 1.12rem;
  }

  #top-students .student-card .profile-desc,
  #staff-section .student-card .profile-desc {
    padding: 0.4rem 0.85rem 0.65rem;
  }

  #top-students .student-card .card-footer-btn,
  #staff-section .student-card .card-footer-btn {
    padding: 11px 14px;
    font-size: 0.85rem;
  }

  /* شريط الفلاتر الموحد - تابلت */
  .unified-filters-bar {
    flex-direction: column;
    gap: 12px;
    padding: 18px 15px;
    margin: 15px 0 25px 0;
    min-height: auto;
  }

  /* أزرار الفلاتر محسنة للتابلت */
  .unified-filter-btn {
    font-size: 0.95rem;
    padding: 12px 18px;
    min-width: 140px;
    flex: 1 1 calc(50% - 6px);
    max-width: 200px;
    justify-content: center;
  }

  /* زر إعادة التعيين - تابلت */
  .unified-reset-btn.circular {
    width: 44px;
    height: 44px;
    align-self: center;
  }

  /* القائمة المنسدلة - تابلت */
  .oval-select-wrapper {
    width: 100%;
    max-width: 200px;
    align-self: center;
    margin: 0;
  }

  .oval-select {
    padding: 12px 18px 12px 35px;
    direction: rtl;
  }

  .oval-select-arrow {
    right: 15px;
  }

  /* زر إعادة التعيين محسن */
  .unified-reset-btn {
    width: 100%;
    justify-content: center;
    font-size: 1rem;
    padding: 14px 20px;
    min-height: 48px;
    border-radius: 25px;
    margin: 8px 0;
  }

  /* القائمة المنسدلة - تابلت */
  .oval-select-wrapper {
    width: 100%;
    max-width: 300px;
  }

  .student-avatar-frame {
    width: 100px;
    height: 100px;
  }

  /* تم حذف تكرارات .student-name و .student-position - موجودة في الأعلى */

  .student-rating {
    margin-bottom: 15px;
  }

  .student-stars i {
    font-size: 0.9rem;
  }

  /* تم حذف أنماط المواد من media queries الصغيرة */

  .load-more-btn {
    padding: 0.8rem 2rem;
    font-size: 1rem;
  }

  .modal-content {
    width: 98%;
    margin: 5% auto;
  }

  .modal-student-header {
    padding: 1rem;
  }

  .modal-student-photo {
    width: 70px;
    height: 70px;
  }

  .modal-student-avatar-placeholder {
    width: 70px;
    height: 70px;
    font-size: 2rem;
  }

  .modal-student-basic-info h2 {
    font-size: 1.3rem;
  }

  .modal-student-bio,
  .modal-student-qualifications,
  .modal-student-contact {
    padding: 0.75rem 1rem;
  }
}

/* ========== شريط البحث البيضاوي - تنسيق نهائي قوي ========== */
#top-students .search-box-oval {
  position: relative;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  background: var(--surface-0);
  border: 2px solid rgba(var(--primary-color-rgb), 0.15);
  border-radius: 25px;
  padding: 12px 50px 12px 20px;
  box-shadow: 0 2px 8px rgba(var(--black-rgb), 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  display: block;
}

#top-students .search-box-oval:hover {
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(var(--primary-color-rgb), 0.15);
  transform: translateY(-2px);
}

#top-students .search-input-oval {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 0.95rem;
  font-family: 'Tajawal', sans-serif;
  color: var(--text-strong);
  font-weight: 500;
  padding: 0;
  margin: 0;
  box-shadow: none;
}

#top-students .search-input-oval::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

#top-students .search-icon-oval {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-size: 1rem;
  opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════
 * STUDENT MODAL — CSS-driven (no inline hardcoded colors)
 * كل الألوان عبر CSS variables لدعم الثيمات
 * ═══════════════════════════════════════════════════════════ */

.student-modal-overlay {
  box-sizing: border-box;
}

/* قفل تمرير الخلفية (مع position:fixed من JS — modal-background-lock.js) */
html.detail-modal-scroll-lock {
  overflow: hidden;
  height: 100%;
}

body.detail-modal-scroll-lock {
  overscroll-behavior: none;
}

/* هاتف: البطاقة بارتفاع المحتوى حتى حد أقصى، ثم تمرير داخلي — بدون تمديد فارغ */
@media (max-width: 768px) {
  .student-modal-overlay {
    padding: max(12px, env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) max(12px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)) !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .student-modal-overlay .student-modal-card {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 0 1 auto !important;
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
    margin: 0 !important;
    border-radius: 16px !important;
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.3) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .student-modal-close-btn {
    top: calc(12px + env(safe-area-inset-top, 0px));
    left: calc(16px + env(safe-area-inset-left, 0px));
  }
}

/* البطاقة الداخلية للمودال */
.student-modal-card {
  /* ارتفاع الشريط الملون + محاذاة مركز الأفاتار مع خط الفصل (نفس فكرة البطاقة) */
  --student-modal-header-h: 100px;
  --student-modal-avatar-size: 120px;
  position: relative;
  background: var(--surface-0);
  margin: 0;
  padding: 0;
  border-radius: 18px;
  width: min(420px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  font-family: 'Tajawal', sans-serif;
  direction: rtl;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.student-modal-card::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* زر الإغلاق */
.student-modal-close-btn {
  position: absolute;
  top: 12px;
  left: 16px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(5px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  font-size: 1.2rem;
  color: var(--text-white);
  transition: all 0.3s ease;
  line-height: 1;
  /* تحسين touch target */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.student-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

/* هيدر المودال — ارتفاع ثابت يطابق متغير المحاذاة */
.student-modal-header {
  position: relative;
  width: 100%;
}

.student-modal-header.profile-header {
  height: var(--student-modal-header-h);
  min-height: var(--student-modal-header-h);
}

/* الصورة / الأفاتار: المركز على حافة الشريط الملون والجسم */
.student-modal-avatar {
  position: absolute;
  left: 50%;
  top: var(--student-modal-header-h);
  transform: translate(-50%, -50%);
  transform-origin: center center;
  z-index: 5;
  width: var(--student-modal-avatar-size);
  height: var(--student-modal-avatar-size);
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 4px solid var(--surface-0);
}

.student-modal-avatar .modal-student-avatar-placeholder {
  margin: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* إبطال أي margin من .profile-avatar عند دمج الأصناف في المودال */
.student-modal-avatar.profile-avatar {
  margin-left: 0;
  margin-inline-start: 0;
  /* المودال: لا هوفر — إلغاء انتقال الحلقة/الصورة يقلل فراغاً بصرياً غير مستقر */
  transition: none;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* اسم الطالب في المودال */
.student-modal-name {
  margin: calc(var(--student-modal-avatar-size) / 2 + 14px) 0 10px;
  font-size: 1.4rem;
  color: var(--text-strong);
}

@media (max-width: 768px) {
  .student-modal-card {
    --student-modal-header-h: 88px;
    --student-modal-avatar-size: 118px;
  }
}

@media (max-width: 480px) {
  .student-modal-card {
    --student-modal-header-h: 80px;
    --student-modal-avatar-size: 104px;
  }
}

/* وصف الطالب في المودال */
.student-modal-desc {
  padding: 0.35rem 1rem 0.8rem;
  text-align: center;
  line-height: 1.4;
}

.student-modal-position {
  font-weight: 600;
  color: var(--text-strong);
  margin-bottom: 3px;
}

.student-modal-department {
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* النجوم داخل المودال */
.student-modal-stars {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 5px;
  margin-bottom: 6px;
}

/* نجوم المودال - بدون inline colors */
.student-modal-stars .star {
  color: var(--star-empty);
  font-size: 1.1rem;
}

.student-modal-stars .star.filled {
  color: var(--gold);
}

.student-modal-stars .star.half {
  background: linear-gradient(270deg, var(--gold) 50%, var(--star-empty) 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* عند لف النجوم بـ badge-sheen-wrap — ضبط الفراغات */
#custom-student-modal .student-modal-stars .badge-sheen-wrap {
  padding: 2px 3px;
  border-radius: 4px;
}

/* صورة الطالب في المودال */
.student-modal-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center center;
  display: block;
  /* تكبير طفيف يغطي فجوات مضادة للاسمية داخل الدائرة (بدون الاعتماد على الهوفر) */
  transform: scale(1.07);
  transform-origin: center center;
}

/* صف الأوسمة */
.student-modal-badges-row {
  text-align: center;
  padding: 0 1rem 0.8rem;
}

/* تفاصيل المودال (الخلفية الداكنة خلف البنود) */
.student-modal-details {
  padding: 1rem 1.2rem 1.2rem;
  background: var(--surface-1);
  margin: 0 1rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

/* عناصر التفاصيل الفردية — RTL: الأيقونة بجوار بداية السطر (يمين)، نص محاذٍ لليمين */
.student-modal-detail-item {
  display: flex;
  flex-direction: row;
  direction: rtl;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.35rem;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--surface-0);
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: right;
  color: var(--text-strong);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.student-modal-detail-item:last-child {
  margin-bottom: 0;
}

.student-modal-detail-item:hover {
  box-shadow: 0 2px 8px rgba(var(--black-rgb), 0.08);
  transform: translateY(-1px);
}

.student-modal-detail-item strong {
  color: var(--text-strong);
  font-weight: 600;
  margin-inline: 0;
  margin-inline-end: 0.3em;
  display: inline;
}

.student-modal-detail-item span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-secondary);
  text-align: right;
  line-height: 1.55;
}

/* إلغاء هامش .detail-icon العام (margin-left) داخل مودال الطالب */
.student-modal-details .student-modal-detail-item > .detail-icon {
  margin: 0;
  width: 1.05em;
  min-width: 1.05em;
  flex-shrink: 0;
  line-height: 1.45;
  font-size: 1em;
  align-self: flex-start;
  padding-top: 0.1em;
  text-align: center;
}

/* أيقونات التفاصيل */
.student-modal-star-icon {
  color: var(--gold);
}

.student-modal-medal-icon {
  color: var(--gold);
}

.student-modal-book-icon {
  color: var(--primary-color);
}

.student-modal-bio-icon {
  color: var(--text-muted);
  opacity: 0.8;
}

/* بند نبذة الطالب — أيقونة الاقتباس بمحاذاة «نبذة:» */
.student-modal-bio-item {
  align-items: flex-start;
  flex-wrap: nowrap;
}

.student-modal-bio-item .detail-icon {
  flex-shrink: 0;
  margin: 0;
  margin-top: 0.12em;
  padding-top: 0;
  color: var(--primary-color);
}

.student-modal-bio-item > div {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
}

.student-modal-bio-text {
  margin: 0.35rem 0 0;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.9rem;
  text-align: right;
}

/* فوتر المودال */
.student-modal-footer {
  padding: 1rem;
  background: var(--primary-color);
  text-align: center;
  min-height: 20px;
  border-radius: 0 0 15px 15px;
}

/* ═══════════════════════════════════════════════════════════════
   وضع الهاتف ≤768px — المتفوقون المدمج (مطابق لنظام المجلة والكادر)
   ═══════════════════════════════════════════════════════════════ */

/* ─── أيقونة قائمة الشعب: مطلقة على جميع الأحجام ─── */
#top-students #sectionFilterSection {
  position: relative;
}

#top-students #sectionFilterSection #sectionSelectIcon {
  position: absolute;
  inset-inline-start: 15px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  pointer-events: none;
  color: var(--primary-color);
  font-size: 0.9rem;
  opacity: 0.85;
  line-height: 1;
}

/* قائمة الشعب: مسافة بداية كافية للأيقونة على جميع الأحجام */
#top-students #sectionFilterSection #sectionSelect {
  padding-inline-start: 40px;
  padding-inline-end: 30px;
}

/* الديسكتوب: القائمة المدمجة مخفية */
@media (min-width: 769px) {
  #top-students .students-compact-grade-filter {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* ── الحاوية: عمودية ومتمركزة ── */
  #top-students .unified-filters-bar {
    --students-compact-width: min(100%, 420px);
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 15px 20px !important;
  }

  /* ── إخفاء أزرار الصفوف الديناميكية (وأي dropdown مضاف لها) ── */
  #top-students [data-dynamic-grade="1"] {
    display: none !important;
  }

  /* ── عرض موحّد لجميع العناصر الأربعة ── */
  #top-students .unified-filters-bar .unified-filter-btn[data-grade="all"],
  #top-students .students-compact-grade-filter,
  #top-students #sectionFilterSection,
  #top-students #resetFilters {
    width: var(--students-compact-width) !important;
    max-width: var(--students-compact-width) !important;
    min-width: 0 !important;
    flex: 0 0 auto !important;
    min-height: 46px !important;
    height: 46px !important;
    box-sizing: border-box !important;
  }

  /* ── زر "جميع الصفوف": كبسولة، الأيقونة مثبّتة على البداية ── */
  #top-students .unified-filters-bar .unified-filter-btn[data-grade="all"] {
    position: relative !important;
    justify-content: center !important;
    border-radius: 999px !important;
    padding: 0 16px !important;
    margin: 0 !important;
    aspect-ratio: auto !important;
  }

  #top-students .unified-filters-bar .unified-filter-btn[data-grade="all"] i {
    position: absolute !important;
    inset-inline-start: 16px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    line-height: 1 !important;
  }

  #top-students .unified-filters-bar .unified-filter-btn[data-grade="all"] span {
    flex: 1 !important;
    text-align: center !important;
  }

  /* ── القائمة المدمجة: إظهار وتنسيق ── */
  #top-students .students-compact-grade-filter {
    display: flex !important;
    padding: 0 !important;
    border-radius: 999px !important;
    overflow: visible !important;
  }

  /* ── تمركز أيقونة القائمة المدمجة — ملوّنة بلون الثيم ── */
  #top-students .students-compact-grade-filter .oval-select-icon {
    position: absolute;
    inset-inline-start: 15px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    color: var(--primary-color);
    font-size: 0.9rem;
    opacity: 0.85;
  }

  /* ── قائمة الشعب: تصحيح ارتفاع وشكل ── */
  #top-students #sectionFilterSection {
    border-radius: 999px !important;
    padding: 0 !important;
  }

  /* ── إخفاء السهم في كلا القائمتين ── */
  #top-students .students-compact-grade-filter .oval-select-arrow,
  #top-students #sectionFilterSection .oval-select-arrow {
    display: none !important;
  }

  /* ── كلا الـ select: نص متمركز، لا تكبير iOS ── */
  #top-students .students-compact-grade-filter .oval-select,
  #top-students #sectionFilterSection .oval-select {
    -webkit-appearance: none;
    appearance: none;
    font-size: max(0.9rem, 16px) !important;
    padding: 0 42px 0 16px !important;
    text-align-last: center !important;
    text-align: center !important;
    -webkit-text-align-last: center !important;
    direction: rtl !important;
    min-height: 46px !important;
    height: 100% !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  /* ── زر إعادة التعيين: مستطيل مدوّر مع نص ── */
  #top-students #resetFilters {
    border-radius: 14px !important;
    aspect-ratio: auto !important;
    padding-inline: 16px !important;
    padding-block: 0 !important;
    justify-content: center !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  #top-students #resetFilters::after {
    content: "إعادة التعيين";
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
  }

  /* ── الدوران: الأيقونة فقط لا الزر كله ── */
  #top-students #resetFilters.spinning {
    animation: none !important;
  }

  #top-students #resetFilters.spinning i {
    animation: studentsResetIconSpin 0.5s ease-in-out;
    transform-origin: center center;
  }
}

@keyframes studentsResetIconSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@media (max-width: 400px) {
  #top-students .unified-filters-bar {
    padding: 12px 15px !important;
  }

  #top-students #resetFilters {
    border-radius: 12px !important;
  }

  #top-students #resetFilters::after {
    font-size: 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #top-students #resetFilters.spinning i {
    animation: none !important;
  }
}

/* ============================================================
   بطاقة وضع الصيانة للمتفوّقين — متوافقة مع الثيم الليلي
   ============================================================ */
#studentsGrid.students-grid--maintenance {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.students-maintenance-card {
  position: relative;
  overflow: hidden;
  max-width: 520px;
  width: 100%;
  padding: 3rem 2.5rem;
  text-align: center;
  border-radius: 16px;
  background: var(--surface-0, #ffffff);
  border: 1px solid var(--border-color, #e9ecef);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.students-maintenance-card.animate,
.students-maintenance-card.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.students-maintenance-card__bar {
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary-color, #6366f1),
    var(--secondary-color, #8b5cf6)
  );
}

.students-maintenance-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  font-size: 1.75rem;
  border-radius: 50%;
  margin-bottom: 1.25rem;
  color: var(--primary-color, #6366f1);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--primary-color, #6366f1) 12%, transparent),
    color-mix(in srgb, var(--secondary-color, #8b5cf6) 12%, transparent)
  );
}

/* احتياط للمتصفحات التي لا تدعم color-mix */
@supports not (background: color-mix(in srgb, red, blue)) {
  .students-maintenance-card__icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  }
}

.students-maintenance-card__msg {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  white-space: pre-line;
  color: var(--text-secondary, #64748b);
}

.students-maintenance-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  color: #fff;
  background: var(--primary-color, #6366f1);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.students-maintenance-card__btn:hover,
.students-maintenance-card__btn:focus-visible {
  opacity: 0.88;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.students-maintenance-card__btn:focus-visible {
  outline: 2px solid var(--primary-color, #6366f1);
  outline-offset: 3px;
}

/* الثيم الليلي */
body.theme-night .students-maintenance-card,
[data-theme="night"] .students-maintenance-card {
  background: var(--surface-1, #1e293b);
  border-color: var(--border-color, #334155);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

body.theme-night .students-maintenance-card__msg,
[data-theme="night"] .students-maintenance-card__msg {
  color: var(--text-secondary, #cbd5e1);
}