@import '../../../scss/mixin';

.prompt {
  pointer-events: auto;
  margin: 10px auto;
  position: relative;
  display: inline-flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  max-width: calc(100% - 16px);
  padding: 8px;
  background: white;
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.08);
  // overflow: hidden;
  transition: ease-in-out 350ms;
  transition-property: border-radius, width, height;
  z-index: 20;

  &.open {
    border-radius: 30px;
    width: auto;
    min-height: 56px;

    :global(.-trigger) {
      display: none;
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
  }

  &:not(.open) {
    border-radius: 8px;
    width: 48px;
    height: 48px;

    :global(.-form),
    :global(.-actions) {
      display: none;
      position: absolute;
      opacity: 0;
      pointer-events: none;
    }
  }
}

.form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  transition: ease-in-out 350ms;
  transition-property: opacity;
}

.control {
  flex: 1 0 0;
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 4px;
  min-width: Min(450px, calc(100vw - 130px));
  min-height: 40px;
  border-radius: 22px;
  border: 1px solid #F2EFEB;
  overflow: visible;
  outline: 2px solid transparent;
  outline-offset: 0;

  :global() {

    &:has(.-textarea:focus),
    &:has(.-textarea:focus-visible) {
      outline-color: currentColor;
    }

    .llm__busyIndicator {
      display: none;
      position: absolute;
      left: 50px;
      top: 50%;
      margin: -16px 0 0 0;
      pointer-events: none;

      &::before {
        background: var(--llm-input-accent);
        opacity: 0.4;
      }

      &>span {

        &::before,
        &::after {
          opacity: 0.4;
          background: var(--llm-input-accent);
        }
      }
    }

    &.streaming {
      .llm__busyIndicator {
        display: block;
      }
    }
  }
}
