@import url("https://fonts.googleapis.com/css2?family=Inter:wght@361;400;600&family=Ubuntu+Mono:wght@400&display=swap");

/* Resetting default styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Ubuntu Mono", monospace;
}

/* Root CSS Variables */
:root {
  /* Dark Mode Colors */
  --theme-color: #0a192f; /* dark background */
  --th-color: #1b88a9; /* deep blue header */
  --white-color: #ffffff;
  --black-color: #0a0a0a;
  --hover-color: rgba(255, 255, 255, 0.15);
  --even-color: rgba(30, 64, 175, 0.25);
  --odd-color: rgba(30, 64, 175, 0.15);

  /* Font Sizes */
  --font-size-small: 0.875rem;
  --font-size-medium: 1rem;
  --font-size-large: clamp(1.875rem, 3.125rem + 8.333vw, 1.5rem);

  /* Padding */
  --padding-small: 0.625rem 1.5625rem;
  --padding-medium: 0.9375rem 1.5625rem;

  /* Countdown Colors - Dark Mode */
  --countdown-bg: #111;
  --countdown-text: #ffffff;
  --countdown-label: rgba(255, 255, 255, 0.7);
  --countdown-title-color: #ffffff;

  /* Report Button */
  --report-bg: #ff4444;
  --report-bg-hover: #e02e2e;
  --report-text: #ffffff;
}

/* Light Mode */
body.light-mode {
  --theme-color: #fcfcfc;
  --th-color: #395090;
  --table-heading-text: #ffffff;
  --white-color: #ffffff;
  --black-color: #0a0a0a;
  --hover-color: rgb(251, 251, 251);
  --even-color: rgba(59, 130, 246, 0.15);
  --odd-color: rgba(59, 130, 246, 0.1);

  --countdown-bg: #f0f0f0;
  --countdown-text: #0a0a0a;
  --countdown-label: rgba(0, 0, 0, 0.6);
  --countdown-title-color: #0a0a0a;

  --report-bg: #ffe5e5;
  --report-bg-hover: #ffcccc;
  --report-text: #d91c1c;
}

/* Body Styles */
body {
  background: var(--theme-color);
  padding-bottom: 10vh;
  transition: background-color 0.3s;
}

/* Heading Styles */
h1 {
  font-size: var(--font-size-large);
  color: var(--white-color);
  margin-bottom: 1.875rem;
  letter-spacing: 0.125rem;
  font-weight: 700;
}

/* Navbar */
nav.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 5%;
  background-color: var(--th-color);
  position: relative;
  z-index: 100;
}

nav .logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white-color);
}

/* Links centered */
nav .nav-right {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex: 1 1 auto;
}

/* Right-side actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

nav .nav-right a {
  text-decoration: none;
  color: var(--white-color);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: color 0.2s;
}

nav .nav-right a:hover {
  color: #0d2d54;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.hamburger span {
  display: block;
  height: 3px;
  width: 100%;
  background: var(--white-color);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Hamburger animation */
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== GITHUB ICON ===== */
.github-icon svg {
  color: var(--white-color);
  width: 20px;
  height: 20px;
}

/* Desktop ≥1151px */
@media (min-width: 1151px) {
  .logo-wrapper svg {
    width: 225px;
    height: 21px;
  }
  nav .nav-right {
    position: static;
    display: flex !important;
    flex-direction: row;
    gap: 1.5rem;
  }
  .hamburger {
    display: none;
  }
}

/* Responsive Navbar */
@media screen and (max-width: 1150px) {
  .logo-wrapper svg {
    width: 140px;
    height: auto;
  }

  .hamburger {
    display: flex;
  }

  nav.navbar {
    padding: 0.75rem 3%;
  }

  .nav-actions {
    gap: 0.6rem;
  }

  nav .nav-right {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    background-color: var(--th-color);
    padding: 1rem;
  }

  nav .nav-right.active {
    display: flex;
  }

  .report-btn {
    min-width: 84px;
    padding: 4px 10px;
  }
  .switch {
    --width-of-switch: 2.8em;
    --height-of-switch: 1.6em;
  }
  .github-icon svg {
    width: 18px;
    height: 18px;
  }
}

/* Mode toggle icon */
.mode-icon {
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--white-color);
  transition: color 0.3s;
}

.mode-icon:hover {
  color: #0d2d54;
}

.mode-icon svg {
  width: 24px;
  height: 24px;
}

/* Particle-Js */
#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Leaderboard Styles */
.leaderboard {
  max-width: 970px;
  margin: 3.125rem auto 0;
  text-align: center;
  padding-bottom: 3rem;
}

/* Table Styles */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: auto;
  margin: 0 auto;
  padding: 4%;
  border: 0px solid var(--th-color);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.3s;
}

th,
td {
  border: none;
  padding: var(--padding-medium);
}

th {
  /* Changed to use the theme-specific table heading color */
  color: var(--table-heading-text);
  text-align: left;
  font-size: var(--font-size-small);
  position: sticky;
  top: 0;
  background-color: var(--th-color);
}

th:first-child {
  border-radius: 6px 0 0 0;
}

