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

.game-item {
  background-color: globals.$dark-background-color;
  width: 100%;
  color: #fff;
  overflow: hidden;
  position: relative;
  border-radius: 4px;
  border: 1px solid globals.$border-color;
  min-height: 103px;

  &:hover .game-item__content-link {
    background-color: rgba(255, 255, 255, 0.05);
  }

  &:hover,
  &:focus-within {
    .game-item__plus-wrapper {
      opacity: 1;
    }
  }

  &__content-link {
    display: flex;
    align-items: center;
    gap: calc(globals.$spacing-unit * 2);
    width: 100%;
    color: inherit;
    transition: background-color 0.2s ease;
    text-decoration: none;

    &:hover,
    &:focus-visible {
      color: inherit;
      text-decoration: none;
    }

    &:focus-visible {
      outline: 2px solid var(--color-primary);
      outline-offset: -2px;
    }
  }

  &__plus-wrapper {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    cursor: pointer;
    z-index: 1;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    padding: 2px;

    &:focus-visible {
      opacity: 1;
      outline: 2px solid var(--color-primary);
      outline-offset: 1px;
    }

    &:disabled {
      opacity: 0.5;
      cursor: default;
    }
  }

  &__plus-wrapper--added {
    opacity: 0.5;
  }

  &__cover {
    width: 200px;
    height: 100%;
    object-fit: cover;
  }

  &__cover-wrapper {
    position: relative;
    width: 200px;
    min-width: 200px;
    height: 103px;
    overflow: hidden;
    border-right: 1px solid globals.$border-color;
  }

  &__cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: globals.$body-color;
    width: 200px;
    height: 103px;
    background: linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.05) 50%,
      rgba(255, 255, 255, 0.1) 100%
    );
  }

  &__compatibility-badge-group {
    position: absolute;
    right: 8px;
    bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: calc(100% - 52px);
    pointer-events: none;
    justify-content: flex-end;
  }

  &__compatibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #0a0a0a;
    background: rgb(180, 199, 220);
    border: 1px solid rgba(0, 0, 0, 0.25);
    line-height: 1.25;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.28);

    &--platinum {
      background: rgb(180, 199, 220);
    }

    &--gold {
      background: rgb(207, 181, 59);
    }

    &--silver {
      background: rgb(166, 166, 166);
    }

    &--bronze {
      background: rgb(205, 127, 50);
      color: #fff;
    }

    &--borked {
      background: #d72626;
      color: #fff;
    }
  }

  &__compatibility-logo {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    display: block;
    opacity: 0.95;
  }

  &__details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: calc(globals.$spacing-unit * 2) 0;
  }

  &__genres {
    color: globals.$body-color;
    font-size: 12px;
    text-align: left;
    margin-bottom: 4px;
  }

  &__repackers {
    display: flex;
    gap: globals.$spacing-unit;
    flex-wrap: wrap;
  }
}
