/*
 * OS Shortcodes - the fixture tables: OneFootball's os-betting-child/css/event-shortcodes.scss (its
 * Figma design, the ES market's), on the plugin's classes; its theme colours replaced by General's
 * (--color-primary-color: Text, --color-border: Border, --event-elevated: Background, the cards'
 * colour as OneFootball's). Desktop and phone split at 1199px, as the themes.
 * Variables (Network Admin > Settings > OS Shortcodes > Fixture tables):
 *   --fixture-table-win, --fixture-table-draw, --fixture-table-loss   outcome tags and chips
 *   --fixture-table-outcome-text                                      their text
 */

.os-fixture-table {
  box-sizing: border-box;
  width: 100%;
  margin: var(--os-shortcodes-spacing-blocks, 24px) 0;
  color: var(--os-shortcodes-text, #1a1a1a);
  font-family: var(--os-shortcodes-font-family, inherit);
  --fixture-table-line: var(--os-shortcodes-border, #e1e0e7);
  --fixture-table-raised: var(--os-shortcodes-background, #f5f5fa);
}

.os-fixture-table *,
.os-fixture-table *::before,
.os-fixture-table *::after {
  box-sizing: inherit;
}

/* The theme's own table colour stays out too (UAI's table { color: #333 }): the cells take Text */
.os-fixture-table table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: collapse;
  color: inherit;
  table-layout: auto;
}

/* The content's own table rules (borders on every row) stay out */
.os-fixture-table tr {
  border: 0;
  background: none;
}

.os-fixture-table th,
.os-fixture-table td {
  padding: 0;
  border: 0;
  background: none;
}

/* Cells centred, above the content's own alignment (UAI's .content-block table td: top, 0,1,2) */
.os-fixture-table table tr > th,
.os-fixture-table table tr > td {
  vertical-align: middle;
}

/* A cell's content at its cell's size, above the content's (UAI's .content-block table td > *: 16px, 0,1,3) */
.os-fixture-table > table > tbody > tr > td > * {
  font-size: inherit;
}

.os-fixture-table img {
  max-width: 100%;
  height: auto;
}

/* thead th */
.os-fixture-table > table > thead th {
  padding: 18px 0;
  border-top: 1px solid var(--fixture-table-line);
  border-bottom: 1px solid var(--fixture-table-line);
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-align: left;
}

.os-fixture-table > table > thead th.os-fixture-table__score-head {
  text-align: center;
}

.os-fixture-table > table > thead th:last-child {
  text-align: right;
}

/* tbody td */
.os-fixture-table > table > tbody td {
  padding: 16px 0;
  border-bottom: 1px solid var(--fixture-table-line);
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  text-align: left;
}

.os-fixture-table__date {
  min-width: 88px;
  white-space: nowrap;
}

.os-fixture-table > table > tbody td.os-fixture-table__date {
  font-weight: 400;
  line-height: 1.4;
}

.os-fixture-table > table > tbody td:last-child {
  text-align: right;
}

/* td.home.team, td.away.team: 50% each, so the score sits under its colspan header */
.os-fixture-table > table > tbody td.os-fixture-table__team {
  width: 50%;
  white-space: nowrap;
}

.os-fixture-table > table > tbody td.os-fixture-table__team--home {
  text-align: right;
}

.os-fixture-table > table > tbody td.os-fixture-table__team--away {
  text-align: left;
}

.os-fixture-table__team--home .os-fixture-table__full {
  max-width: 136px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.os-fixture-table__team--home .os-fixture-table__badge {
  margin-left: 8px;
}

.os-fixture-table__team--away .os-fixture-table__badge {
  margin-right: 8px;
}

.os-fixture-table__team--loss .os-fixture-table__full,
.os-fixture-table__team--loss .os-fixture-table__short {
  opacity: 0.7;
}

/* td.result */
.os-fixture-table > table > tbody td.os-fixture-table__score {
  width: 32px;
  padding-right: 16px;
  padding-left: 16px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.os-fixture-table__badge {
  display: inline-block;
  vertical-align: middle;
}

.os-fixture-table__badge img {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.os-fixture-table__full,
.os-fixture-table__short {
  vertical-align: middle;
}

/* The outcome tag: a pill with the word; a 40px circle with a letter on phones */
.os-fixture-table__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  height: 32px;
  padding: 8px 16px;
  border-radius: 80px;
  color: var(--fixture-table-outcome-text, #fff);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}

.os-fixture-table__tag--win,
.os-fixture-table__chip--win {
  background: var(--fixture-table-win, #007846);
}

.os-fixture-table__tag--draw,
.os-fixture-table__chip--draw {
  background: var(--fixture-table-draw, #a19db3);
}

.os-fixture-table__tag--loss,
.os-fixture-table__chip--loss {
  background: var(--fixture-table-loss, #ec0a33);
}

/* Titles over a block (history, line-up, scorers, form) */
.os-fixture-table__title {
  margin: 0;
  padding: 18px 0;
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.os-fixture-table--history > .os-fixture-table__title,
.os-fixture-table--scorers > .os-fixture-table__title {
  border-top: 1px solid var(--fixture-table-line);
}

/* --- Odds (1 X 2) --- */
.os-fixture-table--odds .os-fixture-table__advertiser {
  width: 100%;
}

.os-fixture-table--odds .os-fixture-table__odd {
  padding-left: 16px !important;
  text-align: center !important;
  white-space: nowrap;
}

.os-fixture-table__operator {
  display: flex;
  align-items: center;
  gap: 16px;
}

.os-fixture-table__operator img {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 100px;
  object-fit: cover;
}

.os-fixture-table__name {
  font-weight: 700;
  word-break: break-word;
}

/* Above the content's link rules (UAI's :is(..., .content-block) a weighs 0,3,1) */
.os-fixture-table.os-fixture-table--odds td.os-fixture-table__odd a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  padding: 12px 16px;
  border: 1px solid var(--fixture-table-line);
  border-radius: 4px;
  background: var(--fixture-table-raised);
  color: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 16px;
  text-decoration: none;
}

.os-fixture-table.os-fixture-table--odds td.os-fixture-table__odd a:hover {
  border-color: var(--os-shortcodes-primary, #0077B2);
  color: inherit;
  text-decoration: none;
}

.os-fixture-table__disclaimer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px solid var(--fixture-table-line);
  color: var(--os-shortcodes-text-muted, #737373);
  font-size: 14px;
  line-height: 16px;
}

.os-fixture-table__disclaimer::before {
  content: '';
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: url('../images/fixture-error-warning-line.svg') center / contain no-repeat;
  mask: url('../images/fixture-error-warning-line.svg') center / contain no-repeat;
}

/* --- History and scorers: the summary between two crests --- */
.os-fixture-table__summary {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 16px;
  padding: 32px;
  border-top: 1px solid var(--fixture-table-line);
}

.os-fixture-table__crest {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 0;
}

.os-fixture-table__crest img {
  width: 64px;
  height: 64px;
  padding: 16px;
  border-radius: 100%;
  background: var(--fixture-table-raised);
  object-fit: contain;
}

.os-fixture-table__crest figcaption {
  font-size: 16px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.os-fixture-table__record {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 2px 24px;
  margin-top: 7px;
  text-align: center;
}

.os-fixture-table__count {
  font-size: 20px;
  font-weight: 700;
  line-height: 32px;
}

.os-fixture-table__label {
  font-size: 14px;
  font-weight: 600;
  line-height: 16px;
  opacity: 0.8;
}

.os-fixture-table--history > table > tbody td {
  padding: 24px 0;
}

.os-fixture-table__competition {
  min-width: 112px;
}

/* --- Line-up: the pitch (OneFootball's SVGs) --- */
/* A div, not a header: the themes' header rule (UAI's: sticky, white) would reach it */
.os-fixture-table__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--fixture-table-line);
  border-bottom: 1px solid var(--fixture-table-line);
}

.os-fixture-table__head .os-fixture-table__title {
  flex: 0 0 auto;
  padding: 0;
  font-weight: 600;
  line-height: 16px;
  text-align: right;
  white-space: nowrap;
  opacity: 0.8;
}

.os-fixture-table__team-title {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 16px;
  min-width: 0;
  margin: 0;
}

.os-fixture-table__team-title img {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.os-fixture-table__team-title figcaption {
  font-size: 16px;
  font-weight: 700;
  line-height: 16px;
}

.os-fixture-table__team-title--away {
  justify-content: flex-end;
  text-align: right;
}

.os-fixture-table__pitch {
  display: flex;
  justify-content: center;
  padding: 24px;
  border-bottom: 1px solid var(--fixture-table-line);
}

.os-fixture-table__squad {
  position: relative;
  width: 100%;
  max-width: 376px;
  aspect-ratio: 376 / 304;
  overflow: hidden;
}

.os-fixture-table__squad::before {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  aspect-ratio: 1;
  background-image: url('../images/fixture-lineup-pitch.svg'), url('../images/fixture-lineup-pitch-edge.svg');
  background-position: center top, center bottom;
  background-size: 100% 97.703%, 100% 2.297%;
  background-repeat: no-repeat, no-repeat;
}

.os-fixture-table__line {
  position: absolute;
  right: 0;
  left: 0;
  transform: translateY(-50%);
}

.os-fixture-table__line--forward { top: 10.3%; }
.os-fixture-table__line--midfield { top: 35%; }
.os-fixture-table__line--defense { top: 60.6%; }
.os-fixture-table__line--goalkeeper { top: 80.9%; }

.os-fixture-table__players {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  margin: 0 auto;
}

.os-fixture-table__line--forward .os-fixture-table__players { width: 72%; }
.os-fixture-table__line--midfield .os-fixture-table__players { width: 80%; }
.os-fixture-table__line--defense .os-fixture-table__players { width: 88%; }
.os-fixture-table__line--goalkeeper .os-fixture-table__players { width: 95%; }

.os-fixture-table__player {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.os-fixture-table__shirt {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding-top: 10px;
  background-image: url('../images/fixture-lineup-shirt.svg'), url('../images/fixture-lineup-shirt-collar.svg');
  background-position: 1.19px 3.29px, 14.25px 2.38px;
  background-size: 35.63px auto, 9.5px 4.75px;
  background-repeat: no-repeat, no-repeat;
  color: #fff;
  font-size: 11.4px;
  font-weight: 600;
  line-height: 1.35;
}

.os-fixture-table__player .os-fixture-table__player-name,
.os-fixture-table__players > .os-fixture-table__empty {
  width: 100%;
  overflow: hidden;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Scorers --- */
.os-fixture-table__scorer {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  text-align: center;
}

.os-fixture-table__photo {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 100%;
  background: var(--fixture-table-raised);
}

.os-fixture-table__photo > img {
  width: 64px;
  height: 64px;
  border-radius: 100%;
  object-fit: cover;
}

.os-fixture-table__photo-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: flex;
  width: 24px;
  height: 24px;
  padding: 2px;
  border-radius: 100%;
  background: var(--os-shortcodes-background, #fff);
}

.os-fixture-table__photo-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.os-fixture-table__scorer figcaption {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.os-fixture-table__scorer .os-fixture-table__player-name {
  font-size: 16px;
  font-weight: 700;
}

.os-fixture-table__position {
  font-size: 14px;
  opacity: 0.8;
}

.os-fixture-table__stats {
  align-self: center;
  width: auto !important;
}

.os-fixture-table__stats td {
  padding: 4px 12px !important;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

.os-fixture-table__stats td.os-fixture-table__label {
  font-size: 14px;
  font-weight: 600;
}

/* No odds (none found, none written, or hidden): the summary closes the table */
.os-fixture-table--scorers > .os-fixture-table__summary:last-child {
  border-bottom: 1px solid var(--fixture-table-line);
}

.os-fixture-table__bets {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--fixture-table-line);
  border-bottom: 1px solid var(--fixture-table-line);
}

.os-fixture-table__bet {
  display: flex;
  justify-content: center;
}

.os-fixture-table__market {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

/* Above the content's link rules (UAI's :is(..., .content-block) a weighs 0,3,1; its :hover 0,4,1), as the odds table's */
.os-fixture-table.os-fixture-table--scorers .os-fixture-table__bet a.os-fixture-table__odd-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--fixture-table-line);
  border-radius: 4px;
  background: var(--fixture-table-raised);
  color: inherit;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
}

.os-fixture-table.os-fixture-table--scorers .os-fixture-table__bet a.os-fixture-table__odd-button:hover {
  border-color: var(--os-shortcodes-primary, #0077B2);
  color: inherit;
  text-decoration: none;
}

.os-fixture-table__odd-button img {
  width: 24px;
  height: 24px;
  border-radius: 100%;
}

/* --- Form and season --- */
.os-fixture-table__versus {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 600;
  line-height: 16px;
  opacity: 0.4;
}

.os-fixture-table__form {
  padding: 24px 0;
  border-bottom: 1px solid var(--fixture-table-line);
}

.os-fixture-table__form .os-fixture-table__title,
.os-fixture-table__season .os-fixture-table__title {
  padding: 0;
}

.os-fixture-table__season .os-fixture-table__title {
  margin-bottom: 20px;
}

.os-fixture-table__caption {
  margin-left: 8px;
  font-size: 14px;
  font-weight: 400;
  opacity: 0.8;
}

.os-fixture-table__form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 0 24px;
}

.os-fixture-table__chips {
  display: flex;
  gap: 4px;
}

.os-fixture-table__chips--away {
  justify-content: flex-end;
}

.os-fixture-table__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 100%;
  color: var(--fixture-table-outcome-text, #fff);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

/* The head-to-head record between the chips: the history's figures over their labels */
.os-fixture-table__h2h {
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.os-fixture-table__h2h .os-fixture-table__record {
  margin-top: 0;
}

.os-fixture-table__season {
  padding: 24px 0;
}

.os-fixture-table__stat + .os-fixture-table__stat {
  margin-top: 20px;
}

.os-fixture-table__stat-info {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  font-weight: 700;
  line-height: 16px;
}

.os-fixture-table__stat-info .os-fixture-table__label {
  flex: 1;
  font-weight: 400;
  text-align: center;
  opacity: 0.8;
}

/* Bars of 4px, 18px apart, both growing out from the centre; the track in Border, the fill in Text */
.os-fixture-table__bars {
  display: flex;
  gap: 18px;
  margin-top: 12px;
}

.os-fixture-table__bar {
  display: flex;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--fixture-table-line);
  overflow: hidden;
}

.os-fixture-table__bar--home {
  justify-content: flex-end;
}

.os-fixture-table__bar > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: currentColor;
}

/* Desktop: full names and dates; phones: the short ones */
@media (min-width: 1200px) {
  .os-fixture-table__short {
    display: none;
  }

  .os-fixture-table__full {
    display: inline-block;
  }
}

@media (max-width: 1199px) {
  .os-fixture-table__full {
    display: none;
  }

  .os-fixture-table__short {
    display: inline-block;
  }

  .os-fixture-table__date {
    min-width: 0;
  }

  .os-fixture-table > table > tbody td.os-fixture-table__score {
    padding-right: 8px;
    padding-left: 8px;
  }

  .os-fixture-table__tag {
    min-width: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 100%;
  }

  /* The score header's label goes, not its cell: the columns stay aligned */
  .os-fixture-table > table > thead th.os-fixture-table__score-head span {
    display: none;
  }

  .os-fixture-table--odds .os-fixture-table__odd {
    padding-left: 8px !important;
  }

  .os-fixture-table__operator {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .os-fixture-table.os-fixture-table--odds td.os-fixture-table__odd a {
    width: auto;
    min-width: 64px;
    font-size: 14px;
  }

  .os-fixture-table__summary {
    padding: 24px 0;
  }

  .os-fixture-table__pitch {
    padding: 24px 0;
  }

  /* Centred, not spread over a tablet's width (OneFootball's 420px) */
  .os-fixture-table__form-row {
    gap: 8px;
    max-width: 420px;
    margin-right: auto;
    margin-left: auto;
    padding: 0;
  }

  .os-fixture-table__chip {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  /* The record gives way to a line between the chips */
  .os-fixture-table__h2h {
    width: 1px;
    height: 24px;
    background: var(--fixture-table-line);
  }

  .os-fixture-table__h2h .os-fixture-table__record {
    display: none;
  }

  .os-fixture-table__season {
    padding-top: 16px;
  }
}
