// 颜色变量已移至全局 variables.scss
@use '../variables' as *;

.ai-chat {
  width: 4.0rem;
  height: 100vh;
  background: #f3f4f6;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  position: fixed;
  right: 0;
  top: 0;
  border-left: 1px solid #e5e7eb;

  &__banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(90deg, #94EF9E , #53D9C8 );
    color: #fff;
    padding: 0.1rem 0.16rem;
    font-size: 0.13rem;
    cursor: pointer;
    border-radius: 0.2rem;
    margin: 0.15rem;
    height: 0.41rem;
  }

  &__banner-arrow {
    font-size: 0.16rem;
    padding-bottom: 0.05rem;
    box-sizing: border-box;
  }

  &__header {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.16rem;
    border-bottom: 1px solid #e5e7eb;
  }

  &__avatar {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.2rem;
  }

  &__info {
    flex: 1;
  }

  &__name {
    font-size: 0.16rem;
    font-weight: 600;
    color: #1a1a2e;
  }

  &__desc {
    font-size: 0.12rem;
    color: #6b7280;
    margin-top: 0.02rem;
  }

  &__messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.16rem;
  }

  &__msg {
    margin-bottom: 0.12rem;
    display: flex;

    &--ai {
      justify-content: flex-start;
    }

    &--user {
      justify-content: flex-end;
    }
  }

  &__msg-bubble {
    border-radius: 0.1rem;
    padding: 0.12rem 0.14rem;
    font-size: 0.13rem;
    line-height: 1.6;
    max-width: 85%;
  }

  &__msg--ai &__msg-bubble {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
  }

  &__msg--user &__msg-bubble {
    background: #fff;
    color: #1a1a2e;
  }

  &__msg-title {
    font-weight: 600;
    font-size: 0.14rem;
    margin-bottom: 0.06rem;
    color: #1a1a2e;
  }

  &__msg-text {
    color: #6b7280;
    font-size: 0.12rem;
  }

  &__quick-questions {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    margin-top: 0.12rem;
    margin-bottom: 0.12rem;
  }

  &__quick-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.08rem;
    padding: 0.1rem 0.14rem;
    color: $text-middle;
    font-size: 0.12rem;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 80%;

    &:hover {
      background: #f9fafb;
      color: #374151;
    }

    /* AI 提问靠左 */
    &--ai {
      align-self: flex-start;
    }

    /* 用户提问靠右 */
    &--user {
      align-self: flex-end;
      background: #f0f3f6;
      border-color: #e0e3e6;
    }
  }

  &__input-area {
    display: flex;
    align-items: center;
    gap: 0.08rem;
    padding: 0.12rem 0.16rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
  }

  &__input {
    flex: 1;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 0.06rem;
    padding: 0.1rem 0.12rem;
    color: #1a1a2e;
    font-size: 0.12rem;
    outline: none;

    &::placeholder {
      color: #9ca3af;
    }

    &:focus {
      border-color: #9ca3af;
    }
  }

  &__send-btn {
    width: 0.36rem;
    height: 0.36rem;
    border-radius: 50%;
    background: #1a1a2e;
    border: none;
    color: #fff;
    font-size: 0.16rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;

    &:hover {
      background: #2e3142;
    }
  }
}
