// Copyright (c) 2024, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

.form-control {
  border-radius: 0;
  border: 0;
}

@media screen and (max-width: 840px) {
  form.search {
    display: none;
  }
}

.navbar-right {
  padding-right: 60px;

  .tt-menu {
    right: 0;
    left: inherit !important;
    width: 540px;
    max-height: 280px;
    overflow-y: scroll;
  }
}

.tt-wrapper {
  position: relative;
  display: inline-block;

  .tt-input {
    position: relative;
    vertical-align: top;
  }

  .typeahead {
    padding: 16px 16px 16px 32px;
    width: 422px;
    height: 24px;
    font-size: 15px;
    background-color: var(--main-bg-color);
    color: var(--main-text-color);
    background-image: var(--search-icon-url);
    background-repeat: no-repeat;
    background-position: 2%;
    outline: 0;
    background-size: 20px;

    @media screen and (max-width: 840px) {
      padding: 17px 17px 17px 33px;
      width: 240px;
      height: 17px;
      border: 1px solid #f5f5f5;
      background-position: 3%;
      margin: 10px 10px 10px 9px;
    }
  }

  .tt-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 100;
    font-size: 14px;
    margin: 0;
    background-color: var(--main-bg-color);
    border: 1px solid var(--main-header-color);
    box-shadow: 0 5px 10px rgba(0, 0, 0, .2);
  }
}

.search-summary {
  margin-bottom: 10px;
}

a.tt-container {
  font-size: 16px;
  color: var(--main-hyperlinks-color);
}

.enter-search-message {
  position: sticky;
  top: 0;
  background-color: #AAA;
  padding: 0;
  font-size: 14px;
  margin: 0;
  clear: both;
  text-align: center;
  color: black;
}

.tt-suggestion {
  &:hover {
    cursor: pointer;
    color: #fff;
    background-color: #0097cf;

    .search-from-lib {
      color: #ddd;
    }
  }

  &.tt-cursor {
    color: #fff;
    background-color: #0097cf;

    .search-from-lib {
      color: #ddd;
    }
  }

  p {
    margin: 0;
  }
}

.tt-container {
  font-size: 14px;
  margin-bottom: 0;
  margin-top: 15px;

  .tt-container-text {
    color: var(--main-text-color);
  }
}

// Search results formatting for mini results below search bar.
.tt-search-results {
  .tt-container {
    margin-top: 5px;
    margin-bottom: 5px;
  }

  // Do not show the container as a section.
  .tt-container-text {
    display: none
  }

  .tt-suggestion {
    color: var(--main-text-color);
    margin-top: 5px;
    overflow: hidden;
    padding-left: 10px;
    padding-right: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tt-suggestion-title {
    font-size: 14px;
    padding-right: 5px;
  }

  .tt-suggestion-container {
    color: var(--main-keyword-color);
    font-size: 14px;
    font-style: italic;
    padding-right: 5px;
  }

  .one-line-description {
    color: var(--main-keyword-color);
    display: inline;
    margin-left: 0;

    &::before {
      content: open-quote;
    }

    &::after {
      content: close-quote;
    }
  }
}

// Search results formatting for full-page search experience.
#dartdoc-main-content {
  .tt-suggestion {
    color: var(--main-text-color);
    margin-top: 5px;
    margin-bottom: 10px;
    border-style: solid;
    border-color: lightgrey;
    border-width: 0.5px;
  }

  .tt-suggestion-title {
    display: block;
    font-weight: 500;
    margin: 4px 10px 0;
  }

  .one-line-description {
    display: block;
    margin: 2px 10px 3px;
  }

  // Do not show a result's container.
  .tt-suggestion-container {
    display: none;
  }
}

.search-body {
  border: 1px solid #7f7f7f;
  width: fit-content;
  max-width: 440px;
  box-shadow: 3px 3px 5px rgba(0, 0, 0, 0.1);
}
