@import './../theme/config.scss';
@import './../mixins/scrollbar.scss';

$list-prefix-cls: #{$vender-prefix}-list;
$tagListPrefixCls: #{$vender-prefix}-taglist;
$selectListPrefixCls: #{$vender-prefix}-selectlist;
$radioListPrefixCls: #{$vender-prefix}-radiolist;

.#{$list-prefix-cls} {
  position: relative;

  * {
    outline: none;
  }

  &-pagination {
    margin-top: 24px;
    text-align: right;

    .#{$vender-prefix}-select {
      text-align: left;
    }
  }

  &-more {
    margin-top: 12px;
    text-align: center;

    button {
      padding-right: 32px;
      padding-left: 32px;
    }
  }

  &-spin {
    min-height: 40px;
    text-align: center;
  }

  &-empty-text {
    padding: 16px;
    font-size: $font-size-base;
    color: $text-color-secondary;
    text-align: center;
  }

  &-item {
    align-items: center;
    display: flex;
    padding-top: 12px;
    padding-bottom: 12px;

    &-meta {
      align-items: center;
      display: flex;
      font-size: 0;

      &-avatar {
        flex: 0;
        margin-right: 16px;
      }

      &-content {
        flex: 1 0;
      }

      &-title {
        margin-bottom: 4px;
        font-size: $font-size-base;
        line-height: 22px;
        color: $text-color;

        > a {
          color: $text-color;
          transition: all 0.3s;

          &:hover {
            color: var(--primary-color);
          }
        }
      }

      &-description {
        font-size: $font-size-base;
        line-height: 22px;
        color: $text-color-secondary;
      }
    }

    &-content {
      display: flex;
      flex: 1;
      justify-content: flex-end;
    }

    &-content-single {
      justify-content: flex-start;
    }

    &-action {
      padding: 0;
      margin-left: 48px;
      font-size: 0;
      flex: 0 0 auto;
      list-style: none;

      & > li {
        position: relative;
        display: inline-block;
        padding: 0 8px;
        font-size: $font-size-base;
        line-height: 22px;
        color: $text-color-secondary;
        text-align: center;
        cursor: pointer;
      }

      & > li:first-child {
        padding-left: 0;
      }

      &-split {
        position: absolute;
        top: 50%;
        right: 0;
        width: 1px;
        height: 14px;
        margin-top: -7px;
        background-color: $border-color-split;
      }
    }

    &-main {
      display: flex;
      flex: 1;
    }

    &-extra {
      flex: 0;
    }
  }

  &-header,
  &-footer {
    padding-top: 12px;
    padding-bottom: 12px;
  }
}

.#{$list-prefix-cls}-split {
  .#{$list-prefix-cls}-item {
    border-bottom: 1px solid $border-color-split;

    &:last-child {
      border-bottom: none;
    }
  }

  .#{$list-prefix-cls}-header {
    border-bottom: 1px solid $border-color-split;
  }
}

.#{$list-prefix-cls}-loading {
  .#{$vender-prefix}-spin-nested-loading {
    min-height: 32px;
  }
}

.#{$list-prefix-cls}-bordered {
  border: 1px solid $border-color-base;
  border-radius: $border-radius-base;

  .#{$list-prefix-cls}-header {
    padding-right: 24px;
    padding-left: 24px;
  }

  .#{$list-prefix-cls}-footer {
    padding-right: 24px;
    padding-left: 24px;
  }

  .#{$list-prefix-cls}-item {
    padding-right: 24px;
    padding-left: 24px;
    border-bottom: 1px solid $border-color-split;
  }
}

.#{$list-prefix-cls}-something-after-last-item .#{$list-prefix-cls}-item:last-child {
  border-bottom: 1px solid $border-color-split;
}

.#{$list-prefix-cls}-bordered.#{$list-prefix-cls}-lg {
  .#{$list-prefix-cls}-header,
  .#{$list-prefix-cls}-footer {
    padding: 16px 24px;
  }
}

.#{$list-prefix-cls}-bordered.#{$list-prefix-cls}-sm {
  .#{$list-prefix-cls}-item {
    padding-right: 16px;
    padding-left: 16px;
  }

  .#{$list-prefix-cls}-header,
  .#{$list-prefix-cls}-footer {
    padding: 8px 16px;
  }
}

.#{$list-prefix-cls}-lg {
  .#{$list-prefix-cls}-item {
    padding-top: 16px;
    padding-bottom: 16px;
  }
}

.#{$list-prefix-cls}-sm {
  .#{$list-prefix-cls}-item {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

