.chat-window {
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;

  .chat-input-container {
    flex-shrink: 0;
    border-top: 1px solid var(--color-border-1);
    position: relative;

    .chat-message-list-to-bottom {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      cursor: pointer;
      background-color: var(--color-bg-1);
      border: 1px solid var(--color-border-2);
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute;
      top: -50px;
      left: 50%;
      transform: translateX(-50%);

      .chat-message-list-to-bottom-icon {
        font-size: 20px;
      }
    }

    .chat-input-tools {
      display: flex;
      align-items: center;
      gap: 10px;
      box-sizing: border-box;
      padding: 15px 15px 0 15px;

      .chat-input-select-image {
        :deep(.arco-upload-hide) {
          display: inline-block;
        }
      }
    }

    .chat-input {
      display: flex;
      align-items: end;
      gap: 10px;
      box-sizing: border-box;
      padding: 15px;

      .chat-input-image {
        position: relative;

        .chat-input-image-delete-btn {
          position: absolute;
          top: 3px;
          right: 3px;
          opacity: 0;
          transition: opacity 100ms linear;
        }

        &:hover {
          .chat-input-image-delete-btn {
            opacity: 1;
          }
        }
      }

      .chat-input-textarea {
        border: none;
        background-color: transparent;

        :deep(.arco-textarea) {
          font-size: var(--font-size-default);
          padding: 0;
        }
      }

      .chat-input-button {
        display: flex;
        align-items: center;
        gap: 10px;
      }
    }
  }
}

.chat-message-list-container {
  .chat-message-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
    padding: 15px;

    .chat-message-time {
      text-align: center;
      font-size: var(--font-size-xs);
      color: var(--color-text-3);
    }

    .chat-message {
      display: flex;
      align-items: flex-start;

      .chat-message-checkbox {
        flex-shrink: 0;
        margin-right: 15px;
        margin-top: 8px;
      }

      .chat-message-avatar {
        display: flex;
        align-items: center;

        // 右侧三角形
        &::after {
          content: '';
          display: inline-block;
          width: 0;
          height: 0;
          border-top: 5px solid transparent;
          border-bottom: 5px solid transparent;
          border-left: 8px solid transparent;
          border-right: 7px solid var(--color-fill-1);
        }
      }

      .chat-message-content {
        flex: 1;
        min-width: 0;
        max-width: max-content;
        white-space: pre-wrap; // 保留空格和换行
        line-break: anywhere;
        background-color: var(--color-fill-1);
        padding: 10px;
        border-radius: var(--border-radius-small);
        font-size: var(--font-size-default);
        min-height: 1rem;
        line-height: var(--line-height-md);
        display: flex;
        flex-direction: column;
        gap: 5px;

        .chat-message-md {
          display: flex;
          flex-direction: column;

          :deep(p) {
            margin-block: 0;
            margin: 0; // markerdown 中 p 标签去除外边距，防止消息框撑开太多
          }

          :deep(li) {
            white-space: normal; // 防止列表的 marker 和内容之间存在换行
          }

          :deep(.chat-message-loading) {
            font-weight: 500;
            color: rgb(var(--primary-6));
            animation: alternate-hide-show 900ms ease-in-out infinite;
          }

          @keyframes alternate-hide-show {
            0%,
            50%,
            100% {
              opacity: 1;
            }
            60%,
            90% {
              opacity: 0;
            }
          }
        }

        .chat-message-img {
          background-color: var(--color-fill-1);
          border-radius: var(--border-radius-small);
        }

        .chat-message-file-list {
          display: flex;
          flex-wrap: wrap;
          gap: 10px;
        }
      }
    }

    .chat-message-clear-context {
      cursor: pointer;

      :deep(.arco-divider-text) {
        font-size: var(--font-size-xs);
        color: var(--color-text-3);
        transition: color 100ms linear;
        background-color: var(--color-bg-1);
        padding: 0 5px;
      }

      &:hover {
        :deep(.arco-divider-text) {
          color: var(--color-text-2);
        }
      }
    }
  }
}
