/*
* Fixed Layout
*/

$navbar-fixed-height: $navbar-min-height;
$navbar-fixed-line-height: $navbar-min-line-height;
$navbar-fixed-font-size: $navbar-min-font-size;

$navbar-fixed-panel-color: $navbar-panel-color;
$navbar-fixed-panel-background: $navbar-panel-background;
$navbar-fixed-shadow: $navbar-shadow;

html.rd-navbar-fixed-linked {
  body {
    padding-top: $navbar-fixed-height;
  }
}

.rd-navbar-fixed {
  display: block;

  // RD Navbar Brand
  .rd-navbar-brand {
    position: relative;
    display: inline-block;
    //padding-left: ($navbar-fixed-height - $navbar-fixed-line-height)*2;
    width: calc(100% - #{$navbar-fixed-line-height*2 + ($navbar-fixed-height - $navbar-fixed-line-height)/2*2 - 48px});
    padding: 0 0 0 ($navbar-fixed-height - $navbar-fixed-line-height)*2;

    .brand-name {
      display: inline-block;
      font-size: 20px;
      line-height: $navbar-fixed-line-height;
      span:nth-child(2){
        padding: 0;
        left: 0;
        line-height: inherit;
        position: relative;
        transform: translate(0,0);
      }

    }

    .brand-slogan {
      display: none;
    }
  }

  // RD Navbar Panel
  .rd-navbar-panel {
    display: block;
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    padding: ($navbar-fixed-height - $navbar-fixed-line-height) / 2;
    height: $navbar-fixed-height;
    color: $navbar-fixed-panel-color;
    box-shadow: $navbar-fixed-shadow;
    z-index: 999;

    &:before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 0;
      background: $navbar-fixed-panel-background;
    }
  }

  // RD Navbar Toggle
  .rd-navbar-toggle {
    display: inline-block;
  }

  // RD Navbar Collapse
  .rd-navbar-collapse {
    right: ($navbar-fixed-height - $navbar-fixed-line-height) / 2;
    z-index: 1000;

    &-items {
      top: 100%;
      right: 0;
      margin-top: 8px;
      @include transform(translateY(30px));
      opacity: 0;
      visibility: hidden;
    }

    &.active {
      .rd-navbar-collapse-items {
        opacity: 1;
        visibility: visible;
        @include transform(translateY(0));
      }
    }
  }

  // RD Navbar Search
  .rd-navbar-search {
    &-form, &-toggle {
      right: 4px;
    }

    &-form, .rd-navbar-live-search-results {
      position: fixed;
      margin-right: 0;
      margin-left: auto;
    }

    .rd-navbar-live-search-results {
      top: $navbar-fixed-height;
    }

    &-form {
      top: 0;
      left: $navbar-fixed-height;
      height: $navbar-fixed-height;
      z-index: 1000;

      &-input {
        padding: ($navbar-fixed-height - $navbar-fixed-line-height) 0;
        visibility: hidden;
        opacity: 0;
        height: $navbar-fixed-height;
        background: $navbar-fixed-panel-background;
        transition: .3s all ease;
        z-index: 1;

        input {
          display: block;
          width: 100%;
          padding: 0 $navbar-fixed-line-height 0 20px;
          height: $navbar-fixed-line-height - 8;
          font-size: 16px;
          line-height: 34px;
          color: $navbar-fixed-panel-color;
          background: darken($navbar-fixed-panel-background, 5%);
        }
      }

      &-submit {
        position: absolute;
        top: ($navbar-fixed-height - $navbar-fixed-line-height) / 2;
        right: 0;
        opacity: 0;
        visibility: hidden;
      }
    }

    &-toggle {
      &.active {
        opacity: 0;
        visibility: hidden;
      }
    }

    &.active {
      .rd-navbar-search-form-input,
      .rd-navbar-search-form-submit {
        opacity: 1;
        visibility: visible;
      }
    }

    @media (min-width: $screen-md-min) {
      &-form, .rd-navbar-live-search-results {
        max-width: 340px;
      }

      .rd-navbar-live-search-results {
        right: 4px;
      }
    }

    @media (min-width: $screen-xs-min) {
      .rd-navbar-brand {
        .brand-name {
          font-size: $navbar-fixed-font-size;
        }
      }
    }
  }

  // RD Navbar Nav
  .rd-navbar-nav {
    @include transform(translateX(-270px));

    li {

      &:hover,
      &.focus {
        > a, > a:hover {
          color: $navbar-nav-hover-color;
          background: $navbar-nav-active-background;
        }
        > .rd-navbar-submenu-toggle {
          //color: #fff;
          &:hover {
            cursor: pointer;
            //background: $primary;
            color: #666;
          }
        }
      }

      .rd-navbar-dropdown,
      .rd-navbar-megamenu {
        transition: .3s all ease;
      }

      &.opened {
        > .rd-navbar-dropdown,
        > .rd-navbar-megamenu {
          display: block;
        }
        > a {
          background: $navbar-nav-active-background;
          color: $navbar-nav-hover-color;
        }
        > .rd-navbar-submenu-toggle {
          //color: #fff;
          @include transform (rotate(180deg));
        }
      }

    }

    .rd-navbar-submenu-toggle {
      &::after {
        content: '\f078';
      }

      position: absolute;
      top: 17px;
      right: 0;
      margin-top: -17.5px;
      width: 55px;
      height: 44px;
      font: 400 10px "FontAwesome";
      line-height: 40px;
      text-align: center;
      //border-radius: 50%;
      transition: 0.4s all ease;
      //background: rgba(0, 0, 0, 0.1);
    }
  }

  // Hybrid Styles
  .rd-navbar-collapse,
  .rd-navbar-search-toggle {
    position: fixed;
    top: ($navbar-fixed-height - $navbar-fixed-line-height) / 2;
    height: $navbar-fixed-line-height;
    z-index: 1000;
  }

  // RD Navbar States
  &.active {
    .rd-navbar-nav {
      @include transform(translateX(0));
    }
  }

  &.rd-navbar--on-search {
    @media (max-width: 1199px) {
      .brand-name {
        opacity: 0;
        visibility: hidden;
        @include transform(scale(0.7));
      }
    }
  }

  &.rd-navbar--is-clone {
    display: none;

    .rd-navbar-panel {
      @include transform(translateY(-110%));
    }

    &.rd-navbar--is-stuck {
      .rd-navbar-panel {
        @include transform(translateY(0));
      }
    }
  }

  .rd-navbar-fixed--visible {
    display: block;
  }

  .rd-navbar-fixed--hidden {
    display: none;
  }
}