/*****************************************************************************
 * Open MCT, Copyright (c) 2014-2024, United States Government
 * as represented by the Administrator of the National Aeronautics and Space
 * Administration. All rights reserved.
 *
 * Open MCT is licensed under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations
 * under the License.
 *
 * Open MCT includes source code licensed under additional open source
 * licenses. See the Open Source Licenses file (LICENSES.md) included with
 * this source code distribution or the Licensing information page available
 * at runtime from the About dialog for additional information.
 *****************************************************************************/

/******************************* EXPANDED SEARCH 2022 */
.c-gsearch {
  .l-shell__head & {
    // Search input in the shell head
    .c-search {
      background: rgba($colorHeadFg, 0.2);
      box-shadow: none;
      flex: 1 1 auto;
      body.mobile & {
        @include phonePortrait() {
          // This logic of expanding the search input upon click only happens in mobile portrait mode
          background: $colorHeadBg;
          width: 15%;
          &:hover {
            // When clicked, expand the search bar
            background-color: rgba($colorHeadFg, 0.2);
            width: 50vw;
            transition: width 120ms;
          }
        }
      }
    }
  }

  &__dropdown {
    @include menuOuter();
    display: flex;
    flex-direction: column;
    padding: $interiorMarginLg;
    min-width: 500px;
    max-height: 500px;
    top: $formInputH;
    z-index: 60;
    body.mobile & {
      // Makes search in mobile look less like an overlay, and more fullscreen.
      position: absolute;
      top: 25px;
      left: -12px;
      height: calc(100vh - 22px);
      min-width: 100vw;
      max-height: none;
      border-radius: 0px;
      box-shadow: none;
    }
  }

  &__results,
  &__results-section {
    flex: 1 1 auto;
  }

  &__results {
    // Holds n __results-sections
    padding-right: $interiorMargin; // Fend off scrollbar
    overflow-y: auto;

    > * + * {
      margin-top: $interiorMarginLg;
    }
    body.mobile & {
      // Add a margin to results so we have room for the close button
      margin-right: 20px;
    }
  }

  &__results-section {
    > * + * {
      margin-top: $interiorMarginSm;
    }
  }

  &__results-section-title {
    @include propertiesHeader();
  }

  &__result-pane-msg {
    > * + * {
      margin-top: $interiorMargin;
    }
  }

  &__results-close {
    // Close button that appears for mobile only
    display: none;
    body.mobile & {
      display: block;
    }
  }

  body.mobile & {
    width: 50vw;
    @include phonePortrait() {
      // This logic only appears for a mobile portrait mode
      width: 100%;
    }
  }
}

.c-gsearch-result {
  display: flex;
  padding: $interiorMarginSm 0;

  > * + * {
    margin-left: $interiorMargin;
  }

  + .c-gsearch-result {
    border-top: 1px solid $colorInteriorBorder;
  }

  &__type-icon,
  &__more-options-button {
    flex: 0 0 auto;
  }

  &__type-icon {
    color: $colorItemTreeIcon;
    font-size: 1.5em;

    // TEMP: uses object-label component, hide label part
    .c-object-label__name {
      display: none;
    }
  }

  &__more-options-button {
    display: none; // TEMP until enabled
  }

  &__body {
    flex: 1 1 auto;

    > * + * {
      margin-top: $interiorMarginSm;
    }

    .c-location {
      color: $colorBodyFg;
      font-size: 0.9em;
      opacity: 0.8;
    }
  }

  &__tags {
    display: flex;

    > * + * {
      margin-left: $interiorMargin;
    }
  }

  &__title {
    border-radius: $basicCr;
    color: pullForward($colorBodyFg, 30%);
    cursor: pointer;
    font-size: 1.15em;
    padding: 3px $interiorMarginSm;

    &:hover {
      background-color: $colorItemTreeHoverBg;
    }
  }

  .c-tag {
    font-size: 0.9em;
  }
}
