/* Premium Leaderboard Page Styles */

.top-students-header {
  text-align: center;
  margin-bottom: 56px;
  position: relative;
}

.top-students-header h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary, #1c2035);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.top-students-header p {
  font-size: 16px;
  color: #6a6c80;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Spotlight Section (Top 3 Podium) */
.spotlight-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 28px;
  margin-bottom: 64px;
  padding: 30px 0 10px;
}

.spotlight-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.04), 0 2px 6px rgba(0, 0, 0, 0.02);
  padding: 36px 24px 28px;
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 320px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 2px solid transparent;
  backdrop-filter: blur(10px);
}

.spotlight-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.08);
}

/* Specific Ranks / Podium Styling */
.spotlight-card.rank-1 {
  order: 2;
  z-index: 3;
  padding-top: 52px;
  border-color: rgba(255, 215, 0, 0.6);
  background: linear-gradient(180deg, #ffffff 0%, #fffef2 60%, #fff9d6 100%);
  box-shadow: 0 18px 45px rgba(255, 193, 7, 0.2), 0 0 20px rgba(255, 215, 0, 0.15);
}

.spotlight-card.rank-1:hover {
  box-shadow: 0 28px 60px rgba(255, 193, 7, 0.3), 0 0 30px rgba(255, 215, 0, 0.25);
}

.spotlight-card.rank-2 {
  order: 1;
  z-index: 2;
  border-color: rgba(192, 192, 192, 0.6);
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 60%, #eef1f6 100%);
  box-shadow: 0 14px 35px rgba(160, 170, 190, 0.18);
}

.spotlight-card.rank-3 {
  order: 3;
  z-index: 1;
  border-color: rgba(205, 127, 50, 0.5);
  background: linear-gradient(180deg, #ffffff 0%, #fdf8f4 60%, #f7e8dc 100%);
  box-shadow: 0 14px 35px rgba(205, 127, 50, 0.18);
}

/* Crown & Floating Icons */
.rank-crown {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.12));
  animation: floatCrown 3.5s ease-in-out infinite;
}

.rank-crown svg {
  transition: transform 0.3s;
}

.spotlight-card:hover .rank-crown svg {
  transform: scale(1.12) rotate(-4deg);
}

@keyframes floatCrown {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-7px); }
}

/* Avatar Wrappers & Pulsing Glows */
.avatar-wrapper {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 20px;
}

.rank-1 .avatar-wrapper {
  width: 116px;
  height: 116px;
}

.avatar-wrapper img.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.spotlight-card:hover img.avatar-img {
  transform: scale(1.05);
}

.avatar-glow {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  z-index: -1;
  animation: rotateGlow 50s linear infinite;
}

.rank-1 .avatar-glow {
  border: 3px dashed #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.rank-2 .avatar-glow {
  border: 3px dashed #b0b5c0;
  box-shadow: 0 0 15px rgba(176, 181, 192, 0.4);
}

.rank-3 .avatar-glow {
  border: 3px dashed #cd7f32;
  box-shadow: 0 0 15px rgba(205, 127, 50, 0.4);
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Rank Badge Pills */
.rank-badge {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  color: #ffffff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.rank-1 .rank-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ff8c00 100%);
  color: #1a1600;
}

.rank-2 .rank-badge {
  background: linear-gradient(135deg, #e0e6ed 0%, #8a96a8 100%);
  color: #1a222e;
}

.rank-3 .rank-badge {
  background: linear-gradient(135deg, #e5a97c 0%, #a75a28 100%);
  color: #2b1100;
}

.student-info h3 {
  font-size: 19px;
  font-weight: 800;
  color: #1c2035;
  margin-bottom: 4px;
  transition: color 0.2s;
}

.student-info a:hover h3 {
  color: var(--primary, #4361ee);
}

.rank-1 .student-info h3 {
  font-size: 21px;
}

.student-info .username {
  font-size: 13px;
  color: #8c8ea3;
  display: block;
  margin-bottom: 20px;
  font-weight: 600;
  direction: ltr;
}

/* Stats Grid with Modern Cards */
.student-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-radius: 16px;
  padding: 12px 8px;
  margin-bottom: 20px;
  border: 1px solid rgba(0, 0, 0, 0.03);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
}

.stat-item .stat-icon {
  margin-bottom: 4px;
  color: var(--primary, #4361ee);
  opacity: 0.85;
}

.stat-item .stat-value {
  font-size: 15px;
  font-weight: 800;
  color: #1c2035;
  line-height: 1.2;
}

.stat-item .stat-label {
  font-size: 10px;
  color: #8c8ea3;
  font-weight: 600;
  margin-top: 2px;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb, 67, 97, 238), 0.12) 0%, rgba(var(--primary-rgb, 67, 97, 238), 0.05) 100%);
  color: var(--primary, #4361ee);
  font-size: 15px;
  font-weight: 800;
  padding: 10px 22px;
  border-radius: 16px;
  border: 1px solid rgba(var(--primary-rgb, 67, 97, 238), 0.15);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb, 67, 97, 238), 0.08);
}

/* Leaderboard Table Section */
.leaderboard-card {
  background: #ffffff;
  border-radius: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
  padding: 32px;
  margin-bottom: 48px;
}

.leaderboard-title-wrapper {
  margin-bottom: 24px;
}

.leaderboard-title-wrapper h2 {
  font-size: 22px;
  font-weight: 800;
  color: #1c2035;
}

