@import "base";

a {
  cursor: pointer;
}

a:focus {
  cursor: default;
}

.button--primary--disabled {
  @include _padding(10px, 15px, 10px, 15px);
  background: $color-button-contained-disabled;
  color: $color-text-primary-disabled;
  cursor: default;
}

.button--primary--danger--disabled {
  background: $color-button-primary-action-danger-disabled;
  color: $color-text-secondary;
  cursor: default;
}

button,
.button {
  @include _font-size(16px);
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  border: 0;
  min-width: 150px;
}

table {
  .button {
    min-width: 100px;
  }
}

.button,
.button:hover,
.button:active,
.button:focus {
  text-decoration: none;
}

/* White contained button */
.button--home {
  @include _padding(9px, 15px, 10px, 15px);
  background-color: $color-button-home;
  color: $color-text-primary;

  &:hover {
    @include material-shadow();
    color: $color-text-primary;
    background-color: $color-button-home-hover;
    text-decoration: none;
  }

  &:active {
    border: 1px solid $color-button-home-border;
    box-shadow: none;
  }
}

/* Yellow contained button */
.button--primary {
  @include _padding(10px, 15px, 10px, 15px);
  background: $color-button-contained;
  color: $color-text-primary;

  &.disabled {
    background: $color-button-contained-disabled;
    color: $color-text-primary-disabled;
    cursor: default;
  }

  &:hover:not(.disabled){
    @include material-shadow();
    background: $color-button-contained-hover;
    color: $color-text-primary;
    text-decoration: none;
  }

  &:active:not(.disabled) {
    background: $color-button-contained-active;
    color: $color-text-primary;
    box-shadow: none;
  }
}

/* Outlined button */
.button--secondary {
  @include _padding(8px, 15px, 8px, 15px);
  background-color: transparent;
  border: 2px solid;

  &:hover {
    text-decoration: underline;
  }

  &:active {
    border-width: 3px;
    text-decoration: none;
  }
  &:focus {
    text-decoration: none;
  }
}

/* Outlined button white border and text */
.button--secondary--light {
  border-color: $color-button-subnav-border;
  color: $color-text-secondary;

  &:hover,
  &:active,
  &:focus {
    border-color: $color-button-subnav-border;
    color: $color-text-secondary;
  }
}

/* Outlined button yellow border with black text */
.button--secondary--dark {
  border-color: $color-button-secondary-border-dark;
  color: $color-text-primary;

  &:hover {
    color: $color-text-primary;
  }

  &:active,
  &:focus {
    border-color: $color-button-secondary-border-dark;
  }
}

.button-right-arrow {
  &:after {
    content: "\e5e1";
    font-family: "Material Icons Outlined";
    position: relative;
    top: 2px;
    left: 5px;
    line-height: 0.9em;
  }
}

.button-email {
  &:after {
    content: "\e0be";
    font-family: "Material Icons Outlined";
    position: relative;
    top: 2px;
    left: 5px;
    line-height: 0.9em;
  }
}

.button--regular,
.ui-dialog-buttonset button {
  @include _padding(10px, 15px, 10px, 15px);
}

.button--small {
  @include _font-size(14px);
  @include _padding(5px, 10px, 5px, 10px);
}

.button--menu {
  text-decoration: none;
}

.button--menu--enabled:hover {
  text-decoration: underline;
}

.button--menu--disabled {
  color: $color-button-disabled;

  &:hover {
    cursor: default;
  }
}

.button--menu--primary {
  @include _font-size(27px);
  @include _margin(0px, 40px, 0px, 10px);
  color: $color-text-tertiary;

  &:hover {
    color: $color-text-tertiary;
    text-decoration: underline;
  }
}

.button--menu--secondary {
  @include _font-size(18px);
  @include _margin(0px, 20px, 0px, 20px);
}

.button--primary--danger,
.ui-dialog-buttonset button {
  background: $color-button-primary-action-danger;
  color: $color-text-secondary;

  &.disabled {
    background: $color-button-primary-action-danger-disabled;
    color: $color-text-secondary;
    cursor: default;
  }

  &:hover:not(.disabled){
    @include material-shadow();
    background: $color-button-primary-action-danger-hover;
    color: $color-text-secondary;
  }
}

td .button--primary--danger,
td .button--primary {
  align-items: center;
  display: inline-flex;
  height: 34px;
  justify-content: center;
}

.button--icon {
  align-items: center;
  display: inline-flex;
  justify-content: space-between;

  .iconify {
    @include _font-size(22px);
    @include _margin(0px, 0px, 0px, 20px);
  }
}

