@import '../bootstrap'
@import '../theme'

/* Themes */
list($material)
  background: $material.cards

  .vf-list__tile:not(.vf-list__tile--active)
    color: $material.text.primary

  .vf-list__tile__sub-title
    color: $material.text.secondary

  .vf-divider
    background-color: $material.dividers

  .vf-list__tile__mask
    color: $material.text.disabled

  &--group
    .vf-list__tile--active
      .vf-list__tile__title
        color: $material.text.link

theme(list, "vf-list")

.vf-list
  list-style-type: none
  padding: $list-top-padding 0 $list-bottom-padding
  transition: height .3s $transition.fast-out-slow-in

  .vf-input-group
    margin: 0

  > .vf-list__tile ~ .lvf-ist__tile
    margin-top: 0

  &__tile
    font-size: $list-tile-font-size
    font-weight: $list-tile-font-weight
    display: flex
    height: $list-item-single-height
    text-decoration: none
    align-items: center
    padding: 0 16px
    margin: 0
    transition: $primary-transition
    position: relative
    user-select: none

    &:after
      content: ''
      position: absolute
      left: 0
      top: 0
      height: 1px
      opacity: 0
      width: 100%
      transition: $primary-transition
      background-color: $material-twelve-percent-dark

    &--link
      cursor: pointer

    &--link:hover, &--highlighted
      background: $material-twelve-percent-dark

    &__content,
    &__action,
    &__avatar
      height: 100%

    &__title, &__sub-title
      white-space: nowrap
      overflow: hidden
      text-overflow: ellipsis
      width: 100%

    &__title
      transition: $primary-transition
      height: 24px
      line-height: 24px
      position: relative
      text-align: left

    &__sub-title
      font-size: $list-sub-title-font-size

    .vf-avatar
      justify-content: flex-start
      min-width: 56px

    &__action
      display: flex
      justify-content: flex-start
      min-width: 56px
      align-items: center

      .vf-input-group--selection-controls
        align-items: center
        padding: 0

      .vf-input-group__details
        display: none

      .vf-icon
        transition: $primary-transition

      .vf-btn //fix button padding if used
        padding 0
        margin 0
        &--icon
          margin -8px

      &-text
        color: $list-action-text-font-color
        font-size: $list-action-text-font-size

      &--stack
        align-items: flex-end
        justify-content: space-between
        padding-top: $list-top-padding
        padding-bottom: $list-bottom-padding
        white-space: nowrap
        flex-direction: column

    &__content
      text-align: left
      flex: 1 1 auto
      overflow: hidden
      display: flex
      align-items: flex-start
      justify-content: center
      flex-direction: column

      ~ .vf-avatar
        justify-content: flex-end

      ~ .vf-list__tile__action:not(.vf-list__tile__action--stack)
        justify-content: flex-end

    &--active
      .vf-list__tile__action:first-of-type
        .vf-icon
          color: inherit

    &--disabled
      opacity: 0.4 !important
      pointer-events: none

    &--avatar
      height: $list-item-avatar-single-height

      .vf-avatar
        img,
        .vf-icon
          height: 40px
          width: 40px

  &--dense
    padding-top: $list-item-dense-top-padding
    padding-bottom: $list-item-dense-top-padding

    .vf-subheader
      font-size: $subheader-dense-font-size
      height: $list-dense-subheader-height
    .vf-list--group
      .vf-subheader
        height $list-dense-subheader-group-height
    .vf-list__tile
      font-size: $list-item-dense-font-size

      &--avatar
        height: $list-item-dense-avatar-single-height

      &:not(.vf-list__tile--avatar)
        height: $list-item-dense-single-height

      .vf-icon
        font-size: $list-item-dense-icon-font-size

    .vf-list__tile__sub-title
      font-size: $list-item-dense-font-size

  &--two-line
    .vf-list__tile
      height: $list-item-double-height

    &.vf-list--dense
      .vf-list__tile
        height: $list-item-dense-double-height

  &--three-line
    .vf-list__tile
      height: $list-item-triple-height

    .vf-list__tile__sub-title
      white-space: initial
      -webkit-line-clamp: 2
      -webkit-box-orient: vertical
      display: -webkit-box

    &.vf-list--dense
      .vf-list__tile
        height: $list-item-dense-triple-height

  &--group
    position: relative
    padding: 0

    &:after
      content: ''
      position: absolute
      left: 0
      bottom: 0
      height: 1px
      opacity: 0
      width: 100%
      background-color: $material-twelve-percent-dark

    .vf-list__tile
      padding-left: $list-item-left-padding

    &__header
      > li:first-child
        cursor: pointer
        display: block

        &:hover
          background: $material-twelve-percent-dark

      + .vf-list--group
        &:after
          opacity: 1

      &--active
        .vf-list__tile
          background: $material-twelve-percent-dark

          &:after
            opacity: 1

          .vf-list__tile__title
            color: inherit

          .vf-list__tile__action:last-of-type
            .vf-icon
              transform: rotate(-180deg)

      &--no-action + .vf-list--group
        .vf-list__tile
          padding-left: $list-left-padding

  &--subheader
    padding-top: 0

  &.vf-list--two-line,
  &.vf-list--three-line
    .vf-list__tile__avatar
      align-items: flex-start
