@use '../../style/themes/default.scss' as *;
@use '../../style/util.scss' as *;

.ele-upload-list {
  font-size: 0;
  max-width: 100%;
  box-sizing: border-box;

  .ele-upload-item {
    width: 100px;
    height: 100px;
    max-width: 100%;
    font-size: 14px;
    display: inline-block;
    margin: 0 12px 12px 0;
    background: elVar('fill-color', 'light');
    border: 1px dashed elVar('border-color');
    border-radius: elVar('border-radius', 'base');
    box-sizing: border-box;
    vertical-align: top;
    position: relative;
    overflow: visible;
    cursor: pointer;

    &.ele-draggable {
      cursor: move;
    }

    .ele-upload-remove {
      width: 18px;
      height: 18px;
      color: #fff;
      font-size: 12px;
      border-bottom-left-radius: 18px;
      border-top-right-radius: elVar('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: elVar('color-danger');
      }
    }

    & > .el-image {
      width: 100%;
      height: 100%;
      display: block;
      border-radius: elVar('border-radius', 'base');
    }

    .ele-upload-thumbnail {
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: elVar('text-color', 'secondary');
      text-align: center;
      font-size: 22px;

      & > .el-icon {
        color: elVar('text-color', 'placeholder');
      }
    }

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

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

      .ele-upload-text {
        margin-bottom: 8px;
        text-align: center;
      }

      .ele-upload-tools {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
      }

      .ele-upload-retry {
        flex-shrink: 0;
        font-size: 16px;
        margin: 8px 3px 0 3px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
      }
    }

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

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

    &:hover {
      border-color: elVar('color-primary');
    }

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

      & > .el-upload {
        height: 100%;
        display: flex;
        cursor: inherit;

        & > .el-upload-dragger {
          width: 100%;
          height: 100%;
          display: flex;
          align-items: center;
          justify-content: center;
          border-radius: elVar('border-radius', 'base');
          background: none;
          cursor: inherit;
          border: none;
          padding: 0;

          &.is-dragover {
            outline: 1px dashed elVar('color-primary');
            background: elVar('color-primary', 'light-9');
          }
        }
      }

      & > .el-upload-list {
        display: none;
      }
    }

    .ele-upload-icon {
      font-size: 22px;
      color: elVar('text-color', 'secondary');
      opacity: 0.68;

      & > svg {
        stroke-width: 3.8;
      }
    }
  }

  &.is-disabled .ele-upload-button {
    background: elVar('disabled', 'bg-color');
    border-color: elVar('disabled', 'border-color');
    cursor: not-allowed;

    .ele-upload-icon {
      color: elVar('disabled', 'text-color');
    }
  }
}
