// extracted from bootstrap dropdown.scss
//
//
// Dropdown menus
// --------------------------------------------------
$caret-width-base: 4px !default;
$zindex-dropdown: 1000 !default;
$dropdown-divider-bg: #e5e5e5 !default;
$dropdown-bg: white !default;
$dropdown-border: rgba(0, 0, 0, 0.15) !default;
$dropdown-link-color: $gray-dark !default;
$dropdown-link-hover-color: darken($gray-dark, 5%) !default;
$dropdown-link-hover-bg: whitesmoke !default;
$component-active-color: white !default;
$component-active-bg: $brand-primary-color !default;
$dropdown-link-active-bg: $component-active-bg !default;
$dropdown-link-active-color: $component-active-color !default;
$dropdown-link-active-bg: $component-active-bg !default;
$dropdown-link-active-bg: $component-active-bg !default;
$dropdown-link-disabled-color: $gray-light !default;

@mixin nav-divider($color: #e5e5e5) {
    height: 1px;
    margin: $line-height-computed / 2 - 1 0;
    overflow: hidden;
    background-color: $color;
}

@mixin reset-filter {
    filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}

// Dropdown arrow/caret
.caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 2px;
    vertical-align: middle;
    border-top: $caret-width-base solid;
    border-right: $caret-width-base solid transparent;
    border-left: $caret-width-base solid transparent;
}

// Prevent the focus on the dropdown toggle when closing dropdowns
.dropdown-toggle:focus {
    //outline: 0;
}

// The dropdown menu (ul)
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: $zindex-dropdown;
    display: none;
    // none by default, but block on "open" of the menu
    float: left;
    min-width: 160px;
    padding: 5px 0;
    margin: 2px 0 0;
    // override default ul
    list-style: none;
    font-size: $font-size-base;
    background-color: $dropdown-bg;
    border: 1px solid $dropdown-border;
    border-radius: $border-radius-base;
    @include box-shadow(0 6px 12px rgba(0, 0, 0, 0.175));
    background-clip: padding-box;
    // Aligns the dropdown menu to right
    //
    // Deprecated as of 3.1.0 in favor of `.dropdown-menu-[dir]`
    &.pull-right {
        right: 0;
        left: auto;
    }
    // Dividers (basically an hr) within the dropdown
    .divider {
        @include nav-divider($dropdown-divider-bg);
    }
    // Links within the dropdown menu
    > li > a {
        display: block;
        padding: 3px 20px;
        clear: both;
        font-weight: normal;
        line-height: $line-height-base;
        color: $dropdown-link-color;
        white-space: nowrap;
        // prevent links from randomly breaking onto new lines
    }
}

.or[dir='rtl'] {
    .dropdown-menu {
        right: 0;
    }
}

// Hover/Focus state
.dropdown-menu > li > a {
    &:hover,
    &:focus {
        text-decoration: none;
        color: $dropdown-link-hover-color;
        background-color: $dropdown-link-hover-bg;
    }
}

// Active state
.dropdown-menu > .active > a {
    &,
    &:hover,
    &:focus {
        color: $dropdown-link-active-color;
        text-decoration: none;
        outline: 0;
        background-color: $dropdown-link-active-bg;
    }
}

// Disabled state
//
// Gray out text and ensure the hover/focus state remains gray

.dropdown-menu > .disabled > a {
    &,
    &:hover,
    &:focus {
        color: $dropdown-link-disabled-color;
    }
}

// Nuke hover/focus effects
.dropdown-menu > .disabled > a {
    &:hover,
    &:focus {
        text-decoration: none;
        background-color: transparent;
        background-image: none;
        // Remove CSS gradient
        @include reset-filter;
        cursor: not-allowed;
    }
}

// Open state for the dropdown
.open {
    // Show the menu
    > .dropdown-menu {
        display: block;
    }
    // Remove the outline when :focus is triggered
    > a {
        outline: 0;
    }
}
