/* Prevent FOUC / layout shifts: hide page until assets are measured */
.js-loading {
  visibility: hidden;
}
.js-loaded {
  visibility: visible;
}

/* ---------- Base (shared) ---------- */
body { font-family: 'Squada One', sans-serif; }

.loading-message {
  font-size: 1.5em;
  text-align: center;
  margin: 2em 0;
}

/* latin */
@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/orbitron/v34/yMJRMIlzdpvBhQQL_Qq7dy0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin */
@font-face {
  font-family: 'Orbitron';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/orbitron/v34/yMJRMIlzdpvBhQQL_Qq7dy0.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

table { width: 100%; border-collapse: collapse; }

th, td { padding: 8px; text-align: left; vertical-align: top; }

th { background-color: #d3d1db; cursor: pointer; user-select: none; }

/* Nav */
.top-nav { text-align: left; margin-bottom: 1rem; }
.nav-box {
  display: inline-block; padding: 0.5rem 1rem; border: 2px solid #ccc; border-radius: 4px;
  text-decoration: none; font-weight: bold; color: #444; cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}
.nav-box:hover { background-color: #f5f5f5; border-color: #888; }

/* Logo spacing */
header .site-logo { width: 100%; height: auto; padding: 1em 0; }

/* Tagline under logo */
.site-tagline {
  font-size: 1.3rem;
  font-weight: 500;
  color: #000000;
  text-align: center;
  margin-top: -0.5rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.03em;
}

/* Row cursor + striping */
table tbody tr { cursor: pointer; }
.table-striped tbody tr:nth-child(odd)  { background:#fff; }
.table-striped tbody tr:nth-child(even) { background:#e7e5f0; }

/* keep header stuck at top of its scroll container */
.table-responsive .header-container {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 10;
}

/* Selected & sort highlights */
.selected-row { background:#fcc652 !important; }
.sort-active        { background:#fcc652; }
.sort-active-column { background:#fcc652 !important; }
.main-table td.sort-active-column { background:#fcc652; }
.search-row .sort-active-column { background:#fcc652; }

/* Sticky header/search row wrapper */
.header-container { position: sticky; top:0; z-index:10; background:#fff; display:block; }
.sticky-header    { position: sticky; top:0; z-index:20; }
.sticky-search-row{ position: sticky; top:calc(var(--header-height,32px) - 1px); z-index:15; background:#fff; }
.sticky-header.sort-active { background:#fcc652 !important; }

/* Pagination */
#pagination button { padding:5px 10px; margin:2px; border:none; background:#f0f0f0; cursor:pointer; }
#pagination button.active { background:#6c757d; color:#fff; }
.pagination-container { display:flex; align-items:center; margin-top:1rem; margin-bottom:1rem; }
#rowsPerPageContainer { margin-left:1rem; }
#rowsPerPage { padding:2px; }

/* Info box + subboxes */
.info-box,
.player-info-box {
  border:1px solid #ddd; border-radius:5px; background:#f9f9f9; margin-bottom:20px; padding:10px;
}
.info-box-header,
.player-info-box-header {
  display:flex; justify-content:space-between; align-items:center; font-weight:bold;
  border-bottom:1px solid #ddd; padding-bottom:5px; margin-bottom:10px; cursor:pointer;
  font-size:1.2em; color:#333;
}
.info-box-content,
.player-info-box-content {
  padding:10px 0;
  content-visibility:auto; /* skip layout/paint when off-screen */
  contain-intrinsic-size:200px 50px; /* reserve space to avoid CLS */
}

.subbox {
  border:1px solid #ccc; border-radius:5px; margin-bottom:15px; background:#fff;
}
.subbox-header {
  display:flex; justify-content:space-between; align-items:center; padding:10px;
  background:#f2f2f2; border-bottom:1px solid #ddd; cursor:pointer;
}

.subbox-header h2 { margin:0; font-size:1.2em; color:#333; }
.subbox-header h3 { margin:0; font-size:1.2em; color:#333; }
.subbox-content { padding:10px; display:none; }

.subbox-content figure,
.subbox-content img {
  max-height: 50%;
  max-width: 85%;
  height: auto;
  display: block;
  margin: 5em auto;
}

@media (max-width: 600px) {
  .subbox-content figure,
  .subbox-content img {
    max-width: 100%;   /* override scaling */
    max-height: none;  /* let it scale naturally */
    margin: 0.5em auto; /* tighter spacing */
  }
}

/* Search row */
.search-row th { user-select:none; cursor:default; }
.search-row button {
  user-select: none;
  cursor: pointer;

  /* ✅ Add padding so the tap target is bigger */
  padding: 4px 8px;

  /* Optional visual improvements */
  min-height: 22px;   /* meets accessibility target */
  min-width: 22px;    /* ensures square if text is tiny */
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}
.search-row input { width:100%; padding:5px; margin-top:5px; box-sizing:border-box; }

/* Value/rank pair cells */
.rank  { font-size:80%; padding-left:5px; }
.value { font-weight:bold; padding-right:5px; border-right:1px solid #b49191; }

/* ---------- Team builder / matchup UI (players page) ---------- */
#teamSelection { display:flex; justify-content:space-around; margin-bottom:20px; flex-wrap: nowrap; }
.team-column {
  flex: 1 1 45%;
  margin: 0.5rem;
  padding-inline: 0.5rem;
  border-radius:10px; text-align:center;
  box-shadow:0 4px 8px rgba(0,0,0,.1); color:black;
}
#team1 { background:#d4e9ff; border:2px solid #094e92; }
#team2 { background:#f3e1b9; border:2px solid #fcc652; }

/* Team table column widths */
#team1 th:nth-child(2),
#team1 td:nth-child(2),
#team2 th:nth-child(2),
#team2 td:nth-child(2) {
  width: 140px;       /* just enough for the eval-input box */
}

#team1 th:nth-child(3),
#team1 td:nth-child(3),
#team2 th:nth-child(3),
#team2 td:nth-child(3) {
  width: 150px;       /* just enough for the percent-input box */
}

.team-column h3 {
  font-family:'Orbitron', sans-serif; font-size:1.8em; letter-spacing:.1em; font-weight:bold; color:black;
  text-shadow:-0.5px -0.5px 0 white, 0.5px -0.5px 0 white, -0.5px 0.5px 0 white, 0.5px 0.5px 0 white;
  margin: 1rem 0;
}

/* Context menus */
.context-menu,
#removeContextMenu {
  display:none; position:absolute; background:#e7e5f0; border:1px solid #ccc; z-index:1000; padding:0;
}
.context-menu div,
#removeContextMenu div {
  padding:10px; cursor:pointer; transition:background-color .2s ease;
}
.context-menu div:hover,
#removeContextMenu div:hover { background:#ddd; }

/* Inputs inside team tables */
.eval-input, .percent-input { width:60px; padding:4px; text-align:center; }

/* Alignment helpers */
.aligned-info { text-align:left; font-weight:bold; padding-left:8px; }

/* Column highlight in team tables */
.selected-column,
.selected-column-header,
.team-selected-row { background:#98eba6 !important; }

/* Matchup / odds UI */
.matchup-box{
  flex: 1 1 45%;
  padding: 1rem;
  align-self:flex-start;
  border:2px solid #ccc; border-radius:10px; background:rgb(68,65,65);
  text-align:center; box-shadow:0 4px 8px rgba(0,0,0,.1);
}
.matchup-box h3{
  font-family:'Orbitron', sans-serif; font-size:1.4em; font-weight:bold; color:white; text-shadow:0 1px 2px rgba(0,0,0,.3);
}
.button-group .advantage-button{
  padding:10px 20px; margin:0 5px; border:2px solid #464947; background:#e0e0e0; color:black;
  font-family:'Orbitron', sans-serif; font-weight:bold;
  transition:background-color .3s ease, color .3s ease; cursor:pointer;
}
.button-group .advantage-button.selected{ background:#f8b8b8; color:black; }
.button-group .advantage-button:hover{ background:#cce7ff; color:#8cb300; }

.goal-differential-section{
  display:flex; flex-direction:column; align-items:center; padding:0; margin:0; gap:1px;
}
.goal-differential-title{ font-size:1.3em; font-weight:bold; color:black; margin-top:30px; text-shadow:0 1px 2px rgba(0,0,0,.3); }
.goal-differential-value{ margin:0; line-height:.5; }
#goalDifferentialValue{ font-size:2em; font-weight:bold; color:black; text-shadow:0 1px 2px rgba(0,0,0,.3); }

#winTieLossOddsContainer{ width:100%; margin-top:30px; text-align:center; font-weight:bold; }
#winTieLossOddsText{
  font-size:1em; margin-bottom:5px; display:flex; justify-content:space-around;
}
#team1WinText{ color:#3da5eb; font-family:'Orbitron', sans-serif; font-size:1.3em; font-weight:bold; letter-spacing:.07em; text-shadow:0 1px 2px rgba(0,0,0,.3); }
#drawText    { color:#98eba6; font-family:'Orbitron', sans-serif; font-size:1.3em; font-weight:bold; letter-spacing:.07em; text-shadow:0 1px 2px rgba(0,0,0,.3); }
#team2WinText{ color:#fcc652; font-family:'Orbitron', sans-serif; font-size:1.3em; font-weight:bold; letter-spacing:.07em; text-shadow:0 1px 2px rgba(0,0,0,.3); }

#winTieLossOddsBar{
  display:flex; height:30px; width:100%; background:#e7e5f0; border-radius:5px; overflow:hidden;
}
.wtl-bar-segment{ height:100%; transition:width .3s ease; }
#team1WinBar{ background:#3da5eb; }
#drawBar    { background:#98eba6; }
#team2WinBar{ background:#fcc652; }

/* ---------- Player chart page ---------- */
#evalChart { cursor: grab; }
.chart-wrapper{ width:100%; overflow:hidden; }
.chart-wrapper canvas{ width:100% !important; height:100% !important; display:block; padding-bottom:4em; }
/* Ensure touch gestures are captured by Chart.js instead of the browser */
#evalChart,
.chart-wrapper {
  touch-action: none;   /* prevents browser scroll/zoom interference */
}

/* Landscape: don't steal height from the canvas; keep a floor for the chart */
@media (orientation: landscape) {
  .chart-wrapper {
    min-height: 420px;     /* pick the floor you want (360–480px is common) */
  }
}

/* Player profile table tweaks */
.player-profile-table th { cursor:default; }
.player-profile-table tbody tr { cursor:default; }

.site-footer{
  margin:2rem 0 1rem;
  text-align:center;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#teamSelection {
  justify-content: center;   /* was space-around */
}

/* stacking/layout adjustments for small devices */
@media (max-width: 1024px) {
  .site-tagline {
    font-size: 0.75em;
    margin-bottom: 1rem;
    padding: 0 1rem;
  }

  /* Disable text selection in all table headers and cells */
  #playerTable th,
  #playerTable td,
  #team1 th, #team1 td,
  #team2 th, #team2 td {
    -webkit-user-select: none; /* Safari / iOS */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge legacy */
    user-select: none;         /* Standard */
  }
  
  /* stack all columns vertically */
  #teamSelection {
    flex-direction: column;
  }
  
  .team-column {
    flex: 1 1 100%;
    margin: 0.5rem 0;
  }

  /* matchup box: don’t stretch, center via auto margins */
  .matchup-box {
    flex: 0 0 auto;
    margin: 0.5rem auto;
    padding: 0.5rem;
  }

  .matchup-box h3 { font-size: 1.1em; }
  #goalDifferentialValue { font-size: 1.5em; }
  #winTieLossOddsBar { height: 20px; }

  /* make table text a bit smaller so it fits */
  table {
    font-size: 0.9rem;
  }
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Target both the page number input and the rows-per-page select */
#pagination input[type="number"],
#rowsPerPage {
  border: 4px solid #ccc;
}