@use '@vizality' as vz;

/**
 * Card (default) view
 */
.vz-addon-card {
  $base: &;
  box-sizing: border-box;
  display: flex;
  flex-flow: column;
  min-width: 340px;
  cursor: pointer;
  transition: box-shadow .2s ease-out, background .2s ease-out;
  flex: 1;
  background: var(--background-secondary-alt);
  border-radius: 8px;
  overflow: hidden;
  /**
   * This is to ensure our click events are being handled properly and not getting eaten
   * by svg children (paths).
   */
  svg * {
    pointer-events: none;
  }
  /**
   * Hack to fix trailing items in the flexbox not sizing correctly with the rest of the items.
   */
  &.vz-addon-card-filler {
    border: none !important;
    height: 0;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background-color: transparent;
    visibility: hidden;
  }
  &:hover {
    background-color: var(--background-tertiary);
    box-shadow: var(--elevation-high);
  }
  &-details {
    display: flex;
    font-size: 14px;
    overflow: hidden;
    margin: 0 !important;
  }
  &-detail {
    &-wrapper {
      overflow: hidden;
      display: block !important;
      & + & {
        margin-left: 12px;
      }
    }
    &-value {
      overflow: hidden;
      text-overflow: ellipsis;
    }
    &-value-wrapper {
      display: flex;
      align-items: center;
    }
    &-value-icon-wrapper {
      margin-right: 5px;
    }
  }
  &-header-wrapper {
    flex: 1;
    flex-wrap: wrap;
    display: flex;
  }
  &-content-wrapper {
    @include vz.size(100%, auto);
    display: flex;
    overflow: hidden;
    box-sizing: border-box;
  }
  &-content {
    display: flex;
    flex-flow: column wrap;
    flex: 1;
    overflow: hidden;
  }
  &-metadata {
    overflow: hidden;
    display: flex;
    flex-flow: column;
    flex: 1 1 auto;
    margin-right: 20px;
    justify-content: center;
  }
  &-header {
    display: flex;
    width: 100%;
    padding: 16px;
    box-sizing: border-box;
  }
  &-icon {
    @include vz.size(50px);
    overflow: hidden;
    margin-right: 12px;
    flex: 0 0 auto;
    position: relative;
    &-image-wrapper {
      @include vz.size(100%);
      border-radius: 8px;
      background: var(--background-primary);
      cursor: unset;
    }
    &-img {
      @include vz.size(100%);
    }
  }
  &-name-version {
    display: flex;
    align-items: flex-end;
    overflow: hidden;
  }
  &-name {
    @include vz.ellipsis(100%, inline-block);
    font-size: 18px;
    margin-right: 7px;
    font-weight: 500;
    line-height: 1;
    color: var(--header-primary);
    > div {
      overflow: hidden;
      text-overflow: ellipsis;
    }
  }
  &-author {
    @include vz.ellipsis(100%);
    width: fit-content;
    font-size: 14px;
    margin-top: 2px;
    color: var(--interactive-normal);
    line-height: 1.5;
    text-decoration: none !important;
    pointer-events: none;
    &:hover {
      color: var(--header-primary);
      text-decoration: underline !important;
    }
    & + & {
      &::before {
        content: ', ';
        color: var(--interactive-normal);
      }
    }
    &[vz-user-id] {
      pointer-events: all;
    }
  }
  &-version {
    font-size: 14px;
    color: var(--interactive-normal);
    margin-bottom: 1px;
    margin-right: 7px;
  }
  &-toggle-wrapper {
    display: flex;
    flex: 0 0 auto;
  }
  &-show-previews-button {
    display: flex;
    &-icon * {
      pointer-events: none;
    }
  }
  &-description {
    @include vz.max-lines(2);
    width: 100%;
    line-height: 1.4;
    flex: 1;
    box-sizing: border-box;
    padding: 0 16px;
  }
  // &-tags {
  //   display: flex;
  //   height: 100%;
  // }
  // &-tag {
  //   border-radius: 1000px;
  //   background: var(--background-primary);
  //   padding: 0 10px;
  //   font-size: 10px;
  //   text-transform: uppercase;
  //   font-weight: 500;
  //   min-width: 30px;
  //   text-align: center;
  //   height: 100%;
  //   display: flex;
  //   align-items: center;
  //   justify-content: center;
  //   position: relative;
  //   & + #{$base}-tag {
  //     margin-left: 10px
  //   }
  // }
  &-footer-wrapper {
    margin: 16px 0 0 16px;
    padding: 0 0 16px;
    border-top: 1px solid var(--background-modifier-accent);
    box-sizing: border-box;
    max-width: calc(100% - 32px);
  }
  &-footer {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    flex: 0;
    width: 100%;
    overflow: hidden;
    &-rating-wrapper,
    &-downloads-wrapper,
    &-last-updated-wrapper {
      display: flex;
      align-items: center;
      font-size: 12px;
      font-weight: 500;
      > div {
        display: flex;
        align-items: center;
      }
      .vz-icon-wrapper {
        margin-right: 3px;
      }
    }
    &-rating-wrapper,
    &-downloads-wrapper {
      margin-right: 15px;
    }
    &-section-left,
    &-section-right {
      display: flex;
      align-items: center;
      > div {
        > div {
          display: flex;
        }
      }
    }
    &-section-right {
      > div {
        margin-left: 12px;
        cursor: pointer;
      }
    }
    &-section-left {
      overflow: hidden;
      > div {
        margin-right: 20px;
      }
    }
  }
  &-placeholder {
    border-radius: 8px;
    background: var(--text-muted);
    opacity: .2;
    animation: placeholderPulse-2NB6YJ 3s ease-in-out infinite;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
}
