@import '../icon/icon.scss';
@import '../progress/progress.scss';
@import '../../styles/mixins/text-ellipsis.scss';

.nut-theme-dark {
  .nut-uploader {
    // background-color:  $gray2;
    &__preview {
      margin-bottom: 0;

      &-img {
        i {
          color: $dark1 !important;
        }
      }
    }
  }

  .nut-progress {
    .nut-progress-text__inner {
      color: $white !important;
    }
  }

  .nut-uploader__preview-list {
    background: $dark5;
    color: $dark1;
  }
}

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

  &__slot {
    position: relative;
  }

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

  &__icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    i {
      opacity: $uploader-picture-icon-opacity;
      margin-bottom: $uploader-picture-icon-margin-bottom;
    }

    &-tip {
      font-size: $uploader-picture-icon-tip-font-size;
      color: $uploader-picture-icon-tip-color;
    }
  }

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

    &:disabled {
      cursor: not-allowed;
    }
  }

  &__upload-disabled {
    background: $uploader-background-disabled;

    .nut-uploader__icon {
      i {
        opacity: $uploader-picture-icon-opacity-disabled;
        margin-bottom: $uploader-picture-icon-margin-bottom;
      }
    }
  }

  &__preview {
    position: relative;
    margin-right: $uploader-preview-margin-right;
    margin-bottom: $uploader-preview-margin-bottom;
    box-shadow: 0 2px 10px 0 rgb(0 0 0 / 10%);

    &__progress {
      position: absolute;
      left: 0;
      top: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      background: $uploader-preview-progress-background;
      border-radius: $uploader-picture-border-radius;

      i {
        margin-bottom: $uploader-picture-icon-margin-bottom;
      }

      &__msg {
        color: #fff;
        font-size: 12px;
      }
    }

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

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

      .nut-uploader__preview-img__file__name {
        -webkit-line-clamp: 1;
        padding: 2px;
        height: 24px;
      }

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

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

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

    .close {
      position: absolute;
      right: $uploader-preview-close-right;
      top: $uploader-preview-close-top;
      transform: translate(50%, -50%);
    }

    &-img {
      position: relative;
      width: $uploader-picture-width;
      height: $uploader-picture-height;
      border-radius: $uploader-picture-border-radius;

      i {
        color: $gray1;
      }

      .tips {
        position: absolute;
        bottom: 0;
        left: 0;
        font-size: 12px;
        color: $white;
        text-align: center;
        box-sizing: border-box;
        height: $uploader-preview-tips-height;
        line-height: $uploader-preview-tips-height;
        border-radius: $uploader-picture-border-radius;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        padding: $uploader-preview-tips-padding;
        background: $uploader-preview-tips-background;
        @include oneline-ellipsis();
      }

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

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

        &__name {
          display: flex;
          width: 100%;
          font-size: 12px;
          color: $text-color;

          &.error {
            color: red !important;
          }

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

          .nut-icon-link {
            &::before {
              margin-left: -25%;
              margin-top: -25%;
              transform: none;
            }
          }

          @include moreline-ellipsis();
        }
      }
    }
  }
}
