.search {
  height: 30px;
  width: 240px;
  position: relative;
  border-radius: 0.175rem;
  z-index: z('search'); 
  margin: 0 0.75rem;

  &[data-bgimg="true"] {
    @include themify($themes) {
      border: 2px solid transparent;
      background-color: transparent;
      &:focus-within {
        background-color: themed("search-background-color");
        border: 2px solid themed('search-border-active-color');
        @include box-shadow(0, 0, 0, 3px, themed('search-border-outline-color'));
      }
    }
  }

  &[data-bgimg="false"] {
    @include themify($themes) {
      border: 2px solid themed('search-border-color');
      background-color: themed("search-background-color");
      &:focus-within {
        border: 2px solid themed('search-border-active-color');
        @include box-shadow(0, 0, 0, 3px, themed('search-border-outline-color'));
      }
    }
  }

  @include box-shadow(0, 0, 0, 3px, transparent);
  @include transition(all, 0.2s, ease-in);
  @include flexbox();
  @include align-items(center);
  @include transition(all, 0.15s, ease);

  @media only screen and (max-width: 1280px) {
    width: 170px;
  }

  @media only screen and (max-width: 960px) {
    display: none;
  }

  .icon {
    padding: 0.45rem;
    @include flexbox();
    @include themify($themes) {
      color: themed("search-placeholder-color");
    }
  }

  .input {
    width: 100%;
    font-size: 0.9rem;
    border: none;
    outline: none;
    padding-right: 1rem;

    @include themify($themes) {
      color: themed('body-color');
      background-color: inherit;
      @include input-placeholder {
        color: themed("search-placeholder-color");
      }
    }
  }

  &-content {
    margin-top: 0.25rem;
    max-height: 350px;
    width: 325px;
    overflow: auto;
    a {
      text-decoration: none !important;
    }
  }

  &__highlight {
    @include themify($themes) {
      color: themed('search-highlight-color');
    }
  }

  &-result {
    position: absolute;
    width: 100%;
    height: calc(100% - 8px);
    z-index: z('navbar');
    margin: 4px 0;

    @include themify($themes) {
      background-color: themed('body-background-color');
    }

    &[data-display="block"] {
      display: block;
    }

    &[data-display="none"] {
      display: none;
    }

    &__header {
    }

    &__close {
      position: absolute;
      right: 0.25rem;
      top: 0.25rem;
      cursor: pointer;

      @include themify($themes) {
        color: themed('body-color');
        @include on-event {
          color: themed('active-font-color');
        }
      }
    }

    &__body {
      margin-top: 2.25rem;
      padding: 0 1rem;
      position: relative;
      display: block;
      overflow: auto;
      height: calc(100% - 3rem);

      @include themify($themes) {
        @include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
        @include webkit-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
      }
    }

    &__item {
      padding: 1rem 0;

      @include themify($themes) {
        border-bottom: 2px dashed themed('hr-color');

        &--title {
          font-family: $title-font;
          font-size: 1rem;
          margin: 0.25rem 0;
          color: themed('title-color');

          &::before {
            content: "📋 ";
          }
        }

        &--desc {
          font-size: 0.9rem;
          margin: 0.25rem 0;
          color: themed('body-color');
        }
      }
    }
  }
}

.menu-item {
  padding: 0.25rem;


  &__title {
    font-size: 1rem;
    @include themify($themes) {
      color: themed('body-color');
    }
  }

  &__desc {
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;

    @include truncate(325px);
    @include themify($themes) {
      color: themed('search-color');
    }
  }
}

#search-results {
  &.dd {
    display: none;
    z-index: z('navbar');

    &.is-active {
      display: inline-block;
      position: absolute;
      top: 40px;
      right: 0;
      width: 325px;
      border-radius: .175rem;
      
      @include box-shadow(0, 1px, 3px, 0, rgba(0, 0, 0, 0.4));
      @include themify($themes) {
        background-color: themed('back-background-color');
      }
    }
  }  

  .dd {
    &-content {
      @include flexbox();
      @include flex-direction(column);
      @include themify($themes) {
        background-color: themed('search-content-background-color');
        @include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
        @include webkit-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
      }
    }

    &-item {
      width: 100%;
      font-size: 1rem;
      padding: 0.35rem 0.6rem;


      @include on-event {
        @include themify($themes) {
          background-color: themed('search-hover-background-color');
        }
        border-bottom-left-radius: 0.1rem;
        border-bottom-right-radius: 0.1rem;        
      }

      &.is-active {
        @include themify($themes) {
          background-color: themed('search-hover-background-color');
        }
      }
    }    
  }
}

.mobile-search {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: z('modal');
  overflow: hidden;

  @include themify($themes) {
    @include webkit-scrollbars2(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
  }

  &__top {
    width: 100%;
    text-align: right;
    position: relative;
    height: $grid-nav-height;

    @include flexbox();
    @include align-items(center);
    @include themify($themes) {
      background-color: themed('navbar-background-color');
    }

    &--icon {
      width: 50px;
      cursor: pointer;
      position: absolute;
      right: 0;

      @include flexbox();
      @include align-items(center);
      @include justify-content(center);
      @include themify($themes) {
        color: themed('burger-menu-color');
        @include on-event {
          color: themed('active-font-color');
        }
      }
    }

    &--input {      
      width: calc(100% - 70px);
      height: 70%;
      outline: none;
      border: none;
      border-radius: 0.25rem;
      padding: 0 1rem;
      font-size: 1.1rem;
      @include themify($themes) {
        color: themed('body-color');
        background-color: themed('navbar-background-color');

        @include input-placeholder {
          color: themed("search-placeholder-color");
        }
      }
    }
  }

  &__body {
    width: 100%;
    height: calc(100vh - $grid-nav-height);
    overflow: auto;   

    @include themify($themes) {
      color: themed('body-color');
      background-color: themed('body-background-color');

      @include moz-scrollbars(themed('custom-scrollbar-foreground-color'), themed('custom-scrollbar-background-color'));
    }
  }

  &__btn {
    width: 100%;
    z-index: z('search-btn');
    background-color: transparent;
    
    @include flexbox();
    @include align-items(center);
    @include justify-content(center);
    @include themify($themes) {
      color: themed('burger-menu-color');  
      @include on-event {
        color: themed('active-font-color');   
      }
    }
  }

  &__content {
    @include themify($themes) {
      background-color: themed('search-content-background-color');
    }
    
    a {
      text-decoration: none !important;
    }
  }

  &__item {   
    padding: 0.5rem;   
    list-style-type: none;

    &--title {
      font-size: 1.2rem;      
      @include themify($themes) {
        color: themed('body-color');
      }

      &::before {
        content: "📋 ";
      }
    }

    &--desc {
      font-size: 0.9rem;
      padding: 0.25rem 0.5rem;
      
      @include themify($themes) {
        color: themed('search-color');
      }
    }
    
    @include on-event {
      @include themify($themes) {
        background-color: themed('search-hover-background-color');
      }
    }
  }
}