.button--dropdown {
  @extend .dropdown;
  width: 20vw;
  align-items: center;
  background: transparent;
  border: 2px solid $color-secondary-600;
  color: $color-text-tertiary;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  outline: none;
  height: 42px;

  .glyphicon {
    @include _font-size(20px);
    @include _padding(0px, 0px, 0px, 10px);
    display: inline-flex;
    position: relative;
    top: 5px;
  }

  &:after {
    @include _font-size(24px);
    @include _padding(0px, 0px, 0px, $spacing * 5);
    font-weight: normal;
    line-height: 1;
    content: "\e5cf";
    font-family: "Material Icons Outlined";
  }

  &[aria-expanded="true"]:after {
    content: "\e5ce";
  }

  &:hover {
    text-decoration: none;

    .dropdown__text {
      text-decoration: underline;
    }
  }
}

.button--register {
  @include _padding(10px, 30px, 10px, 30px);
  background: $color-secondary-300;
  color: $color-text-primary;

  &:hover {
    background: $color-secondary-600;
    color: $color-text-primary;
  }
}

.button-group {
  > :not(:first-child) {
    @include _margin(0px, 0px, 0px, 20px);
  }
}

.button-group__icon {
  @include _padding($spacing * 3, 0px, 0px, 0px);

  .button {
    align-items: center;
    display: inline-flex;
    justify-content: space-between;

    .material-icons-outlined {
      @include _margin(0px, 0px, 0px, $spacing * 2);
    }
  }
}

.button--banner--container {
  display: flex;
  flex-wrap: wrap;
}

.button--banner {
  & + & {
    margin: 0 0 0 30px;
  }
}

.button--login {
  margin-top: $spacing * 3;
}

.games-table__cell {
  .dropdown {
    width: 100%;
  }

  .button--dropdown {
    background: $color-background-secondary;
    height: 34px;
    margin: 0;
    max-width: 100%;
    width: 100%;
  }

  .dropdown-menu {
    width: 100%;
  }

  .dropdown-menu__option {
    height: 34px;

    .button {
      @include _padding(3px, 10px, 3px, 10px);
    }
  }
}

@media (max-width: $tablet-large-max-width) {
  .button--icon {
    justify-content: center;

    .iconify {
      display: none;
    }
  }

  table {
    .button {
      min-width: 70px;
    }
  }
}

@media (min-width: $tablet-large-min-width) {
  .menu__item {
    display: none;
  }
}

@media (min-width: $tablet-large-min-width) and (max-width: $tablet-large-max-width) {
  .button--menu--primary {
    @include _margin(0px, $spacing * 6, 0px, 0px);
  }

  .button--menu--secondary {
    @include _margin(0px, 10px, 0px, 10px);
  }

  .button--menu--enabled {
    @include _font-size(18px);
  }
}

@media (max-width: $tablet-small-max-width) {
  .button--menu__item {
    @include _font-size(30px);
    align-items: center;
    background-color: $color-background-secondary;
    border-bottom: 1px solid $color-button-border-light-grey;
    color: $color-text-tertiary;
    display: flex;
    height: 60px;
    justify-content: space-between;
    text-align: left;
    width: 100%;

    &:hover {
      color: $color-text-tertiary;
    }

    &.button--register {
      background: $color-secondary-300;
      border: 0;
      justify-content: center;
    }

    &.button--header--login {
      border: 2px solid $color-secondary-600;
      margin: 0;
    }

    #login-tabs > & {
      border: 2px solid $color-secondary-600;
      border-top: 0;
    }
  }

  .menu__item {
    @include _font-size(30px);
    align-items: center;
    background-color: $color-button-menu-item;
    display: flex;
    height: 60px;
    justify-content: center;
    text-align: center;
    width: 100%;

    .button--secondary--dark {
      @include _margin(0px, 0px, 0px, 30px);

      .glyphicon {
        @include _font-size(32px);
      }
    }
  }

  .button--menu__item--sub-header {
    &:after {
      content: "\e5c5";
      font-family: "Material Icons Outlined";
      font-size: 32px;
    }
  }

  .button--menu__item--sub-header[aria-expanded="true"] {
    &:after {
      content: "\e5c7";
    }
  }

  .button--menu__item--teacher {
    background-color: $color-background-teach;
  }

  .button--menu__item--student {
    background-color: $color-background-play;

    &,
    &:hover,
    &:active,
    &:focus {
      color: $color-text-secondary;
    }
  }

  .button--menu__item--independent {
    background-color: $color-background-play-indep;
  }

  .button--menu__item__sub {
    padding-left: $spacing * 6;
  }

  .button--menu__item__sub__sub {
    padding-left: $spacing * 10;
  }
}
