@import "../../assets/scss/style.scss";

.ktv-input {
  width: 100%;

  &.horizontal {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: space-between;

    .title {
      width: 50%;
      height: 40px;
      margin: 0;

      label {
        display: -webkit-box !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
    }

    .position-input {
      width: 50%;
    }
  }

  .title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 4px 8px;

    label {
      font-size: 14px;
      font-weight: 400;
      color: $black-100;
      text-transform: capitalize;
      letter-spacing: 0.1px;
    }

    svg {
      width: 16px;
      height: 16px;
      color: $black-50;
    }
  }

  .helper-text {
    display: block;
    margin: 4px 4px 0;
    font-size: 12px;
    font-weight: 400;
    color: $black-60;
    letter-spacing: 0.4px;

    p {
      margin: 0;
    }
  }

  .input {
    display: flex;
    gap: 4px;
    align-items: center;
    min-height: 40px;
    max-height: 40px;
    padding: 0 10px;
    background: $black-00;
    border: 1px solid $black-40;
    border-radius: 8px;
    transition: border 0.1s ease-in-out;

    svg {
      min-width: 16px;
      max-width: 16px;
      min-height: 16px;
      max-height: 16px;
    }

    .tabler-icon-alert-triangle-filled {
      color: $accent-danger-100;
    }

    .icon-close {
      color: $black-50;
      cursor: pointer;

      &:hover {
        color: $black-100;
      }
    }

    .tabler-icon-search {
      color: $black-100;
    }

    input {
      width: 100%;
      height: auto;
      padding: 0;
      font-size: 14px;
      font-weight: 400;
      background-color: transparent;
      border: none;

      &::placeholder {
        font-size: 14px;
        color: $black-40;
      }

      &:focus-visible {
        border: none;
        outline: none;
      }
    }

    &:hover {
      border-color: $black-50;
    }
  }

  &.is-error {
    .input {
      border: 1px solid $accent-danger-100;
    }

    .helper-text p {
      color: $accent-danger-100;
    }
  }

  &.is-focused {
    .input {
      border: 1px solid $accent-info-100;
    }
  }

  &.is-disabled,
  &.is-readonly {
    .input {
      cursor: no-drop;
      user-select: none;
      background-color: $black-20;
      border: 1px solid $black-30;
    }

    input:disabled,
    input:read-only {
      cursor: no-drop;
      user-select: none;
      background-color: $black-20;
    }
  }
}
