@use "../../../scss/globals.scss";

.user-library-game {
  &__wrapper {
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    transition: all ease 0.2s;
    cursor: grab;
    container-type: inline-size;

    &:hover {
      transform: scale(1.05);
    }

    &:active {
      cursor: grabbing;
      transform: scale(1.02);
    }

    &[draggable="true"] {
      cursor: grab;

      &:active {
        cursor: grabbing;
        opacity: 0.8;
        transform: scale(1.02) rotate(2deg);
      }
    }
  }

  &__cover {
    cursor: pointer;
    transition: all ease 0.2s;
    box-shadow: 0 8px 10px -2px rgba(0, 0, 0, 0.5);
    width: 100%;
    position: relative;
    overflow: hidden;

    &:before {
      content: "";
      top: 0;
      left: 0;
      width: 100%;
      height: 172%;
      position: absolute;
      background: linear-gradient(
        35deg,
        rgba(0, 0, 0, 0.1) 0%,
        rgba(0, 0, 0, 0.07) 51.5%,
        rgba(255, 255, 255, 0.15) 54%,
        rgba(255, 255, 255, 0.15) 100%
      );
      transition: all ease 0.3s;
      transform: translateY(-36%);
      opacity: 0.5;
    }

    &:hover::before {
      opacity: 1;
      transform: translateY(-20%);
    }
  }

  &__container {
    transition: all ease 0.2s;

    &:hover {
      transform: scale(1.05);
    }
  }

  &__overlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 20%, transparent 100%);
    padding: 8px;
  }

  &__actions-container {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    z-index: 2;
  }

  &__pin-button {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: solid 1px rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all ease 0.2s;

    &:hover {
      background: rgba(0, 0, 0, 0.5);
      border-color: rgba(255, 255, 255, 0.25);
      transform: translateY(-1px);
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
    }
  }

  &__playtime {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.8);
    border: solid 1px rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all ease 0.2s;

    &-long {
      display: inline;
      font-size: 12px;
    }

    &-short {
      display: none;
      font-size: 12px;
    }

    // When the card is narrow (less than 180px), show short format
    @container (max-width: 140px) {
      &-long {
        display: none;
      }

      &-short {
        display: inline;
      }
    }
  }
  &__manual-playtime {
    color: globals.$warning-color;
  }
  &__stats {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  &__stats-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    color: globals.$muted-color;
    overflow: hidden;
    height: 18px;
  }

  &__stats-content {
    display: flex;
    flex-direction: column;
  }

  &__stats-item {
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease-in-out;
    flex-shrink: 0;
    flex-grow: 0;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  &__game-image {
    object-fit: cover;
    border-radius: 4px;
    width: 100%;
    height: 100%;
    display: block;
  }

  &__cover-placeholder {
    position: relative;
    width: 100%;
    padding-bottom: 150%;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0.04) 50%,
      rgba(255, 255, 255, 0.08) 100%
    );
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.3);

    svg {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }

  &__achievements-progress {
    width: 100%;
    height: 4px;
    transition: all ease 0.2s;

    &::-webkit-progress-bar {
      background-color: rgba(255, 255, 255, 0.15);
      border-radius: 4px;
    }

    &::-webkit-progress-value {
      background-color: globals.$muted-color;
      border-radius: 4px;
    }
  }
}
