//getting rid of Blue Focus
button:focus {
  outline: 0 !important;
}

/*overriding React styles for contextual button*/

.btn {
  animation: none;
}

.btn:focus {
  webkit-box-shadow: none;
  box-shadow: none;
}

//Button when clicked only
.btn-secondary:not(:disabled):not(.disabled).active:focus,
.show > .btn-secondary.dropdown-toggle:focus {
  box-shadow: none;
  background-color: $Vlight-gray;
  color: $dark-gray;
  opacity: 1;
}

// BUTTON IN FOCUS, After click
.btn-secondary:focus {
  background-color: $Vlight-gray;
  color: $dark-gray;
  opacity: 1;
}

//Button in focus, onClick
.btn-secondary:not(:disabled):not(.disabled):active:focus,
.btn-secondary:not(:disabled):not(.disabled).active:focus,
.show > .btn-secondary.dropdown-toggle:focus {
  box-shadow: none;
}

@mixin context-button {
  cursor: pointer;
  border: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  color: $dark-gray;
  border-radius: 5rem;
  opacity: 0.6;
  margin-right: 0;
  font-size: 1.4rem;
  &:hover {
    border: none;
    color: $brand-text--dark;
    opacity: 1;
  }
}
.context-button {
  @include context-button;
}

.context-button.btn-secondary.active {
  background-color: #e7eaeb;
  border-radius: 5rem;
  color: #686768;
  opacity: 1;
}

.navbar {
  .context-button {
    width: 3rem;
    height: 3rem;
    color: $brand-text--dark;
    opacity: 0.8;
    &:hover {
      background-color: $dark-accent--soft;
      opacity: 1;
      color: $brand-text--darker;
    }
  }

  .btn-secondary:not(:disabled):not(.disabled):active,
  .btn-secondary:not(:disabled):not(.disabled).active,
  .show > .btn-secondary.dropdown-toggle {
    box-shadow: none;
    background: $light-accent--strong;
    opacity: 1;
    color: black;
  }

  .btn-secondary:focus {
    background-color: $light-accent--strong;
  }
}

//* - Action button - */

@mixin action-button {
  font-weight: bold;
  cursor: pointer;
  border: 1px solid $brand-workspace;
  min-width: 7rem;
  height: 3.5rem;
  border-radius: 2.5rem;
  @include content-1;
  padding: 0 1.6rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;

  &:disabled {
    color: $light-gray;
    border-color: $light-gray;
    &:hover {
      background-color: transparent;
      cursor: default;
    }
  }
}
%action-button {
  @include action-button;
}
.action-button {
  @include action-button;
}

// In lesson left pannel:
.lesson {
  .action-button:disabled {
    color: $light-accent--Vstrong;
    border-color: $light-accent--Vstrong;
    &:hover {
      background-color: transparent;
      cursor: default;
    }
  }
}

@mixin _texty-button-common {
  display: inline-block;
  @include content-1;
  font-weight: bold;
}

@mixin _texty-button {
  @include _texty-button-common;
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  padding: 0;
  margin: 0;
  border: 0;
  box-shadow: none;
  background: transparent;

  color: $workspace-action;
  &:hover {
    color: $brand-workspace;
  }
  &[disabled] {
    color: $text-muted;
  }

  &:not([disabled]) {
    cursor: pointer;
  }
}

// For a <span> that looks like a <button> that has _texty-button
@mixin _texty-button-disabled-span {
  @include _texty-button-common;
  color: $text-muted;
}

