/* =========================================================
   Qalubia Unified Tables System
   يعيد تصميم كل جداول الموقع وفق أحدث أسماء الكلاسات والـ data-label
   ويأتي في آخر التحميل لإلغاء التكرارات والتدرجات القديمة.
   ========================================================= */
:root{
  --q-table-green:#0b684f;
  --q-table-green-2:#0f8a68;
  --q-table-ink:#173d35;
  --q-table-muted:#657a74;
  --q-table-line:#dcebe4;
  --q-table-soft:#f7fbf9;
  --q-table-soft-2:#eef8f2;
  --q-table-gold:#c9982e;
  --q-table-gold-soft:#fff7df;
  --q-table-danger:#b42318;
  --q-table-shadow:0 16px 40px rgba(16,33,31,.075);
  --q-table-radius:24px;
  --q-cell-pad-y:13px;
  --q-cell-pad-x:12px;
}

/* Wrappers */
.name-results-table-wrap,
.directory-results-table-wrap,
.directory-table-wrap,
.students-table-wrap,
.toppers-table-wrap,
.subjects-table-wrap,
.stats-table-wrap,
.table-scroll,
.responsive-table-wrap{
  width:100%!important;
  max-width:100%!important;
  overflow-x:auto!important;
  background:#fff!important;
  border:1px solid var(--q-table-line)!important;
  border-radius:var(--q-table-radius)!important;
  box-shadow:var(--q-table-shadow)!important;
  -webkit-overflow-scrolling:touch!important;
}

/* Unified table base */
.name-results-table,
.directory-results-table,
.directory-table,
.students-table,
.toppers-table,
.subjects-table,
.stats-table,
.responsive-students-table,
.results-table,
.analytics-table,
table.dataTable{
  width:100%!important;
  border-collapse:separate!important;
  border-spacing:0!important;
  background:#fff!important;
  color:var(--q-table-ink)!important;
  direction:rtl!important;
}

.name-results-table th,
.directory-results-table th,
.directory-table th,
.students-table th,
.toppers-table th,
.subjects-table th,
.stats-table th,
.responsive-students-table th,
.results-table th,
.analytics-table th,
table.dataTable th{
  background:var(--q-table-soft-2)!important;
  background-image:none!important;
  color:var(--q-table-green)!important;
  text-align:right!important;
  font-weight:950!important;
  padding:14px 12px!important;
  border:0!important;
  border-bottom:1px solid var(--q-table-line)!important;
  white-space:nowrap!important;
  line-height:1.45!important;
  vertical-align:middle!important;
}

.name-results-table td,
.directory-results-table td,
.directory-table td,
.students-table td,
.toppers-table td,
.subjects-table td,
.stats-table td,
.responsive-students-table td,
.results-table td,
.analytics-table td,
table.dataTable td{
  background:#fff!important;
  background-image:none!important;
  color:var(--q-table-ink)!important;
  text-align:right!important;
  padding:var(--q-cell-pad-y) var(--q-cell-pad-x)!important;
  border:0!important;
  border-bottom:1px solid #edf4ef!important;
  vertical-align:middle!important;
  font-weight:800!important;
  line-height:1.65!important;
}

.name-results-table tbody tr:nth-child(even) td,
.directory-results-table tbody tr:nth-child(even) td,
.directory-table tbody tr:nth-child(even) td,
.students-table tbody tr:nth-child(even) td,
.toppers-table tbody tr:nth-child(even) td,
.subjects-table tbody tr:nth-child(even) td,
.stats-table tbody tr:nth-child(even) td,
.responsive-students-table tbody tr:nth-child(even) td,
.results-table tbody tr:nth-child(even) td,
.analytics-table tbody tr:nth-child(even) td,
table.dataTable tbody tr:nth-child(even) td{
  background:var(--q-table-soft)!important;
  background-image:none!important;
}

.name-results-table tbody tr:hover td,
.directory-results-table tbody tr:hover td,
.directory-table tbody tr:hover td,
.students-table tbody tr:hover td,
.toppers-table tbody tr:hover td,
.responsive-students-table tbody tr:hover td,
.results-table tbody tr:hover td{
  background:#fffdf5!important;
  background-image:none!important;
}

.name-results-table tr:last-child td,
.directory-results-table tr:last-child td,
.directory-table tr:last-child td,
.students-table tr:last-child td,
.toppers-table tr:last-child td,
.subjects-table tr:last-child td,
.stats-table tr:last-child td,
.responsive-students-table tr:last-child td,
.results-table tr:last-child td,
.analytics-table tr:last-child td{
  border-bottom:0!important;
}

