/*
 *
 *  IN LOCO
 *  www.inlocomedia.com
 *
 *  Copyright 2016 - All Rights Reserved.
 *
 *  -------- SUPERNOVA ---------
 *   search-boxes component file
 *  ----------- *** ------------
 *
 */

@import "search-boxes_variables";


// Search-boxes

.sn-search-box {
  position: relative;
  min-height: $default-search-box-min-height;
  background-color: $default-search-box-background-color;
  @include shadow-2dp();

  &__selected,
  &__results {
    min-height: 40px;
    list-style: none;
    padding: 0;
    margin: 0;
    li {
      position: relative;
      min-height: 40px;
      font-size: 14px;
      color: #000;
      text-overflow: ellipsis;
      word-break: break-all;

      .sn-search-box__item-content {
        padding: 10px 0;
        &__image {
          width: 24px;
          height: 24px;
          border-radius: 50%;
          vertical-align: middle;
        }
        &__tag {
          margin-left: 8px;
          font-size: 12px;
          color: #BDBDBD;
        }
      }

      .sn-search-box__item-button {
        position: absolute;
        display: block;
        width: 22px;
        height: 22px;
        margin: auto 8px;
        padding: 0;
        border: 0;
        top: 0;
        bottom: 0;
        right: 4px;
        font-size: 16px;
        color: $default-search-box-item-button-color;
        background-color: transparent;
        outline: 0;
        border-radius: 50%;
        cursor: pointer;
        &:before {
          position: absolute;
          z-index: 1;
          top: 1px;
          left: 0;
          right: 0;
          bottom: 0;
          width: 22px;
          height: 22px;
          text-align: center;
          margin: 0 auto;
        }
        &.sn-search-box__item-button--top {
          top: 10px;
          bottom: auto;
        }
      }

      a {
        color: $palette-grey-400;
        &:hover {
          color: $color-black;
        }
      }

      .material-icons {
        font-size: 20px;
      }

    }

  }

  &__selected {
    width: 100%;
    li {
      padding: 4px 44px 4px 8px;
      border-bottom: 1px solid $default-search-box-line-divider;
      border-left: 4px solid $default-search-box-selected-color;
    }
    .sn-search-box__item-button {
      &:before {
        font-family: 'Material Icons';
        content: "\E14c";
      }
      &:hover,
      &:active {
        color: $default-search-box-item-button-color-active;
        background-color: $default-search-box-item-button-selected-background-color-active;
      }
    }
  }

  &__results {
    position: absolute;
    width: 100%;
    border-top: 1px solid $default-search-box-line-divider;
    background-color: white;
    z-index: 1;
    @include shadow-2dp();
    li {
      padding: 4px 40px 4px 12px;
      border-top: 1px solid $default-search-box-line-divider;
      &.hovered,
      &:hover,
      &:active  {
        cursor: pointer;
        background-color: $default-search-box-item-hover-background-color;
       .sn-search-box__item-button {
          color: $default-search-box-item-button-color-active;
          background-color: $default-search-box-item-button-results-background-color-active;
       }
      }
      &.sn-search-box__results--no-results {
        padding: 4px 12px;
        color: $palette-grey-400;
        &:hover,
        &:active {
          background-color: white;
          cursor: default;
        }
      }
      &.sn-search-box__results--action {
        padding: 4px 12px;
        margin: 0 auto;
        text-align: center;
        &:hover,
        &:active {
          background-color: white;
          cursor: default;
        }
      }
    }
    li:first-child {
      border: 0;
    }
    .sn-search-box__item-button {
      &:before {
        font-family: 'Material Icons';
        content: "\E145";
      }
    }
  }

  &__input-wrapper {
    position: relative;

    &__input {
      position: relative;
      display: block;
      width: calc(100% - 48px);
      height: 48px;
      padding: 0 36px 0 12px;
      border: 0;
      font-size: 14px;
      line-height: 20px;
      color: black;
      outline: none;
      background: #FFF;
      &.is-selected {
        color: black;
      }

      &--icon {
        display: block;
        position: relative;
        width: 100%;
        background-color: yellow;
        &:before {
          position: absolute;
          top: -32px;
          right: 8px;
          bottom: 0;
          text-align: center;
          width: 22px;
          height: 22px;
          font-size: 20px;
          font-family: 'Material Icons';
          content: "\e8b6";
          color: $default-search-box-item-button-color;
        }
      }

      &--spinner {
        width: 22px;
        height: 22px;
        position: absolute;
        bottom: 12px;
        right: 12px;
      }
    }
  }

  &__message {
    position: absolute;
    display: block;
    width: 100%;
    margin: 8px 0 0 4px;
    font-size: 12px;
    line-height: 1.4;
    &.sn-search-box__message--success {
      color: $default-search-box-message-color-success;
    }
    &.sn-search-box__message--warning {
      color: $default-search-box-message-color-warning;
    }
    &.sn-search-box__message--info {
      color: $default-search-box-message-color-info;
    }
    &.sn-search-box__message--danger {
      color: $default-search-box-message-color-danger;
    }
  }

  &--disabled {
    input {
      color: $default-search-box-disabled-color;
      background-color: $default-search-box-disabled-background-color;
    }
  }

  &--error {
    margin-bottom: $default-search-box-error-margin-bottom;
  }

  &--chips {
    box-shadow: none;

    &__input-wrapper__input {
      @include shadow-2dp();
    }

    &__selected {
      list-style: none;
      padding-left: 0;

      li {
        display: inline-block;

        &:not(:last-child) {
          margin-right: 10px;
        }
      }
    }
  }
}
