/**
 *
 * @ai-apps/angular v2.152.0 | _product-switcher.scss
 *
 * Copyright 2014, 2023 IBM
 *
 * 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.
 */


//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

@import '../../globals/scss/functions';
@import '../../globals/scss/vars';
@import '../../globals/scss/typography';
@import 'theme';
@import 'functions';

/// UI shell product switcher
/// @access private
/// @group ui-shell
@mixin product-switcher {
  //--------------------------------------------------------------------------
  // Global Panel
  //--------------------------------------------------------------------------
  .#{$prefix}--panel--overlay {
    position: fixed;
    z-index: 1000;
    top: mini-units(6);
    right: 0;
    bottom: 0;
    width: mini-units(32);
    height: 100%;
    padding: 1rem 0;
    background-color: $shell-panel-bg-01;
    overflow-x: hidden;
    overflow-y: auto;
    transform: translate3d(100%, 0, 0);
    transition: transform 0.11s cubic-bezier(0.2, 0, 0.38, 0.9);
    will-change: transform;
  }

  .#{$prefix}--panel--expanded {
    box-shadow: 0 8px 16px 0 rgba($carbon--black-100, 0.25);
    transform: translate3d(0, 0, 0);
  }

  //--------------------------------------------------------------------------
  // Switcher - Search
  //--------------------------------------------------------------------------
  .#{$prefix}--product-switcher__search {
    padding: 0 mini-units(2);
    margin-bottom: mini-units(3);
  }

  .#{$prefix}--search--shell input {
    background-color: $carbon--gray-20;
  }

  //--------------------------------------------------------------------------
  // Switcher - Buttons
  //--------------------------------------------------------------------------
  .#{$prefix}--product-switcher__subheader,
  .#{$prefix}--product-switcher__all-btn {
    @include type-style('body-short-01');

    padding: mini-units(1);
    color: $shell-panel-text-01;
  }

  .#{$prefix}--product-switcher__subheader {
    padding-left: mini-units(7);
  }

  .#{$prefix}--product-switcher__all-btn {
    padding-left: mini-units(7);
  }

  .#{$prefix}--product-switcher__all-btn,
  .#{$prefix}--product-switcher__back-btn {
    display: inline-block;
    width: 100%;
    border: none;
    background: transparent;
    color: $shell-header-link;
    cursor: pointer;
    text-align: left;
  }

  .#{$prefix}--product-switcher__all-btn:hover,
  .#{$prefix}--product-switcher__back-btn:hover {
    text-decoration: underline;
  }

  .#{$prefix}--product-switcher__all-btn:focus,
  .#{$prefix}--product-switcher__back-btn:focus {
    box-shadow: inset 0 0 0 3px $shell-header-link;
    outline: none;
  }

  .#{$prefix}--product-switcher__back-btn {
    @include type-style('body-short-01');

    display: flex;
    align-items: center;
    padding: mini-units(1) mini-units(2);
  }

  .#{$prefix}--product-switcher__back-arrow {
    margin-right: mini-units(2);
    fill: $shell-header-link;
  }

  //--------------------------------------------------------------------------
  // Switcher - Product List
  //--------------------------------------------------------------------------
  .#{$prefix}--product-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
  }

  .#{$prefix}--product-list__item:hover {
    background: $carbon--gray-20;
  }

  .#{$prefix}--product-link {
    display: flex;
    width: 100%;
    flex-direction: row;
    align-items: center;
    padding: mini-units(1) mini-units(2);
    text-decoration: none;
  }

  .#{$prefix}--product-link:focus {
    box-shadow: inset 0 0 0 3px $shell-header-link;
    outline: none;
  }

  .#{$prefix}--product-switcher__icon {
    margin-right: mini-units(2);
  }

  .#{$prefix}--product-link__name {
    @include type-style('body-short-01');

    margin-left: 0.25rem;
    color: $shell-header-text-02;
    font-weight: 400;
  }

  .#{$prefix}--product-switcher__product-list .#{$prefix}--overflow-menu {
    display: none;
    width: mini-units(5);
    align-items: center;
    justify-content: center;

    &.#{$prefix}--overflow-menu--open {
      display: flex;
    }
  }

  .#{$prefix}--product-switcher__product-list .#{$prefix}--overflow-menu > svg {
    fill: $shell-header-text-02;
  }

  .#{$prefix}--product-switcher__product-list .#{$prefix}--overflow-menu:hover {
    background: $carbon--gray-30;
  }

  .#{$prefix}--product-switcher__product-list
    .#{$prefix}--overflow-menu:hover
    > svg {
    fill: $shell-header-text-02;
  }

  .#{$prefix}--product-switcher__product-list .#{$prefix}--overflow-menu:focus {
    display: flex;
    box-shadow: inset 0 0 0 3px $shell-header-link;
    outline: none;
  }

  .#{$prefix}--product-switcher__product-list
    .#{$prefix}--overflow-menu-options__option:hover {
    background: $carbon--white-0;
  }

  .#{$prefix}--product-list__item:hover .#{$prefix}--overflow-menu {
    display: flex;
  }
}

@include exports('product-switcher') {
  @if feature-flag-enabled('ui-shell') {
    @include product-switcher;
  }
}
