//-----------------------------
// List
//-----------------------------

@use "../../config" as *;
@use "../../spacing" as *;
@use "../../theme" as *;
@use "../../type" as *;
@use "../../breakpoint" as *;
@use "../../utilities/convert" as *;

/// List styles
/// @access public
/// @group item
@mixin item {
  .#{$prefix}--item {
    padding: $spacing-06;
    margin: 0;
    text-decoration: none;
    display: grid;
    //grid-template-columns: max-content 2fr auto min-content;
    grid-template-columns: max-content 2fr minmax(0, min-content) min-content;
    grid-template-rows: min-content min-content min-content;
    gap: 0px 0px;
    grid-template-areas:
      "photo title additional unread"
      "photo text hint unread"
      "photo subcontent hint unread";
    color: $text-body-default;

    &--section {
      padding: $spacing-08 0;
      text-align: left;
      flex-direction: row;
      justify-content: space-between;
      h2 {
        @include type-style("heading-02");
      }
      p {
        opacity: 0.6;
        @include type-style("caption-01");
      }
    }
    &--large {
      min-height: 17rem;
      padding: 2rem 0;
      height: 100%;
      width: 100%;
      .#{$prefix}--item__text-wrapper {
        flex-direction: column;
      }
      .#{$prefix}--item__image {
        width: 9em;
        margin-bottom: 1em;
      }
      .#{$prefix}--item__title-wrapper {
        justify-content: center;
      }
    }

    &--sidebar {
      cursor: pointer;
      border-bottom: 1px solid $border-subtle;
      &.#{$prefix}--item--active {
        background: $layer-primary;
      }
    }
    &--sidebar {
      cursor: pointer;
      border-bottom: 1px solid $border-subtle;
      &.#{$prefix}--item--active {
        background: $layer-primary;
      }
    }
    &--repeater {
      cursor: pointer;
      background: $layer-primary;
      margin-bottom: 0.3em;
      &.#{$prefix}--item--active {
        background: $layer-active;
      }
    }
    &--button {
      padding: 1em;
      &:hover {
        background: $layer-primary;
      }
    }
    &--horizontal {
      padding: 1em;
      width: 100%;
      flex-direction: row;

      text-align: left;

      > div {
        margin-top: 0rem;
      }

      .#{$prefix}--item__title-wrapper {
        justify-content: space-between;
      }
      .#{$prefix}--item__image {
        max-width: 5rem;
        margin-right: 0.8em;
      }

      p {
        color: $text-placeholder;
      }
      .#{$prefix}--item__button {
        .wfp--btn {
          margin: $spacing-02;
        }
      }
    }
    .#{$prefix}--item__content {
      flex: 1;
    }
    .#{$prefix}--item__title-wrapper {
      margin-bottom: 0;
      font-size: 1em;
      line-break: anywhere;
      display: flex;
      grid-area: title;
      //justify-content: center;

      align-items: center;
    }
    .#{$prefix}--item__additional {
      font-size: 0.9em;
      color: $text-body-secondary;
      margin-left: 1em;
      grid-area: additional;
      text-align: right;
    }
    .#{$prefix}--item__additional-icon {
      font-weight: normal;
      height: 0.9em;
      width: auto;
      margin-left: 0.3em;
      position: relative;
      top: 0.3em;
      path {
        fill: $text-body-secondary;
      }
    }
    .#{$prefix}--item__title {
      font-size: 1em;
    }
    .#{$prefix}--item__hint {
      font-size: 1em;
      grid-area: hint;
      justify-self: flex-end;
      align-self: flex-end;
    }
    .#{$prefix}--item__right {
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      text-align: right;
      margin-left: 1em;
    }
    .#{$prefix}--item__text-wrapper {
      display: flex;
      justify-content: space-between;
      align-items: stretch;
    }
    .#{$prefix}--item__text-wrapper__inner {
      flex: 1;
    }
    .#{$prefix}--item__text {
      grid-area: text;
      font-size: 0.85em;
      line-height: 1.5;
    }
    .#{$prefix}--item__sub-content {
      color: $text-body-secondary;
      grid-area: subcontent;
      //margin-top: $spacing-3xs;
      line-height: 1.3;
      font-size: 0.85em;
    }
    &--unread {
      background-color: $layer-primary;
      position: relative;
    }
  }

  .#{$prefix}--item__unread {
    width: 1em;
    height: 1em;
    grid-area: unread;
    align-self: center;
    background: $action-default-fill-primary-default;
    border-radius: 1em;
  }

  .#{$prefix}--item__image {
    grid-area: photo;
    align-self: center;
    svg,
    .svg-inline--fa,
    img,
    video {
      margin: 0;
      display: block;
      width: 100%;
      height: auto;
    }
    .#{$prefix}--item--large & {
      width: 6rem;
      /*img {
        width: 35rem;
        max-width: 100%;
        max-height: 15rem;
        height: auto;
      }
      svg,
      .svg-inline--fa {
        width: 15rem;
        height: 15rem;
      }*/
      margin-bottom: $spacing-08;
    }
  }
}
