/*
 * Responsive Tournament Bracket
 * Copyright 2016 Jakub Hájek
 * Licensed under MIT (https://opensource.org/licenses/MIT)
 */

.tournament-body {
  background-color: #f1f1f1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  /* Asegura que las líneas conectoras de los extremos no se corten */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.tournament-bracket {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: min-content;
  /* Fuerza al contenedor a medir al menos lo que mide el bracket */
  padding-bottom: 50px;
  /* Margen de seguridad para que respire el borde inferior */
}


@media (min-width: 58em) {
  .tournament-bracket {
    flex-direction: row;
  }
}

.tournament-bracket__round {
  display: block;
  margin-left: -3px;
  flex: 1;
}

.tournament-bracket__round-title {
  color: #9e9e9e;
  font-size: 1.55rem;
  font-weight: 400;
  text-align: center;
  font-style: italic;
  margin-bottom: 0.5em;
}

.tournament-bracket__list {
  display: flex;
  flex-direction: column;
  flex-flow: row wrap;
  justify-content: center;
  height: 100%;
  min-height: 100%;
  border-bottom: 1px dashed #e5e5e5;
  padding-bottom: 2em;
  margin-bottom: 2em;
  transition: padding 0.2s ease-in-out, margin 0.2s ease-in-out;
}

@media (max-width: 24em) {
  .tournament-bracket__list {
    padding-bottom: 1em;
    margin-bottom: 1em;
  }
}

@media (min-width: 38em) {
  .tournament-bracket__list {
    margin-bottom: 0;
    padding-bottom: 0;
    padding-left: 0;
    border-right: 1px dashed #e5e5e5;
    border-bottom: 0;
  }
}

.tournament-bracket__round:last-child .tournament-bracket__list {
  border: 0;
}

.tournament-bracket__item,
.tournament-bracket__item_reverso {
  display: flex;
  flex: 0 1 auto;
  justify-content: center;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  padding: 2% 0;
  width: 48%;
  transition: padding 0.2s linear;
}

.tournament-bracket__item:nth-child(odd),
.tournament-bracket__item_reverso:nth-child(odd) {
  margin-right: 2%;
}

.tournament-bracket__item:nth-child(even),
.tournament-bracket__item_reverso:nth-child(even) {
  margin-left: 2%;
}

.tournament-bracket__item::after,
.tournament-bracket__item_reverso::after {
  transition: width 0.2s linear;
}

@media (max-width: 24em) {

  .tournament-bracket__item,
  .tournament-bracket__item_reverso {
    width: 100%;
  }

  .tournament-bracket__item:nth-child(odd),
  .tournament-bracket__item:nth-child(even),
  .tournament-bracket__item_reverso:nth-child(odd),
  .tournament-bracket__item_reverso:nth-child(even) {
    margin-left: 0;
    margin-right: 0;
  }
}

/*
  even -> par
  odd -> impar
  after -> contenido despues de
  nth-child(n) -> El selector coincide con cada elemento que es el enésimo hijo de su padre.:nth-child(n)

*/

@media (min-width: 38em) {
  .tournament-bracket__item {
    padding: 0.5em 1em;
    width: 100%;
  }

  .tournament-bracket__item:nth-child(odd),
  .tournament-bracket__item:nth-child(even) {
    margin: 0;
  }

  .tournament-bracket__item::after {
    position: absolute;
    right: 0;
    content: '';
    display: block;
    width: 1em;
    height: 45%;
    border-right: 2px solid #9e9e9e;
  }

  .tournament-bracket__item:nth-child(odd)::after {
    top: 50%;
    border-top: 2px solid #9e9e9e;
    transform: translateY(-1px);
  }


  .tournament-bracket--rounded .tournament-bracket__item:nth-child(odd)::after {
    border-top-right-radius: 0.6em;
  }

  .tournament-bracket__item:nth-child(even)::after {
    bottom: 50%;
    border-bottom: 2px solid #9e9e9e;
    transform: translateY(1px);
  }

  .tournament-bracket--rounded .tournament-bracket__item:nth-child(even)::after {
    border-bottom-right-radius: 0.6em;
  }

  .tournament-bracket__round:first-child .tournament-bracket__item {
    padding-left: 0;
  }

  .tournament-bracket__round:last-child .tournament-bracket__item {
    padding-right: 0;
  }

  .tournament-bracket__round:last-child .tournament-bracket__item::after {
    display: none;
  }

  /*.tournament-bracket__round:nth-last-child(2) .tournament-bracket__item::after {
    border-radius: 0;
    border-right: 0;
  }*/

  .tournament-bracket__item_reverso {
    padding: 0.5em 1em;
    width: 100%;
  }

  .tournament-bracket__item_reverso:nth-child(odd),
  .tournament-bracket__item_reverso:nth-child(even) {
    margin: 0;
  }


  .tournament-bracket__item_reverso::after {
    position: absolute;
    left: 0;
    content: '';
    display: block;
    width: 1em;
    height: 45%;
    border-left: 2px solid #9e9e9e;
  }

  .tournament-bracket__item_reverso:nth-child(even)::after {
    bottom: 50%;
    border-bottom: 2px solid #9e9e9e;
    transform: translateY(-1px);
  }


  .tournament-bracket--rounded .tournament-bracket__item_reverso:nth-child(even)::after {
    border-top-right-radius: 0.6em;
  }

  .tournament-bracket__item_reverso:nth-child(odd)::after {
    top: 50%;
    border-top: 2px solid #9e9e9e;
    transform: translateY(1px);
  }

  .tournament-bracket--rounded .tournament-bracket__item_reverso:nth-child(odd)::after {
    border-bottom-right-radius: 0.6em;
  }



  .tournament-bracket__round:last-child .tournament-bracket__item_reverso {
    padding-right: 0;
  }

  .tournament-bracket__round:first-child .tournament-bracket__item_reverso {
    padding-left: 0;
  }

  .tournament-bracket__round:first-child .tournament-bracket__item_reverso::after {
    display: none;
  }

  .tournament-bracket__round:nth-first-child(2) .tournament-bracket__item_reverso::after {
    border-radius: 0;
    border-left: 0;
  }
}