th:last-child {
  border-radius: 0 6px 0 0;
}

td {
  color: var(--white-color);
  font-size: var(--font-size-medium);
}

tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.2s;
}

tbody tr:hover {
  background-color: var(--hover-color) !important;
  cursor: pointer;
}

tbody tr:nth-child(odd) {
  background-color: var(--odd-color);
}

tbody tr:nth-child(even) {
  background-color: var(--even-color);
}

table th:not(:first-child),
table td:not(:first-child) {
  text-align: right;
}

tbody td:last-child {
  font-weight: bold;
}

body.light-mode table {
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode td {
  color: var(--black-color);
}

/* Countdown Section */
.countdown-section {
  text-align: center;
  margin: 30px auto 15px;
}

.countdown-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--countdown-title-color);
  margin-bottom: 15px;
  text-align: center;
}

/* Countdown Styling */
.countdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.time-box {
  background: var(--countdown-bg);
  color: var(--countdown-text);
  border-radius: 12px;
  padding: 15px;
  width: 70px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.digit {
  font-size: 2rem;
  font-weight: bold;
  display: inline-block;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--countdown-label);
}

/* Animation */
.slide-up {
  transform: translateY(-20px);
  opacity: 0;
}

/* Responsive */
@media (min-width: 1024px) {
  .countdown-section {
    margin: 40px auto 20px;
  }
}

@media (max-width: 768px) {
  .countdown-section {
    margin: 25px auto 15px;
  }
  .countdown-title {
    font-size: 1.25rem;
    margin-bottom: 12px;
  }
  .digit {
    font-size: 1.6rem;
  }
  .time-box {
    padding: 12px;
    width: 60px;
  }
  .countdown {
    gap: 0.8rem;
  }
}

@media (max-width: 480px) {
  .countdown-section {
    margin: 20px auto 12px;
  }
  .countdown-title {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }
  .digit {
    font-size: 1.3rem;
  }
  .time-box {
    padding: 10px;
    width: 55px;
  }
  .countdown {
    gap: 0.6rem;
  }
}

/* Report button */
.report-btn {
  text-decoration: none;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px 16px;
  height: 36px;
  min-width: 100px;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  background: var(--report-bg);
  transition: background 0.3s ease, transform 0.2s ease;
}

.report-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--report-text);
  letter-spacing: 0.5px;
}

.report-btn:hover {
  background: var(--report-bg-hover);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Theme Switch */
.switch {
  display: block;
  --width-of-switch: 3.5em;
  --height-of-switch: 2em;
  --size-of-icon: 1.4em;
  --slider-offset: 0.3em;
  position: relative;
  width: var(--width-of-switch);
  height: var(--height-of-switch);
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #f4f4f5;
  transition: 0.4s;
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: var(--size-of-icon, 1.4em);
  width: var(--size-of-icon, 1.4em);
  border-radius: 20px;
  left: var(--slider-offset, 0.3em);
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(40deg, #ff0080, #ff8c00 70%);
  transition: 0.4s;
}

input:checked + .slider {
  background-color: #303136;
}

input:checked + .slider:before {
  left: calc(100% - (var(--size-of-icon, 1.4em) + var(--slider-offset, 0.3em)));
  background: #303136;
  box-shadow: inset -3px -2px 5px -2px #8983f7, inset -10px -4px 0 0 #a3dafb;
}

@media (max-width: 768px) {
  .report-btn {
    min-width: 80px;
    height: 32px;
    padding: 4px 10px;
  }
  .report-label {
    font-size: 13px;
  }
  .switch {
    --width-of-switch: 2.8em;
    --height-of-switch: 1.6em;
    --size-of-icon: 1.1em;
  }
  .github-icon svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 480px) {
  .report-btn {
    min-width: 60px;
    height: 24px;
    padding: 3px 8px;
  }
  .report-label {
    font-size: 12px;
  }
  .switch {
    --width-of-switch: 2.5em;
    --height-of-switch: 1.4em;
  }
  .github-icon svg {
    width: 18px;
    height: 18px;
  }
}

.leaderboard__table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 13px 0 13px;
}

.leaderboard__table table {
  min-width: 600px;
  border-collapse: collapse;
}

/* Keep first column fixed, no theme override */
.leaderboard__table th:first-child,
.leaderboard__table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  white-space: nowrap;
}

.leaderboard__table td:first-child {
  min-width: 180px;
}

/* Remove hyperlink decoration from usernames in the leaderboard table */
.leaderboard__table a {
  text-decoration: none;
  color: inherit;
}

.leaderboard__table a:hover {
  text-decoration: none;
  color: inherit;
}

/* Username cell */
.username {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding-left: 8px;
}

/* Avatar image styling */
.username img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  transition: transform 0.2s ease;
}

.username img:hover {
  transform: scale(1.05);
}

/* Top contributor crown styling */
tbody tr:first-child .username a:last-child {
  display: flex;
  align-items: center;
  gap: 5px;
}

tbody tr:first-child .username a:last-child::after {
  content: "👑";
  font-size: 1.1rem;
  color: #ffd700;
  position: relative;
  top: -3px;
}
