@import "@/scss/mixins.scss";

.ui-button-icon {
  > a,
  > button,
  > span {
    @apply flex justify-center items-center size-8;

    color: #ffdada;
    font-size: 20px;
    font-weight: 800;
    background-color: transparent;
    border-radius: 6px;
    transition: 0.3s ease-in-out;

    &:disabled {
      color: #ffb3b347;
    }

    > img,
    > svg {
      @apply size-5;

      object-fit: contain;
      object-position: center;
      fill: currentColor;
      transition: ease-in-out 0.2s;
    }

    .ui-button-icon-marker-dot {
      position: absolute;
      top: -3px;
      right: -3px;
      background-color: #ff8080;
      border: 2px solid #937979;
      width: 12px;
      height: 12px;
      border-radius: 50%;
      border-bottom-left-radius: 2px;
      transform-origin: top right;
      animation: 0.3s buttonIconMarker forwards ease-in;

      &::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background-color: black;
        height: 2px;
        width: 2px;
        border-radius: 50%;
      }
    }

    .ui-button-icon-marker {
      text-align: center;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      padding: 0 4px;
      background-color: #ff8080;
      color: #170505;
      font-size: 10px;
      min-width: 15px;
      height: 15px;
      line-height: 15px;
      border-radius: 10px;
      border-bottom-left-radius: 2px;
      position: absolute;
      top: -4px;
      right: -4px;
      font-weight: 500;
      letter-spacing: 0.08em;
      box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0.18) 0px 1px 2px 0px;
      transform-origin: top right;
      animation: 0.3s buttonIconMarker forwards ease-in;

      svg {
        fill: currentColor;
      }

      &.ui-button-icon-marker--small {
        padding: 0 2px;
        font-size: 8px;
        min-width: 14px;
        height: 14px;
        line-height: 14px;
      }
    }

    .ui-button-icon-marker--on-soft {
      top: -5px;
      right: -5px;
      border-left: 2px solid #937979;
      border-bottom: 2px solid #937979;
      box-shadow: none;
      min-width: 20px;
      height: 20px;
      border-radius: 9px;
      border-bottom-left-radius: 1px;
      font-weight: 700;
      transition: ease-in-out 0.2s;
    }
  }

  > a,
  > button {
    @include hoverOnDesktopActiveOnMobile {
      color: #fff;
      background: #c6a0a08a;

      .ui-button-icon-marker--on-soft {
        background: white;
      }
    }

    &:active {
      color: #fff;
      background: #d0aeaed6;
    }
  }

  &:hover {
    z-index: 2;
  }

  &.ui-button-icon--small {
    > a,
    > button {
      @apply size-6;

      > img,
      > svg {
        @apply size-4;
      }
    }

    &:hover {
      .ui-button-icon-label--right {
        left: calc(100% + 10px) !important;
      }
  
      .ui-button-icon-label--left {
        right: calc(100% + 10px);
      }
    }
  }

  &.ui-button-icon--large {
    > a,
    > button,
    > span {
      @apply size-12;

      > img,
      > svg {
        @apply size-8;
      }
    } 
  }
}

.ui-button-icon--active {
  > a,
  > button,
  > span {
    color: #fff;
    background: #c6a0a08a;
  }
}

@keyframes buttonIconMarker {
  0% {
    opacity: 0;
    transform: scale(0) translate(20px, -20px);
  }

  30% {
    opacity: 0.1;
  }

  70% {
    transform: scale(1.3) translate(0, 0);
  }

  100% {
    opacity: 1;
    transform: scale(1) translate(0, 0);
  }
}