@import '../../style/themes/default.less';

.ele-image-upload-list {
  font-size: 0;

  .ele-image-upload-item {
    width: 100px;
    height: 100px;
    font-size: 14px;
    display: inline-block;
    margin: 0 12px 12px 0;
    background: @background-color-light;
    border: @border-width-base dashed @border-color-base;
    border-radius: @border-radius-base;
    box-sizing: border-box;
    vertical-align: top;
    position: relative;
    overflow: visible;
    cursor: move;

    .ele-image-upload-close {
      width: 18px;
      height: 18px;
      color: #fff;
      font-size: 12px;
      border-bottom-left-radius: 18px;
      border-top-right-radius: @border-radius-base;
      background: rgba(0, 0, 0, 0.6);
      position: absolute;
      top: 0;
      right: 0;
      line-height: 1;
      padding: 2px 0 0 4px;
      box-sizing: border-box;
      transition: background-color 0.2s ease-in-out;
      cursor: pointer;
      z-index: 2;

      &:hover {
        background: @error-color;
      }

      & > .anticon-close {
        transform: scale(0.85);
        transform-origin: right top;
      }
    }

    & > .ant-image {
      width: 100%;
      height: 100%;

      & > img {
        border-radius: @border-radius-base;
        object-fit: cover;
      }

      & > .ant-image-mask {
        display: none;
      }
    }

    .ele-image-upload-thumbnail {
      height: 100%;
      display: flex;
      flex-direction: column;
      justify-content: center;
      color: @text-color-secondary;
      text-align: center;
      font-size: 22px;
    }

    .ele-image-upload-mask,
    .ele-image-upload-progress {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.3);
      border-radius: @border-radius-base;
      z-index: 1;
    }

    &:not(.sortable-chosen) .ele-image-upload-mask {
      display: none;
    }

    .ele-image-upload-progress {
      color: #fff;
      display: flex;
      flex-direction: column;
      justify-content: center;
      background: rgba(0, 0, 0, 0.6);
      box-sizing: border-box;
      text-align: center;
      line-height: 1;
      padding: 0 6px;

      & > .ant-progress .ant-progress-inner {
        background: #f5f5f5;
      }

      .ele-image-upload-retry {
        font-size: 18px;
        margin-top: 2px;

        & > .anticon {
          cursor: pointer;
        }
      }
    }

    &.sortable-ghost {
      opacity: 0;
    }
  }

  .ele-image-upload-button {
    text-align: center;
    transition: border-color 0.2s ease-in-out;
    cursor: pointer;

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

    & > span {
      height: 100%;
      display: block;

      & > .ant-upload {
        height: 100%;
        display: block;
        border-radius: @border-radius-base;
        background: none;
        border: none;

        & > span {
          height: 100%;
          display: flex !important;
          flex-direction: column;
          justify-content: center;
        }

        &.ant-upload-drag-hover {
          outline: 1px dashed @primary-color;
          background: @item-active-bg;
        }
      }
    }

    .ele-image-upload-icon {
      font-size: 22px;
      color: @text-color-secondary;
      opacity: 0.8;
    }
  }
}

.ele-image-upload-disabled .ele-image-upload-item {
  cursor: pointer;
}
