@import "../../styles/index.scss";

.ia-fileUpload-container {
  width: 550px;
  min-height: 274px;
  padding: 16px;
  border-radius: 16px;
  gap: 16px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background-color: #fff;
  box-shadow: 0px 0px 16px 2px #0000000f;

  .ia-fileUpload-container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .ia-fileUpload-container-header-title {
      display: flex;
      flex-direction: column;
      gap: 2px;
      .ia-fileUpload-container-header-title-primary {
        font-family: $fontFamily;
        font-size: 16px;
        font-weight: 800;
        line-height: 24px;
        color: $darkColor;
      }
      .ia-fileUpload-container-header-title-secondary {
        font-family: $fontFamily;
        font-size: 14px;
        font-weight: 500;
        line-height: 20px;
        color: $inputInfoColor;
      }
    }
    .ia-fileUpload-container-header-closeIcon {
      color: $textButtonFontColor;
      cursor: pointer;
    }
  }

  .ia-fileUpload-heading {
    font-size: 16px;
    font-weight: 800;
    line-height: 24px;
    text-align: left;
    color: #0d152c;
  }
  .ia-fileUpload-subHeading {
    margin-top: 2px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: left;
    color: #7a8294;
  }
}

.ia-fileUpload {
  position: relative;
  width: 100%;
  height: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border-radius: 8px;
  border: 1px dashed $accordionBgBackground;
  margin: auto;

  background-color: transparent;

  &::before {
    content: "";
    display: block;
    width: 55px;
    height: 55px;
    background: url("../../assets/file-upload.svg") no-repeat center / contain;
    flex-shrink: 0;
  }

  .ia-fileUpload-hr {
    font-size: 12px;
    font-weight: 500;
    line-height: 15px;
    text-align: center;
    color: #7a8294;
    width: 25px;

    &::before {
      content: "";
      position: absolute;
      width: 80px;
      height: 1px;
      left: calc(50% - 100px);
      top: 112px;
      background-color: #d9dde7;
    }
    &::after {
      content: "";
      position: absolute;
      width: 80px;
      height: 1px;
      right: calc(50% - 100px);
      top: 112px;
      background-color: #d9dde7;
    }
  }

  input {
    opacity: 0;
    position: absolute;
    top: -1px;
    left: -1px;
    width: calc(2px + 100%);
    height: calc(2px + 100%);
  }

  .ia-fileUpload-label {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    color: $mainFontColor;
  }

  &.ia-fileUpload-error {
    border: 1px solid $destructiveBg;
    box-shadow: 0px 0px 20px 0px #e155541f inset;

    &::before {
      background: url("../../assets/file-upload-error.svg") no-repeat center / contain;
    }

    .ia-fileUpload-label {
      color: #e15554;
    }
  }
  &.ia-fileUpload-disabled {
    opacity: 0.5;
    pointer-events: none;
  }

  &.ia-fileUpload-dragOver {
    background: none;
    border: 1px solid $primaryColor;
    box-shadow: 0px 0px 96px 23px #4259ee24 inset;
    justify-content: center;

    &::before {
      display: none;
    }

    .ia-fileUpload-dragOverLabel {
      color: $mainFontColor;
      font-weight: 700;
      font-size: 14px;
      line-height: 21px;
      font-family: $fontFamily;
    }

    button {
      color: #1849d6 !important;
      border-color: #1849d6 !important;
    }
  }

  .ia-fileUpload-label-secondary {
    color: $inputInfoColor;
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    text-align: center;
  }

  .ia-fileUpload-label-primary {
    display: flex;
    align-items: center;
    gap: 4px;
  }
}

.ia-fileUpload-validFileType {
  font-size: 14px;
  font-weight: 500;
  line-height: 16.1px;
  letter-spacing: 0.01em;
  color: #60697d;

  display: flex;
  align-items: center;
  gap: 4px;
  height: 16px;

  button {
    @include focus-visible-ring;
    &:focus {
      outline: none !important;
    }

    &[data-fileUpload="templateDownload"] {
      padding: 0;
    }
  }

  .ia-fileUpload-validFileType-container {
    position: relative;
    .ia-fileUpload-validFileType-arrow {
      cursor: pointer;
      margin-top: 2px;
      height: 11px;
      width: 11px;
      &.rotate {
        transform: rotate(180deg);
      }
    }
  }

  .ia-fileUpload-validFileType-menu {
    background-color: $whiteColor;
    padding-top: 16px;
    padding-bottom: 16px;
    position: absolute;
    bottom: 32px;
    left: 0;
    width: 100px;
    border-radius: 8px;
    box-shadow: 0px 0px 4px 0px $boxShadowColor;
    z-index: 99;
    display: flex;
    flex-direction: column;
    gap: 5px;

    .ia-fileUpload-validFileType-menu-item {
      font-size: 14px;
      font-weight: 500;
      line-height: 20px;
      text-align: left;
      color: $mainFontColor;
      cursor: pointer;
      padding-left: 18px;
      height: 25px;
      display: flex;
      align-items: center;
      &:hover {
        background-color: $textButtonPrimaryBg;
      }
    }
  }
}

