@use 'sass:math';
@use 'sass:color';

.ls-input {
  $root: &;
  display: flex;
  align-items: stretch;
  position: relative;

  &--disabled {
    opacity: 0.8;
    pointer-events: none;
    cursor: not-allowed;
    border-color: $color-disabled;
    overflow: hidden;
  }

  &--sm {
    min-height: $field-size-sm;

    & #{$root}__input {
      font-size: $font-size-sm;
    }

    & #{$root}__icon {
      width: $field-size-sm;
      font-size: $icon-size-sm;
    }
  }

  &--md {
    min-height: $field-size-md;

    & #{$root}__input {
      font-size: $font-size-md;
    }

    & #{$root}__icon {
      width: $field-size-md;
      font-size: $icon-size-md;
    }
  }

  &--lg {
    min-height: $field-size-lg;

    & #{$root}__input {
      font-size: $font-size-lg;
    }

    & #{$root}__icon {
      width: $field-size-lg;
      font-size: $icon-size-lg;
    }
  }

  &--light {
    background-color: $color-input-bg;
    color: $color-theme-light-font;
  }

  &--dark {
    background-color: $color-theme-dark;
    color: $color-theme-dark-font;
  }

  &--rounded {

    & #{$root}__content {

      &--left-padding {
        padding-left: $border-radius-main;
      }

      &--right-padding {
        padding-right: $border-radius-main;
      }
    }
  }

  &--rounded-lg {

    & #{$root}__content {

      &--left-padding {
        padding-left: $border-radius-large;
      }

      &--right-padding {
        padding-right: $border-radius-large;
      }
    }
  }

  &--round {

    & #{$root}__content {

      &--left-padding {
        padding-left: 4 * $sp;
      }

      &--right-padding {
        padding-right: 4 * $sp;
      }
    }
  }

  &__content {
    padding: $sp $field-sp;
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  &__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    &--clickable {
      cursor: pointer;

      &:hover {
        background-color: $color-hover;
      }
    }
  }

  &__input {
    cursor: text;
    width: 100%;
    border: 0;
    outline: 0;
    flex-grow: 1;
    padding: 0;

    &:-webkit-autofill {
      background-clip: text;
      -webkit-background-clip: text;
    }
  }

  &__label {
    display: block;
    color: $color-label;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: $font-size-input-label;
    line-height: $font-size-input-label;
  }
}
