@use "../base/mixins";
@use "../vars/variables";

.ent-item {
  position: relative;
  display: flex;
  min-height: 13.75rem;
  padding: 1.875rem;
  flex-direction: column;
  align-items: flex-start;
  align-content: space-between;
  gap: 1rem;
  flex-shrink: 0;
  border: 1px solid var(--uc-theme-color-40);
  border-radius: 1rem;
  color: var(--uc-text-text-primary);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;

  & > * {
    z-index: 2;
  }

  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;

    .selected-icon {
      i,
      .vue-load-image {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 3rem;
        height: 3rem;
        font-size: 1.8rem;
      }
    }
  }

  &__options {
    display: flex;
    flex-direction: row;
    gap: 0.625rem;

    @media (pointer: fine) {
      display: none;
    }
  }

  &__title {
    @include mixins.heading-4;

    & {
      margin: 0;
    }
  }

  &__text {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
  }

  &__footer {
    display: flex;
    align-items: flex-end;
    width: 100%;
    justify-content: space-between;
    min-height: 2.5rem;
  }

  &__attributes {
    @include mixins.body-extrasmall;
    display: flex;
    justify-content: flex-start;
    gap: 0.625rem;
  }

  &__attribute {
    display: flex;
    padding: 0.25rem;
    justify-content: center;
    align-items: center;
    height: 2rem;
    min-width: 2rem;
    gap: 0.5rem;
    border-radius: 1.25rem;
    background: var(--uc-bg-bg-surface-2);
    color: var(--uc-text-text-secondary);
    transition: all 0.2s;

    i {
      font-size: 0.875rem;
      color: var(--uc-text-text-secondary);
    }

    &--wide {
      min-width: 2.625rem;
    }

    &--text {
      padding-left: 0.75rem;
      padding-right: 0.75rem;

      &--available-firmware {
        i {
          font-size: 0.75rem;
          color: var(--uc-warning-warning);
        }
      }

      &--version {
        i {
          font-size: 0.75rem;
          color: var(--uc-success-success);
        }
      }
    }

    &--with-text {
      padding-right: 0.75rem;
    }

    &--green {
      i {
        color: var(--uc-success-success);
      }
    }

    &--red {
      i {
        color: var(--uc-error-error-60);
      }
    }

    &--yellow {
      i {
        color: var(--uc-warning-warning);
      }
    }

    &--active {
      background: var(--uc-theme-accent);
      color: var(--uc-black);
    }
  }

  &__background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;

    img {
      width: 100%;
      object-fit: cover;
    }
  }

  @media (pointer: fine) {
    &:hover {
      background: var(--uc-foreground);
      border-color: transparent;
      transition: all 0.2s;

      .ent-item {
        &__header {
          color: var(--uc-background);

          i {
            color: var(--uc-background);
          }
        }

        &__text {
          color: var(--uc-background);
        }

        &__options {
          display: flex;

          .button--secondary {
            background-color: var(--uc-background);
            border-color: var(--uc-background);

            &--inactive,
            &[disabled] {
              background-color: var(--uc-background);
              border-color: var(--uc-background);
            }

            @media (pointer: fine) {
              &:hover {
                background-color: var(
                  --uc-buttons-primary-button-primary-hover-bg
                );
                border-color: var(--uc-buttons-primary-button-primary-hover-bg);
              }
            }

            &:active {
              background-color: var(
                --uc-buttons-primary-button-primary-hover-bg
              );
              border-color: var(--uc-buttons-primary-button-primary-hover-bg);
            }
          }
        }

        &__attribute {
          background-color: var(--uc-background);
          transition: all 0.2s;

          &--active {
            background: var(--uc-theme-accent);
            color: var(--uc-black);
          }
        }
      }
    }
  }

  &--inactive {
    opacity: 0.5;
    border-color: var(--uc-theme-color-30);

    @media (pointer: fine) {
      &:hover {
        opacity: 1;
      }
    }
  }
}

.ent-list {
  display: flex;
  flex: 1;

  &__title {
    @include mixins.heading-4;

    & {
      margin-top: 3.75rem;
      color: var(--uc-white);
    }
  }

  &__description {
    @include mixins.body-large;
    color: var(--uc-theme-color-50);
    margin-top: 0.625rem;
    margin-bottom: 1.25rem;
    width: 100%;
    max-width: 50%;

    @media screen and (max-width: variables.$bp-tablet) {
      max-width: 100%;
    }
  }

  &__body-wrapper {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    @include mixins.scrollbar;
  }

  &__body {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    margin-bottom: 1.25rem;
    gap: 1.25rem;

    @media screen and (max-width: 1600px) {
      grid-template-columns: repeat(4, 1fr);
    }

    @media screen and (max-width: 1300px) {
      grid-template-columns: repeat(3, 1fr);
    }

    @media screen and (max-width: variables.$bp-tablet) {
      grid-template-columns: repeat(2, 1fr);
    }

    @media screen and (max-width: variables.$bp-phone) {
      grid-template-columns: repeat(1, 1fr);
    }
  }

  &__no-items {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    max-width: 22.5rem;
    margin: auto;
    gap: 1.875rem;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);

    h3 {
      @include mixins.heading-4;

      & {
        color: var(--uc-text-text-primary);
      }
    }

    p {
      @include mixins.body-large;

      & {
        color: var(--uc-text-text-secondary);
      }
    }
  }
}
