@import '../../style/themes/index.less';
@import '../../image-viewer/style/index.less';

.lm_upload_wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;

  .lm_paste_upload {
    padding: 16px;
    border: 1px dashed @text-color-disable;
    border-radius: @border-radius-base;
    display: flex;
    flex-wrap: wrap;
    flex: auto;
    gap: 16px;
    &:hover {
      border-color: @primary-color;
    }
  }

  .lm_upload_core {
    position: relative;
    display: inline-flex;
    vertical-align: middle;

    .lm_upload_core_picture {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      text-align: center;
      background-color: @text-color-bg;
      border: 1px dashed @text-color-disable;
      cursor: pointer;
      transition: all 0.3s;
      border-radius: @border-radius-base;

      &::after {
        position: absolute;
        background-color: rgba(0, 0, 0, 0.04);
        cursor: not-allowed;
        inset: 0;
      }

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

      .lm_upload_core_picture_action {
        width: 100%;
        padding: @gap-base;
        text-align: center;

        .action_plus {
          color: @text-color-new;
        }

        .tip {
          margin-top: @gap-base;
          color: @text-color-secondary-new;
        }
      }
    }

    &.disabled {
      .lm_upload_core_picture {
        border-color: rgba(0, 0, 0, 0.15);

        &::after {
          content: '';
        }

        .lm_upload_core_picture_action {
          .action_plus,
          .tip {
            color: rgba(0, 0, 0, 0.25);
          }
        }
      }
    }
  }

  // 上传进度
  .lm_upload_progress {
    width: 100%;
    height: 2px;
    margin: 10px 0;
    background-color: @text-color-bg;
    border-radius: 20px;

    .line {
      width: 0%;
      height: 2px;
      background-color: @primary-color;
      border-radius: 20px;
      transition: 0.3;
    }
  }

  // 文件列表项的每一项ƒ
  .lm_upload_item {
    vertical-align: middle;

    // 文字列表
    &.lm_upload_item_text {
      display: flex;
      gap: @gap-base;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      height: 22px;
      padding: 0 6px;
      cursor: pointer;
      transition: 0.3s;

      &:hover {
        background-color: @text-color-bg;
      }

      .text_left {
        display: flex;
        flex: 1;
        gap: @gap-base;
        align-items: center;

        .prefix {
          color: @text-color-secondary;
          font-size: @font-size-base;
          transition: 0.3s;
        }

        .lm_upload_item_name {
          flex: 1;
          color: @primary-color;
          font-size: @font-size-base;
          transition: 0.3s;
        }
      }

      .text_right {
        display: inline-flex;

        .action_delete {
          width: 24px;
          color: @text-color-secondary;
          text-align: center;
          transition: 0.3s;

          .anticon {
            font-size: 14px;
          }

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

      // 上传错误列表
      &.lm_upload_item_error {
        color: @error-color;
        .text_left {
          .prefix,
          .lm_upload_item_name {
            color: inherit;
          }
        }
        .text_right .action_delete {
          color: inherit;
        }
      }
    }

    // 图片列表
    &.lm_upload_item_card {
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: @gap-base;
      text-align: center;
      border: 1px solid @text-color-border;
      border-radius: @border-radius-base;
      cursor: pointer;
      transition: all 0.3s;

      .lm_upload_item_thumb {
        width: 100%;

        .anticon {
          color: @text-color-secondary;
          font-size: 34px;
        }

        img {
          object-fit: contain;
        }
      }

      // 报错时的内容显示
      .lm_upload_item_thumb_error {
        .lm_upload_item_name {
          margin-top: 8px;
          overflow: hidden;
          font-size: 12px;
          text-overflow: ellipsis;
        }
      }

      .lm_upload_item_mask {
        position: absolute;
        z-index: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: rgba(0, 0, 0, 0.5);
        opacity: 0;
        transition: 0.3s;
        inset: 8px;

        .lm_upload_item_action {
          display: flex;
          gap: @gap-base;
          align-items: center;
          color: @text-color-new;
        }
      }

      .action_delete {
        position: absolute;
        top: -8px;
        right: -8px;
        color: @error-color;
        border: 2px solid #fff;
        font-size: 16px;
        line-height: 1;
        z-index: 11;
      }

      &:hover {
        .lm_upload_item_mask {
          opacity: 1;
        }
        .check_main {
          display: block;
        }
      }

      &.lm_upload_item_error {
        border-color: @error-color;

        .lm_upload_item_mask {
          display: none;
        }

        .lm_upload_item_thumb_error {
          color: @error-color;
        }
      }
      .check_main {
        position: absolute;
        top: 0;
        left: 0;
        padding: 2px 4px;
        background: rgba(19, 21, 35, 0.45);
        border-top-left-radius: 8px;
        border-bottom-right-radius: 8px;
        font-size: 10px;
        color: #fff;
        display: none;
        &.active {
          display: block;
          background: @primary-color;
        }
      }
    }

    // 图卡列表
    &.lm_upload_item_picture {
      display: flex;
      gap: @gap-base;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: @gap-base;
      border: 1px solid @text-color-border;
      border-radius: 2px;
      cursor: pointer;
      transition: 0.3s;

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

      .picture_left {
        display: inline-flex;
        flex: 1;
        gap: @gap-base;
        align-items: center;

        .lm_upload_item_thumb {
          width: 48px;

          img {
            width: 100%;
            max-height: 80px;
          }
        }

        .lm_upload_item_name {
          flex: 1;
          color: @primary-color;
          font-size: @font-size-base;
          transition: 0.3s;
        }
      }

      .picture_right {
        display: flex;
        align-items: center;

        .action_delete {
          width: 24px;
          color: @text-color-secondary-new;
          text-align: center;
          transition: 0.3s;

          .anticon {
            font-size: 14px;
          }

          &:hover {
            color: @primary-color;
          }
        }
      }
      &.lm_upload_item_error {
        color: @error-color;
      }
    }
  }
}
