@import "settings";

.nav > li {
  > a,
  > span {
    &:hover,
    &:focus {
      background-color: $nav-link-hover-bg;
    }
  }

  &.disabled {
    > a,
    > span,
    > button {
      color: $nav-disabled-link-color;

      &:hover,
      &:focus {
        color: $nav-disabled-link-hover-color;
      }
    }
  }
}

// Default navbar
.navbar-default {
  background-color: $navbar-default-bg;

  .navbar-nav {
    > li > a,
    > li > button,
    > li > span {
      color: $navbar-default-link-color;
      fill: $navbar-default-link-color;

      &:hover,
      &:focus {
        color: $navbar-default-link-hover-color;
        fill: $navbar-default-link-hover-color;
        background-color: $navbar-default-link-hover-bg;
      }
    }

    > .active > a,
    > .active > button,
    > .active > span,
    > li > a.is-active,
    > li > button.is-active,
    > li > span.is-active {
      &,
      &:hover,
      &:focus {
        color: $navbar-default-link-active-color;
        fill: $navbar-default-link-active-color;
        background-color: $navbar-default-link-active-bg;
      }
    }

    > .disabled > a,
    > .disabled > button,
    > .disabled > span {
      &,
      &:hover,
      &:focus {
        color: $navbar-default-link-disabled-color;
        fill: $navbar-default-link-disabled-color;
        background-color: $navbar-default-link-disabled-bg;
      }
    }

    &.main {
      margin-right: 5px;
    }
  }

  // Links within the dropdown menu
  .dropdown-menu {
    border-top-left-radius: 0;
    border-top-right-radius: 0;

    > li > a,
    > li > button,
    > li > span {

      &:hover,
      &:focus {
        background-color: $dropdown-link-hover-bg;
      }

      &.is-active {
        background-color: $navbar-default-dropdown-link-active-bg;
        color: $navbar-default-dropdown-link-active-color;
        font-weight: 500;

        &:hover,
        &:focus {
          cursor: default;
        }
      }
    }
  }


  .navbar-toggle {
    border-radius: 0;

    &:hover,
    &:focus {
      background-color: $navbar-default-toggle-hover-bg;
    }

  }

  .navbar-collapse {
    border-color: $navbar-default-border;
  }

  // Dropdown menu items
  .navbar-nav {
    // Remove background color from open dropdown
    > .open > a,
    > .open > button,
    > .open > span {
      &,
      &:hover,
      &:focus {
        background-color: $navbar-default-link-active-bg;
        color: $navbar-default-link-active-color;
      }
    }

    @include for-phone-only {
      // Dropdowns get custom display when collapsed
      .open .dropdown-menu {
        > li > a,
        > li > button,
        > li > span {
          color: $navbar-default-link-color;
          &:hover,
          &:focus {
            color: $navbar-default-link-hover-color;
            background-color: $navbar-default-link-hover-bg;
          }
        }
        > .active > a,
        > .active > button,
        > .active > span {
          &,
          &:hover,
          &:focus {
            color: $navbar-default-link-active-color;
            background-color: $navbar-default-link-active-bg;
          }
        }
        > .disabled > a,
        > .disabled > button,
        > .disabled > span {
          &,
          &:hover,
          &:focus {
            color: $navbar-default-link-disabled-color;
            background-color: $navbar-default-link-disabled-bg;
          }
        }
      }
    }
  }

}

@include for-tablet-landscape-down {
  .navbar-collapse .dropdown-menu {
    li {
      a,
      button,
      span:not(.caret) {
        color: #ffffff;

        &:hover,
        &:focus {
          background-color: $brand-secondary;
        }
      }
    }
  }

  .navbar-default .navbar-nav .open .dropdown-menu {

    > li > a,
    > li > button,
    > li > span {
      color: $dropdown-link-color;
      &:hover,
      &:focus {
        color: $dropdown-link-hover-color;
        background-color: $dropdown-link-hover-bg;
      }
    }
    > .active > a,
    > .active > button,
    > .active > span {
      &,
      &:hover,
      &:focus {
        color: $dropdown-link-active-color;
        background-color: $dropdown-link-active-bg;
      }
    }
    > .disabled > a,
    > .disabled > button,
    > .disabled > span {
      &,
      &:hover,
      &:focus {
        color: $dropdown-link-color;
        background-color: $dropdown-link-disabled-color;
      }
    }

  }

}

.navbar-default .dropdown img {
  border-radius: 50%;
}

.navbar-default .profile img {
  border: 2px solid white;
  width: 24px;
  height: 24px;
  overflow: hidden;
}

.navbar-search {

  .form-group {
    border-radius: $input-border-radius;
  }

  .form-submit {
    border-radius: 0 $input-border-radius $input-border-radius 0;
  }

}

.navbar__open-search-block {
  background: rgba($navbar-default-bg, 0.95);
}

.navbar-nav__icon {
  fill: $navbar-default-link-color;
}

@include for-tablet-landscape-up {

  .search-take-over .form-text {
    color: $navbar-default-link-color;

    &:focus {
      border-color: $navbar-default-link-color;
      box-shadow: 0 2px 0 0 $navbar-default-link-color;
    }

  }

}

// Navbar secondary
// -------------------------
.navbar-secondary {
  background-color: $brand-secondary;

  .navbar-nav {

    a, button, span:not(.caret) {
      color: #fff;
    }

    li.active a, li.active button {
      border-bottom-color: #fff;
    }

    li:not(.active) {
      button,
      a,
      span:not(.caret) {
        &:hover,
        &:focus {
          outline: none;
          background-color: rgba(0,0,0,0.3);
          border-bottom-color: rgba(0,0,0,0.3);
        }
      }
    }
  }
}

// Navbar scrollable
// -------------------------
.navbar-scrollable:after {
  background: linear-gradient(to right, rgba($brand-secondary,0), rgba($brand-secondary,1));
}

// Navbar brand if you use header multi line setting.
.header-top {
  > .container {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }

  .navbar-header {
    padding: 2rem 1rem;

    @include for-tablet-landscape-down {
      padding-top: 1rem;
      padding-bottom: 1rem;
    }
  }

  .navbar-header {
    margin-right: auto;
  }
}

.header-top,
.navbar-second-line {
  .navbar-brand {
    justify-content: flex-start;
  }
}
