@import "../pages/mixins";

.search-component {

  z-index: var(--cover);
  width: 100%;

  & .input {
    width: 100%;

    & .icon {
      display: inline-block;
      position: absolute;
      margin: 9px 2px;
      width: 36px;
    }

    & input {
      @add-mixin font-sm;
      display: block;
      padding: 0.625rem 16px 0.625rem 50px;
      width: 100%;
      /* typography */
      @add-mixin body-font;
      line-height: 24px;
      /* theming */
      color: var(--white);
      background: transparent 14px center no-repeat;
      background-image: url("/images/icons/icon-search.svg");
      border: 1px solid var(--white);
      border-radius: 30px;
      opacity: 1;
      transition: background-color 0.5s ease;

      &::placeholder {
        @add-mixin font-xs;
        color: var(--white);
        @add-mixin body-font;
        opacity: 0.7;
        line-height: 24px;
      }

      &:focus {
        outline: none;
        background-color: var(--white);
        color: var(--accent);
      }
      &:focus::placeholder {
        color: var(--dark-2);
      }

      &.loading {
        background-image: url("/images/icons/icon-mini-loader.svg");
      }
    }
  }

  & .results {
    display: block;
    left: 0;
    list-style: none;
    margin: 0;
    opacity: 0;
    padding: 0;
    position: absolute;
    transition: opacity 0.5s;
    width: 100%;
    background-color: var(--light-1);
    top: 66px;
    & .result {
      padding: 2px 15px;
      transition: opacity 0.2s;
      height: 41px;
      display: flex;
      align-items: center;
      & a {
        @add-mixin font-xs;
        width: 100%;
        color: var(--light-2);
        display: block;
        text-decoration: none;
        @add-mixin body-font;
        color: #929293;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        & .icon-container {
          background-color: var(--white);
          border-radius: 50%;
          z-index: var(--foreground);
          width: 30px;
          height: 30px;
          display: flex;
          align-items: center;
          justify-content: center;
          & .icon {
            display: block;
            height: 16px;
            width: 16px;
          }
        }
        & .content {
          margin-left: 15px;
          max-width: 70%;
          text-transform: uppercase;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        & .separator {
          margin: 0 5px;
        }
        & .type {
          color: var(--accent);
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }

      &:active,
      &:hover,
      &.highlighted {
        opacity: 1;
        background-color: #e6e6e6;
      }
    }
    &:before {
      opacity: 1;
      content: "\A";
      position: absolute;
      left: 15px;
      top: -15px;
      width: 0;
      height: 0;
      border-style: solid;
      border-width: 0 15px 15px 15px;
      border-color: transparent transparent var(--light-1) transparent;
    }
    &.available {
      opacity: 1;
    }
    &.not-available {
      opacity: 0;
      &:before {
        opacity: 0;
      }
    }
  }

  &.active {
    & .results {
      opacity: 1;
    }
  }
}
