.search-typeahead {
  position: relative;
  width: 100%;
  // corner radius
  border-top-right-radius: $border-radius;
  border-bottom-right-radius: $border-radius;
  .rbt-input-main {
    padding-right: 36px;
  }
  .search-clear {
    position: absolute;
    top: 4px;
    right: 4px;
    z-index: 3;
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 0;
  }

  .rbt-menu {
    max-height: none !important;
    margin-top: 3px;

    li a span {
      .page-path {
        display: inline;
        padding: 0 4px;
        color: inherit;
      }

      .page-list-meta {
        font-size: 0.9em;
        color: $gray-400;

        > span {
          margin-right: 0.3rem;
        }
      }
    }
  }
}

// styles for admin user search
.admin-user-page {
  .search-typeahead {
    .search-clear {
      top: 7px;
      right: 4px;
    }
  }
}

// input styles
.grw-global-search {
  .dropdown-toggle {
    min-width: 95px;
    padding-left: 1.5rem;
  }

  .search-typeahead {
    .rbt-menu {
      @extend .dropdown-menu-right;
      @extend .dropdown-menu-md-left;
      @include media-breakpoint-down(sm) {
        left: auto !important;
        width: 90vw;
      }
    }
  }

  // using react-bootstrap-typeahead
  // see: https://github.com/ericgio/react-bootstrap-typeahead
  .rbt-input.form-control {
    height: 30px;
    .rbt-input-wrapper {
      margin-left: 8px;
    }
  }

  .form-group:not(.has-error) {
    .rbt-input.form-control {
      border: none;
    }
  }

  .grw-shortcut-key-indicator {
    position: absolute;
    top: 0;
    right: 4px;

    display: flex;
    align-items: center;
    height: 30px;

    code {
      padding-right: 0.4rem;
      padding-left: 0.4rem;
    }
  }
}

// layout for GlobalSearch
.grw-global-search-top {
  // centering on navbar
  top: $grw-navbar-height / 2;
  left: 50vw;
  z-index: $zindex-fixed + 1;
  transform: translate(-50%, -50%);

  .rbt-input.form-control {
    width: 200px;
    transition: 0.3s ease-out;

    // focus
    &.focus {
      width: 300px;
    }

    @include media-breakpoint-up(md) {
      width: 300px;
    }
    @include media-breakpoint-up(lg) {
      // focus
      &.focus {
        width: 400px;
      }
    }
    @include media-breakpoint-up(xl) {
      width: 350px;
      // focus
      &.focus {
        width: 450px;
      }
    }
  }
}

// layout
.on-search {
  .page-wrapper {
    padding-bottom: unset;
  }

  .search-control-include-options {
    .card-body {
      padding: 5px 10px;
    }
  }
  .search-result-list {
    .search-result-list-scroll {
      // subtract the height of GrowiNavbar + (SearchControl component + other factors)
      height: calc(100vh - (($grw-navbar-height + $grw-navbar-border-width) + 110px));
      overflow-y: scroll;

      @include media-breakpoint-down(sm) {
        height: calc(100vh - (($grw-navbar-height + $grw-navbar-border-width + $grw-navbar-bottom-height) + 123px));
      }
    }

    .search-result-keyword {
      font-size: 17.5px;
      font-weight: bold;
    }
    .search-result-select-group {
      > select {
        max-width: 8rem;
      }
    }

    // list group
    .page-list {
      // not show top label in search result list
      .page-list-meta {
        .top-label {
          display: none;
        }
      }
    }
  }

  .search-result-content {
    .search-result-content-nav {
      min-height: $grw-subnav-search-preview-min-height;
      overflow: auto;

      .grw-subnav {
        min-height: inherit;
      }
    }

    .search-result-content {
      height: calc(100vh - ($grw-navbar-height + $grw-navbar-border-width));

      > h2 {
        margin-right: 10px;
        font-size: 22px;
        line-height: 1em;
      }

      &:first-child > h2 {
        margin-top: 0;
      }

      .search-result-content-body-container {
        overflow-y: auto;

        .wiki {
          padding: 16px;
          font-size: 13px;
        }
      }
    }
  }
}

// support for your search
.grw-search-table {
  caption {
    display: table-header-group;
  }
}

@include media-breakpoint-down(sm) {
  .grw-search-table {
    th {
      text-align: right;
    }

    td {
      overflow-wrap: anywhere;
      white-space: normal !important;
    }

    @include media-breakpoint-down(xs) {
      th,
      td {
        display: block;
      }

      th {
        text-align: left;
      }

      td {
        padding-top: 0 !important;
        border-top: none !important;
      }
    }
  }
}
