/* /public/css/leaderboard.css */

/* Inherit base styles from common.css */
body {
  /* FIX: Removed background image and set a solid color matching the site's theme */
  background-color: #030712;
}

#leaderboard-root {
  position: relative;
  z-index: 1;
  padding-top: 80px; /* Space for the fixed header */
  padding-bottom: 4rem;

  /* Add a subtle gradient overlay to match the homepage feel without a full image */
  background-image: linear-gradient(to bottom, rgba(3, 7, 18, 0.1), rgba(3, 7, 18, 0.5) 50%, #030712);
}

/* Custom scrollbar for the modal */
.modal-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.modal-scrollbar::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 4px;
}

.modal-scrollbar::-webkit-scrollbar-thumb {
  background: var(--primary-blue, #00bfff);
  border-radius: 4px;
}

.modal-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--blue-700, #0099cc);
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6);
  }
}

@keyframes pulse-glow-silver {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(192, 192, 192, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(192, 192, 192, 0.5);
  }
}

@keyframes pulse-glow-bronze {
  0%,
  100% {
    box-shadow: 0 0 15px rgba(205, 127, 50, 0.3);
  }
  50% {
    box-shadow: 0 0 25px rgba(205, 127, 50, 0.5);
  }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Add a delay for each row to stagger the animation */
.leaderboard-row {
  animation: fadeIn 0.5s ease-out forwards;
}

/* Container for horizontal scrolling */
.leaderboard-responsive-container {
  overflow-x: auto; /* Enable horizontal scrolling */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  /* Custom scrollbar styles for horizontal scroll */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--primary-blue, #00bfff) #1f2937; /* Firefox */
}

.leaderboard-responsive-container::-webkit-scrollbar {
  height: 8px; /* Height for horizontal scrollbar */
}

.leaderboard-responsive-container::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 4px;
}