@media (min-width: 72em) {

  .tournament-bracket__item,
  .tournament-bracket__item_reverso {
    padding: 0.5em 1.5em;
  }

  .tournament-bracket__item::after,
  .tournament-bracket__item_reverso::after {
    width: 1.5em;
  }
}

.tournament-bracket__match,
.tournament-bracket__match_reverso {
  display: flex;
  width: 100%;
  background-color: #ffffff;
  padding: 1em;
  border: 1px solid transparent;
  border-radius: 0.1em;
  box-shadow: 0 2px 0 0 #e5e5e5;
  outline: none;
  cursor: pointer;
  transition: padding 0.2s ease-in-out, border 0.2s linear;
}

.tournament-bracket__match:focus,
.tournament-bracket__match_reverso:focus {
  border-color: #2196F3;
}

.tournament-bracket__match::before,
.tournament-bracket__match::after,
.tournament-bracket__match_reverso::before,
.tournament-bracket__match_reverso::after {
  transition: all 0.2s linear;
}

@media (max-width: 24em) {

  .tournament-bracket__match,
  .tournament-bracket__match_reverso {
    padding: 0.75em 0.5em;
  }
}

@media (min-width: 38em) {

  .tournament-bracket__match::before,
  .tournament-bracket__match::after {
    position: absolute;
    left: 0;
    z-index: 1;
    content: '';
    display: block;
    width: 1em;
    height: 10%;
    border-left: 2px solid #9e9e9e;
  }

  .tournament-bracket__match::before {
    bottom: 50%;
    border-bottom: 2px solid #9e9e9e;
    transform: translate(0, 1px);
  }

  .tournament-bracket--rounded .tournament-bracket__match::before {
    border-bottom-left-radius: 0.6em;
  }

  .tournament-bracket__match::after {
    top: 50%;
    border-top: 2px solid #9e9e9e;
    transform: translate(0, -1px);
  }

  .tournament-bracket--rounded .tournament-bracket__match::after {
    border-top-left-radius: 0.6em;
  }

  .tournament-bracket__match_reverso::before,
  .tournament-bracket__match_reverso::after {
    position: absolute;
    right: 0;
    z-index: 1;
    content: '';
    display: block;
    width: 1em;
    height: 10%;
    border-right: 2px solid #9e9e9e;
  }

  .tournament-bracket__match_reverso::before {
    bottom: 50%;
    border-bottom: 2px solid #9e9e9e;
    transform: translate(0, 1px);
  }

  .tournament-bracket--rounded .tournament-bracket__match_reverso::before {
    border-bottom-right-radius: 0.6em;
  }

  .tournament-bracket__match_reverso::after {
    top: 50%;
    border-top: 2px solid #9e9e9e;
    transform: translate(0, -1px);
  }

  .tournament-bracket--rounded .tournament-bracket__match_reverso::after {
    border-top-right-radius: 0.6em;
  }
}



@media (min-width: 72em) {

  .tournament-bracket__match::before,
  .tournament-bracket__match::after,
  .tournament-bracket__match_reverso::before,
  .tournament-bracket__match_reverso::after {
    width: 1.5em;
  }

  .tournament-bracket__match::before,
  .tournament-bracket__match_reverso::before {
    transform: translate(0, 1px);
  }

  .tournament-bracket__match::after,
  .tournament-bracket__match_reverso::after {
    transform: translate(0, -1px);
  }
}



