/* ============ VARIABLES ============ */
:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1e293b;
  --accent: #2563eb;
  --shadow: rgba(0, 0, 0, 0.08);
  --muted: #64748b;
}

body.dark {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #e2e8f0;
  --accent: #3b82f6;
  --shadow: rgba(255, 255, 255, 0.1);
  --muted: #94a3b8;
}

/* ============ GLOBAL ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", "Inter", sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  display: flex;
  transition: background 0.4s, color 0.4s;
}

main {
  flex: 1;
  padding: 1.5rem;
}

/* ============ SIDEBAR ============ */
.sidebar {
  background: var(--card);
  width: 250px;
  height: 100vh;
  box-shadow: 2px 0 6px var(--shadow);
  position: fixed;
  left: 0;
  top: 0;
  padding: 1.2rem;
  transition: transform 0.3s ease-in-out;
}

.sidebar h2 {
  color: var(--accent);
  margin-bottom: 1rem;
  text-align: center;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s;
}

.sidebar ul li:hover,
.sidebar ul li.active {
  background: var(--accent);
  color: white;
}

/* ============ OVERLAY ============ */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  z-index: 9;
}

/* ============ HEADER ============ */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

header .left h1 {
  font-size: 1.8rem;
  color: var(--accent);
}

header .right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.menu-btn {
  display: none;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ============ STATS, TABLE, LEADERBOARD ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  background: var(--card);
  text-align: center;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 6px var(--shadow);
  transition: transform 0.3s;
}

.card:hover {
  transform: translateY(-5px);
}

.leaderboard, .table-section {
  background: var(--card);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 6px var(--shadow);
}

.leaderboard h2, .table-section h2 {
  color: var(--accent);
  margin-bottom: 1rem;
}

/* ============ TABLE ============ */
table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

th, td {
  text-align: left;
  padding: 0.8rem;
  border-bottom: 1px solid var(--shadow);
}

th {
  color: var(--accent);
}

/* ============ RESPONSIVE SIDEBAR ============ */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 10;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .overlay.active {
    display: block;
  }

  .menu-btn {
    display: inline-block;
  }

  main {
    padding: 1rem;
  }

  header .right {
    flex: 1;
    justify-content: flex-end;
  }
}