/* TODO: should be able to go wider than container https://stackoverflow.com/questions/5581034/is-there-are-way-to-make-a-child-divs-width-wider-than-the-parent-div-using-css */
.tournament-bracket__container {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: var(--s-6);
}

.tournament-bracket__elim__container {
  display: flex;
  width: 100%;
  justify-content: center;
  margin: 0 auto;
}

.tournament-bracket__stage-banner {
  display: flex;
  width: 100%;
  height: 10rem;
  flex-direction: column;
  justify-content: space-between;
  background-image: var(--_tournament-bg-url);
  background-position: center;
  border-start-end-radius: var(--rounded);
  border-start-start-radius: var(--rounded);
  grid-area: img;
}

.tournament-bracket__stage-banner__top-bar {
  display: flex;
  justify-content: space-between;
  padding: var(--s-2);
  backdrop-filter: blur(5px);
  background: rgb(0 0 0 / 25%);
  border-start-end-radius: var(--rounded);
  border-start-start-radius: var(--rounded);
}

.tournament-bracket__stage-banner__bottom-bar {
  display: flex;
  justify-content: flex-end;
  padding: var(--s-2);
}

.tournament-bracket__stage-banner__undo-button {
  border: 0;
  background-color: var(--theme-error-transparent);
  color: var(--text);
  font-size: var(--fonts-xxs);
  padding-block: var(--s-1);
  padding-inline: var(--s-2);
}

.tournament-bracket__stage-banner__top-bar__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
}

.tournament-bracket__during-match__opponent-info {
  margin-right: var(--s-6);
  font-size: var(--fonts-md);
  font-weight: var(--bold);
}

.tournament-bracket__during-match-actions-container {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  gap: var(--s-2-5);
}

.tournament-bracket__infos {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s-4);
  background: var(--tournaments-bg);
  border-end-end-radius: var(--rounded);
  border-end-start-radius: var(--rounded);
  color: var(--tournaments-text);
  column-gap: var(--s-8);
  font-size: var(--fonts-xs);
  padding-block: 1px;
}

.tournament-bracket__infos__label {
  margin-block-end: 0;
}

.tournament-bracket__infos__value > button {
  font-size: var(--fonts-xxs);
}

.tournament-bracket__stage-banner__top-bar__mode-image {
  width: 1.5rem;
  height: 1.5rem;
}

.tournament-bracket__during-match-actions {
  display: grid;
  grid-template-areas:
    "img"
    "infos"
    "rosters";
  grid-template-columns: 1fr;
}

.tournament-bracket__during-match-actions__actions {
  display: flex;
  width: 100%;
  height: 2rem;
  justify-content: center;
  color: var(--theme-warning);
  margin-block-start: var(--s-6);
}

.tournament-bracket__during-match-actions__amount-warning-paragraph {
  display: flex;
  align-items: center;
  font-size: var(--fonts-xs);
}

.tournament-bracket__during-match-actions__rosters {
  display: flex;
  width: 100%;
  flex-wrap: wrap;
  justify-content: space-evenly;
  row-gap: var(--s-4);
  text-align: center;
}

.tournament-bracket__during-match-actions__winner-text {
  color: var(--theme-secondary);
  font-size: var(--fonts-xs);
  font-weight: var(--bold);
}

.tournament-bracket__during-match-actions__radio-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tournament-bracket__during-match-actions__team-players {
  display: flex;
  width: 15rem;
  flex-direction: column;
  margin-top: var(--s-3);
  gap: var(--s-2);
}

.tournament-bracket__during-match-actions__checkbox-name {
  display: flex;
  width: 100%;
  align-items: center;
}

.tournament-bracket__during-match-actions__checkbox-name:not(.disabled-opaque):not(.presentational):hover {
  border-radius: var(--rounded);
  cursor: pointer;
  outline: 2px solid var(--theme-transparent);
  outline-offset: 2px;
}

.tournament-bracket__during-match-actions__checkbox {
  width: 50% !important;
  height: 1.5rem !important;
  appearance: none;
  background-color: var(--theme-transparent);
  border-end-start-radius: var(--rounded);
  border-start-start-radius: var(--rounded);
}

.tournament-bracket__during-match-actions__checkbox:checked {
  background-color: var(--theme);
}

.tournament-bracket__during-match-actions__checkbox::after {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  color: var(--text-lighter);
  content: "Didn't play";
  font-size: var(--fonts-xxs);
  font-weight: var(--bold);
  letter-spacing: var(--sparse);
  padding-block-end: 1px;
}

.tournament-bracket__during-match-actions__checkbox:checked::after {
  color: var(--button-text);
  content: "Played";
}

