/* =========================================================
   Witton League Table – clean + responsive
   Target: #leagueTable
   ========================================================= */

#leagueTable {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

/* Header: left aligned + black */
#leagueTable thead th {
  text-align: left !important;
  color: #000 !important;
  font-weight: 700;
  font-size: 14px;
  background: #f6f7f8;
  padding: 10px 12px;
  border-bottom: 1px solid #e6e6e6;
  white-space: nowrap;
}

/* Body cells */
#leagueTable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  vertical-align: middle;
}

/* Team name cell */
#leagueTable td.team {
  font-weight: 700;
}

/* Row hover */
#leagueTable tbody tr:hover {
  background: #fafafa;
}

/* Zone colouring (subtle left border) */
#leagueTable tbody tr.promotion {
  border-left: 4px solid #2ecc71;
}
#leagueTable tbody tr.playoffs {
  border-left: 4px solid #f1c40f;
}
#leagueTable tbody tr.relegation {
  border-left: 4px solid #e74c3c;
}

/* Focused team highlight */
#leagueTable tbody tr.focused {
  background: #f0f6fc;
}
#leagueTable tbody tr.focused td.team {
  color: #0a4b78;
}

/* Form chips */
#leagueTable .form {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
#leagueTable .form span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #e6e6e6;
  background: #fff;
}
#leagueTable .form span.W { background: #e9f8ef; border-color: #bfe9cc; }
#leagueTable .form span.D { background: #fff7e6; border-color: #f1d39a; }
#leagueTable .form span.L { background: #fdecec; border-color: #f3bcbc; }

/* =========================================================
   Mobile: stack rows like cards
   ========================================================= */
@media (max-width: 720px) {

  /* Hide the header on mobile */
  #leagueTable thead {
    display: none;
  }

  #leagueTable,
  #leagueTable tbody,
  #leagueTable tr,
  #leagueTable td {
    display: block;
    width: 100%;
  }

  #leagueTable tbody tr {
    border-bottom: 1px solid #e6e6e6;
    padding: 10px 10px 6px;
  }

  #leagueTable tbody td {
    border: none;
    padding: 6px 2px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  /* Labels for each cell using nth-child */
  #leagueTable tbody td:nth-child(1)::before { content: "Pos"; font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(2)::before { content: "Team"; font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(3)::before { content: "P";   font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(4)::before { content: "W";   font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(5)::before { content: "D";   font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(6)::before { content: "L";   font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(7)::before { content: "Pts"; font-weight: 700; opacity: .75; }
  #leagueTable tbody td:nth-child(8)::before { content: "Form";font-weight: 700; opacity: .75; }

  /* Put the team name at the top, full width */
  #leagueTable tbody td.team {
    font-size: 16px;
    padding-top: 2px;
    padding-bottom: 10px;
    justify-content: flex-start;
  }
  #leagueTable tbody td.team::before {
    content: "";
    display: none;
  }

  /* Make form align right in its row */
  #leagueTable tbody td:nth-child(8) {
    align-items: center;
  }
  #leagueTable tbody td:nth-child(8) .form {
    justify-content: flex-end;
  }
}