@import "./colors";
@import "./variables";
@import "./mixins";
@import "./icons";

$navbar-color: $charcoal-blue !default;
$navbar-brand: $primary-brand !default;
$navbar-height: 53px !default;
$navbar-app-padding-left: 25px !default;
$navbar-app-padding-right: 50px !default;
$navbar-text: $white !default;
$navbar-text-inactive: $gray-300 !default;
$navbar-fixed-shadow: 0px 2px 6px $shadow;

@mixin hc-navbar-fixed-top {
    top: 0;
    position: fixed;
    right: 0;
    left: 0;
    z-index: $zindex-navbar;
    box-shadow: $navbar-fixed-shadow;
}

@mixin hc-navbar {
    height: $navbar-height;
    background-color: $navbar-color;
    display: flex;
    font-size: 15px;
    line-height: 1;
}

@mixin navbar-brand {
    background-color: $navbar-brand;
    flex-basis: auto;
    height: 100%;
    width: 55px;
    min-width: 55px;
    display: flex;
    justify-content: center;
    align-items: center;
    .brand {
        & > img {
            height: 37px;
            width: 100%;
        }
        & > hc-icon {
            width: 100%;
            color: $white;
        }
        transition: background-color 0.25s ease;
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100%;
        cursor: default;
        min-width: 55px;
    }

    @include media-breakpoint-down(md) {
        display: none;
    }
}

@mixin navbar-app {
    height: 100%;

    a {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-left: $navbar-app-padding-left;
        padding-right: $navbar-app-padding-right;
        height: 100%;

        img {
            height: 30px;
            width: auto;
            padding-top: 2px;
        }

        &:focus {
            outline-offset: -8px;
        }
    }
}

@mixin hc-navbar-link-container {
    display: flex;
    list-style-type: none;
    margin: 0;
    padding: 0;
    padding-left: 0;
    overflow: hidden;
    width: 100%;
    @include media-breakpoint-down(md) {
        display: none;
    }
}

@mixin hc-navbar-ico-chevron-down {
    background-image: url($ico-chev-down-grey);
    background-repeat: no-repeat;
}

@mixin hc-navbar-mobile-ico-times {
    background-image: url($ico-times-white);
    background-repeat: no-repeat;
}

@mixin hc-navbar-mobile-ico-bars {
    background-image: url($ico-bars-white);
    background-repeat: no-repeat;
}

@mixin navbar-link {
    display: inline-block;
    height: 100%;
    box-sizing: border-box;
    padding: 22px 30px 0 30px;
    text-align: center;
    white-space: nowrap;
    color: $navbar-text-inactive;
    border-bottom: 5px solid transparent;
    transition: background-color 0.25s;
    outline: none;
    &:focus {
        outline: none;
        color: $navbar-text;
        background-color: darken($navbar-color, 8%);
    }
    &:hover {
        outline: none;
        font-weight: 400;
        color: $navbar-text;
        background-color: darken($navbar-color, 5%);
    }
    &:active,
    &.active,
    &.force-active {
        color: $navbar-text;
        font-weight: 600;
        border-bottom: 5px solid $navbar-brand;
    }

    &.active:hover,
    &.force-active:hover {
        font-weight: 600;
    }

    &:active {
        background-color: darken($navbar-color, 8%);
    }

    &.force-inactive {
        color: $navbar-text-inactive;
        font-weight: 400;
        border-bottom: 5px solid transparent;

        &:hover,
        &:focus {
            color: $navbar-text;
        }
    }

    // This piece of code allows to use the bold styling from the style guide, while
    // avoiding the css jitter that normally would accompany such an effect
    // https://stackoverflow.com/questions/556153/inline-elements-shifting-when-made-bold-on-hover
    &:before {
        display: block;
        content: attr(title);
        font-weight: 600;
        height: 1px;
        color: transparent;
        overflow: hidden;
        visibility: hidden;
        margin-bottom: -1px;
    }
}

@mixin hc-navbar-right-container {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    position: relative;
    margin-left: auto;

    @include media-breakpoint-down(sm) {
        div:nth-child(n+1){
            display: none;
        }
    }
}

@mixin navbar-item() {
    height: $navbar-height;
    color: $navbar-text;
    cursor: pointer;
    transition: background-color 0.25s;
    &:hover:not(.active),
    &.force-inactive:hover {
        outline: none;
        color: $navbar-text;
        background-color: darken($navbar-color, 5%);
    }
    &:focus {
        outline: none;
        background-color: darken($navbar-color, 8%);
    }
}

@mixin hc-navbar-icon {
    @include navbar-item();
    min-width: 53px !important;
    padding: 18px 0;
}

@mixin hc-navbar-icon-home-uri {
    cursor: pointer;
}

