@import "../../../styles/variables.scss";

:host {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 0 $spacing-md;
  font-size: var(--font-size-button);
  height: 3rem;
  border: none;
  color: var(--text-main, $dark);
  background: transparent;
  border-radius: 3px;
  text-transform: uppercase;
  transition: all 200ms ease-in-out;
  gap: $spacing-md;
  cursor: pointer;
  user-select: none;
  text-overflow: clip;
  white-space: nowrap;
  overflow: hidden;
  flex: 0 0 auto;

  .button-contents {
    height: var(--font-size-button);
    display: inline-flex;
    align-items: center;
    line-height: 1;
    font-size: inherit;
    color: inherit;
    text-transform: uppercase;
  }

  i {
    height: var(--font-size-button);
    font-size: inherit;
    line-height: 1;
  }

  &[size="small"],
  &[size="sm"] {
    font-size: 1rem;
    padding: 0 $spacing-md;
    height: 2.4rem;
    gap: $spacing-sm;
    .button-contents,
    i {
      height: 1rem;
    }
  }

  &[size="large"],
  &[size="lg"] {
    font-size: 1.6rem;
    padding: 0 $spacing-lg;
    height: 3.6rem;
    gap: $spacing-lg;
    .button-contents,
    i {
      height: 1.6rem;
    }
  }

  &:focus {
    outline: none;
  }

  &[disabled],
  &.novo-button-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
  }

  &[disabled="false"] {
    opacity: 1;
    cursor: pointer;
    pointer-events: auto;
  }

  &[loading="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    i.loading {
      display: flex;
      align-items: center;
      justify-content: center;
      animation: rotate 1200ms linear infinite;
      svg {
        width: 100%;
        height: 100%;
        max-width: 15px;
        max-height: 15px;
        .spinner {
          fill: currentColor;
        }
      }
    }
  }
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}
