@import '@/assets/variables.less';
@import '@/assets/mixins.less';

.chatInput {
  position: relative;
  z-index: 2;
  margin: 0 auto;
  padding: 0 12px 12px 20px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;

  &.singleModel {
    padding-top: 12px;
  }
}

.chatInput {
  &.disabled {
    opacity: 0.4;
  }

  &.error {
    border-color: #e63224;
  }
}

.chatInput:not(.disabled):not(.error):not(.loading) {
  &:hover {
    border-color: var(--border-hover-color);
    box-shadow: 0 4px 6px 0 var(--border-shadow-color);
  }

  &.focused {
    .gradient-border();
  }
}

.leftArea,
.rightArea {
  display: flex;
  align-items: center;
}

.uploadIcon {
  margin-right: 10px;
  font-size: 24px;
  color: #9595b9;
  cursor: pointer;

  &.disabled {
    opacity: 0.65;
    cursor: not-allowed;
  }
}
.chatTextareaText {
  padding: 1px 0;
}
.chatTextarea {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;

  .textarea {
    width: 100%;
    color: var(--primary-text-color) !important;
    line-height: normal;
    background: transparent !important;
    border: 0;
    outline: 0;
    resize: none;
    caret-color: var(--primary-text-color) !important;
    box-shadow: none !important;
    min-height: 28px;
    padding: 0 8px 0 0;
    font-size: 16px;
    line-height: 28px;
  }

  .textarea::placeholder {
    font-size: 16px;
    color: @text-gray-4;
  }

  .tools {
    display: flex;
    width: 100%;
    justify-content: space-between;
    flex-shrink: 0;
    align-items: center;
    line-height: 18px;
    margin-top: 1px;

    .count {
      display: flex;
      flex-direction: row;
      flex-shrink: 0;
      align-items: center;
      justify-content: flex-end;
      cursor: default;
      font-size: 14px;
      margin-right: 18px;
      line-height: 24px;
      color: #b6b6b6;
      .wordLen {
        font-size: 14px;
        line-height: 24px;
        color: @text-gray-4;
      }

      .limitMax {
        color: #e63224 !important;
      }
    }

    .chatBtn {
      flex-shrink: 0;
      font-size: 24px;
      color: #fff;
      cursor: pointer;
      width: 40px;
      height: 40px;
      line-height: 40px;
      border-radius: 10px;
      background: var(--send-btn-bg);

      .loadingIcon {
        cursor: not-allowed;
        opacity: 0.45;
      }

      &.disabled {
        cursor: not-allowed;
        background: var(--button-disabled-bg);
      }
    }
  }
}

.tabs {
  width: 100%;
  :global {
    .ant-tabs-nav {
      margin: 0 0 10px 0;
    }
    .ant-tabs-nav:before {
      display: none;
    }
    .ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn,
    .ant-tabs-tab:hover,
    .ant-tabs-tab-btn:focus,
    .ant-tabs-tab-remove:focus,
    .ant-tabs-tab-btn:active,
    .ant-tabs-tab-remove:active {
      color: var(--primary-color);
    }
    .ant-tabs-ink-bar {
      background-color: var(--primary-color);
      margin-left: 24px;
      width: 35px !important;
      height: 3px;
      border-radius: 6px;
    }
  }
}

.tipPop {
  :global {
    .ant-popover-inner-content {
      padding: 20px;
    }
    .ant-popover-inner {
      border-radius: 16px;
    }
    .ant-popover-content {
      max-width: 314px;
    }
  }

  h3 {
    font-size: 16px;
    color: var(--primary-text-color);
  }
  p {
    font-size: 12px;
    color: var(--description-text-color);
  }
  .img {
    cursor: pointer;
    max-width: 130px;
    border-radius: 8px;
    &:first-of-type {
      margin-right: 16px;
    }
    &:hover {
      border: 1px solid var(--primary-color);
    }
  }
  .tip {
    margin-top: 16px;
    color: var(--text-gray-1);
    font-size: 12px;
  }
}
.picInputContent {
  display: flex;
  width: 100%;
  gap: 15px;
}
.imgUpload {
  width: 85px;
  height: 85px;

  :global {
    .ant-upload-animate-inline-leave,
    .ant-upload-animate-inline-enter,
    .ant-upload-animate-inline-appear {
      animation: none !important;
      display: none;
    }
    .ant-upload-list-picture-card .ant-upload-list-item-info::before {
      left: 0;
    }
    .ant-upload-list-picture-card .ant-upload-list-item {
      border-radius: 16px;
    }
    .ant-upload-list-picture-card-container {
      width: 85px;
      height: 85px;
      background: #ffffff;
      transition: none !important;
    }
    .ant-upload.ant-upload-select-picture-card {
      width: 85px;
      height: 85px;
      background: #ffffff;
      border-radius: 16px;
      border: 1px solid rgba(0, 0, 0, 0.08);
    }
  }
}
.pdfBtn {
  margin-right: 15px;
  padding: 0 16px;
  color: var(--primary-text-color);
  img {
    width: 16px;
    height: 16px;
  }
  :global {
    .anticon:hover {
      color: var(--primary-color);
    }
  }
}
.downloadIcon:hover {
  color: var(--primary-color);
}
.pdfBtn:not(.pdfError):not(.pdfUploading):not(.pdfBtnUploaded) {
  &:hover {
    color: var(--primary-color);
  }
}
button.pdfBtn.pdfUploading {
  background: white !important;
  color: var(--primary-text-color);
}
.pdfError {
  color: var(--primary-text-color);
  font-size: 14px;
  background: white !important;
}

.pdfItem {
  width: auto;
  height: 40px;
  border-radius: 4px;
  background: var(--module-bg);
  margin-top: 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0 12px;
  cursor: pointer;
  img {
    width: 18px;
    height: 20px;
    margin-right: 12px;
  }
  p {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--primary-text-color);
    margin: 0 12px 0 0;
    user-select: none;
  }
}

.fadeIn {
  animation: fade-in 0.15s ease-in-out forwards;
}
.fadeOut {
  animation: fade-out 0.15s ease-in-out forwards;
}
.fadeOutLeft {
  animation: fade-out-left 0.15s ease-in-out;
}
@keyframes fade-in {
  0% {
    transform: translateY(20%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes fade-out {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(20%);
    opacity: 0;
  }
}
@keyframes fade-out-left {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-100%);
    opacity: 0;
  }
}

.tabLabel {
  display: flex;
  align-items: center;
  :global {
    .anticon {
      font-size: 20px;
      margin-right: 6px;
    }
  }
}

.avatar {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  width: 100%;
  height: 100%;
  img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
  &:hover {
    .prevBtn {
      opacity: 1;
    }
  }
  .prevBtn {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;

    :global {
      .anticon {
        color: white;
        font-size: 16px;
      }
    }
  }
}

.filename {
  white-space: nowrap;
}

.uploadBtn {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 6px;
  &:hover {
    color: var(--primary-color);
  }
}