@-webkit-keyframes spinner-in-button {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
@keyframes spinner-in-button {
  0% {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
  }
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@mixin button-primary {
  color: white;
  border-color: $primary;
  background: $primary;
  &:hover {
    color: $primary;
    background: white;
  }
  &:active {
    color: $primary;
    background: $SuperLightGray;
  }
}

@mixin button-white {
  color: white;
  border-color: $white;
  background-color: transparent;
  &:hover,
  &:hover .spinner::after {
    background-color: $light-accent--strong;
  }
  &:active,
  &:active .spinner::after {
    background-color: $light-accent--Vstrong;
  }
}
.button-white {
  @include button-white;
}

@mixin button-white--fill {
  color: $brand-workspace;
  border-color: $white;
  &,
  .spinner::after {
    background-color: white;
  }
  &:hover,
  &:hover .spinner::after {
    background-color: $light-accent--strong;
    color: white;
  }
  &:active,
  &:active .spinner::after {
    background-color: $light-accent--Vstrong;
    border: 1px solid white;
  }
}
.button-white--fill {
  @include button-white--fill;
}

@mixin button-gray {
  color: $medium-gray;
  border-color: $medium-gray;
  background-color: white;
  &:hover {
    color: $dark-gray;
    background-color: composite-colors($dark-accent--soft, white);
  }
  &:active {
    color: $dark-gray;
    background-color: composite-colors($dark-accent--soft-M, white);
  }
}
.button-gray {
  @include button-gray;
}

@mixin button-blue {
  color: $workspace-action;
  border-color: $workspace-action;
  background-color: transparent;
  &:hover,
  &:hover .spinner::after {
    background-color: $brand-workspace--Vlight;
    color: $workspace-action;
  }
  &:active,
  &:active .spinner::after {
    background-color: $workspace-action;
    color: white;
  }
}
.button-blue {
  @include button-blue;
}

@mixin button-blue--fill {
  background-color: $workspace-action;
  color: white;
  border-color: transparent;
  &:hover {
    background-color: $brand-workspace--Vlight;
    border-color: $workspace-action;
    color: $workspace-action;
  }
  &:active {
    background-color: $brand-workspace;
    color: white;
  }
}

.button-blue--fill {
  @include button-blue--fill;
}

@mixin button-red {
  color: $brand-red;
  border-color: $brand-red;
  background-color: transparent;
  &:hover,
  &:hover .spinner::after {
    background-color: $error-prompt--light;
  }
  &:active,
  &:active .spinner::after {
    background-color: $error-prompt;
    color: white;
  }
}

@mixin button-pink-fill {
  color: white;
  background-color: $brand-learn;
  display: inline-flex;
  border: 1px solid $brand-learn;
  &:hover {
    background-color: $brand-learn--light;
    border: 1px solid $brand-learn;
    color: $brand-learn;
  }
  &:active {
    background-color: $brand-learn;
  }
}

@mixin button-orange {
  color: $brand-orange;
  border-color: $brand-orange;
  background-color: transparent;
  &:hover {
    background-color: $brand-orange--light;
  }
  &:active {
    background: $brand-orange;
    color: $white;
  }
}
.button-orange {
  @include button-orange;
}

@mixin button-orange--fill {
  color: white;
  border-color: $brand-orange;
  &:hover {
    color: $brand-orange;
    background-color: white;
  }
  &,
  .spinner::after {
    background-color: $brand-orange;
  }
  &:hover .spinner::after {
    background-color: $light-accent--strong;
    color: white;
  }
  &:active,
  &:active .spinner::after {
    background-color: $light-accent--Vstrong;
    border: 1px solid $brand-orange;
  }
}
.button-orange--fill {
  @include button-orange--fill;
}

// Style for button with Icon within
.button-icon {
  cursor: pointer;
  height: 3.5rem;
  width: 6rem;
  border: 2px solid $Vlight-gray;
  background-color: $white;
  display: flex;
  align-items: center;
  justify-content: center;
  color: $medium-gray;
  border-radius: 0 3px 3px 0;
  font-size: 1.5rem;
  text-decoration: none;
  &:hover {
    background-color: $SuperLightGray;
    text-decoration: none;
    color: $brand-text--dark;
  }
}

// Application links

@mixin action-link {
  display: inline;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: $workspace-action;
  font-weight: bold;

  &:hover {
    color: #2d9daa;
    text-decoration: none;
  }
}

@mixin export-link {
  // Appears at top-left of OutputPane and in reports.
  //
  // HTML:
  // <div className='export-link'>
  //   <i className='icon-download' />
  //   Download spreadsheet
  // </div>
  @include action-button();
  @include button-blue();

  .icon-download {
    font-size: 1.5rem;
    margin-right: 1rem;
  }

  &:not(:hover):not(:focus):not(:active) {
    // De-buttonize it when nobody's around, so it doesn't distract
    border-color: transparent;
    background: transparent;
  }
}
