@import '~ng-devui/styles-var/devui-var.scss';

.devui-add-images {
  width: 100px;
  height: 100px;
  cursor: pointer;
  position: relative;
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 8px;

  &.devui-upload {
    border: 1px dashed $devui-line;
    border-radius: 2px;

    &:hover {
      border-color: $devui-brand;

      .icon-op-add {
        color: $devui-icon-fill-active;
      }
    }

    &.devui-upload-dropover {
      border-color: $devui-brand;
    }

    .icon-op-add {
      font-size: 16px;
      color: $devui-icon-fill;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
    }
  }

  .devui-add-items {
    background-color: $devui-default-bg;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    border: 1px solid $devui-line;
    color: $devui-text;

    & > * {
      position: absolute;
      width: 80%;
      left: 50%;
      transform: translateX(-50%);
    }

    span {
      text-align: center;
    }

    .devui-cancel-upload {
      display: block;
      margin-top: 8px;

      &:hover {
        color: $devui-link;
      }
    }

    .filename {
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      top: 20%;
    }

    .devui-loading {
      top: 60%;
    }

    .icon-file {
      top: 20%;
      font-size: 32px;
    }

    &.devui-upload-failed,
    &.devui-upload-success {
      background-color: $devui-global-bg-normal;

      .filename {
        top: 70%;
      }
    }

    &.devui-upload-failed {
      border-color: $devui-danger-line;
      color: $devui-danger;

      .icon-file {
        color: $devui-danger-line;
      }
    }

    &.devui-upload-success {
      border-color: $devui-success-line;
      color: $devui-success;

      .icon-file {
        color: $devui-success-line;
      }
    }
  }

  span.customize-area-upload-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 16px;
    transform: translate(-50%, -50%);
    margin-left: 14px;
    display: none;

    &:last-child {
      margin-left: -14px;
    }

    svg path {
      fill: $devui-light-text;
    }
  }

  .icon {
    font-size: 16px;
    color: $devui-icon-bg;
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);

    &.icon-running {
      left: 35%;
    }

    &.devui-failed-icon {
      left: 60%;
    }
  }

  &:hover {
    .devui-upload-failed,
    .devui-upload-success {
      &::before {
        position: absolute;
        content: '';
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border: 1px solid transparent;
        border-radius: 2px;
        background-color: #000000;
        opacity: 0.4;
        z-index: 1;
      }

      & + .icon-delete {
        display: block;
        z-index: 2;
      }
    }

    .customize-area-upload-icon {
      display: block;
      z-index: 2;
    }
  }
}
