/**
 *
 * This file may have been modified by Bytedance Inc. (“Bytedance Inc.'s Modifications”). 
 * All Bytedance Inc.'s Modifications are Copyright (year) Bytedance Inc..  
 * 
 * This source code is licensed under the Apache license.
 * See LICENSE file in the project root for license information.
 *
 */
.@{ant-prefix}-sp-upload {

  .sp-upload-component {
    display: none;
  }
  .@{ant-prefix}-sp-icon {
    font-size: 16px;
  }
  .@{ant-prefix}-upload.@{ant-prefix}-upload-select-picture-card {
    width: 88px;
    height: 88px;
    border: none;
    background: transparent;
  }

  .@{ant-prefix}-upload.@{ant-prefix}-upload-select-picture-card > .@{ant-prefix}-upload {
    padding: 0;
  }

  .@{ant-prefix}-popover-open {

    .spm-image-upload-item-mask {
      opacity: 1;
      transition: opacity .3s;
      z-index: 101;
    }
  }

  .spm-image-upload {

    &-item {
      width: 88px;
      height: 88px;
      background: #fff;
      border: 1px dashed @color-line-0;
      color: @color-text-icon-1;
      border-radius: @corner-s;
      position: relative;
      cursor: pointer;
      margin: 0 8px 8px 0;
      float: left;
      font-weight: 400;
      font-size: 12px;
      line-height: 16px;
    }

    &-item-default-btn:hover {
      border: 1px dashed @color-primary-hover;
      color: @color-primary-hover;
    }

    &-item-default-img-wrap {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      background: @color-background-page;
      > .@{ant-prefix}-sp-icon {
        font-size: 24px;
        color: #000;
        opacity: .08;
      }
    }

    &-item-other-img-wrap-success {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      background: rgba(71, 132, 255, .1);
      > .@{ant-prefix}-sp-icon {
        opacity: 1;
        color: #4784ff;
      }
    }

    &-item-other-img-wrap-fail {
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      background: rgba(255, 255, 255, .7);
      > .@{ant-prefix}-sp-icon {
        opacity: 1;
        color: #bad1ff;
      }
    }

    &-item-other-img-extension {
      display: block;
      word-break: break-all;
      font-size: 12px;
      text-align: center;
      font-weight: 600;
      line-height: 12px;
      color: #1966ff;
      margin-top: 3px;

      &-fail {
        color: #bad1ff;
      }
    }

    &-item-error {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      font-size: 12px;
      line-height: 16px;
      z-index: 1;
      background: rgba(255, 255, 255, .7);
    }

    &-item-error-title {
      color: @color-function-danger-main;
      margin: 6px 0;
    }

    &-item-success {
      margin: 0 8px 8px 0;
      width: 88px;
      height: 88px;
      background: #fff;
      color: @color-text-icon-1;
      border: 1px solid @color-line-1;
      border-radius: @corner-s;
      position: relative;
      cursor: pointer;
      float: left;
    }

    &-item-error-wrapper {
      border: 1px solid @color-function-danger-main;
      overflow: hidden;

      &:hover {
        border: 1px solid @color-function-danger-main;
      }
    }

    &-item-img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      object-position: center;
    }

    &-item-img-error-wrapper {
      width: 100%;
      height: 100%;
      overflow: hidden;
      border-radius: @corner-s;
    }

    &-item-img-error {
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center;
      filter: blur(3px);
    }

    &-item-success:hover {

      .spm-image-upload-item-mask {
        opacity: 1;
        transition: opacity .3s;
        z-index: 101;
      }
    }

    &-item:hover {

      .spm-image-upload-item-mask {
        opacity: 1;
        transition: opacity .3s;
        z-index: 101;
      }
    }

    &-item-img-icon {
      width: 16px;
      height: 16px;
    }

    &-item-img {
      border-radius: @corner-s;
      object-fit: contain;
      background-color: @color-line-1;
    }

    &-item-mask {
      position: absolute;
      bottom: -1px;
      left: -1px;
      width: calc(100% + 2px);
      height: calc(100% + 2px);
      background: @color-fill-deepen-1_2;
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: space-evenly;
      opacity: 0;
      border-radius: @corner-s;
      transition: opacity .3s;
      justify-content: space-evenly;
      line-height: 1.5715;

      &-split {
        width: 1px;
        height: 12px;
        background: rgba(133, 135, 138, 1);
        border-radius: 1px;
      }

      &-item {
        height: 32px;
        display: flex;
        align-items: center;
        flex-direction: column;
        justify-content: center;
        color: #fff;
      }
    }

    &-item-progress {
      width: 48px;
      margin-bottom: 5px;
    }

    &-item-progress-text {
      margin-bottom: 3px;
      font-size: 12px;
      line-height: 16px;
      color: @color-fill-deepen-1;
    }

    &-item-icon {
      font-size: 16px;
    }

    &-item-top {
      position: absolute;
      top: 50%;
      left: 0;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-end;
      transform: translateY(-50%);
    }

    &-item-bottom {
      margin-top: 8px;
      width: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
    }

    &-item-text {
      font-size: 12px;
      line-height: 16px;
    }

    &-item-image {
      width: 88px;
      height: 88px;
      object-fit: cover;
    }
  }
  &.@{ant-prefix}-sp-upload-disabled {

    .spm-image-upload {

      &-item-default-btn {
        color: @color-text-icon-3;

        &:hover {
          border: 1px dashed @color-line-0;
          color: @color-text-icon-3;
          cursor: not-allowed;
        }
      }

      &-item-mask {

        &-delete,
        &-retry {
          cursor: not-allowed;
        }
      }
    }
  }
}

.@{ant-prefix}-form-item-has-error {
  .@{ant-prefix}-upload-list {

    .spm-image-upload-item-default-btn {
      border-color: @color-function-danger-main;
    }
  }
}

.@{ant-prefix}-popover {

  &.spm-image-upload-item-popover-wrap {
    .@{ant-prefix}-popover-content {
      .@{ant-prefix}-popover-inner {
        .@{ant-prefix}-popover-inner-content:not(.sp-null) {
          padding: 0 12px;
        }
      }
    }

    .spm-image-upload-item-popover {
      display: flex;
      color: #565960;

      &-item {
        cursor: pointer;
        width: 30px;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 14px 12px;

        &:not(&-disabled):hover {
          color: @color-primary-brand;
        }

        &-disabled {
          cursor: not-allowed;
          color: @color-text-icon-3;
        }
      }
    }
  }
}