.tournament-bracket__during-match-actions__player-name {
  display: flex;
  width: 50%;
  height: 1.5rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  background-color: var(--bg);
  border-end-end-radius: var(--rounded);
  border-start-end-radius: var(--rounded);
  overflow-x: hidden;
  text-overflow: ellipsis;
}

.tournament-bracket__elim__bracket {
  display: grid;
  column-gap: 2px;
  grid-template-columns: repeat(var(--brackets-columns), 250px);
  overflow-x: auto;

  --brackets-match-height: 100px;
}

.tournament-bracket__elim__roundInfo {
  padding: 1.5rem 1rem;
  background-color: var(--bg-lighter);

  /* TODO: transition: background-color 0.5s; */
}

.tournament-bracket__elim__roundInfo:first-of-type {
  border-radius: var(--rounded) 0 0 var(--rounded);
}

.tournament-bracket__elim__roundInfo.highlighted {
  background-color: var(--theme);
  color: var(--button-text);
}

.tournament-bracket__elim__roundInfo.last {
  border-radius: 0 var(--rounded) var(--rounded) 0;
}

.tournament-bracket__elim__roundTitle {
  font-size: var(--fonts-sm);
  font-weight: 500;
}

.tournament-bracket__elim__bestOf {
  font-size: var(--fonts-xs);
}

.tournament-bracket__match__link {
  all: unset;
  cursor: pointer;
}

.tournament-bracket__match__link:hover {
  --_tournaments-match-bg-color: var(--bg-lighter-transparent);
}

.tournament-bracket__elim__match {
  display: grid;
  margin: 1rem 0;
  column-gap: 5px;
  grid-template-areas:
    "round-number team-one"
    "round-number team-two";
  grid-template-columns: 10px 1fr;
  place-items: center;
  row-gap: 2px;
}

.tournament-bracket__elim__match.hidden {
  visibility: hidden;
}

.tournament-bracket__elim__roundNumber {
  font-size: var(--fonts-xs);
  grid-area: round-number;
}

.tournament-bracket__elim__team {
  display: flex;
  width: 200px;
  justify-content: space-between;
  padding: 0.25rem 0.75rem;
  background-color: var(--_tournaments-match-bg-color, var(--bg-lighter));
  font-size: var(--fonts-sm);
  place-self: flex-start;
  transition: background-color 100ms ease-out;
}

.tournament-bracket__elim__team.own {
  background: var(--tournaments-bg);
  color: var(--tournaments-text);
  font-weight: var(--bold);
}

.tournament-bracket__elim__team.defeated {
  color: var(--text-lighter);
}

.tournament-bracket__elim__teamOne {
  border-radius: var(--rounded) var(--rounded) 0 0;
  grid-area: team-one;
}

.tournament-bracket__elim__teamTwo {
  border-radius: 0 0 var(--rounded) var(--rounded);
  grid-area: team-two;
}

.tournament-bracket__elim__loser-info {
  display: flex;
  align-items: center;
  color: var(--text-lighter);
  font-size: var(--fonts-xs);
}

.tournament-bracket__elim__score {
  font-weight: bold;
}

.tournament-bracket__elim__column {
  display: flex;
}

.tournament-bracket__elim__matches {
  display: flex;
  height: calc(var(--brackets-match-height) * var(--brackets-max-matches));
  flex-direction: column;
  justify-content: space-around;
}

.tournament-bracket__elim__lines {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding-left: 5px;
}

.tournament-bracket__elim__lines > div {
  position: relative;
  width: calc(var(--brackets-match-height) / 4);
  height: calc(
    2px + var(--brackets-match-height) *
      (var(--brackets-max-matches) / var(--brackets-column-matches))
  );
  border-top: 2px solid var(--theme-transparent);
  border-bottom: var(--brackets-bottom-border-length, 2px) solid
    var(--theme-transparent);
  border-inline-end: 2px solid var(--theme-transparent);
  border-radius: 0 var(--rounded) var(--rounded) 0;
}

.tournament-bracket__elim__lines > .no-line {
  visibility: hidden;
}

.tournament-bracket__elim__lines > .top-only {
  border-bottom: none;
  border-radius: 0 var(--rounded) 0 0;
}

.tournament-bracket__elim__lines > .bottom-only {
  border-top: none;
  border-radius: 0 0 var(--rounded) 0;
}

.bottom-only::after {
  position: absolute;
  top: 25%;
  right: -4px;
  width: 3px;
  height: 60%;
  background: var(--bg);
  content: "";
  transform: translate(-50%, -50%);
}

.top-only::after {
  position: absolute;
  top: 75%;
  right: -4px;
  width: 3px;
  height: 60%;
  background: var(--bg);
  content: "";
  transform: translate(-50%, -50%);
}

@media screen and (min-width: 480px) {
  .tournament-bracket__infos {
    flex-direction: row;
  }
}
