@use '../abstracts/variables';
@use '../abstracts/mixins';
@use "sass:list";
@use "sass:map";
@use "sass:math";

.button {
  @include mixins.input-transition;

  &.miter {
    @include mixins.miter;
  }

  font-family: variables.$font--secondary;
  padding: 0;
  background: none;
  border: none;

  > :first-child {
    align-items: center;
    border: none;
    border-radius: 4px;
    display: flex;
    font-size: 14px;
    justify-content: center;
    padding: 9px 24px;
    user-select: none;
    background-clip: padding-box;
    -webkit-background-clip: padding-box;
  }

  @include mixins.input-transition;

  border: none;
  border-radius: 4px;
  background: none;
  padding: 0;

  &:focus-visible {
    outline: none;
  }

  &.icon {
    [data-test='default'] {
      display: inline-flex;
      align-items: center;

      i {
        margin-right: 10px;
      }
    }
  }

  &.icon-button {
    color: variables.$grey-80;

    > :first-child {
      padding: 4px;
      background: transparent;
      border: 1px solid variables.$inactive;
      font-size: 16px;
      height: 24px;
      width: 24px;
    }

    &.hovered > :first-child {
      background: variables.$secondary-hover;
      border-color: variables.$secondary-pressed;
    }

    &.active > :first-child {
      background: variables.$secondary-pressed;
      border-color: variables.$secondary-pressed;
    }
  }

  &.primary {
    color: variables.$text--white;

    > :first-child {
      background-color: variables.$primary;
      border: 1px solid variables.$primary;
    }

    &.hovered > :first-child {
      background-color: variables.$primary-hover;
      border: 1px solid variables.$primary-hover;
    }

    &.active > :first-child {
      background-color: variables.$primary-pressed;
      border: 1px solid variables.$primary-pressed;
    }
  }

  &.delete{
    color: variables.$text--white;

    > :first-child {
      background-color: variables.$delete;
      border: 1px solid variables.$delete;
    }

    &.hovered > :first-child {
      background-color: variables.$delete-hover;
      border: 1px solid variables.$delete-hover;
    }

    &.active > :first-child {
      background-color: variables.$delete-pressed;
      border: 1px solid variables.$delete-pressed;
    }
  }

  &.secondary {
    color: variables.$primary;

    > :first-child {
      background-color: variables.$white;
      border: 1px solid variables.$inactive;
    }

    &.light {
      color: variables.$grey-80;

      > :first-child {
        border: 1px solid variables.$blue-20;
      }
    }

    &.hovered > :first-child {
      border: 1px solid variables.$primary;
    }

    &.active {
      color: variables.$text--white;
      > :first-child {
        background-color: variables.$primary;
      }
    }
  }

  &.alternate {
    color: variables.$grey-80;

    > :first-child {
      background-color: variables.$grey-10;
      border: 1px solid variables.$inactive;
    }

    &.hovered > :first-child {
      border: 1px solid variables.$grey-80;
    }

    &.active > :first-child {
      background-color: variables.$grey-20;
    }
  }

  &.disabled {
    cursor: not-allowed;

    > :first-child {
      border: 1px solid variables.$secondary-background;
      background-color: variables.$secondary-background !important;
      color: variables.$grey-20 !important;
    }
  }

  &.rounded {
    :first-child {
      border-radius: 50%;
    }
  }

  &.flat {
    color: variables.$grey-80;

    > :first-child {
      background-color: initial;
      border: 1px solid transparent;
    }
  }
}