.leaderboard-responsive-container::-webkit-scrollbar-thumb {
  background: var(--primary-blue, #00bfff);
  border-radius: 4px;
}

.leaderboard-responsive-container::-webkit-scrollbar-thumb:hover {
  background: var(--blue-700, #0099cc);
}


/* Leaderboard Header */
.leaderboard-header {
  /* Reverted to original Tailwind grid classes, removed explicit grid-template-columns */
  /* The grid-cols-12 and col-span classes in JSX will handle the column distribution */
  padding: 0.75rem 1rem; /* Adjusted padding */
  font-size: 0.875rem; /* Smaller font size */
  font-weight: 600; /* Slightly bolder */
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em; /* Increased letter spacing */
  border-bottom: 2px solid var(--primary-blue); /* Changed color to primary-blue */
  background-color: rgba(17, 24, 39, 0.8); /* Darker background for header */
  position: sticky; /* Make header sticky */
  top: 0; /* Stick to the top of its parent */
  z-index: 10; /* Ensure it's above scrolling content */
  /* Ensure a minimum width for the header to prevent wrapping on smaller desktop screens */
  min-width: 680px; /* This value might need adjustment based on content */
}

/* Removed specific styles for individual header cells as Tailwind classes handle this */
.leaderboard-header > div {
  white-space: nowrap; /* Prevent text from wrapping */
  overflow: hidden; /* Hide overflowing text */
  text-overflow: ellipsis; /* Add ellipsis for hidden text */
  /* Tailwind's flex and text alignment classes in JSX will manage display and alignment */
}


/* Leaderboard Row */
.leaderboard-row {
  /* Reverted to original Tailwind grid classes, removed explicit grid-template-columns */
  /* The grid-cols-12 and col-span classes in JSX will handle the column distribution */
  gap: 1rem; /* Reduced gap */
  align-items: center;
  padding: 0.75rem 1rem; /* Adjusted padding */
  border-bottom: 1px solid var(--gray-800);
  transition: background-color 0.3s ease;
  min-width: 680px; /* Ensure rows don't shrink too much, allowing scroll */
}

.leaderboard-row:hover {
  background-color: rgba(0, 191, 255, 0.1); /* Primary blue hover */
}

.leaderboard-row .col-span-1 {
  display: flex;
  justify-content: center;
  align-items: center;
}

.leaderboard-row .col-span-5 {
  display: flex;
  align-items: center;
  gap: 0.75rem; /* Adjusted gap */
}

.leaderboard-row .col-span-3,
.leaderboard-row .col-span-2 {
  text-align: center;
  font-size: 0.9375rem; /* Slightly smaller font */
}

.leaderboard-row .col-span-2 {
  text-align: right;
  font-size: 1.125rem; /* Slightly smaller font */
}

.leaderboard-row .col-span-1:last-child {
  display: flex;
  justify-content: center;
}

.leaderboard-row button {
  padding: 0.375rem; /* Smaller padding for button */
  border-radius: 0.375rem; /* Slightly smaller border-radius */
}

/* Container for vertical scrollable leaderboard content */
.leaderboard-content-scroll {
  max-height: calc(100vh - 250px); /* Adjust based on header/footer height */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  /* Custom scrollbar styles */
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: var(--primary-blue, #00bfff) #1f2937; /* Firefox */
}

.leaderboard-content-scroll::-webkit-scrollbar {
  width: 8px;
}

.leaderboard-content-scroll::-webkit-scrollbar-track {
  background: #1f2937;
  border-radius: 4px;
}

.leaderboard-content-scroll::-webkit-scrollbar-thumb {
  background: var(--primary-blue, #00bfff);
  border-radius: 4px;
}

.leaderboard-content-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--blue-700, #0099cc);
}


/* Mobile Specific Styles (max-width: 767px) */
@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex !important;
  }

  .leaderboard-header {
    display: none; /* Hide desktop header on mobile */
  }

  .leaderboard-row {
    display: none; /* Hide desktop rows on mobile */
  }

  .leaderboard-mobile-card {
    background-color: var(--gray-900);
    border: 1px solid var(--gray-800);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    animation: fadeIn 0.5s ease-out forwards;
  }

  .mobile-card-header {
    display: flex;
    /* Changed to flex-start for better mobile alignment */
    justify-content: flex-start; 
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--gray-800);
    gap: 1rem; /* Added gap for spacing between rank and player info */
  }

  .mobile-rank {
    display: flex;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 600;
  }

  .mobile-player-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-grow: 1;
    /* Aligned player info to the left for better readability */
    justify-content: flex-start; 
  }

  .mobile-player-info img {
    width: 3rem; /* Slightly larger avatar for mobile */
    height: 3rem;
  }

  .mobile-player-info span {
    font-size: 1.125rem; /* Slightly larger player name font for mobile */
  }

  .mobile-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--gray-800);
  }

  .mobile-stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem; /* Slightly larger font for stats */
  }

  .mobile-stat-item span:first-child {
    color: var(--gray-400);
  }

  .mobile-card-footer {
    padding-top: 0.75rem;
  }

  .mobile-card-footer .btn {
    padding: 0.75rem 1.25rem; /* Increased button padding */
    font-size: 1rem; /* Increased button font size */
    width: 100%; /* Ensure button is full width */
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-blue, #00bfff); /* Consistent button styling */
    color: white;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
  }

  .mobile-card-footer .btn:hover {
    background-color: var(--blue-700, #0099cc);
  }

  /* Apply scrollability to mobile cards container */
  .leaderboard-content-scroll {
    max-height: calc(100vh - 200px); /* Adjust for mobile header/footer */
  }
}

/* Tablet Specific Styles (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .desktop-only {
    display: grid !important; /* Ensure desktop grid is visible */
  }

  .mobile-only {
    display: none !important; /* Hide mobile cards on tablet */
  }

  .leaderboard-header {
    padding: 1rem 1.5rem; /* Slightly more padding */
    font-size: 0.9375rem; /* Slightly larger font */
  }

  .leaderboard-row {
    padding: 1rem 1.5rem; /* Slightly more padding */
  }

  .leaderboard-row .col-span-3,
  .leaderboard-row .col-span-2 {
    font-size: 1rem; /* Default font size */
  }

  .leaderboard-row .col-span-2 {
    font-size: 1.25rem; /* Default font size */
  }
}

/* Desktop (1025px+) */
@media (min-width: 1025px) {
  .desktop-only {
    display: grid !important;
  }

  .mobile-only {
    display: none !important;
  }

  .leaderboard-header {
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
  }

  .leaderboard-row {
    padding: 1rem 1.5rem;
  }
}
