/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --bg:           hsl(222, 47%, 11%);
  --fg:           hsl(210, 40%, 98%);
  --card:         hsl(217, 33%, 17%);
  --primary:      hsl(199, 89%, 60%);
  --primary-fg:   hsl(222, 47%, 11%);
  --secondary:    hsl(217, 33%, 22%);
  --accent:       hsl(38, 92%, 50%);
  --destructive:  hsl(0, 84%, 60%);
  --border:       hsl(217, 33%, 24%);
  --muted-fg:     hsl(215, 20%, 65%);
  --gold:         hsl(38, 92%, 50%);
  --surface-hover: hsl(217, 33%, 22%);
  --radius:       0.5rem;
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter Tight', 'Inter', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

main { flex: 1; }

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

button { font-family: inherit; cursor: pointer; }

/* ============================================================
   LAYOUT
============================================================ */
.container {
  width: 90%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section { padding: 3rem 0; }
.section-sm { padding: 1.5rem 0; }

/* ============================================================
   NAVBAR
============================================================ */
.navbar {
  background: hsl(222, 47%, 9%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-fg);
  flex-shrink: 0;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-fg);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--fg);
  background: var(--secondary);
}

.nav-link.active {
  color: var(--fg);
  background: var(--secondary);
}

.guest-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ============================================================
   FOOTER
============================================================ */
.footer {
  background: hsl(222, 47%, 9%);
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--muted-fg);
  font-size: 0.875rem;
  text-align: center;
  margin-top: auto;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.1); }

.btn-hero {
  background: var(--primary);
  color: var(--primary-fg);
  font-size: 1rem;
  font-weight: 700;
  padding: 0.75rem 1.5rem;
  box-shadow: 0 4px 16px hsl(199, 89%, 60%, 0.3);
}
.btn-hero:hover {
  filter: brightness(1.1);
  box-shadow: 0 6px 24px hsl(199, 89%, 60%, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--secondary); }

.btn-ghost {
  background: transparent;
  color: var(--muted-fg);
}
.btn-ghost:hover {
  background: var(--secondary);
  color: var(--fg);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--fg);
}
.btn-secondary:hover { filter: brightness(1.1); }

/* ============================================================
   CARDS
============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
  border-color: hsl(199, 89%, 60%, 0.4);
  box-shadow: 0 0 20px -5px hsl(199, 89%, 60%, 0.15);
}

/* ============================================================
   BADGES
============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}
.badge-csgo   { background: hsl(199, 89%, 60%, 0.18); color: var(--primary); }
.badge-lol    { background: hsl(38, 92%, 50%, 0.18);  color: var(--accent);  }
.badge-dota2  { background: hsl(0, 84%, 60%, 0.18);   color: var(--destructive); }

/* ============================================================
   FORM INPUTS
============================================================ */
.input-group {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  bottom: 0.65rem;
  color: var(--muted-fg);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.input {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  font-family: inherit;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(199, 89%, 60%, 0.15);
}

.input::placeholder { color: var(--muted-fg); }

/* ============================================================
   USER MENU / AVATAR
============================================================ */
.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}

.avatar-btn {
  background: none;
  border: 2px solid var(--border);
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
}

.avatar-btn:hover {
  border-color: var(--primary);
  transform: scale(1.05);
}

.avatar-btn img {
  width: 38px;
  height: 38px;
}

.dropdown-content {
  position: absolute;
  right: 0;
  top: 50px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  min-width: 160px;
  overflow: hidden;
}

.dropdown-content a {
  display: block;
  color: var(--muted-fg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
}

.dropdown-content a:hover {
  background: var(--secondary);
  color: var(--fg);
}

/* ============================================================
   TEXT UTILITIES
============================================================ */
.text-gradient {
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted       { color: var(--muted-fg); }
.text-primary     { color: var(--primary); }
.text-accent      { color: var(--accent); }
.text-destructive { color: var(--destructive); }

/* ============================================================
   SECTION HEADINGS
============================================================ */
.section-heading {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* ============================================================
   TOAST / ERROR NOTIFICATIONS
============================================================ */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  max-width: 400px;
  width: calc(100vw - 3rem);
}

.toast-error {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: hsl(0, 30%, 16%);
  border: 1px solid hsl(0, 84%, 40%);
  border-left: 4px solid var(--destructive);
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  animation: toast-slide-in 0.25s ease;
}

@keyframes toast-slide-in {
  from { transform: translateX(110%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

.toast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.toast-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--destructive);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toast-message {
  font-size: 0.875rem;
  color: var(--fg);
  line-height: 1.4;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--muted-fg);
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 4px;
  display: flex;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}
.toast-close:hover {
  color: var(--fg);
  background: hsl(0, 84%, 60%, 0.15);
}

/* ============================================================
   GAME TABS — reusable pill-style tab bar
   Used by: leaderboard, and available for any page with game switching
============================================================ */
.game-tabs {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
  gap: 0.25rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted-fg);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  font-family: inherit;
}

.tab-btn:hover {
  color: var(--fg);
  background: var(--secondary);
}

.tab-btn-active {
  background: var(--secondary);
  color: var(--fg);
}

/* ============================================================
   FILTER BUTTONS — row of toggle-style buttons
   Used by: fantasy builder game filter, reusable for any filter UI
============================================================ */
.filter-btns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted-fg);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4375rem 0.875rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.filter-btn:hover {
  color: var(--fg);
  border-color: var(--primary);
  background: var(--secondary);
}
.filter-btn-active {
  background: var(--secondary);
  color: var(--fg);
  border-color: var(--primary);
}

/* ============================================================
   SEARCH INPUT — icon-prefixed search field
   Used by: fantasy builder, reusable for any search UI
============================================================ */
.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  color: var(--muted-fg);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.875rem;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px hsl(199, 89%, 60%, 0.15);
}
.search-input::placeholder { color: var(--muted-fg); }

/* ============================================================
   CENTERED PAGE LAYOUT — vertically centered single-card pages
   Used by: register, error, and any future centered-content page
============================================================ */
.page-centered {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
}

/* ============================================================
   DATA TABLE — styled table with card wrapper
   Used by: leaderboard, reusable for any tabular data
============================================================ */
.data-table-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table thead {
  background: hsl(222, 47%, 9%);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 0.875rem 1.25rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr {
  transition: background 0.15s;
}

.data-table tbody tr:hover {
  background: var(--surface-hover);
}

/* ============================================================
   PAGE HEADER — icon + title combo
============================================================ */
.page-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
  color: var(--primary);
}

.page-header h1 {
  font-size: 2rem;
  color: var(--fg);
}
