/* Begin Code specific to the button hover animation (horizontal fill of background and inversion of text color) */

@mixin button-with-hover-animation(
  $text-color, $border-color: yellow, $hover-background-color: $border-color, $background-color: initial) {
  position: relative; /* so that on hover, background animation can fill the button instead of its parent */
  background-color: $background-color;
  border-color: $border-color;
  color: $text-color;
  z-index: 0;
  transition: color 0.2s ease-in;

  &:hover,
  &:focus,
  &:active,
  &:focus:active,
  &:active:hover,
  &[disabled]:hover {
    color: #fff; /* opposite of current non-hover color */
    border-color: $border-color;
    background-color: $background-color;
    text-decoration: none;
  }

  &:before {
    content: '';
    position: absolute;
    background: $hover-background-color;
    bottom: 0;
    left: 0;
    right: 100%;
    top: 0;
    z-index: -1;
    transition: right 0.2s ease-in;
  }

  &:hover:before,
  &:focus:before,
  &:active:before,
  &:focus:active:before {
    right: 0;
  }
}

/* End Code specific to the button hover animation (horizontal fill of background and inversion of text color) */

.button-link {
  @include button-with-hover-animation($btn-light-txt);

  @extend .button-generic;

  display: inline-block;
  padding: 10px 50px;
}

.button-submit {
  @extend .button-generic;

  padding: 10px 24px;

  &:active {
    box-shadow: none;

    &:focus {
      background-color: $white;
      box-shadow: none;
    }
  }
}

.button-pending {
  @include button-with-hover-animation($white, $orange);

  border-width: $btn-light-border-width;
  border-style: $btn-light-border-style;
  color: $orange3;
}

.btn-draft {
  margin-right: 20px;
}

.button-cancel {
  @extend .button-generic;

  padding: 11px 24px;
}

.button-light {
  @include button-with-hover-animation($btn-light-txt);

  background: $btn-light-bkg;
  border-width: $btn-light-border-width;
  border-style: $btn-light-border-style;
}

.button-dark {
  @include button-with-hover-animation($btn-dark-txt);

  background: $btn-dark-bkg;
  border-width: $btn-dark-border-width;
  border-style: $btn-dark-border-style;
}

.button-disable {
  background: $btn-light-txt;
  color: $grey;
  cursor: not-allowed;

  &:active,
  &:focus,
  &:hover,
  &:visited {
    color: $grey !important;
    border: 1px solid $grey;
  }
}

.button-generic {
  border-radius: $btn-radius;
  font-family: $font-family2;
  font-size: $font-size-xs;
  letter-spacing: $button-letter-spacing;
  text-align: center;
  text-transform: $btn-text-transform;
  text-decoration: none;

  &:active,
  &:hover,
  &:focus,
  &:visited {
    text-decoration: none;
    outline: none;
  }

  &[disabled] {
    box-shadow: unset;
    opacity: inherit;
  }
}

.button-diamond-dark {
  border-left: none;
  transition: none;
  margin-left: 18px;
  display: inline-block;
  height: 40px;

  &:before {
    transition: none;
  }

  .button-diamond-dark-back {
    transition: none;
    position: absolute;
    left: -14px;
    height: 28px;
    width: 28px;
    border-style: $btn-dark-border-style;
    border-width: $btn-dark-border-width;
    transform: rotate(45deg);
    top: 4px;
    border-top: none;
    border-right: none;
  }
}

.button-diamond-dark:hover {
  background-color: initial;

  .button-diamond-dark-back {
    &:before {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      top: 0;
      z-index: -1;
      right: 0;
    }
  }
}

.action-button {
  display: inline-block;
  padding: 6px 0 6px 15px;
  margin-right: 30px;
  cursor: pointer;
  min-width: 145px;
  text-align: left;

  &:hover {
    .action-button-label {
      font-family: $font-family3;
    }

    svg {
      stroke-width: 2.3;
    }

    span {
      &:before {
        font-weight: 700;
      }
    }
  }

  svg {
    vertical-align: middle;
  }

  .action-button-label {
    color: $white;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    text-transform: uppercase;
    font-size: $font-size-xs;
    font-family: $font-family4;
  }
}

.share-button {
  .share-icon-container {
    display: inline-block;
    width: 30px;
    height: 30px;
    vertical-align: middle;
    padding-top: 5px;
  }
}

.like-button {
  background-color: $like-color;
}

.disagree-button {
  background-color: $disagree-color;
}

.info-button {
  background-color: $more-info-color;
}

.back-btn {
  color: $black;

  .icon-button {
    font-size: 20px;
  }
}

.blackIcon {
  g {
    path {
      stroke: $black;
    }
  }
}

.whiteIcon {
  g {
    path {
      stroke: $white;
    }
  }
}

@media screen and (max-width: $screen-xxs-max) {
  .button-submit {
    white-space: pre-wrap;
    display: inline-block;
  }
}

.deletePostIcon {
  .group {
    fill: $black;

    .path {
      stroke: $black;
    }
  }
}

// Icon default style
@import '../../js/app/components/common/icons/deletePostIcon/deletePostIcon.scss';
@import '../../js/app/components/common/icons/editPostIcon/editPostIcon.scss';

// The partial used below is only used as an example for instruction purpose
@import '../../js/app/integration/101/components/button101/button101';
@import '../../js/app/integration/101/components/checkbox101/checkbox101';
