/* ============================================
   TOP STUDENTS — Public Ranking Card Styles
   ============================================ */

/* ===================================================
   HEADER — "Our Top Performers"
   =================================================== */
.top-students-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.top-students-header .ts-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: linear-gradient(135deg, var(--gold-50), rgba(247,197,39,.12));
  color: var(--gold-700);
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .4rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(247,197,39,.25);
  margin-bottom: .75rem;
}
.top-students-header h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  color: var(--gray-900);
  margin-bottom: .5rem;
}
.top-students-header p {
  font-size: .95rem;
  color: var(--gray-500);
  max-width: 560px;
  margin: 0 auto;
}

/* ===================================================
   FILTERS — Board & Year pills
   =================================================== */
.ts-filters {
  display: flex;
  justify-content: center;
  gap: .5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.ts-filter-btn {
  padding: .45rem 1.2rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-500);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  transition: all .3s var(--ease);
  cursor: pointer;
}
.ts-filter-btn:hover {
  border-color: var(--gold-400);
  color: var(--gold-700);
}
.ts-filter-btn.active {
  background: linear-gradient(135deg, var(--gold-400), var(--gold-500));
  color: var(--white);
  border-color: var(--gold-400);
  box-shadow: 0 3px 12px rgba(247,197,39,.3);
}

.ts-year-select {
  padding: .45rem 2rem .45rem 1rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  appearance: none;
  cursor: pointer;
  transition: all .3s var(--ease);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23959da8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}
.ts-year-select:focus {
  outline: none;
  border-color: var(--gold-400);
  box-shadow: 0 0 0 3px rgba(247,197,39,.15);
}

/* ===================================================
   RANKERS GRID
   =================================================== */
.rankers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

/* ===================================================
   RANKER CARD — Premium design
   =================================================== */
.ranker-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  position: relative;
  overflow: hidden;
  transition: all .4s var(--ease);
  text-align: center;
}

/* top colored strip */
.ranker-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-600));
  transition: height .3s var(--ease);
}

.ranker-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue-200);
}
.ranker-card:hover::before { height: 5px; }

/* rank-specific top strip colors */
.ranker-card.rank-1::before {
  background: linear-gradient(90deg, #f7c527, #e8a708, #fad34e);
}
.ranker-card.rank-2::before {
  background: linear-gradient(90deg, #94a3b8, #cbd5e1, #94a3b8);
}
.ranker-card.rank-3::before {
  background: linear-gradient(90deg, #d97706, #b45309, #d97706);
}

/* ===================================================
   RANK BADGE — positioned top-right
   =================================================== */
.rank-badge {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 800;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  box-shadow: 0 2px 8px rgba(30,93,232,.3);
  z-index: 2;
}

.rank-badge.gold {
  background: linear-gradient(135deg, #f7c527, #e8a708);
  color: var(--gray-900);
  box-shadow: 0 2px 12px rgba(247,197,39,.5);
  width: 40px; height: 40px;
  font-size: .85rem;
}
.rank-badge.silver {
  background: linear-gradient(135deg, #94a3b8, #64748b);
  box-shadow: 0 2px 10px rgba(148,163,184,.4);
}
.rank-badge.bronze {
  background: linear-gradient(135deg, #d97706, #92400e);
  box-shadow: 0 2px 10px rgba(217,119,6,.4);
}

/* ===================================================
   STUDENT PHOTO — circle with glow ring
   =================================================== */
.ranker-photo {
  width: 160px; height: 160px;
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  position: relative;
  overflow: hidden;
  border: 3px solid var(--blue-100);
  box-shadow: 0 4px 16px rgba(30,93,232,.12);
  transition: all .35s var(--ease);
}
.ranker-card:hover .ranker-photo {
  border-color: var(--blue-300);
  box-shadow: 0 6px 24px rgba(30,93,232,.25);
  transform: scale(1.03);
}

.ranker-card.rank-1 .ranker-photo {
  border-color: var(--gold-300);
  box-shadow: 0 4px 20px rgba(247,197,39,.25);
}
.ranker-card.rank-1:hover .ranker-photo {
  border-color: var(--gold-400);
  box-shadow: 0 4px 24px rgba(247,197,39,.4);
}

.ranker-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.ranker-photo .ranker-initials {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--white);
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
}

/* ===================================================
   STUDENT INFO
   =================================================== */
.ranker-details-wrapper {
  text-align: left;
  background: rgba(243, 246, 252, 0.6);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.2rem;
  border: 1px solid var(--gray-100);
}

.ranker-detail {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--gray-800);
  margin-bottom: .4rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.ranker-detail strong {
  color: var(--blue-700);
  font-weight: 700;
  min-width: 50px;
}

/* ===================================================
   PERCENTAGE BAR — animated gradient fill
   =================================================== */
.ranker-score {
  margin-bottom: .75rem;
}
.ranker-score .score-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .35rem;
}
.ranker-score .score-text {
  font-size: .75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.ranker-score .score-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--blue-700);
}

.ranker-card.rank-1 .score-value { color: var(--gold-600); }

.score-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}
.score-bar .score-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--blue-400), var(--blue-600));
  width: 0%;
  transition: width 1.2s var(--ease);
  position: relative;
}
.score-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 20px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4));
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}

.ranker-card.rank-1 .score-fill {
  background: linear-gradient(90deg, var(--gold-400), var(--gold-600));
}
.ranker-card.rank-2 .score-fill {
  background: linear-gradient(90deg, #94a3b8, #64748b);
}
.ranker-card.rank-3 .score-fill {
  background: linear-gradient(90deg, #d97706, #b45309);
}

/* animate when visible */
.ranker-card.visible .score-fill {
  width: var(--pct) !important;
}

/* ===================================================
   BOARD BADGE
   =================================================== */
.ranker-board {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .72rem;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: .06em;
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-200);
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.ts-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-400);
  grid-column: 1 / -1;
}
.ts-empty i {
  font-size: 2rem;
  margin-bottom: .75rem;
  display: block;
  opacity: .4;
}

/* ===================================================
   VIEW ALL LINK
   =================================================== */
.ts-view-all {
  text-align: center;
  margin-top: 2rem;
  position: relative;
  z-index: 1;
}

/* ===================================================
   RESPONSIVE — Top Students
   =================================================== */
@media (max-width: 768px) {
  .rankers-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
  }
  .ranker-photo { width: 130px; height: 130px; }
  .ts-filters { gap: .4rem; }
  .ts-filter-btn { padding: .4rem 1rem; font-size: .78rem; }
}

@media (max-width: 480px) {
  .rankers-grid { grid-template-columns: 1fr; gap: 1rem; }
  .ranker-card { padding: 1.25rem 1rem 1rem; }
  .ranker-photo { width: 120px; height: 120px; }
  .rank-badge { width: 30px; height: 30px; font-size: .7rem; top: 10px; right: 10px; }
  .rank-badge.gold { width: 34px; height: 34px; font-size: .75rem; }
  .top-students-header h3 { font-size: 1.35rem; }
}

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