/* ===== LEADERBOARD PAGE STYLES ===== */
.leaderboard-hero {
  background: linear-gradient(135deg, rgba(45, 45, 45, 0.9) 0%, rgba(45, 45, 45, 0.7) 100%), 
              url('https://images.unsplash.com/photo-1546519638-68e109498ffc?ixlib=rb-4.0.3&auto=format&fit=crop&w=1400&q=80');
}

/* Leaderboard Filters */
.leaderboard-filters {
  background: var(--white);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--light-gray);
}

.filter-controls {
  display: flex;
  gap: var(--space-6);
  justify-content: center;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.filter-group label {
  font-weight: 600;
  color: var(--secondary);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select {
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--light-gray);
  border-radius: var(--radius);
  background: var(--white);
  font-family: var(--font-secondary);
  transition: var(--transition);
  min-width: 150px;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Leaderboard Table */
.leaderboard-table {
  background: var(--white);
  padding: var(--space-16) 0;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.table-header h2 {
  color: var(--secondary);
  margin-bottom: 0;
}

.table-info {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.last-update {
  color: var(--text-light);
  font-size: var(--text-sm);
}

.countdown-container {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(40, 167, 69, 0.1);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--success);
  color: var(--success);
  font-weight: 600;
  margin-right: var(--space-4);
}

.countdown-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  opacity: 0.8;
}

.countdown-timer {
  font-family: monospace;
  font-size: var(--text-base);
  font-weight: 700;
}

.table-container {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--light-gray);
  overflow: hidden;
  margin-bottom: var(--space-8);
}

.leaderboard {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
}

.leaderboard thead {
  background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-light) 100%);
}

.leaderboard th {
  color: var(--white);
  font-weight: 600;
  padding: var(--space-4) var(--space-3);
  text-align: left;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--primary);
}

.leaderboard tbody tr {
  border-bottom: 1px solid var(--light-gray);
  transition: var(--transition);
}

.leaderboard tbody tr:hover {
  background: var(--light);
}

.leaderboard tbody tr:last-child {
  border-bottom: none;
}

.leaderboard td {
  padding: var(--space-4) var(--space-3);
  color: var(--text);
  vertical-align: middle;
}

/* Top Performer Styles */
.top-performer {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, rgba(255, 215, 0, 0.02) 100%);
  border-left: 4px solid transparent;
}

.top-performer.gold {
  border-left-color: #FFD700;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 215, 0, 0.02) 100%);
}

.top-performer.silver {
  border-left-color: #C0C0C0;
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.1) 0%, rgba(192, 192, 192, 0.02) 100%);
}

.top-performer.bronze {
  border-left-color: #CD7F32;
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.1) 0%, rgba(205, 127, 50, 0.02) 100%);
}

.rank-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--light);
  border-radius: 50%;
  font-weight: 700;
  color: var(--secondary);
}

.top-performer .rank-number {
  background: var(--primary);
  color: var(--white);
}

/* Player Info */
.player-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.player-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.player-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-name {
  font-weight: 600;
  color: var(--secondary);
}

.player-age {
  font-size: var(--text-xs);
  color: var(--text-light);
}

/* Score and Accuracy */
.score {
  font-weight: 700;
  color: var(--primary);
  font-size: var(--text-lg);
}

.accuracy {
  min-width: 100px;
}

.accuracy-bar {
  position: relative;
  height: 24px;
  background: var(--light-gray);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.accuracy-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.accuracy-bar span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--white);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.page-btn {
  padding: var(--space-2) var(--space-4);
  background: var(--white);
  border: 2px solid var(--light-gray);
  border-radius: var(--radius);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.page-btn:hover:not(.disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.page-btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.page-info {
  color: var(--text-light);
  font-weight: 600;
}

/* Leaderboard Stats */
.leaderboard-stats {
  background: linear-gradient(135deg, var(--light) 0%, var(--white) 100%);
  padding: var(--space-16) 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
}

.stat-card {
  background: var(--white);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  text-align: center;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--light-gray);
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto var(--space-4);
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  color: var(--white);
}

.stat-content h3 {
  color: var(--text-light);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--space-2);
}

.stat-number {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.stat-content p {
  color: var(--text-light);
  font-size: var(--text-sm);
  margin: 0;
}

/* Recent Events */
.recent-events {
  background: var(--white);
  padding: var(--space-16) 0;
}

.events-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.event-result-card {
  background: var(--white);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--light-gray);
  transition: var(--transition);
  text-align: center;
}

.event-result-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.event-result-card h3 {
  color: var(--secondary);
  margin-bottom: var(--space-2);
}

