$btn-border-radius: $border-radius-lg;
$btn-padding-x: $base-gap * 6;
$btn-padding-y: calc($base-gap * 2 - 1px);

.btn,
.pi-form-button button {
  text-decoration: underline;
  text-decoration-color: transparent;
  transition-duration: 0.15s;
  transition-timing-function: ease-in-out;
  display: inline-flex;
  align-items: center;
  border-width: $bsr-border-width-m;

  &[class*="btn-outline-"]:not([class*="btn-outline-light"]) {
    --bs-btn-bg: #{$bsr-white-100};

    &:hover:not([aria-disabled="true"]) {
      border-color: $bsr-white-100;
    }
  }
  &.btn-outline-light:hover {
    background-color: $bsr-white-100;
    color: $text-secondary;
    border-color: $bsr-white-100;
  }
  &.btn-outline-light:focus-visible {
    color: $bsr-white-100;
  }

  &:hover {
    text-decoration-color: currentColor;

    &:not([class*="btn-outline-"]):not([class*="teaserBtnAtom"]):not(
        [class*="editingBtnAtom"]
      ):not([class*="iconOnlyBtnAtom"]) {
      background-color: $bsr-white-100;
      color: $bsr-brick-100;
      border-color: var(--bs-btn-bg);

      &[class*="btn-light"] {
        background-color: $bsr-brick-100;
        color: $bsr-white-100;
      }

      &[aria-disabled="true"]:not([class*="btn-outline-light"]) {
        background-color: $bsr-black-90;
        color: $bsr-white-100;
        border-color: $bsr-black-90;
      }
    }
  }

  &:active {
    text-decoration: none;
  }

  &[aria-disabled="true"],
  .disabled,
  &:disabled {
    text-decoration: none;

    @each $color, $value in $theme-colors {
      @if $color == "light" {
        &.btn-light {
          background-color: $value;
          border-color: currentColor;
          color: $bsr-brick-100;
          opacity: 0.4;
          cursor: not-allowed;
        }

        &.btn-outline-light {
          background-color: transparent;
          border-color: $value;
          color: $value;
          opacity: 0.4;
          cursor: not-allowed;
        }
      } @else {
        /*
                &.btn-#{$color} {
                    background-color: shade-color($value, 100%) !important;
                    border-color: shade-color($value, 100%);
                    color: $bsr-black-90;
                    opacity: .4;
                    cursor: not-allowed;
                }

                &.btn-outline-#{$color} {
                    background-color: transparent;
                    border-color: shade-color($value, 100%);
                    color: shade-color($value, 100%);
                    opacity: .4;
                    cursor: not-allowed;
                }
                */
      }
    }
  }
}

.btn.btn-light {
  --bs-btn-color: #{$bsr-brick-100};
  &:hover {
    &[aria-disabled="true"] {
      background-color: $bsr-white-100 !important;
      color: $bsr-brick-100 !important;
      border-color: $bsr-brick-100 !important;
    }
  }
  &:focus {
    background-color: $bsr-white-100 !important;
    color: $bsr-black-90 !important;
    box-shadow: 0 0 0 0.25rem rgba($bsr-white-100, 0.5) !important;
  }
}

.btn.btn-outline-light {
  --bs-btn-hover-color: #{$bsr-brick-100} !important;
  background: $bsr-brick-100;

  &.btn:active {
    --bs-btn-active-color: #{$bsr-brick-100};
  }
}

.btn[class*="editingBtnAtom"] {
  font-size: $editingBtn-font-size;
  line-height: $editingBtnAtom-line-height;
  letter-spacing: $letter-spacing-xs;
  font-weight: $fontweight-bold;
  &[aria-disabled="true"] {
    opacity: 0.4;
  }
}

.btn[class*="iconOnlyBtnAtom"]:not([class*="btn-outline-brick"]) {
  padding: 0;
  background-color: $secondary !important;
  color: $light !important;
  border-color: $secondary !important;
  text-decoration: none;

  &:hover,
  &:focus,
  &:active {
    background-color: $white !important;
    color: $text-secondary !important;
    border-color: $secondary !important;
    text-decoration: underline;
    border-width: $bsr-border-width-m !important;
  }

  &:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
}

button[type="button"].btn.btn-primary, button[type="button"].btn.btn-secondary {
    padding: $base-gap * 1.5 $base-gap * 6;
    border-radius: $btn-border-radius;
    background: none;
    font-size: $fontsize-base;
    line-height: $lineheight-base;
    background-image: none !important;

    &:hover,
    &:focus-visible {
        text-decoration-color: currentColor;
    }
    
    &:focus,
    &:focus-visible {
        outline: none;
    }
}

button[type="button"].btn.btn-primary {
    background-color: $bsr-brick-100;
    color: $bsr-white-100;
    border: $bsr-border-width-m solid $bsr-brick-100;

    &:hover,
    &:focus-visible {
        background-color: $bsr-white-100;
        color: $bsr-brick-100;
    }
}

button[type="button"].btn.btn-secondary {
    background-color: $bsr-white-100;
    color: $bsr-brick-100;
    border: $bsr-border-width-m solid $bsr-brick-100;
    
    &:hover,
    &:focus-visible {
        background-color: $bsr-brick-100 !important;
        color:  $bsr-white-100 !important;

        & i {
            color: $bsr-white-100 !important;
        }
    }
}
