/* styles.css */

/* ===== FONT IMPORTS ===== */
@font-face {
  font-family: "Nunito Sans";
  src: url("../fonts/NunitoSans-VariableFont_YTLC,opsz,wdth,wght.ttf") format("truetype");
  font-weight: normal;
}

@font-face {
  font-family: "Refrigerator Deluxe";
  src: url("../fonts/Refrigerator Deluxe Bold.otf");
  font-weight: normal;
}

/* ===== RESET / BASE ===== */
html {
  overflow-y: scroll;
}

body {
  color: white;
  margin: 0;
  padding: 0;
  font-family: "Nunito Sans";
  background-color: #181A26;
}

/* ===== HEADINGS ===== */
h1 {
  font-family: "Refrigerator Deluxe";
  text-align: center;
  margin: 20px 0;
  font-size: 80px;
}

h2 {
  font-family: "Nunito Sans";
  text-align: center;
  margin: 20px 0;
  font-size: 30px;
}

/* ===== HERO GRID ===== */
.hero-grid {
  display: grid;
  /* The auto-fill/minmax approach already helps with responsiveness. */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.hero-card {
  text-align: center;
  text-decoration: none;
  color: #333;
  transition: transform 0.2s ease-in-out;
}

.hero-card:hover {
  transform: scale(1.02);
}

.hero-card img {
  width: 100%;
  height: auto;
  border: 3px solid transparent;
}

.hero-card p {
  margin: 10px 0 0;
  font-weight: bold;
  color: inherit;
}

/* ===== TITLE CONTAINER ===== */
.title-container {
  text-align: center;
  padding: 40px 0 5px;
  margin: 0;
  margin-bottom: 40px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.02) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.title-container h1 {
  font-family: "Refrigerator Deluxe", sans-serif;
  font-size: 80px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

.title-container h2 {
  font-family: "Nunito Sans", sans-serif;
  margin-top: 10px;
  font-size: 26px;
  font-weight: 300;
  color: #dddddd;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== LEADERBOARD WRAPPER ===== */
.leaderboard-container {
  /* Use fluid width + max-width instead of a fixed 50% */
  width: 90%;
  max-width: 1000px;
  margin: 20px auto 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);

  /* Allow horizontal scroll on small screens if table overflows */
  overflow-x: auto;
}

/* ===== TABLE STYLES ===== */
table#leaderboard {
  width: 100%;
  border-collapse: collapse;
  color: #fff;
  font-family: "Nunito Sans", sans-serif;
  border-radius: 8px;
  overflow: hidden;
  margin: 0 auto;
}

table#leaderboard thead {
  background: linear-gradient(90deg, rgba(100, 100, 120, 0.35), rgba(80, 80, 100, 0.35));
}

table#leaderboard thead th {
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 1px;
  font-weight: 600;
  padding: 15px 15px;
  border-bottom: 1px solid #444;
  text-align: left;
}

table#leaderboard tbody tr {
  border-bottom: 1px solid #333;
  transition: background-color 0.2s ease;
}

table#leaderboard tbody tr:hover {
  background-color: #2c313c;
}

table#leaderboard tbody td {
  /* Slightly reduced padding for smaller screens */
  padding: 15px 10px;
  font-size: 18px;
  vertical-align: middle;
  border: none;
}

/* FIRST COLUMN: RANK */
table#leaderboard tbody td:first-child {
  width: 60px;
  text-align: center;
  font-size: 20px;
  font-weight: bold;
}

.rank-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 8px;
}

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

/* ===== PAGE HEADLINE ===== */
h1#hero-name {
  font-family: "Refrigerator Deluxe";
  text-align: center;
  margin: 40px 0 10px;
  font-size: 54px;
  color: #fff;
}

h2#description {
  font-family: "Nunito Sans";
  text-align: center;
  margin: 0 0 20px;
  font-size: 20px;
  color: #ddd;
}

/* ===== BACK BUTTON ===== */
.hero-select-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 6rem;
  height: fit-content;
  transition: all 0.3s ease;
}

.hero-select-btn:hover {
  transform: scale(1.1);
}

/* ===== FADE-IN ANIMATIONS ===== */
@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-element {
  opacity: 0;
  animation: fadeInUp 0.5s forwards ease-out;
}

.fade-in-row {
  animation: fadeInUp 0.5s forwards ease-out;
  opacity: 0;
}

/* ===== SCROLLBAR STYLES (OPTIONAL) ===== */
::-webkit-scrollbar {
  width: 8px;
  background-color: rgba(0,0,0,0.5);
  -webkit-border-radius: 100px;
}

::-webkit-scrollbar:hover {
  background-color: rgba(0, 0, 0, 0.09);
}

::-webkit-scrollbar-thumb:vertical {
  background: #323342;
  -webkit-border-radius: 100px;
}
::-webkit-scrollbar-thumb:vertical:active {
  background: rgba(0,0,0,0.61);
  -webkit-border-radius: 100px;
}

/* ===== FOOTER ===== */
.site-footer {
  background-color: #181A26;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  padding: 20px 0;
  margin-top: 40px;
}

.site-footer p {
  margin: 0 auto;
  max-width: 600px;
  font-size: 14px;
  color: #cccccc;
  line-height: 1.6;
}

footer#footer {
  display: none;
}

/* ===== INFO TOOLTIP ===== */
.info-icon-container {
  position: relative;
  display: inline-block;
  margin-left: 8px;
  cursor: pointer;
}

.info-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
}

.info-tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  background-color: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: opacity 0.2s ease, visibility 0.2s ease;
  transform: translateX(5%) translateY(-40%);
  z-index: 9999;
  font-size: 14px;
  white-space: nowrap;
}

.info-icon-container:hover .info-tooltip {
  visibility: visible;
  opacity: 1;
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */

/* For tablets and down */
@media screen and (max-width: 1024px) {
  h1 {
    font-size: 60px;
  }
  .title-container h1 {
    font-size: 60px;
  }
  .title-container h2 {
    font-size: 24px;
  }
  table#leaderboard tbody td {
    font-size: 16px;
    padding: 10px;
  }
}

/* For mobile screens */
@media screen and (max-width: 750px) {
  h1 {
    font-size: 40px;
    margin: 10px 0;
  }
  .title-container h1 {
    font-size: 40px;
  }
  .title-container h2 {
    font-size: 18px;
  }
  h1#hero-name {
    font-size: 32px;
    margin: 20px 0;
  }
  h2#description {
    font-size: 16px;
  }

  /* Reduce the table font & spacing to avoid overflow */
  table#leaderboard thead th {
    font-size: 12px;
    padding: 10px;
  }
  table#leaderboard tbody td {
    font-size: 14px;
    padding: 8px;
  }

  /* Optional: Adjust grid to fewer columns if needed */
  .hero-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .hero-select-btn {
    position: relative;
    top: 0px;
    right: 0px;
    width: 6rem;
    height: fit-content;
    transition: all 0.3s ease;
  }

  .back-btn {
    width: 100%;
    height: fit-content;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .info-icon-container {
    display: none;
  }
}
