/* Global layout */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background-color: #0c3b66;       /* deep blue */
  color: #e5f3ff;                  /* light blue/white */
}

/* Top navbar */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: #0a2f52;
  border-bottom: 1px solid #0b3a63;
  /* position:sticky and position:relative coexist — sticky IS a relative formatting context */
}

.top-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  height: 52px;
}

.top-nav-brand {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  text-decoration: none;
  flex-shrink: 0;
}

.top-nav-links {
  display: flex;
  gap: 4px;
}

.top-nav-link {
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #c1d8f2;
  text-decoration: none;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.top-nav-link:hover {
  background-color: #10497c;
  color: #ffffff;
}

.top-nav-link.active {
  background-color: #10497c;
  color: #ffffff;
}

.top-nav-logout {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid rgba(193, 216, 242, 0.3);
  background-color: transparent;
  color: #c1d8f2;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s ease, color 0.12s ease;
}

.top-nav-logout:hover {
  border-color: #e5f3ff;
  color: #ffffff;
}

/* Centered content column */
.page-wrapper {
  max-width: 1200px;
  margin: 40px auto 80px auto;
  padding: 0 24px;
}

/* Header / player name */
.page-title {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.8),
               0 0 30px rgba(255, 255, 255, 0.5);
  margin-bottom: 32px;
}

/* Section title + subtitle */
.section-title {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 32px;
  margin-bottom: 4px;
}

.section-subtitle {
  font-size: 13px;
  color: #c1d8f2;
  margin-bottom: 24px;
}

/* Table container */
.stats-table-wrapper {
  border-radius: 3px;
  overflow-x: auto;
  background-color: #10497c; /* header row bg */
  padding-bottom: 8px;
}

/* Base table */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

/* Header row */
.stats-table thead {
  background-color: #10497c;
}

.stats-table thead th {
  padding: 12px 20px;
  font-weight: 600;
  text-align: left;
  color: #e5f3ff;
  white-space: nowrap;
}

/* Body rows */
.stats-table tbody tr {
  background-color: #0e416f;
}

.stats-table tbody tr:nth-child(even) {
  background-color: #0d3b66;
}

.stats-table tbody td {
  padding: 10px 20px;
  color: #d7e7ff;
  white-space: nowrap;
}

/* Sticky first column — opt in with .col-sticky-first on the table */
.col-sticky-first thead th:first-child,
.col-sticky-first tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
}

.col-sticky-first thead th:first-child {
  background-color: #10497c;
}

.col-sticky-first tbody tr:nth-child(odd) td:first-child {
  background-color: #0e416f;
}

.col-sticky-first tbody tr:nth-child(even) td:first-child {
  background-color: #0d3b66;
}

.col-sticky-first tbody tr.stats-row-win td:first-child {
  background-color: rgba(0, 80, 0, 0.35) !important;
}

/* Subtle right shadow to indicate more content */
.col-sticky-first thead th:first-child::after,
.col-sticky-first tbody td:first-child::after {
  content: '';
  position: absolute;
  top: 0;
  right: -6px;
  bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,0.15), transparent);
  pointer-events: none;
}

/* Links inside table (match ids / JSON links) */
.stats-table a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

.stats-table a:hover {
  border-bottom-color: rgba(255, 255, 255, 1);
}

/* “Time ago” column style */
.stats-time {
  color: #f9fafb;
}

/* Small top note text (e.g. “Displaying the last 10 matches…”) */
.helper-text {
  font-size: 13px;
  color: #c1d8f2;
  margin-bottom: 12px;
}

/* Optional: tighten table at larger screens */
@media (min-width: 1200px) {
  .page-wrapper {
    max-width: 1200px;
  }
}

.stats-table tr.stats-row-win {
  background-color: rgba(0, 255, 0, 0.1) !important;
}

/* Primary action button */
.btn-primary {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 4px;
  border: none;
  background-color: #1ea7ff;           /* bright blue */
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background-color: #1590dd;
  transform: translateY(-1px);
}

.btn-primary:active {
  background-color: #0f79b9;
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

table.js-sortable th.sortable {
    position: relative;
    cursor: pointer;
    padding-right: 1.2rem; /* room for arrow */
}

/* base icon (optional faint icon indicating sortable) */
table.js-sortable th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.3rem;
    font-size: 0.75rem;
    opacity: 0.35;
}

