/*
######################
### MOLECULE: input-bar ###
######################
*/

@import '_extends.scss';
@import '_functions.scss';
@import '_mixins.scss';
@import '_variables.scss';

@import 'components/atoms/_text.scss';
@import 'components/atoms/_color.scss';

.#{molecule('input-bar')} {
  $inputBar: &;
  z-index: 10;
  margin-left: 0;
  padding: 0 15px 30px 15px;

  @media (min-width: 768px) {
    padding: 0 0 30px 0;
  }

  &-title {
    font-size: 24px;

    @media (min-width: 768px) {
      padding: 25px;
      font-size: 28px;
    }

    @media (min-width: 1024px) {
      padding-left: 35px;
    }
  }

  &-container {
    z-index: 1;
    display: flex;
    height: 66px;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 10px 25px 0 transparentize(color('black'), 0.87);
    background: safeColor('white');

    @media (min-width: 1024px) {
      height: 76px;
      padding: 13px 15px;
    }
  }

  &-input {
    position: relative;
    width: 100%;

    &:after {
      content: '';
      display: block;
      position: absolute;
      bottom: 0;
      left: 20px;
      right: 20px;
      height: 2px;
      background: color('guardsman-red');
      opacity: 0;
      transition: opacity 0.3s ease-in-out;

      @media (min-width: 1024px) {
        left: 25px;
        right: 25px;
      }
    }

    &-field {
      height: 100%;
      width: 100%;
      padding: 0 10px;
      border: 0;
      border-radius: 4px 0 0 4px;
      font-family: 'Poppins',  system;
      font-size: 18px;
      font-weight: bold;

      @media (min-width: 768px) {
        padding: 0 15px;
      }

      @media (min-width: 1024px) {
        padding: 0 20px;
        font-size: 22px;
      }
    }
  }

  &-submit {
    cursor: pointer;
    @include txt-font-accent;
    min-width: 45px;
    margin: 0;
    border: 0;
    border-radius: 4px;
    font-family: 'Poppins',  system;
    text-align: center;
    font-size: 0;
    color: safeColor('white');
    background: safeColor('blue');

    @media (min-width: 600px) {
      min-width: 129px;
      font-size: 16px;
    }

    svg {
      transform: rotate(-90deg);
      height: 20px;
      width: 20px;
      fill: safeColor('white');

      @media (min-width: 600px) {
        display: none;
      }
    }

    &.loading {
      pointer-events: none;

      #{$inputBar}-submit-title {
        font-size: 0;
      }

      svg {
        display: none;
      }
    }

    .#{atom('pixi-analyzing-dots')} {
      font-size: 20px;
    }
  }

  &-label {
    @include txt;
    @include txt-2;
    z-index: -1;
    display: block;
    position: absolute;
    width: calc(100% - 30px);
    padding: 10px 15px 2px 20px;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-weight: bold;
    color: safeColor('white');
    background: safeColor('dark-red');
    opacity: 0;
    transform: translateY(-100%);
    transition: transform 0.3s ease, opacity 0.2s ease;

    @media (min-width: 768px) {
      padding: 10px 15px 2px 25px;
    }

    @media (min-width: 1024px) {
      width: 100%;
      padding: 10px 15px 2px 35px;
    }
  }

  &.error {
    #{$inputBar} {
      &-textbox:after {
        opacity: 1;
      }

      &-label {
        opacity: 1;
        transform: translateY(-8px);
      }
    }
  }
}