/* Serial / small columns */
th.serial-col,
td.serial-col,
th[data-label="م"],
td[data-label="م"],
.name-results-table th:first-child,
.name-results-table td:first-child,
.directory-results-table th:first-child,
.directory-results-table td:first-child,
.toppers-table th:first-child,
.toppers-table td:first-child{
  width:46px!important;
  min-width:46px!important;
  max-width:58px!important;
  text-align:center!important;
  padding-inline:6px!important;
  white-space:nowrap!important;
}
.row-index{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  min-width:30px!important;
  height:30px!important;
  padding:0 8px!important;
  border-radius:999px!important;
  background:#f1f7f4!important;
  color:#506963!important;
  border:1px solid #dcebe4!important;
  font-weight:950!important;
  font-size:.86rem!important;
}

/* Links and cells */
.name-student-link,
.table-scope-link,
.toppers-student-link,
.school-link,
.edara-link,
.responsive-students-table a,
.toppers-table a{
  display:inline-flex!important;
  align-items:center!important;
  gap:8px!important;
  color:var(--q-table-green)!important;
  text-decoration:none!important;
  font-weight:950!important;
  line-height:1.65!important;
}
.name-student-link:hover,
.table-scope-link:hover,
.toppers-student-link:hover,
.school-link:hover,
.edara-link:hover,
.responsive-students-table a:hover,
.toppers-table a:hover{
  color:var(--q-table-green-2)!important;
  text-decoration:underline!important;
  text-underline-offset:4px!important;
}
.name-student-link i,
.table-scope-link i,
.toppers-student-link i,
.school-link i,
.edara-link i{color:var(--q-table-gold)!important;flex:0 0 auto!important;}

.table-pill,
.seat-pill,
.percent-pill,
.rank-number,
.score-pill,
.score-pill--table,
.status-badge{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  border-radius:999px!important;
  white-space:nowrap!important;
  font-weight:950!important;
  line-height:1.2!important;
}
.table-pill,.seat-pill{
  min-width:64px!important;
  padding:7px 11px!important;
  background:var(--q-table-soft-2)!important;
  color:var(--q-table-green)!important;
  border:1px solid #cbe8db!important;
}
.percent-pill{
  padding:7px 11px!important;
  background:var(--q-table-green)!important;
  color:#fff!important;
  border:1px solid rgba(11,104,79,.2)!important;
}
.rank-number{
  min-width:52px!important;
  padding:7px 11px!important;
  background:var(--q-table-gold-soft)!important;
  color:#8a5a00!important;
  border:1px solid #f0d690!important;
}
.score-pill,.score-pill--table,.status-badge{
  padding:7px 11px!important;
  background:#fff7df!important;
  color:#8a5a00!important;
  border:1px solid #f0d690!important;
}
.table-result-btn,
.view-details-btn--compact{
  min-width:42px!important;
  height:42px!important;
  padding:0 13px!important;
  border-radius:15px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  color:#fff!important;
  background:linear-gradient(135deg,var(--q-table-green),var(--q-table-green-2))!important;
  border:0!important;
  text-decoration:none!important;
  box-shadow:0 10px 22px rgba(10,107,79,.18)!important;
  font-weight:950!important;
}
.table-result-btn:hover,
.view-details-btn--compact:hover{transform:translateY(-1px)!important;filter:saturate(1.06)!important;text-decoration:none!important;}

