@import "svg-fill";

@mixin bp-btn--custom ($primary-color, $secondary-color) {
  @include bp-btn--regular ($primary-color, $secondary-color);
  @include bp-btn--bordered ($secondary-color, $secondary-color);
  @include bp-btn--regular-arrow($secondary-color);
  @include bp-btn--bordered-arrow($secondary-color);
  @include bp-btn--text-only($secondary-color);
}

@mixin bp-btn--arrow () {
  &.bp-btn--arrow {
    overflow: visible;
    position: relative;
    &:after {
      content: ' ';
      width: 30px;
      height: 30px;
      position: absolute;
      right: -14px;
      top: 6px;
      transform: rotate(45deg);
      border-radius: 3px;
    }

    &:disabled {
      &:after {
        cursor: default;
      }
    }
  }
}

@mixin bp-btn--regular($color, $bg-color) {
  color: $color;
  background-color: $bg-color;

  &:hover {
    background-color: bp-darken($bg-color);
  }

  &:disabled {
    background-color: $bp-btn-bg-color;
    color: $bp-btn-color;
    border-width: 0;
  }
}

@mixin bp-btn--icon() {
  &.bp-btn--icon {
    min-width: 0;
    height: auto;
    line-height: 0;
    padding: 0;
    background-color: transparent;

    &:hover,
    &:disabled {
      background-color: transparent;
    }

    &:disabled {
      @include all-fill-opacity(0.5);
    }
  }
}

@mixin bp-btn--text-only($color) {
  &.bp-btn--text-only {
    min-width: 0;
    height: auto;
    line-height: $bp-btn-text-only-line-height;
    padding: $bp-btn-text-only-padding;
    color: $color;
    background-color: transparent;

    &:hover {
      background-color: transparent;
      color: bp-darken($color);
    }

    &:disabled {
      background-color: transparent;
      color: $bp-btn-bg-color;
    }
  }
}

@mixin bp-btn--bordered($color, $border-color) {
  &.bp-btn--flat {
    border-style: $bp-btn-flat-border-style;
  }

  &.bp-btn--dashed {
    border-style: $bp-btn-dashed-border-style;
  }

  &.bp-btn--flat,
  &.bp-btn--dashed {
    color: $color;
    background-color: transparent;
    border-width: $bp-btn-border-width;
    border-color: $border-color;

    &:hover {
      background-color: transparent;
      border-color: bp-darken($border-color);
      color: bp-darken($color);

      path {
        fill: $bp-color-blip-dark;
      }
    }

    &:disabled {
      background-color: transparent;
      color: $bp-btn-bg-color;
      border-width: $bp-btn-border-width;
      border-color: $bp-btn-bg-color;
    }
  }
}

@mixin bp-btn--regular-arrow($color) {
  &.bp-btn--arrow {
    &:after {
      background-color: $color;
    }

    &:hover {
      &:after {
        border-color: bp-darken($color);
        background-color: bp-darken($color);
      }
    }

    &:disabled {
      &:after {
        background-color: $bp-btn-bg-color;
        color: $bp-btn-color;
        border-width: 0;
      }
    }
  }
}

@mixin bp-btn--bordered-arrow($color) {
  &.bp-btn--arrow {
    &.bp-btn--flat {
      &:after {
        width: 28px;
        height: 28px;
        border-style: $bp-btn-flat-border-style;
      }
    }

    &.bp-btn--dashed {
      &:after {
        width: 27px;
        height: 27px;
        border-style: $bp-btn-dashed-border-style;
      }
    }

    &.bp-btn--flat,
    &.bp-btn--dashed {
      border-right: none;
      &:after {
        right: -14px;
        top: 4px;
        border-radius: 3px;
        border-width: $bp-btn-border-width $bp-btn-border-width 0 0;
        border-color: $color;
        background-color: transparent;
      }

      &:hover {
        &:after {
          background-color: transparent;
          border-color: bp-darken($color);
        }
      }

      &:disabled {
        border-right: none;
        &:after {
          background-color: transparent;
          color: $bp-btn-bg-color;
          border-width: $bp-btn-border-width $bp-btn-border-width 0 0;
          border-color: $bp-btn-bg-color;
        }
      }
    }
  }
}

@mixin bp-btn--c($color) {
  color: $color;

  &:disabled {
    color: $bp-btn-color;
  }

  &.bp-btn--flat,
  &.bp-btn--text-only {
    color: $color;
    &:hover {
      color: bp-darken($color);
    }

    &:disabled {
      color: $bp-btn-bg-color;
      &:hover {
        color: $bp-btn-bg-color;
      }
    }
  }
}

@mixin bp-btn--bg($bg-color) {
  background-color: $bg-color;

  &:hover {
    background-color: bp-darken($bg-color);
  }

  &:disabled {
    background-color: $bp-btn-bg-color;
    &:hover {
      background-color: $bp-btn-bg-color;
    }
  }

  @include bp-btn--regular-arrow($bg-color);
}