@mixin hc-navbar-username {
    @include navbar-item();
    padding: 2px 15px 0;
    > hc-icon {
        font-size: 12pt;
        padding-top: 2px;
    }
    display: flex;
    line-height: 1.2;
    align-items: center;
    white-space: nowrap;
}

@mixin hc-navbar-username-subtext {
    color: $slate-gray-300;
}

@mixin hc-navbar-vertical-separator {
    display: flex;
    align-items: center;
    &::after {
        content: "|";
        font-size: 18px;
        color: $navbar-text;
    }
}

@mixin hc-navbar-more-links {
    display: inline-block;
    white-space: nowrap;
    cursor: pointer;
    height: 100%;
    box-sizing: border-box;
    padding: 22px 30px 0 30px;
    text-align: center;
    color: $navbar-text-inactive;
    border-bottom: 5px solid transparent;
    transition: background-color 0.25s;

    hc-icon {
        margin-left: 5px;
        vertical-align: top;
        margin-top: 1px;
        margin-right: -10px;
        font-size: 13px !important;
    }

    &:focus {
        outline: none;
        color: $navbar-text;
        background-color: darken($navbar-color, 8%);
    }
    &:hover {
        outline: none;
        font-weight: 400;
        color: $navbar-text;
        background-color: darken($navbar-color, 5%);
    }
    &.active,
    &.force-active {
        color: $navbar-text;
        font-weight: 600;
        border-bottom: 5px solid $navbar-brand;

        &:hover {
            font-weight: 600;
        }
    }

    &:active {
        background-color: darken($navbar-color, 8%);
    }

    &.force-inactive {
        color: $navbar-text-inactive;
        font-weight: 400;
        border-bottom: 5px solid transparent;

        &:hover,
        &:focus {
            color: $navbar-text;
        }
    }

    &:hover,
    &.force-inactive:hover,
    &:focus,
    &.active,
    &.force-active {
        .hc-navbar-ico-chevron-down {
            background-image: url($ico-chev-down-white);
            background-repeat: no-repeat;
            display: inline-block;
        }
    }

    // This piece of code allows to use the bold styling from the style guide, while
    // avoiding the css jitter that normally would accompany such an effect
    // https://stackoverflow.com/questions/556153/inline-elements-shifting-when-made-bold-on-hover
    &:before {
        display: block;
        content: attr(title);
        font-weight: 600;
        height: 1px;
        color: transparent;
        overflow: hidden;
        visibility: hidden;
        margin-bottom: -1px;
    }
}

@mixin hc-navbar-mobile-menu {
    background-color: $slate-blue;
    color: $slate-gray-200;
    min-width: 55px;
    width: 55px;
    flex-basis: auto;
    height: 100%;
    justify-content: center;
    align-items: center;
    margin-left: 0;
    cursor: pointer;
    display: none;

    hc-icon {
        font-size: 25px !important;
        height: 25px !important;
    }

    .hc-navbar-mobile-ico-bars {
        width: 22px !important;
    }

    .hc-navbar-mobile-ico-times {
        width: 17px !important;
    }

    @include media-breakpoint-down(md) {
        display: flex;
    }
}

/* Mobile menu */

@mixin hc-navbar-mobile-menu-dropdown() {
    background-color: $slate-blue;
    visibility: hidden;
    margin-top: 53px;
    padding-top: 15px;
    position: fixed;
    overflow-y: scroll;
    height: calc(100vh - 53px);
    width: 100%;
    z-index: $zindex-navbar-menu;

    @include media-breakpoint-down(md) {
        display: inline;
        visibility: visible;
    }
}

@mixin hc-navbar-mobile-hr() {
    background-color: lighten($slate-blue, 20%);
    border: 0;
    height: 1px;
    margin: 0 0 0 5% !important;
}

@mixin hc-navbar-mobile-a() {
    text-decoration: none;
    color: inherit !important;
    height: 100%;
    display: flex;
    align-items: center;
}

@mixin hc-navbar-mobile-list-item() {
    color: $slate-gray-200;
    cursor: pointer;
    display: block;
    visibility: inherit;
    padding-left: 2%;
    transition: background-color 0.25s ease;

    &:hover {
        background-color: darken($slate-blue, 5%);
    }

    &:focus {
        outline: none;
    }
}

@mixin hc-navbar-mobile-list-text() {
    height: 100%;
    justify-content: center;
}

@mixin hc-navbar-mobile-active-link() {
    background-color: darken($slate-blue, 5%);
    border-left: 8px solid $primary-brand;
    color: $white;
    font-weight: bold;
}

@mixin hc-navbar-mobile-active-link-content() {
    padding-left: 4px;
}

@mixin hc-navbar-cobrand( $color ) {
    display: flex;
    align-items: center;
    padding: 0 15px;
    @if $color == 'light' {
        background-color: $white;
    } @else {
        border-left: 1px solid darken($navbar-color, 10%);
    }

    @include media-breakpoint-down(md) {
        display: none;
    }
}
