/* ===========================
   NFL Roster — Clean Layout
   =========================== */

/* Theme tokens (dark, high contrast) */
:root {
  --bg: #0e1116;
  --card: #141a23;
  --card-2: #121825;
  --ink: #e9eef7;
  --ink-muted: #b9c3d7;
  --line: #273147;
  --line-2: #202a3f;
  --thead: #0a1226;
  --row: #0f1524;
  --row-alt: #0c1320;
  --row-hover: #17253f;
}

/* Page grid */
.roster-page {
  background: var(--bg);
  color: var(--ink);
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  padding: 28px clamp(16px, 2.5vw, 40px);
  --primary: var(--primary, #1e90ff);
  --secondary: var(--secondary, #85bfff);
  --text-on-primary: var(--text-on-primary, #ffffff);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

/* Sidebar */
.side-card {
  position: sticky; top: 24px; align-self: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
}
.team-logo { width: 120px; height: 120px; object-fit: contain; display:block; margin: 0 auto 10px; }
.team-title { text-align: center; font-size: 1.25rem; margin: 4px 0 12px; }

.side-nav { display: grid; gap: 8px; margin-bottom: 14px; }
.side-nav a {
  display: block; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; background: var(--card-2); color: var(--ink);
  border: 1px solid var(--line-2);
}
.side-nav a:hover { background: #18233a; }
.back-link { display:block; text-align:center; color: var(--ink-muted); text-decoration:none; margin-top: 4px; }
.back-link:hover { color: var(--ink); }

/* Main */
.main { display: flex; flex-direction: column; gap: 24px; }
.group-title {
  font-size: 1.15rem; margin: 6px 0;
  padding-left: 10px; border-left: 4px solid var(--primary);
  color: var(--ink);
}

/* Position card */
.pos-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
}
.pos-head {
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--card), #101724);
}
.pos-name { margin: 0; font-size: 1.05rem; letter-spacing: .2px; }
.pos-count {
  background: var(--secondary); color: #000;
  font-weight: 600; font-size: .8rem; padding: 2px 8px; border-radius: 999px;
  border: 1px solid #0003;
}

/* Table */
.table-wrap { width: 100%; overflow: auto; }
.roster-table {
  width: 100%;
  border-collapse: collapse;      /* keep header/body perfectly aligned */
  table-layout: fixed;            /* predictable column sizing */
  background: var(--row);
  color: var(--ink);
  font-size: .95rem;
}

.roster-table thead th {
  background: var(--thead);
  color: var(--text-on-primary, #fff);
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  font-weight: 650;
  letter-spacing: .15px;
  text-transform: none;
  white-space: nowrap;
}

.roster-table th,
.roster-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Column sizing: wide player, tight numerics, wider college */
.col-player { width: 44%; min-width: 240px; }
.col-num    { width: 80px; text-align: right; }
.col-mid    { width: 90px; text-align: center; }
.col-college{ width: 220px; }

/* Body rows */
.roster-table tbody tr:nth-child(odd) { background: var(--row-alt); }
.roster-table tbody tr:hover { background: var(--row-hover); }

/* Player cell: avatar + name, no wobble */
.player-cell {
  display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center;
}
.player-link { color: var(--ink); text-decoration: none; }
.player-link:hover { text-decoration: underline; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background-size: cover; background-position: center;
  background-color: #24314e; box-shadow: inset 0 0 0 1px #0006, 0 1px 2px #0007;
}
.avatar.is-empty { background-image: none; }

/* Numeric alignment and tabular figures */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mid { text-align: center; }
.college { color: var(--ink-muted); }

/* Responsive */
@media (max-width: 1100px) {
  .roster-page { grid-template-columns: 1fr; }
  .side-card { position: static; order: -1; }
}
@media (max-width: 720px) {
  .roster-table { font-size: .9rem; }
  .col-college, .college { display: none; } /* hide College on small screens */
  .col-player { width: 60%; min-width: 200px; }
}

/* ===== Row Contrast Fix ===== */
.roster-table tbody tr {
  background-color: var(--row) !important;
  color: var(--ink) !important;
}

.roster-table tbody tr:nth-child(odd) {
  background-color: #131b2b !important; /* slightly lighter than base for striping */
  color: var(--ink) !important;
}

.roster-table tbody tr:hover {
  background-color: #1b2945 !important; /* hover clearly visible */
  color: var(--ink) !important;
}

.roster-table td,
.roster-table th {
  color: var(--ink) !important; /* no faded font */
}