.tournament-bracket__round:last-child .tournament-bracket__match::before,
.tournament-bracket__round:last-child .tournament-bracket__match::after {
  border-right: 0;
}

.tournament-bracket__round:last-child .tournament-bracket__match::before {
  border-bottom-right-radius: 0;
}

/*.tournament-bracket__round:last-child .tournament-bracket__match::after {
  display: none;
}*/
.tournament-bracket__round:first-child .tournament-bracket__match::before,
.tournament-bracket__round:first-child .tournament-bracket__match::after {
  display: none;
}



.tournament-bracket__round:first-child .tournament-bracket__match_reverso::before,
.tournament-bracket__round:first-child .tournament-bracket__match_reverso::after {
  border-left: 0;
}

.tournament-bracket__round:first-child .tournament-bracket__match_reverso::after {
  border-bottom-left-radius: 0;
}

.tournament-bracket__round:last-child .tournament-bracket__match_reverso::before,
.tournament-bracket__round:last-child .tournament-bracket__match_reverso::after {
  display: none;
}


/*********************************************Oscar*******************************************/


/*
.tournament-bracket__content .tournament-bracket__team:first-child .tournament-bracket__country {
  order: 2;
  justify-content: flex-end;
}
@media (min-width: 24em) {
  .tournament-bracket__content .tournament-bracket__team:first-child .tournament-bracket__country {
    order: 0;
  }
}*/
@media (min-width: 38em) and (max-width: 52em) {
  .tournament-bracket__content .tournament-bracket__team:first-child .tournament-bracket__country {
    flex-direction: column-reverse;
    align-items: flex-end;
  }
}

/*
.tournament-bracket__content .tournament-bracket__team:first-child .tournament-bracket__score {
  order: 0;
}
@media (min-width: 24em) {
  .tournament-bracket__content .tournament-bracket__team:first-child .tournament-bracket__score {
    order: 2;
  }
}
*/

.tournament-bracket__content .tournament-bracket__team:last-child {
  width: 50%;
  order: 2;
  text-align: left;
}

@media (min-width: 38em) and (max-width: 52em) {
  .tournament-bracket__content .tournament-bracket__team:last-child {
    align-items: flex-start;
  }
}

@media (min-width: 38em) {
  .tournament-bracket__content .tournament-bracket__team:last-child .tournament-bracket__country {
    justify-content: flex-start;
  }
}

@media (min-width: 38em) and (max-width: 52em) {
  .tournament-bracket__content .tournament-bracket__team:last-child .tournament-bracket__country {
    align-items: flex-start;
  }
}

.tournament-bracket__content .tournament-bracket__team:last-child .tournament-bracket__code {
  order: 1;
}

.tournament-bracket__table {
  width: 100%;
}

.tournament-bracket__caption {
  font-size: 0.8rem;
  color: red;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding-right: 0.75em;
}

.tournament-bracket__caption_reverso {
  font-size: 0.8rem;
  color: red;
  font-weight: 600;
  display: flex;
  align-items: center;
  padding-left: 0.75em;
}

.tournament-bracket__code {
  padding: 0 0.5em;
  color: #212121;
  font-weight: 600;
  text-transform: uppercase;
  border: 0;
  text-decoration: none;
  cursor: help;
  transition: padding 0.2s ease-in-out;
}

.tournament-bracket__country {
  font-size: 0.95rem;
  /*display: flex;*/
  margin-top: 0.5em;
  align-items: center;
}

@media (max-width: 24em) {
  .tournament-bracket__country {
    margin-top: 0;
  }
}

.tournament-bracket__score {
  display: flex;
  align-items: center;
}

.tournament-bracket__team:first-child .tournament-bracket__score {
  flex-direction: row-reverse;
  padding-left: 0.75em;
}

.tournament-bracket__team:last-child .tournament-bracket__score {
  flex-direction: row-reverse;
  padding-left: 0.75em;
}

.tournament-bracket__number {
  display: inline-block;
  min-width: 7em;
  /* 👈 Esto asegura un ancho mínimo (puedes variar el número) */
  padding: 0.2em 0.4em 0.2em;
  border-bottom: 0.075em solid transparent;
  font-size: 1rem;
  background-color: #F5F5F5;
  border-color: #dddddd;
  text-align: center;
  /* 💡 Opcional: Centra el número si el contenedor es más ancho */
}

.tournament-bracket__team--winner .tournament-bracket__number {
  background-color: #FFF176;
  border-color: #fad674;
}

.tournament-bracket__team--winner .tournament-bracket__country {
  background-color: #FFF176;
  border-color: #fad674;
}