$utility-nav-height: 43px;

@use "00-base/configure" as *;

.ma__utility-nav {
  position: relative;

  @media ($bp-header-toggle-min) {
    background-color: $c-primary;
    color: $c-font-inverse;
  }

  &__items {

    @include ma-reset-list;

    @include ma-container;

    @media ($bp-header-toggle-max) {
      padding-left: 0;
      padding-right: 0;
    }

    @media ($bp-header-toggle-min) {

      @include ma-valign-block;
      height: $utility-nav-height;
      text-align: right;
    }
  }

  &__item {

    @media ($bp-header-toggle-max) {
      padding-right: 15px;
      position: relative;

      &:hover {
        background-color: $c-white;
        box-shadow: 0 0.25rem 0.5rem rgba(#000, 0.25);
      }
    }

    @media ($bp-header-toggle-min) {
      display: inline-block;
      padding-left: 30px;
      vertical-align: middle;
    }

    // Adjusting the style to match other items.
    // Separate this style from react.

    a.direct-link {
      padding: 1px 7px 2px 7px;

      @media ($bp-header-toggle-max) {
        padding: 11px 20px 9px 45px;
        width: 100%;
        text-align: left;
      }
    }
  }

  &__link,
  &__translate {
    display: block;
    font-size: $fonts-small;
    line-height: 1.45;
    color: $c-font-base;

    @media ($bp-header-toggle-min) {
      line-height: 2;
      transition: opacity .4s ease;
      color: $c-font-inverse;

      &:hover {
        opacity: .7;
      }
    }

    &:after {
      border-right-color: $c-primary-alt;
      border-bottom-color: $c-primary-alt;
    }

    svg {
      fill: $c-primary;

      @media ($bp-header-toggle-min) {
        fill: $c-font-inverse;
        opacity: .7;
        stroke: transparent;
      }
    }

    span {
      font-family: $fonts;
      font-weight: $fonts-normal;
    }
  }

  &__link {
    border: 0;
    background-color: transparent;

    @media ($bp-header-toggle-max) {
      padding: 11px 20px 9px 45px;
      width: 100%;
      text-align: left;
    }

    @media ($bp-header-toggle-max) {

      @include ma-chevron;

      &:after {
        position: absolute;
        right: 20px;
        top: 18px;
        border-right-color: $c-primary-alt;
      border-bottom-color: $c-primary-alt;
      }
    }

    & > svg,
    & > span {
      display: inline-block;
      vertical-align: middle;
    }

    & > svg {
      height: 16px;
      width: 20px;

      @media ($bp-header-toggle-max) {
        position: absolute;
          top: 50%;
          left: 20px;
        transform: translateY(-50%);
      }
    }

    & > span {

      @media ($bp-header-toggle-max) {
        display: block;
      }
    }
  }

  &__translate {
    position: relative;

    .goog-te-gadget {
      font-size: $fonts-small;
      font-weight: $fonts-light;
    }

    .goog-te-gadget-simple {
      font-size: $fonts-small;
      background-color: transparent;
      border: none;
      font-weight: $fonts-normal;

      @media ($bp-header-toggle-max) {
        padding: 11px 0 9px 45px;
        width: 100%;
      }

      & > img {
        margin-right: 15px;
        margin-bottom: 0;
        opacity: .7;

        @media ($bp-header-toggle-max) {
          margin-right: 1px;
          margin-bottom: 2px;
        }
      }

      & > span {
        display: inline-block;
        width: calc(100% - 20px); // width of the image
      }
    }

    .goog-te-gadget-simple .goog-te-menu-value {

      @include ma-chevron;
      color: $c-font-base;

      @media ($bp-header-toggle-min) {
        color: $c-font-inverse;

        &:after {
          opacity: .7;
        }
      }

      @media ($bp-header-toggle-max) {
        display: block;
        width: 100%;

        &:after {
          border-right-color: $c-primary-alt;
          border-bottom-color: $c-primary-alt;
        }
      }

      & > * {
        display: none;
      }

      & > :first-child {
        display: inline;
      }

      &:after {
        margin-left: .25em;
        transform: rotate(45deg) translateY(-45%);

        @media ($bp-header-toggle-max) {
          position: absolute;
            top: 45%;
            right: 10px;
        }
      }
    }
  }

  &__translate-icon {
    line-height: 1em;
    opacity: 0;
    position: absolute;
      left: 30px;
      top: 54%;
    transform: translateY(-50%);
    transition: opacity .001s;
    transition-delay: .5s;

    @media ($bp-header-toggle-max) {
      left: 20px;
    }

    & > svg {
      height: 18px;
      width: 20px;
    }
  }

  .has-rendered + &__translate-icon {
    opacity: 1;
  }

  &__content {
    display: block;
    margin-top: $header-mobile-controls-height;
    padding-left: 20px;
    position: fixed;
    top: 0;
    right: -300px;
    text-align: left;
    transition: visibility .5s ease, right .5s ease;
    width: 300px;
    z-index: $z-modal;
    color: $c-font-inverse;

    .translated-rtl &,
    .translated-ltr & {
      top: 40px;
    }

    .show-menu & {
      right: 0;
    }

    &.is-closed {
      visibility: hidden;
      right: -300px;
    }

    a {
      color: $c-font-inverse;
    }

    .ma__rich-text {
      max-width: 720px;

      a {
        border-color: $c-font-inverse;
      }
    }

    @media ($bp-header-toggle-min) {
      margin-top: 0;
      overflow: visible;
      background-color: $c-primary;
      padding-left: 0;
      position: absolute;
      left: 0;
      top: 0;
      transition: visibility .6s, top .6s;
      visibility: visible;
      width: 100%;

      &.is-closed {
        right: 0;
        transition: visibility .3s, top .3s;
      }
    }
  }

  &__container {

    @include ma-container;
    overflow-y: auto;
    padding-bottom: 20px;
    padding-top: 15px;
    position: relative;
    z-index: $z-dropdown;

    @media ($bp-header-toggle-min) {
      height: auto;
      padding-bottom: 0;
      padding-top: 0;
      margin-top: 10px;
    }

    @media ($bp-header-toggle-max) {
      height: calc(100vh - #{$header-mobile-controls-height});
      padding-left: 20px;
      padding-right: 20px;
      background-color: $c-primary;

      .translated-rtl &,
      .translated-ltr & {
        height: calc(100vh - #{$header-mobile-controls-height * 2});
      }
    }
  }

  &__close {

    @include ma-button-reset;
    cursor: pointer;
    font-size: $fonts-xsmall;
    font-weight: $fonts-bold;
    position: absolute;
    top: 0;
    right: 35px;

    @media ($bp-header-toggle-max) {
      display: none;
    }

    span {
      display: inline-block;
      text-transform: uppercase;
      vertical-align: middle;
      letter-spacing: $letter-spacing-large;
      color: $c-white;
      opacity: 0.7;
    }

    &:hover span {
      opacity: 1;
    }
  }

  &__close-icon {
    font-size: $fonts-4xlarge;
    line-height: .5em;
    margin-left: .2em;
    transform: rotate(45deg);
    font-weight: $fonts-light;
  }

  &__content-title {

    h2 {
      display: inline-block;
      vertical-align: middle;
      font-size: $fonts-larger;
      line-height: 1.45;
      font-weight: $fonts-normal;
      margin-bottom: 0;
      color: $c-white;
    }

    @media ($bp-header-toggle-min) {
      padding-bottom: 5px;
    }

    svg {
      opacity: 0.7;
      fill: $c-white;
    }

    & > span,
    & > svg {
      display: inline-block;
      vertical-align: middle;
    }

    & > svg {
      height: 20px;
      margin-right: 10px;
      width: 20px;

      &.svg-login {
        width: 25px;
      }
    }
  }
}