.event-date {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.event-location {
  color: var(--text-light);
  margin-bottom: var(--space-4);
}

.event-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.event-stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-1);
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive Design */
@media (max-width: 992px) {
  .filter-controls {
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
  }

  .filter-group {
    width: 100%;
    max-width: 300px;
  }

  .table-header {
    flex-direction: column;
    text-align: center;
  }

  .countdown-container {
    width: 100%;
    justify-content: center;
    margin-right: 0;
    margin-bottom: var(--space-2);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .leaderboard {
    display: block;
    overflow-x: auto;
  }

  .leaderboard th,
  .leaderboard td {
    padding: var(--space-3) var(--space-2);
    font-size: var(--text-sm);
  }

  .player-info {
    flex-direction: column;
    text-align: center;
    gap: var(--space-2);
  }

  .accuracy-bar {
    height: 20px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .events-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  .leaderboard-table {
    padding: var(--space-12) 0;
  }

  .leaderboard-stats {
    padding: var(--space-12) 0;
  }

  .recent-events {
    padding: var(--space-12) 0;
  }

  .stat-card {
    padding: var(--space-4);
  }

  .event-result-card {
    padding: var(--space-4);
  }

  .event-stats {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
}

/* Event Gallery Section */
.event-gallery {
    background: linear-gradient(135deg, var(--light) 0%, var(--white) 100%);
    padding: var(--space-16) 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-8);
}

.gallery-item {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    position: relative;
    background-color: #000; /* Dark background for letterboxed media */
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.gallery-item .gallery-media {
    width: 100%;
    height: 250px; /* Fixed height for all media */
    object-fit: contain; /* Ensures entire image/video is visible */
    transition: var(--transition-slow);
    background-color: #000;
}

/* Video Overlay Styles */
.video-container {
    position: relative;
    width: 100%;
    height: 250px; /* Matches gallery-media height */
    background-color: #000;
    overflow: hidden;
}

.video-container .gallery-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.play-button {
    width: 60px;
    height: 60px;
    background-color: rgba(255, 94, 20, 0.9); /* Primary color */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.play-overlay:hover .play-button {
    transform: scale(1.15);
    background-color: var(--primary);
}

.video-duration {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 6;
}

.fullscreen-btn:hover {
    background-color: var(--primary);
    transform: scale(1.1);
}

/* Image Lightbox Styles */
.image-container {
    position: relative;
    width: 100%;
    height: 250px; /* Matches gallery-media height */
    background-color: #000;
    overflow: hidden;
    cursor: pointer;
}

.image-container .gallery-media {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.zoom-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-overlay i {
    color: white;
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.image-container:hover .zoom-overlay {
    opacity: 1;
}

.image-container:hover .gallery-media {
    transform: scale(1.05);
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-content {
    margin: auto;
    display: block;
    width: auto;
    height: auto;
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    animation: zoomIn 0.3s;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.lightbox-caption-container {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
    text-align: center;
    color: #ccc;
    padding: 20px 0;
}

.lightbox-caption-container h3 {
    color: var(--white);
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.lightbox-caption-container p {
    color: var(--text-light);
    font-size: 1rem;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 2001;
}

.lightbox-close:hover,
.lightbox-close:focus {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
}

/* Lightbox Navigation */
.lightbox-prev,
.lightbox-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: white;
    font-weight: bold;
    font-size: 20px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    -webkit-user-select: none;
    z-index: 2002;
    background-color: rgba(0, 0, 0, 0.3);
}

.lightbox-next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

@keyframes zoomIn {
    from {transform:scale(0.9); opacity: 0;}
    to {transform:scale(1); opacity: 1;}
}

.video-container.playing .play-overlay {
    opacity: 0;
    pointer-events: none;
}

.gallery-caption {
    padding: var(--space-4);
    text-align: center;
    background-color: var(--white);
    flex-grow: 1; /* Ensures captions align if heights vary slightly */
}

.gallery-caption h4 {
    color: var(--secondary);
    margin-bottom: var(--space-1);
    font-size: var(--text-lg);
}

.gallery-caption p {
    color: var(--text-light);
    margin-bottom: var(--space-2);
    font-size: var(--text-sm);
    line-height: 1.4;
}

.photo-date {
    color: var(--primary);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gallery-cta {
    text-align: center;
    background: var(--white);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--light-gray);
}

.gallery-cta p {
    color: var(--text);
    margin-bottom: var(--space-4);
    font-size: var(--text-lg);
    font-weight: 600;
}

/* Enhanced Mobile Responsiveness for Gallery */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-4);
    }
    
    .gallery-item .gallery-media {
        height: 200px;
    }
    
    .gallery-cta {
        padding: var(--space-4);
    }
    
    .gallery-cta p {
        font-size: var(--text-base);
    }
}

@media (max-width: 576px) {
    .event-gallery {
        padding: var(--space-12) 0;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}