@import '../../../style/theme/default/index';
@import '../../../style/mixins/index';

@upload-prefix-cls: ~"@{idoll-prefix}-upload";
@upload-item: ~"@{idoll-prefix}-upload-list-item";
@upload-pictrue-card-size: 104px;
@iconfont-css-prefix: ~"@{idoll-prefix}-icon";

.@{upload-prefix-cls} {
  .reset-component;
  outline: 0;

  p {
    margin: 0;
  }

  &-btn {
    display: block;
    width: 100%;
    outline: none;
  }

  input[type="file"] {
    cursor: pointer;
  }

  &&-select {
    display: block;
    position: relative;
    margin-bottom: 40px;
    .@{upload-prefix-cls} {
      p {
        position: absolute;
        top: 50px;
        left: 0;
        font-size: @font-size-sm;
        color: @text-color-secondary;
        user-select: none;
        pointer-events: none;
      }
    }
  }

  &&-select-picture-card {
    border: @border-width-base dashed @border;
    width: @upload-pictrue-card-size;
    height: @upload-pictrue-card-size;
    border-radius: @border-radius-base;
    background-color: hsv(0, 0, 98%);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s ease;
    vertical-align: top;
    margin-right: 8px;
    margin-bottom: 8px;
    display: table;

    &:hover {
      border-color: @primary-color;
    }

    > .@{upload-prefix-cls} {
      width: 100%;
      height: 100%;
      display: table-cell;
      text-align: center;
      vertical-align: middle;
      padding: @padding-xs;
    }

    .@{iconfont-css-prefix}-plus {
      font-size: 30px;
      transition: all .3s;
      color: @text-color-disable;
    }
    .@{upload-prefix-cls}-text {
      margin-top: 14px;
      color: @text-color-secondary;
      line-height: @upload-basic-height;
    }
  }
  
  &&-select-picture-card.@{idoll-prefix}-upload-disabled:hover {
    border-color:@border;
  }

  &&-drag {
    border: @border-width-base dashed @border;
    transition: border-color .3s;
    cursor: pointer;
    border-radius: @border-radius-base;
    text-align: center;
    width: 100%;
    height: 100%;
    position: relative;
    background: hsv(0, 0, 98%);

    &.@{upload-prefix-cls}-disabled {
      cursor: not-allowed;
    }

    .@{upload-prefix-cls}-btn {
      display: table;
      height: 100%;
    }

    .@{upload-prefix-cls}-drag-container {
      padding: 37px 0 32px 0;
      vertical-align: middle;
      width: 100%;
      height: 100%;
    }

    &:not(.@{upload-prefix-cls}-disabled):hover {
      border-color: @primary-color;
    }

    p.@{upload-prefix-cls}-icon {
      .@{iconfont-css-prefix} {
        font-size: 72px;
        color: @primary-color;
      }
      margin-bottom: 18px;
    }
    p.@{upload-prefix-cls}-text {
      font-size: @font-size-base;
      margin: 0 0 8px 0;
      color: @text-color;
      line-height: @upload-basic-height;
    }
    p.@{upload-prefix-cls}-limit {
      font-size: @font-size-sm;
      color: @text-color-secondary;
      line-height: @upload-basic-height - 2px;
    }
  }
}

.@{upload-prefix-cls}-disabled,.@{upload-prefix-cls}-disabled:hover {
  user-select: none;
  cursor: not-allowed;
  .@{idoll-prefix}-btn {
    background-color: @disabled;
    border: @border-width-base @border-style-base@border;
    cursor: not-allowed;
    i,span {
      color: @text-color-disable
    }
  }
  .@{idoll-prefix}-btn-primary:focus > .@{idoll-prefix}-icon {
    color: @text-color-disable 
  }
  div.@{upload-prefix-cls}-drag-container {
    .@{upload-prefix-cls}-icon {
      i.@{idoll-prefix}-icon {
        color: @text-color-disable 
      }
    }
  }
  
}

.beginUpload {
  margin-left: 10px;
}
.beginUpload[disabled] {
  .@{iconfont-css-prefix} {
    color: @text-color-disable;
  }
}

