@import '../../constants/styles';
@import '../../constants/overlay';

.SearchOverlay {
  @extend %overlay;
  right: 16px;
  top: 46px;
  width: 280px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-wrap: nowrap;

  // We need to override open/closed for searchOverlay since it involves
  // transitions and using visibility to open/close it will results in delay
  &.open {
    display: flex;
  }

  &.closed {
    display: none;
  }

  @include mobile {
    width: 100%;
    top: $top-bar-height-m !important;
    right: 0 !important;
    border-top: none;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  
  &.transformed {
    right: 0;
    width: 300px;
    border-color: transparent;
    border-radius: 0;
    background-color: transparent;
    transition: all .3s ease, background-color .3s ease .2s, border-color .3s ease .2s;

    @include mobile {
      width: 100%;
    }
  }

  @include mobile {
    right: 8px;
    top: calc(#{$top-bar-height-m} + 3px);
  }

  .wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;

    .main {
      display: flex;
      width: 100%;

      .input-wrapper {
        flex: 1;

        input[type='text'] {
          width: 100%;
          height: 30px;
          padding: 0 5px;
          border: 1px solid $gray12;
          border-top-left-radius: 5px;
          border-bottom-left-radius: 5px;
          border-top-right-radius: 0px;
          border-bottom-right-radius: 0px;
          border-right: none;
          box-sizing: border-box;
          font-size: 1em;

          &:focus {
            outline: none;
          }
        }
      }

      .number-of-results {
        display: flex;
        align-items: center;
        height: 30px;
        font-size: 12px;
        color: $gray20;
        border: 1px solid $gray12;
        border-left: none;
        background: white;

        div {
          padding-right: 5px;
        }
      }

      .button {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 30px;
        height: 30px;
        border: 1px solid $gray12;
        border: 1px solid var(--border-color);
        border-left: 0;
        background: $gray4;
        background: var(--secondary-color);
        cursor: pointer;

        &.next {
          border-top-right-radius: 5px;
          border-bottom-right-radius: 5px;
        }
      }

      .advanced {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        width: 32px;
        transition: all .2s ease;
  
        &.hidden {
          width: 0;
          opacity: 0;
          z-index: -1;
        }

        &:hover {
          cursor: pointer;
        }
  
        .Icon {
          transform: rotate(90deg);
          transition: opacity .2s ease;
        }
      }
    }

    .options {
      display: none;
      width: 100%;
      user-select: none;
      
      &.visible {
        display: flex;
        padding: 5px 0 0 20px;
      }
    }
  }
}
