* {
  font-family: 'Rubik', sans-serif;
}

/* ======================
   BASE BODY STYLES
   ====================== */
body {
  background: whitesmoke;
  margin: 0;
  padding: 50px;
  padding-top: 100px;
}

/* ======================
   HEADER & NAVIGATION
   ====================== */
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  width: 100%;
  margin: 0px;
}

header a {
  margin-left: 50px;
  color: darkgray;
  text-decoration: none;
}

header a:hover { 
  color: black; 
}

header h1 { 
  font-size: 45px; 
}

header p {
  position: absolute;
  top: 5px;
  right: 50px;
  font-size: 12px;
}

header p:hover { 
  color: black; 
}

header select {
  position: absolute;
  right: 50px;
  top: 50px;
  z-index: 10;
}

nav {
  position: absolute;
  width: 100%;
  margin: 0;
  text-align: center;
  z-index: 100;
}

nav a {
  color: darkgray;
  text-decoration: none;
  font-size: 18px;
  margin-left: 50px;
  margin-right: 50px;
}

nav a:hover { 
  color: black; 
}

/* ======================
   SEARCH CONTAINER
   Base styles + state transitions
   ====================== */
.search-container {
  display: flex;
  align-items: center;
  gap: 15px;
  z-index: 20;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
}

.search-container h4 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.search-container select {
  min-height: 40px;
  text-align: center;
  border-radius: 10px;
  width: 200px;
}

/* PREGAME STATE: Search container centered below header */
body.pregame .search-container {
  position: absolute;
  bottom: 50px;
  transform: translateX(-50%);
  left: 50%;
  margin: 0;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.85);
  padding: 12px 16px;
  gap: 12px;
}

body.pregame .search-container h3 {
  color: #000;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

body.pregame .search-container .search-dropdowns{
  display: flex;
  flex-direction: row;
  gap: 20px;
}

body.pregame #asideColumn {
  display: block;       /* allow container to exist */
  visibility: hidden;   /* hide contents by default */
  position: relative;
}

body.pregame #asideColumn .search-container {
  visibility: visible;
}



/* IN-GAME STATE: Search container as compact sidebar */
body.in-game .search-container {
  grid-column-start: 2;
  transform: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.9);
  padding: 15px;
  gap: 10px;
  justify-content: center;
  justify-items: center;
  align-items: center;
  align-content: center;
  text-align: center;
}

body.in-game .search-container select {
  width: 90%;
  font-size: 14px;
  min-height: 35px;
  margin-bottom: 20px;
  
}


/* ======================
   PREGAME LAYOUT
   ====================== */
body.pregame {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Show only pregame elements */
body.pregame #preGameScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
}


/* Tagline */
#tagline {
  width: 100%;
  margin-top: 150px;
  margin-bottom: 50px;
  text-align: center;

  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #111;
  position: relative;
}

#tagline::after {
  content: "";
  display: block;
  width: 140px;            /* slightly wider looks more balanced */
  height: 5px;             /* a little thicker for impact */
  margin: 14px auto 0;
  border-radius: 3px;

  /* Half green, half red */
  background: linear-gradient(
    to right,
    #2ecc71 0%,
    #2ecc71 50%,
    #e74c3c 50%,
    #e74c3c 100%
  );
}


/* Instructions */
.instructions {
  max-width: 700px;
  margin-top: 50px;
  background-color: lightgray;
  padding: 1.5rem;
  font-size: 18px;
  color: #333;
  text-align: center;
  border-radius: 8px;
}

/* Top Outliers of the Day */
.top-outliers-section {
  width: 100%;
  margin-top: 50px;
}

.top-outliers-container {
  background: #f8f9fa;
  padding: 20px;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.top-outliers-header {
  text-align: center;
  margin-bottom: 16px;
}

.top-outliers-header h3 {
  color: #000;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.top-outliers-date {
  color: #6c757d;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0;
}

/* Scrollable list like recent games */
.top-outliers-list {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.top-outliers-list::-webkit-scrollbar {
  height: 8px;
}

.top-outliers-list::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 4px;
}

.top-outliers-list::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 4px;
}

.top-outliers-list::-webkit-scrollbar-thumb:hover {
  background: #495057;
}

/* Cards */
.top-outlier-item {
  flex-shrink: 0;
  width: 180px;
  background: #fff;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  align-items: center;
}

.top-outlier-item:hover {
  border-color: #007bff;
  transform: translateY(-2px);
}

/* Ranked highlight borders */
.top-outlier-item.rank-1 {
  border-color: #d4af37;
}

.top-outlier-item.rank-2 {
  border-color: #c0c0c0;
}

.top-outlier-item.rank-3 {
  border-color: #cd7f32;
}

.top-outlier-item.rank-3:hover {
  border-color: #007bff;
  transform: translateY(-2px);
}


.top-outlier-item.rank-1:hover {
  border-color: #007bff;
  transform: translateY(-2px);
}


.top-outlier-item.rank-2:hover {
  border-color: #007bff;
  transform: translateY(-2px);
}

