/* Leaderboard Page Styles */

.top-students-header {
  text-align: center;
  margin-bottom: 48px;
}

.top-students-header h1 {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 12px;
}

.top-students-header p {
  font-size: 16px;
  color: #6a6c80;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Spotlight Section (Top 3) */
.spotlight-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  margin-bottom: 56px;
  padding: 20px 0;
}

.spotlight-card {
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
  width: 100%;
  max-width: 300px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid transparent;
}

.spotlight-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Specific ranks */
.spotlight-card.rank-1 {
  order: 2;
  z-index: 3;
  padding-top: 48px;
  border-color: #ffd700;
  background: linear-gradient(180deg, #ffffff 0%, #fffdf0 100%);
  box-shadow: 0 15px 35px rgba(255, 215, 0, 0.15);
}

.spotlight-card.rank-1:hover {
  box-shadow: 0 25px 50px rgba(255, 215, 0, 0.25);
}

.spotlight-card.rank-2 {
  order: 1;
  z-index: 2;
  border-color: #c0c0c0;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
  box-shadow: 0 10px 25px rgba(192, 192, 192, 0.15);
}

.spotlight-card.rank-3 {
  order: 3;
  z-index: 1;
  border-color: #cd7f32;
  background: linear-gradient(180deg, #ffffff 0%, #faf3ed 100%);
  box-shadow: 0 10px 25px rgba(205, 127, 50, 0.15);
}

/* Crown and Badges */
.rank-crown {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
}

.rank-crown img {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
  animation: floatCrown 3s ease-in-out infinite;
}

.rank-1 .rank-crown img {
  width: 56px;
  height: 56px;
}

@keyframes floatCrown {
  0% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
  100% { transform: translateY(0); }
}

.avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 20px;
}

.rank-1 .avatar-wrapper {
  width: 110px;
  height: 110px;
}

.avatar-wrapper img.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #ffffff;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

/* Glow rings around avatar */
.avatar-glow {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  z-index: -1;
  animation: rotateGlow 8s linear infinite;
}

.rank-1 .avatar-glow {
  border: 3px dashed #ffd700;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

.rank-2 .avatar-glow {
  border: 3px dashed #c0c0c0;
}

.rank-3 .avatar-glow {
  border: 3px dashed #cd7f32;
}

@keyframes rotateGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(36deg); }
}

.rank-badge {
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #ffffff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.rank-1 .rank-badge {
  background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
  color: #000000;
}

.rank-2 .rank-badge {
  background: linear-gradient(135deg, #e0e0e0 0%, #9e9e9e 100%);
}

.rank-3 .rank-badge {
  background: linear-gradient(135deg, #d7a15c 0%, #b87333 100%);
}

.student-info h3 {
  font-size: 18px;
  font-weight: 800;
  color: #1c2035;
  margin-bottom: 4px;
}

.rank-1 .student-info h3 {
  font-size: 20px;
}

.student-info .username {
  font-size: 13px;
  color: #a0a2b5;
  display: block;
  margin-bottom: 20px;
  font-weight: 500;
}

/* Stat Grid */
.student-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid #f1f2f6;
  border-bottom: 1px solid #f1f2f6;
  padding: 16px 0;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-item .stat-icon {
  margin-bottom: 6px;
  color: var(--primary);
  opacity: 0.8;
}

.stat-item .stat-value {
  font-size: 15px;
  font-weight: 800;
  color: #1c2035;
}

.stat-item .stat-label {
  font-size: 10px;
  color: #a0a2b5;
  font-weight: 500;
  margin-top: 2px;
}

.score-badge {
  display: inline-block;
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
  padding: 8px 16px;
  border-radius: 12px;
}

/* 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;
  }
}
