//** Listing | Row

$checkbox-row-width: 32px;

.listing__row {
  box-shadow: $card-box-shadow;
  background: var(--foreground);
  border-radius: $border-radius;
  display: flex;
  flex-wrap: wrap;
  position: relative;
  padding: $spacer*0.625;

  @include media-breakpoint-up(md) {
    flex-wrap: wrap;
    padding: 0;
  }

  &.is-small {
    .listing__row--item-title-excerpt {
      display: none;

      @include media-breakpoint-up(md) {
        display: none;
      }
    }

    &.is-actions {
      .btn-group {
        height: 1.8rem;
        width: auto;
      }

      .btn-group + .btn-group {
        margin: 0 0 0 0.4rem;
      }
    }

    .listing__row--item {
      &.is-details {
        display: flex;
        align-items: center;
      }

      &.is-meta {
        display: flex;
        align-items: center;
      }

      &.is-actions {
        display: flex;
        align-items: center;
      }

      &.is-excerpt {
        display: none;
      }
    }
  }

  &--item {
    min-height: inherit;
    padding: 0;
    margin: 0 0 $spacer*0.25;

    &.is-thumbnail {
      display: none;

      @include media-breakpoint-up(sm) {
        position: relative;
        top: 0.25rem;
        display: block;
        flex: 0 0 20%;
        max-width: 108px;
        max-height: 86px;
        overflow: hidden;
        border-radius: $border-radius 0 0 $border-radius;
        background-color: var(--shade-400);
        background-repeat: no-repeat;
        background-size: cover;
        margin: 2px;
      }

      @include media-breakpoint-up(md) {
        order: 2;
        top: 0;
      }

      & ~ .is-excerpt {
        @include media-breakpoint-up(sm) {
          padding-left: 0.5rem;
        }

        @include media-breakpoint-up(md) {
          padding-left: 0;
        }
      }
    }

    &.is-details {
      flex: 0 0 100%;
      flex-grow: 2;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 3;

      //line-height: 1.3rem;
      max-height: 4.75rem;

      @include media-breakpoint-up(md) {
        order: 1;
        flex: 1 0 290px;
        padding: $spacer*0.4 $spacer $spacer*0.5 $spacer*0.625;
        margin-bottom: 0;
        line-height: 1.5rem;
      }

      a {
        font-weight: bold;
      }

      span {
        color: var(--shade);
      }
    }

    .listing__row--item-title-excerpt {
      display: none;

      @include media-breakpoint-up(md) {
        display: inline;
      }
    }

    &.is-excerpt {
      display: none;

      @include media-breakpoint-up(xs) {
        display: inline;
      }

      @include media-breakpoint-up(sm) {
        flex: 1 1 80%;
        max-height: 70px;
        overflow: hidden;
      }

      @include media-breakpoint-up(md) {
        order: 1;
        flex: 1 1 auto;
      }

      @include media-breakpoint-up(md) {
        padding-left: 0;
        display: none;
      }

      p,
      span {
        @include media-breakpoint-up(sm) {
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
          line-clamp: 2;
          overflow: hidden;
        }
      }
    }

    &.is-meta {
      flex: 1 0 68%;
      display: block;
      flex-wrap: wrap;
      padding-top: 0;
      margin-bottom: 0;

      @include media-breakpoint-up(xs) {
        flex: 1 0 80%;
      }

      @include media-breakpoint-up(sm) {
        flex: 1 0 100%;
        margin-top: 1rem;
      }

      @include media-breakpoint-up(md) {
        flex: 0 0 175px;
        max-width: 175px;
        order: 3;
        padding: $spacer*0.5 0 $spacer*0.3 $spacer*0.5;
        margin: 0 -2rem 0 0;
      }
    }

    &.is-actions {
      flex: 1 0 35%;
      padding-top: 0;
      //flex: 0 0 14%;
      display: flex;
      justify-content: flex-end;
      align-items: flex-end;
      border-radius: 0 $border-radius $border-radius 0;
      margin-bottom: 0;
      //align: right;
      @include media-breakpoint-up(xs) {
        flex: 1 0 20%;
      }

      @include media-breakpoint-up(md) {
        flex: 0 0 110px;
        order: 4;
        padding: $spacer*0.625;
        align-items: flex-start;
      }
    }
  }

  &--list {
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
    letter-spacing: $letter-spacing;
    margin-bottom: 0;

    @include media-breakpoint-up(wd) {
      font-size: 0.875rem;
      line-height: 1.5;
    }

    li {
      margin-bottom: $spacer * 0.25;
      color: var(--shade);
      text-transform: capitalize;
      text-overflow: ellipsis;
      overflow: hidden;

      > :first-child,
      .status,
      .fas {
        margin-right: 0.125rem;
        top: 0.125rem;
        display: inline-block;
        font-size: 0.8125rem;
        width: 0.75rem;
        height: 0.75rem;

        @include media-breakpoint-up(md) {
          margin-right: 0.35rem;
        }
      }

      .status {
        margin-right: 0.3rem;

        @include media-breakpoint-up(md) {
          margin-right: 0.625rem;
        }
      }
    }
  }

  &--move {
    flex: 0 0 15px;
    padding: 0;
    color: var(--secondary);
    border: 0;

    &:focus,
    &:hover {
      outline: none;
      cursor: move;
    }
  }

  .listing--actions {
    font-size: 90%;
    margin: 0;
    padding: 0;
    list-style: none;
    width: 100%;
    text-align: right;

    li {
      margin-bottom: $spacer;

      &:last-child {
        margin-bottom: 0;
      }

      a {
        color: var(--secondary);
      }
    }
  }

  .dropdown-menu {
    padding: 3px 0;
  }

  .dropdown-item {
    padding: 3px 0.75rem;
  }

  .dropdown-item-text {
    padding: 3px 0.75rem;
    color: var(--shade);
  }
}

.edit-actions {
  &__dropdown {
    font-size: 0.9375rem;
  }
}

.card-enter-active,
.card-leave-active {
  transition: all 0.25s;
}

.card-enter,
.card-leave-to {
  opacity: 0;
  transform: translateX(30px);
  transform-origin: right;
}

@import '_container';
@import '_checkbox';