.stat-positive {
  color: #28a745; /* green */
  font-weight: 700;
}

.stat-negative {
  color: #d11a2a; /* red */
  font-weight: 700;
}


/* Rank */
.outlier-rank {
  font-size: 1.4rem;
  font-weight: 800;
  margin-right: 8px;
  color: darkgray;
}

.top-outlier-item.rank-1 .outlier-rank { color: #d4af37; }
.top-outlier-item.rank-2 .outlier-rank { color: #c0c0c0; }
.top-outlier-item.rank-3 .outlier-rank { color: #cd7f32; }

/* Content */
.outlier-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.outlier-item-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e0e0e0;
}

.outlier-info {
  flex: 1;
  min-width: 0;
}

.outlier-name {
  font-size: 12px;
  color: #333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.outlier-stat {
  font-weight: 600;
  color: #000;
  font-size: 0.9rem;
  background: rgba(102, 126, 234, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 10px;
}

.outlier-game {
  font-size: 0.7rem;
  color: darkgray;
  font-weight: 800;
}


/* Recent Games Section */
.recent-games-section {
  width: 100%;
}


.recent-games-container {
  background: #f8f9fa;
  padding: 20px;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
}

.recent-games-header{
    text-align: center;
    margin-bottom: 16px;
}

.recent-games-header h3 {
  color: #000;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recent-games-header h2{
  color: black;
  font-size: 15px;
}

.recent-games-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 10px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.recent-games-scroll::-webkit-scrollbar {
  height: 8px;
}

.recent-games-scroll::-webkit-scrollbar-track {
  background: #e9ecef;
  border-radius: 4px;
}

.recent-games-scroll::-webkit-scrollbar-thumb {
  background: #6c757d;
  border-radius: 4px;
}

.recent-games-scroll::-webkit-scrollbar-thumb:hover {
  background: #495057;
}

.recent-game-item {
  flex-shrink: 0;
  width: 180px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.recent-game-item:hover {
  border-color: #007bff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.season-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 0.6rem;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}

.season-badge.playoffs {
  background: #ffeaa7;
  color: #d63031;
  border: 1px solid #fab1a0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.game-date {
  text-align: center;
  font-size: 0.7rem;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-matchup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.team {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: center;
}

.team-logo-small {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.team-abbr {
  font-weight: 600;
  font-size: 0.9rem;
  color: #333;
}

.at-symbol {
  font-size: 0.8rem;
  color: #6c757d;
  font-weight: 500;
}

.loading-message {
  text-align: center;
  color: #6c757d;
  font-style: italic;
  padding: 40px 20px;
}

/* ======================
   IN-GAME LAYOUT
   ====================== */
body.in-game {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 20px;
  padding: 100px 0px 50px 0px;
  align-items: start;
}

/* Hide pregame elements */
body.in-game #preGameScreen {
  display: none;
}

body.in-game #gameLayout {
  display: contents;
}

/* Table Section (left column) */
#tableSection {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 50px;
  padding: 20px;
}

/* Aside Column (right column) - contains search and DNP */
#asideColumn {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  margin-top: 50px;
}

/* ======================
   OUTLIER TABLE
   ====================== */
.outlier-wrapper {
  background-color: white;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
  padding: 20px;
}

.team-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: nowrap;
}

.team-logo {
  width: 80px;
  height: 80px;
}

.boxscore-btn {
  background: whitesmoke;
  color: black;
  border: 2px solid darkgray;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.boxscore-btn:hover {
  background-color: #c0c0c0;
}

.outlier-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: 17px;
}

.outlier-table th {
  border-top: 2px solid #333;
  border-bottom: 2px solid #333;
  font-weight: 700;
  padding: 12px 8px;
  text-align: center;
}

.outlier-table td {
  padding: 10px 8px;
  vertical-align: middle;
  text-align: center;
}

.outlier-table tr:not(:first-child) {
  border-top: 1px solid #ddd;
  text-align: center;
}

.outlier-table tr:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.outlier-table img {
  border: 2px solid darkgray;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
}

.player-cell-content {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
}

.rank-cell {
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.rank-1 {
  color: #d4af37;
  font-size: 20px;
  font-weight: 800;
  background: rgba(212, 175, 55, 0.12);
}

.rank-2 {
  color: #c0c0c0;
  font-size: 18px;
  font-weight: 750;
  background: rgba(192, 192, 192, 0.12);
}

.rank-3 {
  color: #cd7f32;
  font-size: 17px;
  font-weight: 700;
  background: rgba(205, 127, 50, 0.12);
}

.score-positive {
  color: #5cb85c;
  font-weight: bold;
}

.score-negative {
  color: #d9534f;
  font-weight: bold;
}

.team-logo-mini {
  width: 60px;
  height: 60px;
}

/* ======================
   DNP SECTION
   ====================== */
.dnp-section {
  background-color: white;
  border: 3px solid rgb(232, 232, 232);
  border-radius: 10px;
  padding: 20px;
  grid-column-start: 2;
}

.dnp-section h3 {
  color: rgba(255, 107, 107, 0.8);
  font-size: 1.2em;
  margin-bottom: 12px;
  text-align: center;
  font-weight: 500;
}

.dnp-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dnp-team {
  color: black;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.dnp-team-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dnp-team-name {
  font-weight: 600;
  font-size: 1.1em;
  color: black;
}

.dnp-count {
  margin-left: auto;
  background: rgba(255, 107, 107, 0.15);
  color: rgba(255, 107, 107, 0.8);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 0.8em;
  font-weight: 500;
}

.dnp-players-container {
  position: relative;
}

.dnp-players {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc((50px + 8px) * 3); /* 3 players tall */
  overflow-y: auto;
  scrollbar-width: thin;
}


.dnp-players::-webkit-scrollbar {
  width: 6px;
}

.dnp-players::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}

.dnp-players::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.dnp-player {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  border-left: 2px solid transparent;
  color: black;
}

.dnp-player:hover {
  background: rgba(255, 255, 255, 0.02);
}

.dnp-starter {
  border-left-color: rgba(255, 71, 87, 0.6);
}

.dnp-rotation {
  border-left-color: rgba(255, 165, 2, 0.6);
}

.dnp-bench {
  border-left-color: rgba(116, 125, 140, 0.4);
}

.dnp-player-headshot {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 6px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.dnp-player-info {
  flex: 1;
  min-width: 0;
}

.dnp-player-name {
  font-weight: 500;
  font-size: 1em;
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: black;
}

.dnp-player-stats {
  display: flex;
  gap: 4px;
  font-size: 0.9em;
  flex-wrap: wrap;
  color: black;
}

.dnp-avg-min {
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 0.75em;
}

.dnp-last-played {
  font-size: 0.7em;
  color: black;
}

/* ======================
   BOXSCORE STYLES
   ====================== */
#boxscore-section {
  grid-column: 1;
}

.boxscore-window {
  position: fixed;
  background: white;
  border: 2px solid #333;
  border-radius: 8px;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2);
  width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

.boxscore-header {
  flex-shrink: 0;
  background: #eee;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  border-bottom: 2px solid #ccc;
}

.boxscore-drag-handle {
  cursor: move;
}

.boxscore-table-container {
  flex: 1;
  overflow: auto;
}

.close-btn {
  background: red;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 16px;
  cursor: pointer;
}

.boxscore-table {
  background-color: whitesmoke;
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 800px;
}

.boxscore-table th {
  background: whitesmoke;
  color: black;
  padding: 12px 8px;
  text-align: center;
  font-weight: 600;
  border-bottom: 2px solid rgba(79, 70, 229, 0.3);
  position: sticky;
  top: 0;
  z-index: 10;
}

.boxscore-table th:first-child {
  text-align: left;
  padding-left: 15px;
  min-width: 180px;
}

.boxscore-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: black;
}

.boxscore-table tbody tr:hover {
  background: rgba(79, 70, 229, 0.1);
}

.player-name-cell {
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-align: left !important;
  padding-left: 15px !important;
  min-width: 180px;
}

.boxscore-player-headshot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #324C5E;
  flex-shrink: 0;
}

.player-name {
  font-weight: 600;
  white-space: nowrap;
  color: black;
}

.team-totals-row {
  background: rgba(0, 0, 0, 0.05);
  border-top: 2px solid rgba(79, 70, 229, 0.3);
  border-bottom: 2px solid rgba(79, 70, 229, 0.3);
}

.team-totals-row:hover {
  background: rgba(79, 70, 229, 0.15) !important;
}

.stat-highlight {
  font-weight: 700;
  color: #fbbf24 !important;
}

.plus-minus-positive {
  color: #10b981 !important;
  font-weight: 600;
}

.plus-minus-negative {
  color: #ef4444 !important;
  font-weight: 600;
}

/* Hide elements by default based on state */
body.pregame #output,
body.pregame .dnp-section,
body.pregame #boxscore-section {
  display: none;
}

/* ======================
   RESPONSIVE DESIGN
   ====================== */
@media (max-width: 1024px) {
  body.in-game {
    grid-template-columns: 1fr;
    padding-right: 20px;
  }

  #asideColumn {
    grid-column: 1;
  }

  body.in-game .search-container {
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 20px;
  }
  
}

@media (max-width: 768px) {
  body {
    padding-top: 80px;
  }

  header h1 {
    font-size: 32px;
  }

  header select {
    right: 20px;
    top: 30px;
  }

  body.pregame .search-container {
    top: 150px;
    width: 90%;
  }

  .search-container select {
    width: 100%;
  }

  .recent-games-section {
    width: 90%;
  }

  .instructions {
    font-size: 16px;
    padding: 1rem;
  }

  .outlier-table {
    font-size: 14px;
  }

  .team-header {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .team-logo {
    width: 60px;
    height: 60px;
  }

  .boxscore-btn {
    font-size: 12px;
    padding: 8px 15px;
  }

  .boxscore-window {
    width: 95%;
    left: 2.5% !important;
  }
}

/* Hide outlier count selector for now */
#outlierCountSelector {
  display: none;
}