﻿/* Leaderboard Styles - Vibrant Dark Theme */

/* Statistics cards */
.stats-card {
  background: linear-gradient(135deg, #161b22 0%, #1a1f26 50%, #1e2328 100%);
  border: 1px solid rgba(33, 150, 243, 0.1);
  border-radius: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(33, 150, 243, 0.05);
  position: relative;
  overflow: hidden;
}

.stats-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2196f3, #1976d2, #0d47a1);
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.5);
}

.stats-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 32px rgba(33, 150, 243, 0.25), 0 4px 16px rgba(0, 0, 0, 0.3);
  border-color: rgba(33, 150, 243, 0.3);
}

/* Leaderboard container */
.leaderboard-container {
  background: linear-gradient(135deg, #161b22 0%, #1a1f26 50%, #1e2328 100%);
  border: 1px solid rgba(33, 150, 243, 0.1);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(33, 150, 243, 0.05);
  position: relative;
}

.leaderboard-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2196f3, #1976d2, #0d47a1);
  box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
}

.leaderboard-header {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #0891b2 100%);
  padding: 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.leaderboard-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.leaderboard-content {
  background: linear-gradient(135deg, #161b22 0%, #1a1f26 50%, #1e2328 100%);
}

/* User avatar styling */
.avatar-container {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  position: relative;
}

.user-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid transparent;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6) padding-box,
              linear-gradient(135deg, #3b82f6, #8b5cf6, #06d6a0) border-box;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.user-avatar:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.5);
}

.avatar-placeholder {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06d6a0 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5rem;
  border: 4px solid transparent;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
  transition: all 0.3s ease;
}

.avatar-placeholder:hover {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.5);
}

/* Username link styling */
.username-link {
  color: #f1f5f9;
  font-size: 1.375rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f1f5f9, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: inline-block;
}

.username-link:hover {
  background: linear-gradient(135deg, #60a5fa, #a855f7, #06d6a0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Badge styling */
.rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-radius: 9999px;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.rank-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.rank-badge:hover::before {
  left: 100%;
}

.rank-first {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  color: #451a03;
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
  transform: scale(1.05);
}

.rank-second {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 50%, #9ca3af 100%);
  color: #1f2937;
  box-shadow: 0 4px 20px rgba(209, 213, 219, 0.4);
}

.rank-third {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%);
  color: #431407;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
}

.rank-other {
  background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%);
  color: #f1f5f9;
  box-shadow: 0 4px 20px rgba(71, 85, 105, 0.4);
}

.points-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06d6a0 100%);
  color: white;
  font-weight: 700;
  font-size: 1.125rem;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.points-badge::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.points-badge:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 30px rgba(59, 130, 246, 0.6);
}

.points-badge:hover::before {
  left: 100%;
}

/* Button styles - Override with site-consistent styling */
.btn-primary {
  border-radius: .25rem;
  --tw-bg-opacity: 1;
  background-color: rgb(33 150 243 / var(--tw-bg-opacity, 1));
  padding: .5rem 1rem;
  font-weight: 500;
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(.4,0,.2,1);
  transition-duration: .15s;
  border: none;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.btn-primary:hover {
  background-color: rgb(25 118 210 / var(--tw-bg-opacity, 1));
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
  text-decoration: none;
}

/* Higher specificity to override a[href^="/user/"] selector */
a.btn-secondary,
.btn-secondary {
  display: inline-flex !important;
  align-items: center !important;
  padding: 0.75rem 1.5rem !important;
  border: 2px solid var(--primary-color) !important;
  color: var(--primary-color) !important;
  background-color: transparent !important;
  font-weight: 600 !important;
  border-radius: var(--border-radius) !important;
  text-decoration: none !important;
  transition: var(--transition) !important;
  cursor: pointer !important;
}

a.btn-secondary:hover,
.btn-secondary:hover {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important;
  border-color: var(--primary-color) !important;
  color: white !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3) !important;
  text-decoration: none !important;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border: 2px solid var(--text-muted, #6c757d);
  color: var(--text-primary);
  background-color: transparent;
  font-weight: 600;
  border-radius: var(--border-radius);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.btn-outline:hover {
  background: var(--text-muted, #6c757d);
  border-color: var(--text-muted, #6c757d);
  color: white;
  transform: translateY(-1px);
  text-decoration: none;
}

/* Table hover effect */
tr:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.05)) !important;
  box-shadow: inset 4px 0 0 #3b82f6;
}

/* Enhanced challenge count styling */
.text-green-400 {
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced time display */
.text-blue-400 {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Responsive design */
@media (max-width: 768px) {
  .avatar-container {
    width: 48px;
    height: 48px;
  }

  .user-avatar,
  .avatar-placeholder {
    width: 48px;
    height: 48px;
    border-width: 2px;
  }

  .username-link {
    font-size: 1.125rem;
  }

  .stats-card {
    padding: 1rem;
  }

  table {
    font-size: 0.875rem;
  }

  .rank-badge,
  .points-badge {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
  }

  /* Improve button styling on mobile */
  .btn-primary {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    min-width: auto;
    width: auto;
  }

  .btn-secondary,
  .btn-outline {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
  }

  /* Fix button centering on mobile - remove margin-right when buttons stack */
  .text-center a.btn-secondary,
  .text-center .btn-secondary,
  .text-center a.btn-primary,
  .text-center .btn-primary {
    display: block !important;
    margin: 0 auto 0.75rem auto !important;
  }

  .text-center a.btn-outline,
  .text-center .btn-outline {
    display: block !important;
    margin: 0 auto !important;
  }
}
