@import "mixins/mixins";
@import "progress";
@import "common/var";

@include b(upload) {
  display: inline-block;
  text-align: center;
  cursor: pointer;
  outline: none;
  @include e(input) {
    display: none;
  }
  .yk-button {
    [class^="yk_icon_"] {
      font-weight: bold;
      margin-right: 8px;
    }
  }
  @include e(tip) {
    font-size: 12px;
    color: rgba($color: $--color-text-regular, $alpha: 0.76) ;
    margin-top: 7px;
    line-height: 20px;
  }

  iframe {
    position: absolute;
    z-index: -1;
    top: 0;
    left: 0;
    opacity: 0;
    filter: alpha(opacity=0);
  }
  /* 照片墙模式 */
  @include m(default) {
    display: flex;
    align-items: flex-end;
    @include e(tip) {
      top: 0;
      margin-left: 12px;
    }
  }
  @include e(tip) {
    top: 12px;
    margin-left: 12px;
  }
  /* 照片墙模式 */
  @include m(picture-card) {
    background-color: #F7FAFE;
    border: 1px dashed rgba(44, 40, 54, 0.12);
    border-radius: 4px;
    box-sizing: border-box;
    width: 120px;
    height: 120px;
    cursor: pointer;
    line-height: 120px;
    vertical-align: top;

    i {
      font-size: 28px;
      color: #8c939d;
    }

    &:hover {
      border-color: $--color-primary;
      color: $--color-primary;
    }
  }
  &:focus {
    border-color: $--color-primary;
    color: $--color-primary;

    .yk-upload-dragger {
      border-color: $--color-primary;
    }
  }
}

@include b(upload-dragger) {
  background-color: #F7FAFE;
  border: 1px dashed rgba(44, 40, 54, 0.12);
  border-radius: 4px;
  box-sizing: border-box;
  width: 472px;
  height: 180px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;

  .yk_icon_export {
    font-size: 24px;
    color: $--color-text-placeholder;
    margin: 59px 0 16px;
    line-height: 24px;
  }

  + .yk-upload__tip {
    text-align: center;
  }

  ~ .yk-upload__files {
    border-top: $--border-base;
    margin-top: 7px;
    padding-top: 5px;
  }

  .yk-upload__text {
    color: rgba(44, 40, 54, 0.32);
    font-size: 14px;
    text-align: center;
    font-weight: 400;

    em {
      color: $--color-primary;
      font-style: normal;
    }
  }

  &:hover {
    border-color: $--color-primary;
  }

  @include when(dragover) {
    background-color: rgba(32, 159, 255, .06);
    border: 2px dashed $--color-primary;
  }
}

