@use "variables" as *;

// trigger button
.qdr-search-input-btn {
  display: block;
  width: 90%;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  color: $color-primary;
  border: 1px solid $color-accent-light;
  border-radius: 4px;
  background: none;

  &:hover {
    color: var(--brand-secondary);
    box-shadow: 0 0 1px 0 var(--brand-secondary);
  }
}

// modal
.qdr-search {
  display: none;
  width: 100%;
  height: 100%;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  transition: opacity 0.4s ease-in;
  opacity: 0;
  background-color: $modal-overlay-background;
  overflow: auto;


  &.active {
    transition: opacity 0.4s ease-out;
    opacity: 1;
  }

  &__dialog {
    max-width: 800px;
    min-height: 316px;
    max-height: $modal-dialog-max-height;
    margin: 80px 10px;
    border-radius: 8px;
    background-color: #fefefe;
    @media (min-width: 992px) {
      margin-top: $modal-vertical-margin;
      margin-right: auto;
      margin-left: auto;
    }
  }

  &__header {
    padding: 1rem 0;
    position: relative;
    border-bottom: 1px solid #B2BFE8;
  }

  &__icon {
    display: block;
    width: 16px;
    height: 16px;
    padding: 28px 18px;
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    border: 0;
    background: url("../images/search.png") 50% 50% no-repeat;
    background-size: initial;
    filter: invert(20%) sepia(12%) saturate(4683%) hue-rotate(210deg) brightness(140%) contrast(92%);
  }

  &__close {
    position: absolute;
    z-index: 3;
    top: 20px;
    right: $padding-horizontal;
    cursor: pointer;
    color: $color-accent-dark;
    border: 0;
    background: transparent;
    text-shadow: 0 1px 0 #fff;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;

    &:hover {
      color: $color-primary;
    }
  }

  &__input {
    display: block;
    width: calc(100% - 30px - 52px);
    height: calc(1.5em + 0.75rem);
    padding: 0 30px 0 52px;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    color: $color-primary;
    border: 0;
    border-radius: .25rem;
    outline: none;
    background-color: #fff;
    background-clip: padding-box;
    font-family: $font-family;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;

    &:focus {
      border: 0;
      box-shadow: none;
    }
  }

  &__results {
    min-height: 180px;
    max-height: $modal-result-max-height;
    padding: 8px $padding-horizontal;
    overflow-y: scroll;
    scrollbar-width: none;
    &::-webkit-scrollbar {
      display: none;
    }
  }

  &__footer {
    display: flex;
    align-items: center;
    justify-content: end;
    padding: 18px $padding-horizontal 16px;
    text-align: right;
    border-top: 1px solid $color-accent-light;

    a {
      display: flex;
      text-decoration: none;
      color: $color-accent-dark;
      font-size: 14px;
      line-height: 1;

      &:hover {
        color: $color-primary;
      }
    }
  }

  &__logo {
    display: inline-block;
    width: 72px;
    height: 24px;
    margin-top: -6px;
    margin-right: 4px;
    margin-left: 8px;
    background: url("../images/logo_with_text.svg") 0 0 no-repeat;
    background-size: contain;
  }
}

// result
.qdr-search-result {
  display: block;
  margin: 8px 0;
  padding: 10px 8px;
  position: relative;
  text-decoration: none;
  color: $color-primary;
  border: 1px solid $color-accent-light;
  border-radius: 7px;

  &__icon {
    background: $file-icon 50% 50% no-repeat;
  }

  &__paragraph-icon {
    background: $paragraph-icon 50% 50% no-repeat;
  }

  &__icon, &__paragraph-icon {
    display: block;
    width: 20px;
    height: 20px;
    margin-top: -12px;
    margin-right: 8px;
    position: absolute;
    top: 50%;
    background-size: contain;
    fill: $color-primary;
    stroke: $color-primary;
    filter: $icons-filter;
  }

  //&:hover,
  &.active {
    color: white;
    background: $color-primary;

    .qdr-search-result__icon {
      background: $file-icon 50% no-repeat;
      background-size: contain;
      filter: $icons-hover-filter;
    }

    .qdr-search-result__paragraph-icon {
      background: $paragraph-icon 50% no-repeat;
      background-size: contain;
      filter: $icons-hover-filter;
    }
  }

  &__body {
    padding-left: calc(24px + 16px);

    h5 {
      margin: 0 0 7px;
      font-family: $font-family;
      font-size: 16px;
      font-weight: 400;
      line-height: 1;
    }

    p {
      margin: 0;
      color: $color-accent-dark;
      font-family: $font-family;
      font-size: 12px;
      line-height: 1.5;
    }
  }

  //&:hover .qdr-search-result__body,
  &.active .qdr-search-result__body {

    p {
      color: $color-accent-light;
    }

    b {
      text-decoration: underline;
    }
  }
}
