.obs-btn-primary {
  border: 2px solid var(--green-500);
  background-color: var(--green-500);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 14px;
  font-weight: 700;
  line-height: 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
  cursor: pointer;

  &:hover,
  &:focus {
    color: #fff;
    box-shadow: 0 0 0 3px var(--green-200);
  }

  &:active,
  &:focus-within {
    box-shadow: none;
    background-color: var(--green-600);
  }

  &.disabled {
    opacity: 0.5;
    pointer-events: none;
  }

  &.loading {
    color: var(--green-500);
    pointer-events: none;

    &::before,
    &::after {
      content: " ";
      position: absolute;
      display: block;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      border-radius: 50%;
    }

    &::before {
      width: 12px;
      height: 12px;
      background-color: var(--green-500);
      z-index: 2;
    }

    &::after {
      width: 16px;
      height: 16px;
      background-image: conic-gradient(from 180deg at 50% 50%, #fff 0deg, rgba(255, 255, 255, 0) 360deg);
      animation: spin 0.5s linear infinite;
    }
  }
}

.obs-btn-primary-outline {
  @extend .obs-btn-primary;

  background-color: transparent;
  color: var(--green-500);
  padding-right: 23px;
  padding-left: 23px;

  &:hover,
  &:focus {
    color: var(--green-500);
  }

  &:active,
  &:focus-within {
    box-shadow: none;
    background-color: var(--green-100);
  }

  &.loading {
    color: transparent;

    &::before {
      background-color: transparent;
    }

    &::after {
      background: url("../img/loading-bg-green.png") center/contain no-repeat;
    }
  }
}

.obs-btn-secondary-outline {
  @extend .obs-btn-primary-outline;

  color: var(--gray-400);
  border-color: var(--gray-400);

  &:hover,
  &:focus {
    color: var(--gray-400);
    box-shadow: 0 0 0 3px var(--gray-200);
  }

  &:active,
  &:focus-within {
    box-shadow: none;
    background-color: var(--gray-100);
  }

  &.loading::after {
    background-image: url("../img/loading-bg-gray.png");
  }
}

.obs-btn-danger {
  @extend .obs-btn-primary;

  border: 1.5px solid var(--red-500);
  background-color: var(--red-500);

  &:hover,
  &:focus {
    box-shadow: 0 0 0 3px var(--red-200);
  }

  &:active,
  &:focus-within {
    box-shadow: none;
    background-color: var(--red-600);
  }

  &.loading {
    color: var(--red-500);

    &::before {
      background-color: var(--red-500);
    }
  }
}

.obs-btn-add-bucket {
  @extend .obs-btn-primary-outline;

  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;

  .icon {
    width: 16px;
    height: 16px;
    margin-inline-end: 8px;
    color: var(--green-500);
  }

  &.loading .icon {
    display: none;
  }
}

@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotateZ(0);
  }

  to {
    transform: translate(-50%, -50%) rotateZ(-360deg);
  }
}