@include b(upload-list) {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;

  @include e(item) {
    transition: all .5s cubic-bezier(.55,0,.1,1);
    font-size: 14px;
    color: $--color-text-regular;
    line-height: 40px;
    height: 40px;
    // margin-top: 5px;
    position: relative;
    box-sizing: border-box;
    border-radius: 4px;
    width: 240px;
	  // padding: 6px;
    &:hover{
      .yk-progress{
        display: none;
      }
    }

    .yk-progress {
      position: absolute;
      top: 0;
      width: 100%;
    }
    .normal .yk-progress-bar__outer{
      background: #fff;
      border-radius: 4px;
    }

    .normal .yk-progress-bar__inner{
      background: rgba(46, 99, 253, 0.04);
      border-radius: 4px;
      text-align: left;
    }

    .normal .yk-progress-bar__innerText{
      font-size: 14px;
      color: rgba(44, 40, 54, 0.76);
      margin: 0 0 0 12px;
    }

    .normal .yk-progress__text {
      position: absolute;
      right: 0;
      top: -13px;
    }

    .yk-progress-bar {
      margin-right: 0;
      padding-right: 0;
    }
    .abnormal .yk-progress {
      .yk-progress-bar{
        vertical-align: bottom;
      }
    }
    .abnormal .yk-progress-bar__outer {
      margin-top: calc(100% - 2px);
      background-color: #fff;
    }

    &:first-child {
      margin-top: 10px;
    }

    & .el-icon-upload-success {
      color: $--color-success;
    }

    .yk_icon_close {
      display: none;
      width: 16px;
      height: 16px;
      position: absolute;
      font-weight: bold;
      font-size: 16px;
      padding-right: 0;
      top: calc(50% - 8px);
      right: 16px;
      cursor: pointer;
      opacity: .75;
      color: $--color-text-regular;
      //transform: scale(.7);

      &:hover {
        opacity: 1;
      }
    }

    .icon_refresh {
      display: none;
      width: 16px;
      height: 16px;
      position: absolute;
      font-weight: bold;
      font-size: 16px;
      padding-right: 0;
      top: calc(50% - 8px);
      right: 40px;
      cursor: pointer;
      opacity: .75;
      &:hover {
        opacity: 1;
      }
    }

    .failStyle{
      color: #DD425A;
    }

    .eye_open,.pictrue_refresh {
      display: none;
      position: absolute;
      width: 64px;
      height: 64px;
      font-size: 24px;
      top: calc(50% - 31px);
      right: 166px;
      color: #fff;
      cursor: pointer;
      background: rgba(44, 40, 54, 0.56);
      border-radius: 2px;
      z-index: 99;
      .yk_icon_eye_open_outline,.yk_icon_refresh {
        position: absolute;
        top: calc(50% - 12px);
        left: calc(50% - 8px);
      }
    }

    & .el-icon-close-tip {
      display: none;
      position: absolute;
      top: calc(50% - 5px);
      right: 5px;
      font-size: 12px;
      cursor: pointer;
      opacity: 1;
      color: $--color-primary;
    }
    
    &:hover {
      background-color: $--background-color-base !important;
      .yk_icon_close,.eye_open,.icon_refresh,.pictrue_refresh {
        display: inline-block;
      }
      .yk-progress__text { 
        display: none;
      }
    }

    @include when(success) {
      .yk-upload-list__item-status-label {
        display: block;
        .greenColor {
          font-size: 16px;
          color: #4CAF50 !important;
        }
      }

      .yk-upload-list__item-name:hover, .yk-upload-list__item-name:focus {
        color: $--link-hover-color;
        cursor: pointer;
      }

      &:focus:not(:hover) {  /* 键盘focus */
        .el-icon-close-tip {
          display: inline-block;
        }
      }

      &:not(.focusing):focus, &:active { /* click时 */
        outline-width: 0;
        .el-icon-close-tip {
          display: none;
        }
      }

      &:hover, &:focus {
        .yk-upload-list__item-status-label {
          display: none;
        }
      }
    }
    @include when(fail) {
      .yk-upload-list__item-name{
        i{
          color: #DD425A;
          margin-right: 8px
        }
      }
      .yk-upload-list__item-status-label {
        display: block;
        .yk_icon_refresh {
          font-size: 16px;
          color: #DD425A !important;
        }
      }

      .yk-upload-list__item-name:hover, .yk-upload-list__item-name:focus {
        color: $--link-hover-color;
        cursor: pointer;
        i{
          color: #909399;
        }
      }

      &:focus:not(:hover) {  /* 键盘focus */
        .el-icon-close-tip {
          display: none;
        }
      }

      &:not(.focusing):focus, &:active { /* click时 */
        outline-width: 0;
        .el-icon-close-tip {
          display: none;
        }
      }

      &:hover, &:focus {
        .yk-upload-list__item-status-label {
          display: none;
        }
      }
    }
  }

  @include when(disabled) {
    .yk-upload-list__item:hover .yk-upload-list__item-status-label {
      display: block;
    }
  }

  @include e(item-name) {
    color: $--color-text-deep;
    display: block;
    margin-right: 40px;
    overflow: hidden;
    padding-left: 12px;
    text-overflow: ellipsis;
    transition: color .3s;
    white-space: nowrap;

    [class^="yk_icon"] {
      height: 100%;
      margin-right: 8px;
      color: $--color-text-secondary;
      line-height: inherit;
    }
  }

  @include e(item-status-label) {
    position: absolute;
    right: 16px;
    top: 0;
    line-height: inherit;
    display: none;
  }

  @include e(item-delete) {
    position: absolute;
    right: 10px;
    top: 0;
    font-size: 12px;
    color: $--color-text-regular;
    display: none;

    &:hover {
      color: $--color-primary;
    }
  }

  @include m(picture-card) {
    margin: 0;
    display: inline;
    vertical-align: top;

    .yk-upload-list__item {
      overflow: hidden;
      background-color: #fff;
      border: 1px solid #c0ccda;
      border-radius: 4px;
      box-sizing: border-box;
      width: 120px;
      height: 120px;
      margin: 0 8px 8px 0;
      display: inline-block;
      line-height: 1.8;
      
      div {
        height: 100%;
      }

      .yk-icon-check,
      .yk-icon-circle-check {
        color: $--color-white;
      }

      .yk_icon_close,.eye_open,.icon_refresh,.pictrue_refresh {
        display: none;
      }
      &:hover {
        .yk-upload-list__item-status-label {
          display: none;
        }

        .yk-progress__text {
          display: block;
        }
      }
    }
    .is-fail {
      border:1px solid #DD425A;
      .yk-upload-list__item-placeholder{
        background-color: rgba(221,66,90,0.04);
        i{
          color: #DD425A;
        }
      }
    }
    .is-uploading{
      border: 1px dashed rgba(44, 40, 54, 0.12);
      .yk-progress-bar__outer{
        background-color: #fff;
      }
    }

    .yk-upload-list__item-name {
      display: none;
    }

    .yk-upload-list__item-thumbnail {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: #DD425A;
      font-weight: 400;
      i{
        font-size: 24px;
        margin-bottom: 8px;
      }
      font-size: 12px;
      line-height: 20px;
      text-align: center;
    }
    .yk-upload-list__item-thumbnail.percentage{
      font-family: HelveticaNeue-CondensedBold, HelveticaNeue;
      color: rgba(44,40,54,0.3200);;
      line-height: 28px;
      letter-spacing: 1px;
      span{
        color: rgba(44,40,54,0.5600);
        font-size: 20px;
        font-weight: bold;
        margin-left: 8%;
      }
    }

    .yk-upload-list__item-status-label {
      position: absolute;
      right: -14px;
      top: -7px;      
      text-align: center;
      width: 40px;
      height: 24px; 
      background: #13ce66;
      transform: rotate(45deg);
      box-shadow: 0 0 1pc 1px rgba(0,0,0,0.2);

      i {
        font-size: 12px;
        margin-top: 5px;
        color: #fff;
        transform: rotate(-45deg);
      }
    }

    .yk-upload-list__item-actions {
      position: absolute;
      width: 100%;
      height: 100%;
      left: 0;
      top: 0;
      cursor: default;
      text-align: center;
      color: #fff;
      opacity: 0;
      font-size: 24px;
      background-color: rgba(0, 0, 0, .5);
      transition: opacity .3s;
      &::after {
        display: inline-block;
        content: "";
        height: 100%;
        vertical-align: middle
      }

      span {
        display: none;
        cursor: pointer;
      }

      span + span {
        margin-left: 15px;
      }

      .yk-upload-list__item-delete {
        position: static;
        font-size: inherit;
        color: inherit;
      }

      &:hover {
        opacity: 1;
        span {
          display: inline-block;
        }
      }
    }

    .normal .yk-progress {
      top: calc(50% + 12px);
      left: calc(50% + 12px);
      transform: translate(-50%, -50%);
      bottom: auto;
      width: 126px;

      .yk-progress__text {
        top: 50%;
      }
    }
    .annormal .yk-progress {
      top: calc(50% + 12px);
      left: calc(50% + 12px);
      transform: translate(-50%, -50%);
      bottom: auto;
      width: 126px;
    }
  }

  @include m(picture) {
    .yk-upload-list__item {
      overflow: hidden;
      z-index: 0;
      background-color: #fff;
      border: 1px solid rgba(44, 40, 54, 0.06);
      border-radius: 4px;
      box-sizing: border-box;
      margin-top: 10px;
      padding: 8px 8px 8px 88px;
      height: 80px;
      margin-right: 8px;

      .yk-icon-check,
      .yk-icon-circle-check {
        color: $--color-white;
      }
      .el-icon-loading {
        color:#2C2836 !important;
      }
	  
      .yk-upload-list__item-status-label{
        top: 20px;
      }
      .eye_open .yk_icon_eye_open_outline{
        top: calc(50% - 20px);
      }
      &:hover {
        border: 1px solid $--color-primary;
        .yk-upload-list__item-status-label {
          background: transparent;
          box-shadow: none;
          top: -6px;
          right: -20px;
        }

        .yk-progress__text {
          display: block;
        }
      }

      &.is-success {
        .yk-upload-list__item-name {
          line-height: 64px;
          margin-top: 0;
          i {
            display: none;
          }
        }
      }
      &.is-fail {
        border:1px solid #DD425A;
        .yk-upload-list__item-placeholder{
          background-color: rgba(221,66,90,0.04);
          i{
            color: #DD425A;
          }
        }
      }
    }

    .yk-upload-list__item-thumbnail {
      vertical-align: middle;
      display: inline-block;
      width: 64px;
      height: 64px;
      float: left;
      position: relative;
      z-index: 1;
      margin-left: -80px;
      background-color: $--color-white;
	    border-radius: 2px;
    }
    .yk-upload-list__item-placeholder {
      vertical-align: middle;
      // display: inline-block;
      width: 64px;
      height: 64px;
      float: left;
      position: relative;
      z-index: 1;
      margin-left: -80px;
      background-color: rgba(46, 99, 253, 0.04);
      border-radius: 2px;
      i {
        color: #ccc;
        font-size: 30px;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%,-50%);
      }
    }

    .yk-upload-list__item-name {
      display: block;
      margin-top: 10px;

      i {
        font-size: 70px;
        line-height: 1;
        position: absolute;
        left: 9px;
        top: 10px;
      }
    }

    .yk-upload-list__item-status-label {
      position: absolute;
      right: 16px;
      top: 0;
	  // text-align: center;
   //    width: 46px;
   //    height: 26px;
   //    background: #13ce66;      
   //    transform: rotate(45deg);
   //    box-shadow: 0 1px 1px #ccc;

      i {
        font-size: 16px;
		    color: #4CAF50 !important;
        // margin-top: 12px;
        // transform: rotate(-45deg); 
      }
    }

    .normal .yk-progress {
      position: relative;
      top: -7px;
    }
  }
}

