@import '../settings/base';

$counter_css_prefix: #{$css_prefix}_c_counter;

@mixin counter_btn($type) {
  flex: none;
  position: relative;
  width: 32px;
  height: 32px;
  background-color: $color_gray_k8;
  border: 1px solid $color_gray_k5;
  cursor: pointer;

  &:hover, &:active {
    background-color: $color_gray_k7;
  }
  @if $type == plus {
    &::before {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: 2px;
      height: 10px;
      background-color: $color_gray_k2;
      transform: translate(-50%, -50%);
    }
  }

  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 2px;
    background-color: $color_gray_k2;
    transform: translate(-50%, -50%);
  }

  &--is_disabled {
    border-color: $color_gray_k6;

    &:hover, &:active {
      background-color: $color_gray_k8;
    }

    &::before {
      background-color: $color_gray_k6;
    }

    &::after {
      background-color: $color_gray_k6;
    }
  }

}

.#{$counter_css_prefix} {
  display: flex;
  align-items: center;

  &__minus {
    @include counter_btn(minus);

    border-top-left-radius: 2px;
    border-bottom-left-radius: 2px;
  }

  &__count {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 32px;
    color: #424242;
    background-color: $color_gray_k9;
    border-top: solid 1px $color_gray_k5;
    border-bottom: solid 1px $color_gray_k5;

    &--is_disabled {
      color: $color_gray_k4;
      background-color: $color_gray_k8;
      border-top-color: $color_gray_k6;
      border-bottom-color: $color_gray_k6;
    }
  }

  &__plus {
    @include counter_btn(plus);

    border-top-right-radius: 2px;
    border-bottom-right-radius: 2px;
  }


  &--small {
    .#{$counter_css_prefix}__minus {
      width: 24px;
      height: 24px;
    }

    .#{$counter_css_prefix}__count {
      width: 36px;
      height: 24px;
    }

    .#{$counter_css_prefix}__plus {
      width: 24px;
      height: 24px;
    }
  }

}