/* ascending */
table.js-sortable th.sortable.sort-asc::after {
    content: '▲';
    opacity: 0.8;
}

/* descending */
table.js-sortable th.sortable.sort-desc::after {
    content: '▼';
    opacity: 0.8;
}

table.js-sortable th.sortable {
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
    user-select: none;         /* Standard */
}

.stats-cards {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;          /* still allows multiple rows */
}

.stats-card {
  flex: 0 0 auto;                 /* shrink to content */
  padding: 8px 14px;
  margin-bottom: 20px;

  border-radius: 3px;
  background-color: #10497c;      /* same family as table header */
  border: 1px solid #0b3154;      /* slightly darker border */
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.stats-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c1d8f2;                 /* same as section-subtitle */
  margin-bottom: 2px;
}

.stats-card-value {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;                 /* matches page-title / table links */
}

/* ── Column toggle bar ── */
.col-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.col-toggles-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c1d8f2;
  margin-right: 4px;
}

.col-toggle-btn {
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid #2a6aaa;
  background-color: transparent;
  color: #c1d8f2;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
  user-select: none;
}

.col-toggle-btn:hover {
  background-color: #1a4f80;
  color: #ffffff;
}

.col-toggle-btn.active {
  background-color: #1ea7ff;
  border-color: #1ea7ff;
  color: #ffffff;
}

.col-reset-btn {
  padding: 4px 10px;
  border-radius: 3px;
  border: 1px solid #4a7aaa;
  background-color: transparent;
  color: #7aaad4;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
  transition: border-color 0.12s ease, color 0.12s ease;
  user-select: none;
}

.col-reset-btn:hover {
  border-color: #e5f3ff;
  color: #e5f3ff;
}

/* Hidden column cells */
.col-hidden {
  display: none;
}

@keyframes col-flash {
    0%   { background-color: rgba(30, 167, 255, 0.25); }
    100% { background-color: transparent; }
}

.col-flash {
    animation: col-flash 0.4s ease-out;
}

/* ── Mobile nav: hamburger button (hidden on desktop) ── */
.top-nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.top-nav-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background-color: #c1d8f2;
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: center;
}

/* Animate to X when open */
.top-nav-hamburger.nav-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.top-nav-hamburger.nav-open span:nth-child(2) {
  opacity: 0;
}
.top-nav-hamburger.nav-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Logout form lives inside nav links — visible on both desktop and mobile */
.top-nav-logout-form {
  display: flex;
  align-items: center;
  margin-left: auto;
}

/* ── Responsive breakpoint ── */
@media (max-width: 640px) {
  /* Show hamburger, hide desktop logout form outside nav */
  .top-nav-hamburger {
    display: flex;
  }

  /* Nav links: collapsed by default on mobile */
  .top-nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background-color: #0a2f52;
    border-bottom: 1px solid #0b3a63;
    padding: 8px 0;
    z-index: 99;
  }

  .top-nav-links.nav-open {
    display: flex;
  }

  .top-nav-link {
    padding: 12px 20px;
    border-radius: 0;
    font-size: 14px;
  }

  /* Logout inside the mobile dropdown */
  .top-nav-logout-form {
    display: block;
    margin-left: 0;
    padding: 8px 20px 4px;
    border-top: 1px solid rgba(193, 216, 242, 0.15);
    margin-top: 4px;
  }

  .top-nav-logout {
    width: 100%;
    text-align: left;
    font-size: 14px;
    padding: 8px 0;
    border: none;
    background: none;
    color: #c1d8f2;
  }

  /* Tighter page padding */
  .page-wrapper {
    margin: 20px auto 40px auto;
    padding: 0 12px;
  }

  .page-title {
    font-size: 28px;
    margin-bottom: 20px;
  }

  /* Tighter table cell padding */
  .stats-table thead th {
    padding: 10px 12px;
  }

  .stats-table tbody td {
    padding: 8px 12px;
  }

  /* Scrollable column toggle bar — single row, no wrap */
  .col-toggles {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none; /* hide scrollbar on Firefox */
  }

  .col-toggles::-webkit-scrollbar {
    display: none; /* hide scrollbar on Chrome/Safari */
  }

  /* Prevent toggle buttons from shrinking */
  .col-toggle-btn,
  .col-reset-btn,
  .col-toggles-label {
    flex-shrink: 0;
  }
}

