.search-listpage-icon {
  font-size: 16px;
  color: #999;
}

.search-input-group {
  width: 240px;
  vertical-align: bottom;

  .input-group-append.search-listpage-submit-group {
    position: relative;
    > button {
      width: 40px;
      border-color: $border-color;
    }

    .search-listpage-clear {
      z-index: 3;
      display: none;
      position: relative;
      right: 46px;
      z-index: 10;
      font-size: 0.6em;
      width: 22px;
      height: 22px;
      color: #ccc;
      padding: 8px;
    }
  }
}

.v2-crowi-header {
  .search-top {
    width: 100%;

    // for SearchSuggest
    @include media-breakpoint-up(lg) {
      position: relative;
    }

    .search-top-input-group {
      display: flex;
      position: relative;
      margin: 0;

      .search-top-icon,
      .search-top-clear {
        position: absolute;
        z-index: 10;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 32px;
        height: 100%;

        svg {
          margin-top: 0;
        }
      }

      .search-top-icon {
        left: 6px;
        pointer-events: none;
      }

      .search-top-input {
        transition: width ease .5s;
        @include media-breakpoint-down(sm) {
          max-width: none !important;
        }
        @include media-breakpoint-up(md) {
          max-width: 300px;
        }
        border-radius: 20px;
        padding-left: 40px;

        &:disabled {
          background: none;
        }
        &:focus {
          border-color: $border-color;
          box-shadow: none;
        }
      }

      .search-top-clear {
        right: 6px;
        color: #ccc;
      }
    }
  }
}

.search-suggest {
  width: 100%;
  @include media-breakpoint-down(md) {
    left: 1em;
    width: calc(100% - 2em);
  }
  position: absolute;
  margin-top: 2px;
  border: none;
  box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1), 0px 8px 20px rgba(0, 0, 0, 0.2);

  .searching {
    color: #666;
  }
}


.search-result {
  .search-result-list {
    nav {
      position: sticky;
      top: 0;
      max-height: 100vh;
      overflow-y: scroll;
      .nav {
        > li {
          padding: 0px 11px 0 8px;
          &.active {
            padding: 0px 8px;
            border-right: solid 3px #666;
            background: #f0f0f0;
          }
        }
      }
    }
  }

  .search-result-content {
    padding-bottom: 32px;

    .search-result-meta {
      margin-bottom: 16px;
      font-weight: bold;
    }
    .search-result-page {
      > h2 {
        font-size: 20px;
      }
      &:first-child > h2 {
        margin-top: 0;
      }

      .wiki {
        border: solid 1px #ccc;
        padding: 16px;
        border-radius: 3px;
        font-size: 13px;
      }
    }
  }
}

.search-toolbar {
  padding: 0 20px 12px;
  margin: 0 15px 16px;
  border-bottom: 1px solid $border-color;

  .search-meta {
    display: flex;
    align-items: center;
    padding: 0;
    margin: 4px 0;

    h3.search-keyword {
      margin: 0;
      padding-right: 10px;
      flex: 1;
      word-break: break-all;
    }
  }

  .search-navbar {
    position: relative;
    padding: 0;

    .navbar-nav {
      display: flex;
      flex-wrap: wrap;
      flex-direction: row;
      position: relative;
      margin: 0;

      > li {
        white-space: nowrap;
        margin: 4px 0;

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

        > a {
          padding: 6px 20px;
          border-radius: 20px;
          border: 1px solid transparent;

          &:hover {
            background: transparent;
            border-color: $border-color;
          }
        }

        &.active > a {
          color: white;
          border-color: $primary;
          background: $primary;
        }
      }
    }
  }

  .dropdown-menu,
  .navbar-nav {
    i {
      width: 14px;
      margin-right: 8px;
    }
  }
}

@include media-breakpoint-up(md) {
  .search-toolbar {
    display: flex;
    align-items: flex-end;
    margin-right: 15px;
    margin-left: 15px;

    .search-meta {
      padding-right: 40px;
    }
  }
}

// Smartphone and Tablet
@include media-breakpoint-down(sm) {
  .content-main {
    max-width: 100vw;
  }

  .search-toolbar {
    margin: 0;
    padding: 0 0 1em;
    .search-keyword {
      display: none;
    }
  }

  .search-result {
    .search-result-content {
      .search-result-page {
        > h2 {
          word-break: break-all;
          padding-top: 1em;
        }
        .wiki {
          h1, h2, h3, h4, h5, h6 {
            font-size: medium;
          }
          height: 250px;
          overflow: scroll;
          word-break: break-all;
        }
      }
    }
  }
}
