/* Enhanced General Styles */
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #f0f4f8 0%, #e6eef7 100%);
  width: 100%;
  min-height: 100vh;
  color: #2d3748;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Enhanced Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  background: linear-gradient(90deg, rgba(0, 84, 180, 0.9) 0%, rgba(0, 122, 255, 0.9) 100%);
  height: 4rem;
  box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  height: 100%; /* Ensures logo is within navbar height */
}

/* Logo Image */
.logo a img {
  height: 4rem;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  background: transparent;
  border-radius: 2%;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
  transition: all 0.3s ease;
}

/* Nav Links */
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: rgba(255, 255, 255, 0.8);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  color: #dbeafe;
}

/* Leaderboard Section */
.leaderboard-section {
  max-width: 90%;
  margin: 2rem auto;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 84, 180, 0.15);
}

/* Table Responsive Container */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 84, 180, 0.1);
}

/* Enhanced Table Styles */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
}

.leaderboard-table th {
  background-color: rgba(0, 122, 255, 0.9);
  color: white;
  padding: 1rem;
  text-align: left;
  white-space: nowrap;
}

.leaderboard-table td {
  padding: 1rem;
  border-top: 1px solid #eaeaea;
}

.leaderboard-table tr:hover {
  background-color: rgba(0, 122, 255, 0.05);
}

/* Top ranks highlighting */
.leaderboard-table tr:nth-child(1) td {
  background-color: rgba(0, 122, 255, 0.15);
  font-weight: bold;
}

.leaderboard-table tr:nth-child(2) td {
  background-color: rgba(0, 122, 255, 0.1);
  font-weight: bold;
}

.leaderboard-table tr:nth-child(3) td {
  background-color: rgba(0, 122, 255, 0.05);
  font-weight: bold;
}

/* Enhanced Footer */
.footer {
  margin-top: auto;
  padding: 1.5rem;
  background: #f8f9fa;
  text-align: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.footer p {
  color: #6c757d;
  font-size: 0.9rem;
}

/* Responsive Styles */
@media screen and (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .leaderboard-section {
    max-width: 95%;
    padding: 0.75rem;
  }
}

@media screen and (max-width: 600px) {
  .navbar {
    flex-direction: column;
    height: auto;
    padding: 0.5rem;
  }
  
  .logo {
    margin-bottom: 0.5rem;
  }
  
  .logo a img {
    height: 3rem;
  }
  
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
  
  .back-btn {
    font-size: 0.9rem;
    padding: 6px 12px;
  }
  
  .contest-name {
    font-size: 1.2rem;
  }
}

@media screen and (max-width: 480px) {
  .nav-links {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }
  
  .nav-links li {
    margin: 0;
    padding: 0.2rem 0;
  }
  
  .nav-links li a {
    font-size: 0.9rem;
  }
  
  .leaderboard-table th,
  .leaderboard-table td {
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  .empty-message {
    padding: 20px;
    font-size: 0.9rem;
  }
  
  .leaderboard-section {
    padding: 0.5rem;
    max-width: 98%;
    margin: 1rem auto;
  }
}