.ia-fileUpload-previewItem {
  gap: 8px;
  border-radius: 12px;
  border: 1px solid #e7e7e7;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  padding: 16px;

  img {
    max-width: 36px;
    max-height: 36px;
  }

  .ia-fileUpload-previewItem-exceptProgress {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    z-index: 99;

    .ia-fileUpload-previewItem-details {
      display: flex;
      gap: 8px;

      .ia-fileUpload-previewItemIcon {
        width: 36px;
        height: 36px;

        &.xls,
        &.xlsx {
          background: url("../../assets/excel-icon.svg") no-repeat;
        }

        &.csv {
          background: url("../../assets/csv-icon.svg") no-repeat;
        }

        &.text {
          background: url("../../assets/text-icon.svg") no-repeat;
        }
      }

      .ia-fileUpload-previewItemIcon-failed {
        &.xls,
        &.xlsx {
          background: url("../../assets/failed-excel-icon.svg") no-repeat;
        }

        &.csv {
          background: url("../../assets/failed-csv-icon.svg") no-repeat;
        }
      }

      .ia-fileUpload-previewItem-info {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        gap: 2px;

        .ia-fileUpload-previewItem-name {
          font-size: 12px;
          font-weight: 700;
          line-height: 18px;
          color: #0b0b0b;
          &.ia-fileUpload-previewItem-name-failed {
            color: $inputInfoColor;
          }
        }

        .ia-fileUpload-previewItem-size {
          font-size: 12px;
          font-weight: 500;
          line-height: 16px;
          color: #6d6d6d;
          text-align: left;

          &.uploadFailed {
            color: $destructiveBg;
          }

          &.uploading {
            color: transparent;
          }
          &.disabled {
            color: $inputInfoColor;
          }
        }
      }
    }

    .ia-fileUpload-previewItem-actions {
      display: flex;
      align-items: center;
      gap: 14px;

      .ia-fileUpload-previewItem-action {
        color: $primaryColor;
        cursor: pointer;

        &.removeIcon {
          color: $textButtonFontColor;
        }
      }
    }
    .ia-fileUpload-previewItem-actions-failed {
    }
  }

  .ia-fileUpload-progress {
    .progressbar_layout {
      margin: 0;
    }
    .progressbar_label_container {
      margin: -24px 0 8px;
    }
  }

  .ia-fileUpload-previewItem:hover .ia-fileUpload-previewItem-del {
    opacity: 1;
  }
}

.ia-fileUpload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

.ia-fileUpload-validFileType-menu .MuiPaper-root {
  min-width: 226px;
  .ia-btn-icon {
    margin-bottom: 0;
  }
}

.ia-template-preview {
  background-color: $templatePreviewBgColor;
  border-radius: 8px;
  padding: 12px;
  // overflow: hidden;
  box-shadow: 0 0 16px 2px rgba(0, 0, 0, 0.06);

  .ia-template-preview__title {
    font-size: $normalFontSize;
    font-weight: 800;
    line-height: 21px;
    color: $darkColor;
    margin: 0 0 10px 0;
  }

  .ia-template-preview__grid-wrapper {
    overflow-x: auto;
    border-radius: 4px;
    border: 1px solid $borderColor;
  }

  .ia-template-preview__table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    table-layout: fixed;

    th,
    td {
      border: 1px solid $borderColor;
      padding: 0;
      text-align: center;
      font-size: $smallFontSize;
      line-height: 20px;
    }
  }

  .ia-template-preview__col-header {
    background-color: #f3f4f6;
    color: #6b7280;
    font-weight: 500;
    font-size: $smallFontSize;
  }

  .ia-template-preview__row-header {
    background-color: $progressBarBg;
    color: $breadCrumbsDot;
    font-weight: 500;
    font-size: $smallFontSize;
    width: 28px;
    min-width: 28px !important;
    max-width: 28px;
  }

  .ia-template-preview__cell {
    background-color: #fff;
  }

  .ia-template-preview__cell-value {
    font-weight: 600;
    font-size: $smallFontSize;
    color: $darkColor;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-inline: 2px;
  }
}