/* Toppers-specific table card */
.toppers-table-card{
  background:#fff!important;
  background-image:none!important;
  border:1px solid var(--q-table-line)!important;
  border-radius:28px!important;
  padding:18px!important;
  box-shadow:var(--q-table-shadow)!important;
}
.toppers-table-card__head{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:14px!important;
  margin-bottom:15px!important;
}
.toppers-table-card__head h3{
  margin:0 0 7px!important;
  color:var(--q-table-green)!important;
  font-weight:950!important;
  line-height:1.45!important;
  display:flex!important;
  align-items:center!important;
  gap:9px!important;
}
.toppers-table-card__head h3 i{color:var(--q-table-gold)!important;}
.toppers-table-card__head p{margin:0!important;color:var(--q-table-muted)!important;font-weight:800!important;line-height:1.8!important;}
.toppers-count-badge{
  display:inline-flex!important;
  align-items:center!important;
  gap:8px!important;
  border-radius:999px!important;
  background:#fff7df!important;
  color:#744d00!important;
  border:1px solid #f0d690!important;
  padding:9px 13px!important;
  font-weight:950!important;
  white-space:nowrap!important;
}
.toppers-table tr.is-podium-row td{
  background:#fffaf0!important;
  background-image:none!important;
  color:#5b3b00!important;
}
.topper-card-btn{
  min-width:44px!important;
  height:44px!important;
  padding:0 13px!important;
  border:0!important;
  border-radius:16px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:8px!important;
  cursor:pointer!important;
  background:linear-gradient(135deg,#c9982e,#f0d690)!important;
  color:#3f2a00!important;
  box-shadow:0 12px 24px rgba(201,152,46,.22), inset 0 0 0 1px rgba(255,255,255,.45)!important;
  font-weight:950!important;
  transition:transform .18s ease, box-shadow .18s ease, filter .18s ease!important;
}
.topper-card-btn:hover{
  transform:translateY(-2px)!important;
  filter:saturate(1.08)!important;
  box-shadow:0 16px 30px rgba(201,152,46,.30), inset 0 0 0 1px rgba(255,255,255,.6)!important;
}
.topper-card-btn i{font-size:1.05rem!important;}

/* Subjects and analytics tables */
.subjects-table th,
.subjects-table td,
.stats-table th,
.stats-table td,
.analytics-table th,
.analytics-table td{text-align:center!important;}
.subjects-table th:first-child,
.subjects-table td:first-child,
.stats-table th:first-child,
.stats-table td:first-child,
.analytics-table th:first-child,
.analytics-table td:first-child{text-align:right!important;}

/* Advertisement rows inside tables */
.table-ad-row,
.table-ad-row td{
  background:transparent!important;
  background-image:none!important;
  border:0!important;
  box-shadow:none!important;
  padding:10px 0!important;
}
.table-ad-row td:before{display:none!important;content:none!important;}

/* Mobile: turn result tables into cards */
@media(max-width:760px){
  .name-results-table-wrap,
  .directory-results-table-wrap,
  .directory-table-wrap,
  .students-table-wrap,
  .toppers-table-wrap{
    overflow:visible!important;
    border:0!important;
    box-shadow:none!important;
    background:transparent!important;
  }
  .name-results-table,
  .directory-results-table,
  .directory-table,
  .students-table,
  .toppers-table,
  .responsive-students-table{
    min-width:0!important;
    width:100%!important;
    display:block!important;
    background:transparent!important;
    border:0!important;
  }
  .name-results-table thead,
  .directory-results-table thead,
  .directory-table thead,
  .students-table thead,
  .toppers-table thead,
  .responsive-students-table thead{display:none!important;}
  .name-results-table tbody,
  .directory-results-table tbody,
  .directory-table tbody,
  .students-table tbody,
  .toppers-table tbody,
  .responsive-students-table tbody{
    display:grid!important;
    gap:12px!important;
    padding:0!important;
  }
  .name-results-table tr,
  .directory-results-table tr,
  .directory-table tr,
  .students-table tr,
  .toppers-table tr,
  .responsive-students-table tr{
    display:grid!important;
    overflow:hidden!important;
    border:1px solid rgba(10,107,79,.14)!important;
    border-radius:22px!important;
    background:#fff!important;
    box-shadow:0 14px 32px rgba(16,33,31,.08)!important;
  }
  .name-results-table td,
  .directory-results-table td,
  .directory-table td,
  .students-table td,
  .toppers-table td,
  .responsive-students-table td{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:12px!important;
    padding:11px 13px!important;
    border:0!important;
    border-bottom:1px solid #e8f2ed!important;
    background:#fff!important;
    background-image:none!important;
    text-align:left!important;
    font-size:.9rem!important;
    line-height:1.7!important;
  }
  .name-results-table td:last-child,
  .directory-results-table td:last-child,
  .directory-table td:last-child,
  .students-table td:last-child,
  .toppers-table td:last-child,
  .responsive-students-table td:last-child{border-bottom:0!important;}
  .name-results-table td:before,
  .directory-results-table td:before,
  .directory-table td:before,
  .students-table td:before,
  .toppers-table td:before,
  .responsive-students-table td:before{
    content:attr(data-label)!important;
    display:block!important;
    flex:0 0 94px!important;
    color:var(--q-table-green)!important;
    font-weight:950!important;
    text-align:right!important;
  }
  .name-results-table td[data-label="م"],
  .directory-results-table td[data-label="م"],
  .toppers-table td[data-label="م"],
  .responsive-students-table td[data-label="م"]{
    width:100%!important;
    max-width:none!important;
    justify-content:flex-start!important;
    background:#f8fcfa!important;
  }
  .table-result-btn,.view-details-btn--compact{margin-inline-start:auto!important;}
  .toppers-table-card{padding:14px!important;border-radius:24px!important;}
  .toppers-table-card__head{flex-direction:column!important;align-items:stretch!important;}
  .toppers-count-badge{width:max-content!important;max-width:100%!important;}
}

@media(min-width:761px){
  .name-results-table td[data-label="بيان النتيجة"],
  .directory-results-table td[data-label="بيان النتيجة"],
  .responsive-students-table td[data-label="بيان النتيجة"],
  .toppers-table td[data-label="بطاقة تهنئة"]{text-align:center!important;}
}