.#{$list-prefix-cls}-vertical {
  .#{$list-prefix-cls}-item {
    display: block;

    &-extra-wrap {
      display: flex;
    }

    &-main {
      display: block;
      flex: 1;
    }

    &-extra {
      margin-left: 58px;
      flex: 0;
    }

    &-meta {
      margin-bottom: 16px;

      &-avatar {
        display: none;
      }

      &-title {
        margin-bottom: 12px;
        font-size: $font-size-lg;
        line-height: 24px;
        color: $heading-color;
      }
    }

    &-content {
      display: block;
      margin-bottom: 16px;
      font-size: $font-size-base;
      color: $text-color;
    }

    &-action {
      margin-left: auto;

      & > li {
        padding: 0 16px;
      }

      & > li:first-child {
        padding-left: 0;
      }
    }
  }
}

.#{$list-prefix-cls}-grid {
  .#{$list-prefix-cls}-item {
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 20px;
    border-bottom: none;

    &-content {
      display: block;
    }
  }
}

.#{$list-prefix-cls}-empty {
  padding: 16px 0;
  font-size: 12px;
  color: $text-color-secondary;
  text-align: center;
}

@media screen and (max-width: $screen-md) {
  .#{$list-prefix-cls} {
    &-item {
      &-action {
        margin-left: 24px;
      }
    }
  }

  .#{$list-prefix-cls}-vertical {
    .#{$list-prefix-cls}-item {
      &-extra {
        margin-left: 24px;
      }
    }
  }
}

@media screen and (max-width: $screen-xs) {
  .#{$list-prefix-cls} {
    &-item {
      flex-wrap: wrap;

      &-action {
        margin-left: 12px;
      }
    }
  }

  .#{$list-prefix-cls}-vertical {
    .#{$list-prefix-cls}-item {
      &-extra-wrap {
        flex-wrap: wrap-reverse;
      }

      &-main {
        min-width: 220px;
      }

      &-extra {
        margin-left: 0;
      }
    }
  }
}

// tag list

.#{$tagListPrefixCls} {
  padding: 0 0 3px 6px;
  margin: 0;
  line-height: 1;
  list-style: none;

  li {
    display: inline-block;
    margin-top: 3px;
    margin-right: 6px;
    vertical-align: middle;

    input {
      height: 22px;
      vertical-align: top;
      background: transparent;
      border: none;
      outline: none;
    }
  }

  .#{$tagListPrefixCls}-item {
    position: relative;
    padding-left: 5px;
    cursor: default;
    background-color: #f3f3f3;
    border: 1px solid #e8e8e8;
    border-radius: 2px;

    .amos-btn-icon {
      i[class*='icon'] {
        font-size: 12px;
      }

      &:hover {
        i[class*='icon'] {
          color: $danger-color;
        }
      }
    }
  }

  .#{$tagListPrefixCls}-label {
    display: inline-block;
    max-width: 100px;
    line-height: 22px;
    vertical-align: middle;
  }
}


// select list
.#{$selectListPrefixCls} {
  position: relative;
  display: inline-block;
  width: 180px;
  height: 200px;
  font-size: 12px;
  vertical-align: middle;

  &#{&}-bordered {
    border: 1px solid #d9d9d9;
    border-radius: 4px;
  }

  &-body {
    position: relative;
    height: 100%;
    font-size: 12px;

    &-search-wrapper {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      padding: 4px;
    }
  }

  &-pretty {
    .#{$selectListPrefixCls}-content {
      @include pretty-scrollbar(6px, 6px);
    }
  }

  &-content {
    height: 100%;
    overflow: auto;

    > .#{$prefixCls}-lazy {
      animation: listHighlightIn 1s;
    }

    &-item {
      min-height: 32px;
      padding: 7px 15px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      transition: all 0.3s;

      .#{$prefixCls}-checkbox {
        margin-right: 6px;
      }

      &-title {
        margin-left: 8px;
      }
    }

    &-item:not(&-item-disabled):hover {
      cursor: pointer;
      background-color: rgba($primary-color, 0.1);
    }

    &-item-disabled {
      color: rgba(0, 0, 0, 0.25);
      cursor: not-allowed;
    }
  }

  &-content:empty + &-body-not-found {
    display: block;
  }
}

@keyframes listHighlightIn {
  0% {
    background: rgba($primary-color, 0.1);
  }

  100% {
    background: transparent;
  }
}

// radio list
.#{$radioListPrefixCls} {
  &#{&}-bordered {
    padding: 0 6px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
  }

  &-item {
    display: flex;
    padding: 6px 8px;
    margin: 3px 0;
    align-items: center;
    cursor: pointer;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    box-shadow: 0 3px 6px rgba(black, 0.1);

    &:hover,
    &#{&}-active {
      background: #e6f7ff;
      border-color: #00b1ff;
    }
  }

  &-inline {
    display: flex;
    flex-wrap: wrap;

    .#{$radioListPrefixCls}-item {
      margin: 3px;
    }
  }
}
