/* 
* Ping Pong Leaderboard - TV Display
* Minimalistic, classy design with muted colors
* Layout optimized for TV with top 3 featured and four-column layout
*/

/* Base Styles */
:root {
  --primary-bg: #121212;
  --card-bg: #1e1e1e;
  --accent-color: #ff6b6b;
  --text-primary: #f5f5f5;
  --text-secondary: #e0e0e0;
  --border-color: #333333;
  --highlight-row: rgba(255, 107, 107, 0.1);
  --top1-color: #ffd700;
  --top2-color: #c0c0c0;
  --top3-color: #cd7f32;
  --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

body {
  margin: 0;
  padding: 0;
  font-family: "Arial", sans-serif;
  background-color: var(--primary-bg);
  color: var(--text-primary);
  line-height: 1.6;
  height: 100vh;
  overflow: hidden; /* Prevent scrolling on TV display */
}

.container {
  width: 95%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Header Styling */
h1 {
  font-size: 3.5rem;
  text-transform: uppercase;
  letter-spacing: 4px;
  margin: 0.5rem 0;
  text-align: center;
  font-weight: 800;
  color: var(--text-primary);
  text-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

h1::after {
  content: "";
  display: block;
  width: 100%; /* Changed from 100px to 100% */
  height: 4px;
  background-color: var(--accent-color);
  margin: 1rem 0; /* Changed from 0.5rem auto 1rem */
  border-radius: 2px;
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  position: relative;
  width: 100%;
}

.header-container h1 {
  margin: 0;
}

.submit-match-btn {
  background: linear-gradient(135deg, var(--accent-color), #ff8f8f);
  color: white;
  border: none;
  padding: 1rem 2rem; /* Increased padding */
  border-radius: 50px;
  font-size: 1.2rem; /* Increased font size */
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
  min-width: 180px; /* Added minimum width */
}

.submit-match-btn .btn-icon {
  font-size: 1.6rem; /* Increased icon size */
  font-weight: bold;
}

.submit-match-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
  background: linear-gradient(135deg, #ff8f8f, var(--accent-color));
}

.button-group {
  display: flex;
  gap: 1.5rem; /* Increased gap between buttons */
  position: relative;
  margin-left: auto;
  z-index: 1;
}

.show-image-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border: none;
  padding: 1rem 2rem; /* Increased padding */
  border-radius: 50px;
  font-size: 1.2rem; /* Increased font size */
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
  min-width: 180px; /* Added minimum width */
}

.show-image-btn .btn-icon {
  font-size: 1.6rem; /* Increased icon size */
}

.show-image-btn:hover {
  transform: scale(1.05);
}

.image-overlay {
  display: block; /* Changed from none */
  position: fixed;
  top: 0;
  right: -50%; /* Changed from right: 0 */
  width: 50%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  padding: 2rem;
  box-sizing: border-box;
  opacity: 0;
  transition: all 0.5s ease-in-out;
  pointer-events: none;
}

.image-overlay.active {
  right: 0;
  opacity: 1;
  pointer-events: all;
}

.overlay-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  position: relative;
  top: 50%;
  transform: translateY(-50%) scale(0.9);
  opacity: 0;
  transition: all 0.5s ease-in-out 0.2s;
}

.image-overlay.active .overlay-image {
  transform: translateY(-50%) scale(1);
  opacity: 1;
}

.close-image-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--accent-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.close-image-btn:hover {
  transform: scale(1.1);
}

/* Side Button Container */
.side-button-container {
  position: fixed;
  right: 0;
  top: 110px;
  transform: translateY(-50%);
  z-index: 100;
  padding: 1rem;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

.submit-match-btn,
.show-image-btn {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.submit-match-btn:hover,
.show-image-btn:hover {
  transform: translateX(-10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .submit-match-btn {
    position: static;
    transform: none;
  }

  .submit-match-btn:hover {
    transform: scale(1.05);
  }

  .button-group {
    position: relative;
    margin: 1rem auto;
    justify-content: center;
  }

  .image-overlay {
    width: 100%;
  }

  .side-button-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    padding: 0.5rem;
    background-color: rgba(18, 18, 18, 0.85);
  }

  .button-group {
    flex-direction: row;
    justify-content: center;
  }

  .submit-match-btn:hover,
  .show-image-btn:hover {
    transform: scale(1.05);
  }
}

/* Main Content Layout */
.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* Reduced from 2rem */
  padding: 0 1rem;
  margin-top: 1rem; /* Added to give some space at the top */
}

/* Top 3 Players Section */
.top-players {
  display: flex;
  justify-content: center;
  gap: 1.5rem; /* Reduced from 2rem */
  margin-bottom: 0.5rem; /* Reduced from 1rem */
}

.winner-card {
  background-color: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  position: relative;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s;
  width: 20%; /* Reduced from 22% */
  min-width: 180px; /* Reduced from 200px */
}

.winner-card.first-place {
  transform: translateY(-10px) scale(1.03); /* Reduced Y offset and scale */
  z-index: 3;
  box-shadow: 0 10px 20px rgba(255, 215, 0, 0.2); /* Reduced shadow */
}

.winner-card.second-place {
  z-index: 2;
}

.winner-card.third-place {
  z-index: 1;
}

.winner-banner {
  padding: 0.5rem 0; /* Reduced from 1rem */
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.first-place .winner-banner {
  background-color: rgba(255, 215, 0, 0.2);
  color: var(--top1-color);
}

.second-place .winner-banner {
  background-color: rgba(192, 192, 192, 0.2);
  color: var(--top2-color);
}

.third-place .winner-banner {
  background-color: rgba(205, 127, 50, 0.2);
  color: var(--top3-color);
}

.winner-position {
  font-size: 2.5rem; /* Reduced from 3rem */
  font-weight: 900;
  margin: 0.3rem 0; /* Reduced from 0.5rem */
}

.first-place .winner-position {
  color: var(--top1-color);
}

.second-place .winner-position {
  color: var(--top2-color);
}

.third-place .winner-position {
  color: var(--top3-color);
}

.winner-name {
  font-size: 1.6rem; /* Reduced from 2rem */
  font-weight: 700;
  margin: 0.3rem 0; /* Reduced from 0.5rem */
  color: var(--text-primary);
}

.winner-rating {
  font-size: 1.6rem; /* Reduced from 2rem */
  font-weight: 700;
  margin: 0.3rem 0 1rem; /* Reduced top/bottom margins */
  color: var(--accent-color);
}

/* Four Column Table Layout */
.rankings-container {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.rankings-column {
  flex: 1;
}

/* Table Styling */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

thead {
  background-color: #2a2a2a;
  border-bottom: 3px solid var(--accent-color);
}

th {
  padding: 1.2rem 1rem;
  text-align: left;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--text-primary);
}

td {
  padding: 1rem 0.8rem;
  font-size: 1.1rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
}

tbody tr:nth-child(even) {
  background-color: var(--highlight-row);
}

tbody tr:hover {
  background-color: rgba(255, 107, 107, 0.15);
}

/* Rating column special styling */
td:last-child {
  font-weight: bold;
  text-align: right;
  color: var(--accent-color);
}

/* Rank column styling */
td:first-child {
  text-align: center;
  font-weight: bold;
  width: 15%;
}

/* Name column styling */
td:nth-child(2) {
  width: 55%;
  font-size: 1.3rem; /* Added to increase the player name size in tables */
  font-weight: 500; /* Added to make names more prominent */
}

/* Rating column styling - additional width control */
th:last-child,
td:last-child {
  width: 30%;
}

/* Responsive design for different TV sizes */
@media (max-width: 1500px) {
  .winner-name {
    font-size: 1.4rem;
  }

  .winner-rating {
    font-size: 1.8rem;
  }

  h1 {
    font-size: 3rem;
  }
}

@media (max-width: 1200px) {
  .top-players {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  .winner-card {
    width: 70%;
  }

  .winner-card.first-place {
    transform: scale(1);
  }

  .rankings-container {
    flex-direction: column;
  }
}

/* For very large TV displays */
@media (min-width: 2000px) {
  body {
    font-size: 1.3rem;
  }

  h1 {
    font-size: 4rem;
  }

  .winner-position {
    font-size: 4rem;
  }

  .winner-name {
    font-size: 2.4rem; /* Also increase the font size for large displays */
  }

  .winner-rating {
    font-size: 2.5rem;
  }

  th {
    font-size: 1.4rem;
  }

  td {
    font-size: 1.3rem;
  }

  td:nth-child(2) {
    font-size: 1.5rem; /* Increase name size for larger displays */
  }
}

/* Helper for visually hiding elements but keeping them accessible */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