.leaderboard-table {
  width: 100%;
}

.leaderboard-table-header {
  display: grid;
  grid-template-columns: 80px 1fr 100px 100px 100px 100px 140px;
  padding: 16px 24px;
  border-bottom: 1px solid #f1f2f6;
  color: #a0a2b5;
  font-size: 13px;
  font-weight: 700;
  gap: 5px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px 100px 100px 100px 140px;
  padding: 16px 24px;
  align-items: center;
  border-radius: 16px;
  margin-top: 8px;
  transition: all 0.2s ease;
  background: #ffffff;
  border: 1px solid transparent;
}

.leaderboard-row:hover {
  background: #fdfdff;
  border-color: rgba(var(--primary-rgb), 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
  transform: scale(1.005);
}

.row-rank-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f2f6;
  color: #6a6c80;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.row-student {
  display: flex;
  align-items: center;
  gap: 16px;
}

.row-student img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.row-student-info {
  display: flex;
  flex-direction: column;
}

.row-student-info .student-name {
  font-size: 15px;
  font-weight: 700;
  color: #1c2035;
  transition: color 0.2s;
}

.row-student-info .student-name:hover {
  color: var(--primary);
}

.row-student-info .student-username {
  font-size: 12px;
  color: #a0a2b5;
  font-weight: 500;
}

.row-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: #1c2035;
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-stat-val .row-icon {
  color: var(--primary);
  opacity: 0.6;
}

.row-score {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary);
}

/* RTL Adjustments */
.rtl .top-students-header p {
  margin: 0 auto;
}

.rtl .spotlight-card.rank-1 {
  order: 2;
}

.rtl .spotlight-card.rank-2 {
  order: 3; /* Flip side-by-side ordering for RTL */
}

.rtl .spotlight-card.rank-3 {
  order: 1;
}

.rtl .rank-badge {
  left: auto;
  right: 50%;
  transform: translateX(50%);
}

.rtl .row-student-info {
  text-align: right;
}

/* Dark Mode Support */
.dark-mode .spotlight-card {
  background: #1e1e30;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-color: #2b2b40;
}

.dark-mode .spotlight-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.dark-mode .spotlight-card.rank-1 {
  background: linear-gradient(180deg, #242215 0%, #1e1e30 100%);
  border-color: #ffd700;
  box-shadow: 0 15px 35px rgba(255, 215, 0, 0.1);
}

.dark-mode .spotlight-card.rank-2 {
  background: linear-gradient(180deg, #1f2024 0%, #1e1e30 100%);
  border-color: #c0c0c0;
  box-shadow: 0 10px 25px rgba(192, 192, 192, 0.1);
}

.dark-mode .spotlight-card.rank-3 {
  background: linear-gradient(180deg, #241e1a 0%, #1e1e30 100%);
  border-color: #cd7f32;
  box-shadow: 0 10px 25px rgba(205, 127, 50, 0.1);
}

.dark-mode .student-info h3 {
  color: #ffffff;
}

.dark-mode .student-info .username {
  color: #8c8ea3;
}

.dark-mode .student-stats-grid {
  border-color: #2b2b40;
}

.dark-mode .stat-item .stat-value {
  color: #ffffff;
}

.dark-mode .stat-item .stat-label {
  color: #8c8ea3;
}

.dark-mode .score-badge {
  background: rgba(255, 255, 255, 0.05);
  color: var(--primary);
}

.dark-mode .leaderboard-card {
  background: #1e1e30;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.dark-mode .leaderboard-title-wrapper h2 {
  color: #ffffff;
}

.dark-mode .leaderboard-table-header {
  border-color: #2b2b40;
  color: #8c8ea3;
}

.dark-mode .leaderboard-row {
  background: #1e1e30;
  border-color: transparent;
}

.dark-mode .leaderboard-row:hover {
  background: #25253d;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.dark-mode .row-rank-num {
  background: #2b2b40;
  color: #8c8ea3;
}

.dark-mode .row-student img {
  border-color: #1e1e30;
}

.dark-mode .row-student-info .student-name {
  color: #ffffff;
}

.dark-mode .row-student-info .student-username {
  color: #8c8ea3;
}

.dark-mode .row-stat-val {
  color: #ffffff;
}

.dark-mode .row-stat-val .row-icon {
  color: var(--primary);
}

.dark-mode .top-students-header p {
  color: #8c8ea3;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
  .leaderboard-table-header {
    display: none;
  }
  
  .leaderboard-row {
    grid-template-columns: 50px 1fr 1fr;
    gap: 16px;
    padding: 16px;
  }
  
  .row-student {
    grid-column: 2 / span 2;
  }
  
  .row-stat-val {
    grid-column: span 1;
    font-size: 13px;
    padding-top: 8px;
    border-top: 1px solid #f8f9fc;
  }
  
  .dark-mode .row-stat-val {
    border-color: #2b2b40;
  }
  
  .row-score {
    grid-column: 3;
    text-align: right;
    font-size: 14px;
  }
}

@media (max-width: 768px) {
  .spotlight-container {
    flex-direction: column;
    align-items: center;
    gap: 40px;
  }
  
  .spotlight-card {
    max-width: 320px;
  }
  
  .spotlight-card.rank-1 {
    order: 1;
  }
  
  .spotlight-card.rank-2 {
    order: 2;
  }
  
  .spotlight-card.rank-3 {
    order: 3;
  }
}