@include b(upload-cover) {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 10;
  cursor: default;
  @include utils-vertical-center;

  img {
    display: block;
    width: 100%;
    height: 100%;
  }

  @include e(label) {
    position: absolute;
    right: -15px;
    top: -6px;
    width: 40px;
    height: 24px;
    background: #13ce66;
    text-align: center;
    transform: rotate(45deg);
    box-shadow: 0 0 1pc 1px rgba(0,0,0,0.2);

    i {
      font-size: 12px;
      margin-top: 11px;
      transform: rotate(-45deg);
      color: #fff;
    }
  }

  @include e(progress) {
    display: inline-block;
    vertical-align: middle;
    position: static;
    width: 243px;

    + .yk-upload__inner {
      opacity: 0;
    }
  }

  @include e(content) {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }

  @include e(interact) {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(#000, .72);
    text-align: center;

    .btn {
      display: inline-block;
      color: $--color-white;
      font-size: 14px;
      cursor: pointer;
      vertical-align: middle;
      transition: $--md-fade-transition;
      margin-top: 60px;

      i {
        margin-top: 0;
      }

      span {
        opacity: 0;
        transition: opacity .15s linear;
      }

      &:not(:first-child) {
        margin-left: 35px;
      }

      &:hover {
        transform: translateY(-13px);

        span {
          opacity: 1;
        }
      }

      i {
        color: $--color-white;
        display: block;
        font-size: 24px;
        line-height: inherit;
        margin: 0 auto 5px;
      }
    }
  }

  @include e(title) {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: $--color-white;
    height: 36px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: normal;
    text-align: left;
    padding: 0 10px;
    margin: 0;
    line-height: 36px;
    font-size: 14px;
    color: $--color-text-primary;
  }

  + .yk-upload__inner {
    opacity: 0;
    position: relative;
    z-index: 1;
  }
}
