@use "sass:color";

.user-reactions {
  position: relative;

  .button {
    cursor: pointer;
  }

  .reactions {
    position: absolute;
    left: -1.25rem;
    bottom: 1rem;
    display: flex;
    gap: 0.1rem;
    width: max-content;
    max-width: 50vw;
    justify-content: space-around;
    flex-wrap: wrap;
    padding: 0.5rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 2rem;
    background-color: var(--bs-body-bg);
    transition: all $transition-speed;
    visibility: hidden;
    opacity: 0;

    .reaction {
      position: relative;
      width: 3rem;
      height: 3rem;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      transition: all $transition-speed;
      border-radius: 100%;
      background-color: transparent;
      cursor: pointer;

      .emoji {
        font-size: 2rem;
        line-height: 1;
        transition: all $transition-speed;
      }

      .counter {
        position: absolute;
        transition: all $transition-speed;
        top: -0.5em;
        right: -0.5em;
        font-size: 0.5em;
        width: 1.5rem;
        height: 1.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background-color: var(--bs-secondary-bg);
        border: 1px solid var(--bs-border-color);
      }

      &:hover {
        cursor: pointer;
        background-color: var(--bs-secondary-bg);

        .emoji {
          transform: scale(1.25);
        }

        .counter {
          top: -0.75rem;
          right: -0.75em;
          width: 1.75rem;
          height: 1.75rem;
          transform: scale(1.2);
        }
      }

      &.selected {
        background-color: var(--bs-warning-bg-subtle);

        .counter {
          border-color: var(--bs-warning);
          background-color: var(--bs-warning-border-subtle);
        }
      }
    }
  }

  &.visible {
    .reactions {
      visibility: visible;
      opacity: 1;
    }
  }

  &.small {
    .reactions {
      .reaction {
        width: 2rem;
        height: 2rem;

        .emoji {
          font-size: 1.5rem;
        }

        .counter {
          top: -0.75em;
          right: -0.75em;
          width: 1.25rem;
          height: 1.25rem;
        }
      }
    }
  }

  @include media-breakpoint-down(md) {
    .reactions {
      max-width: 75vw;
      left: -0.5rem;
    }
  }
}