.@{upload-prefix-cls}-list {
  .reset-component;
  .clearfix;
  &-item {
    margin-top: 8px;
    font-size: @font-size-base;
    position: relative;
    height: @upload-basic-height;
    &-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 100%;
      display: inline-block;
      > span {
        margin-left: 8px;
      }
      p > i:last-child {
        position: absolute;
        right: @upload-position-size;
        top:0;
        line-height: @upload-basic-height;
        font-size:@font-size-sm;
        cursor: pointer; 
      }
    }

    &-info {
      height: 100%;
      padding: 0 @padding-sm 0 0;
      transition: background-color .3s;

      > span {
        display: block;
      }

      .@{iconfont-css-prefix}-loading,
      .@{iconfont-css-prefix}-paper-clip {
        font-size: @font-size-base;
        color: @text-color-secondary;
        position: absolute;
        top: @font-size-base / 2 - 2px;
      }
    }

    .@{iconfont-css-prefix}-close {
      font-size: @font-size-base;
      opacity: 0;
      cursor: pointer;
      position: absolute;
      top: 0;
      right: @upload-position-size;
      color: @text-color-secondary;
      line-height: @upload-basic-height;
      &:hover {
        color: @text-color;
      }
    }

    &:hover &-info {
      background-color: @primary-lightBg;
    }

    &:hover .@{iconfont-css-prefix}-check {
      opacity: 0;
    }
    &:hover .@{iconfont-css-prefix}-close {
      opacity: 1;
    }

    &-error,
    &-error .@{iconfont-css-prefix}-paper-clip,
    &-error &-name {
      cursor: pointer;
      color: @error-color;
      i {
        color: @error-color;
      }
    }

    &-error .@{iconfont-css-prefix}-close {
      opacity: 1;
      color: @error-color !important;
    }

    &-progress {
      line-height: 0;
      font-size: @font-size-base;
      position: absolute;
      width: 100%;
      bottom: -12px;
      padding-left: @font-size-base + 12px;
    }
  }
  &-item-done {
    cursor: pointer;
    .@{upload-item}-info a {
      .@{iconfont-css-prefix}-check {
        font-size: @font-size-base;
        position: absolute;
        top: @upload-position-size;
        right: @upload-position-size;
      }
    }
    .@{upload-item}-info span {
      color: @primary-color;
      i {
        color: @primary-color; 
      }
      .@{iconfont-css-prefix}-check {
        font-size: @font-size-base;
        position: absolute;
        top: @upload-position-size;
        right: @upload-position-size;
      }
    }
  }
  &-item-uploading,&-item-undefined {
    cursor: pointer;
    .@{upload-item}-info span {
      .@{iconfont-css-prefix}-check {
        display: none !important
      }
    }
  }


  &-picture,
  &-picture-card {
    .@{upload-item} {
      padding: @padding-xs;
      border-radius: @border-radius-base;
      border: @border-width-base @border-style-base @border;
      height: 66px;
      position: relative;
      &:hover {
        background: transparent;
      }
      &-error {
        border-color: @error-color;
      }
    }

    .@{upload-item}-info {
      padding: 0;
    }

    .@{upload-item}:hover .@{upload-item}-info {
      background: transparent;
    }


    .@{upload-item}:hover > span {
       opacity: 1;
    }


    .@{upload-item}-progress {
      padding-left: 56px;
      margin-top: 0;
      bottom: 14px;
      width: ~"calc(100% - 24px)";
      span {
        color: @text-color-secondary;
      }
    }

    .@{iconfont-css-prefix}-close {
      font-size: @font-size-base !important;
      position: absolute;
      right: @upload-position-size;
      top: @upload-position-size;
      line-height: 1;
    }
  }

  &-picture-card {
    display: inline;
    .@{upload-prefix-cls}-disabled,.@{upload-prefix-cls}-disabled:hover {
      cursor: not-allowed;
      border-color:@border;
    }

    .@{upload-item}-done,.@{upload-item}-error {
      .@{upload-item}-info >span {
        .@{upload-item}-name {
          .@{iconfont-css-prefix}-check,.@{iconfont-css-prefix}-close  {
            font-size: 0;
          }
        }
      }
    }

    .@{upload-item} .@{upload-item}-info span{
      display: block;
      width: 100%;
      height: 100%;
      opacity: 1;
      a {
        margin-right: 8px;
        i {
        color: @text-color-secondary-dark ;
        }
      }
      a:hover i {
        color:@text-color-dark;
      }
      a:active i {
        color: @white;
      }
    }

    &.@{upload-prefix-cls}-list:after {
      display: none;
    }
    .@{upload-item} {
      float: left;
      width: @upload-pictrue-card-size;
      height: @upload-pictrue-card-size;
      margin: 0 8px 8px 0;
    }

    .@{upload-item}-info {
      position: relative;

      &:before {
        content: ' ';
        position: absolute;
        z-index: 1;
        background-color: @text-color;
        transition: all .3s;
        width: 100%;
        height: 100%;
        opacity: 0;
      }
    }

    .@{upload-item}:hover .@{upload-item}-info:before {
      opacity: 1;
    }

    .@{upload-item}-actions {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      z-index: 10;
      white-space: nowrap;
      opacity: 0;
      transition: all .3s;

      .@{iconfont-css-prefix}-eye,
      .@{iconfont-css-prefix}-delete {
        z-index: 10;
        transition: all .3s;
        cursor: pointer;
        font-size: @font-size-lg;
        width: 16px;
        color: @text-color-dark;
        margin: 0 8px;
        &:hover {
          color: @white;
        }
      }
    }

    .@{upload-item}-info:hover + .@{upload-item}-actions,
    .@{upload-item}-actions:hover {
      opacity: 1;
    }

    .@{upload-item}-thumbnail,
    .@{upload-item}-thumbnail img {
      display: block;
      width: 100%;
      height: 100%;
      position: static;
    }

    .@{upload-item}-name {
      display: none;
    }

    .@{upload-item}-uploading {
      &.@{upload-item} {
        background-color: hsv(0, 0, 98%);
      }

      .@{upload-item}-info {
        height: auto;
        &:before,
        .@{iconfont-css-prefix}-pro2-eye,
        .@{iconfont-css-prefix}-delete {
          display: none;
        }
      }
    }

    .@{upload-item}-progress span {
      color: @text-color-secondary;
    }
    .@{upload-item}-progress {
      padding-left: 0;
      .@{idoll-prefix}-progress-circle {
        .@{idoll-prefix}-progress-inner {
          .@{idoll-prefix}-progress-text {
            opacity: 1;
            line-height: @upload-basic-height + 2px;
          }
          .idoll-progress-circle {
            .idoll-progress-circle-path {
              stroke: @primary-color !important;
            }
          }
        }
      }
    }
  }
  &-picture {
    .@{upload-item} a span {
      .@{upload-item} {
        .@{upload-item}-info {
          a {
            .@{iconfont-css-prefix}-check {
              font-size: @font-size-base;
              position: absolute;
              top: @upload-position-size;
              right: @upload-position-size;
            }
             span {
              opacity: 1;
            }
          }
        }
      }
      .@{upload-item}-progress {
        .@{idoll-prefix}-progress {
          .@{idoll-prefix}-progress-inner {
            .@{idoll-prefix}-progress-text {
              opacity: 1;
              line-height: @upload-basic-height + 2px;
            }
          }
        }
      }
    } 
    .@{upload-item}-thumbnail {
      width: @upload-picture-card-size;
      height: @upload-picture-card-size;
      position: absolute;
      top: 8px;
      left: 8px;
    }

    .@{upload-item}-thumbnail img {
      width: @upload-picture-card-size;
      height: @upload-picture-card-size;
      overflow: hidden;
      display: block;
    }

    .@{upload-item}-thumbnail.@{iconfont-css-prefix}:before {
      line-height: @upload-picture-card-size;
      font-size: 24px;
      color: @text-color-secondary;
    }


    .@{upload-item}-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin: 0 0 0 8px;
      line-height: @upload-picture-card-size - 4px;
      transition: all .3s;
      padding-left: @upload-picture-card-size;
      padding-right: @padding-xs;
      max-width: 100%;
      display: inline-block;
      box-sizing: border-box;
    }

    .@{upload-item}-uploading .@{upload-item}-name {
      line-height: @upload-basic-height + 6px;
    }
  }

  .@{upload-prefix-cls}-success-icon {
    color: @success-color;
    font-weight: bold;
  }

  .@{upload-prefix-cls}-animate-enter,
  .@{upload-prefix-cls}-animate-leave,
  .@{upload-prefix-cls}-animate-inline-enter,
  .@{upload-prefix-cls}-animate-inline-leave {
    animation-duration: .3s;
    animation-fill-mode: @ease-in-out-circ;
  }

  .@{upload-prefix-cls}-animate-enter {
    animation-name: uploadAnimateIn;
  }

  .@{upload-prefix-cls}-animate-leave {
    animation-name: uploadAnimateOut;
  }

  .@{upload-prefix-cls}-animate-inline-enter {
    animation-name: uploadAnimateInlineIn;
  }

  .@{upload-prefix-cls}-animate-inline-leave {
    animation-name: uploadAnimateInlineOut;
  }
}
.manual {
  .@{iconfont-css-prefix}-file {
    color: @primary-color
  }
  position: relative;
  .beginUpload {
   position: absolute;
   top: 0;
   left: 108px;
   margin-top: 0 !important;
  }
}

.@{idoll-prefix}-progress-text {
  color: @text-color-secondary;
}
@keyframes uploadAnimateIn {
  from {
    height: 0;
    margin: 0;
    opacity: 0;
    padding: 0;
  }
}

@keyframes uploadAnimateOut {
  to {
    height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
  }
}

@keyframes uploadAnimateInlineIn {
  from {
    width: 0;
    height: 0;
    margin: 0;
    opacity: 0;
    padding: 0;
  }
}

@keyframes uploadAnimateInlineOut {
  to {
    width: 0;
    height: 0;
    margin: 0;
    padding: 0;
    opacity: 0;
  }
}