@import "../progress/index";
@import "../button/index";

.nut-theme-dark {
  .nut-uploader {
    &__upload {
      background: $dark-background;
    }
  }

  .nut-uploader__preview-list {
    color: $dark-color;
    background: $dark-background2;
  }

  .close {
    color: $dark-color !important;
  }
}

.nut-uploader {
  position: relative;
  display: flex;
  flex-wrap: wrap;

  &__slot {
    position: relative;
  }

  &__upload {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: $uploader-picture-width;
    height: $uploader-picture-height;
    background: $uploader-background;
  }

  &__input {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden;
    cursor: pointer !important;
    opacity: 0;

    &:disabled,
    &.disabled {
      cursor: not-allowed !important;
    }
  }

  &__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px 0 rgb(0 0 0 / 10%);

    &__progress {
      position: absolute;
      top: 0;
      left: 0;

      /* #ifdef H5 */

      z-index: 99;

      /* #endif */

      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      background: rgb(0 0 0 / 60%);

      &__msg {
        margin-top: 6px;
        font-size: 12px;
        color: $white;
      }
    }

    &.list {
      width: 100%;
      margin-top: 10px;
      margin-right: 0;
      margin-bottom: 0;
    }

    &-list {
      position: relative;
      display: flex;
      flex-direction: column;
      width: 100%;
      height: 32px;

      .nut-uploader__preview-img__file__name {
        display: flex;
        align-items: center;
        height: 100%;
        padding: 2px 4px;

        .file-name__tips {
          padding: 0 20px;
          margin-left: 4px;

          @include oneline-ellipsis;
        }
      }

      .nut-uploader__preview-img__file__del {
        position: absolute;
        top: 6px;
        right: 6px;
      }

      .nut-uploader__preview-img__file__link {
        position: absolute;
        top: 8px;
        left: 6px;
      }

      .nut-progress {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;

        .nut-progress-outer {
          height: 2px !important;
        }
      }
    }

    &-img {
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      width: $uploader-picture-width;
      height: $uploader-picture-height;
      border-radius: 6px;

      .close {
        position: absolute;
        top: 0;
        right: 0;
        z-index: 99;
        color: rgb(0 0 0 / 60%);
        transform: translate(50%, -50%);
      }

      .tips {
        position: absolute;
        right: 0;
        bottom: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        height: 0;
        font-size: 12px;
        color: $white;
        text-align: center;
        background: rgb(0 0 0 / 54%);
        transition: height 0.3s;

        @include oneline-ellipsis;
      }

      &__c {
        max-width: 100%;
        max-height: 100%;
        overflow: hidden;
        border-radius: 6px;
      }

      &__file {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        transition: all 0.3s;

        &__name {
          box-sizing: border-box;
          display: flex;
          align-items: center;
          width: 100%;
          height: 100%;
          padding: 10px;
          overflow: hidden;
          font-size: 12px;
          color: $text-color;

          &.error {
            color: red !important;
          }

          &.success {
            color: #1890ff !important;
          }
        }
      }
    }
  }
}
