//
// Dropdown
// --------------------------------------------------

.dropdown-menu {
  background-color: @dropdown-background;
  border: none;
  display: block;
  margin-top: 8px;
  opacity: 0;
  padding: 0;
  visibility: hidden;
  width: 100%;
  .box-shadow(none);
  .transition(.25s);
  
  &.typeahead {
    display: none;
    opacity: 1;
    visibility: visible;
    width: auto;
    margin-top: 2px;
  }

  // Opened state
  .open > & {
    margin-top: 18px;
    opacity: 1;
    visibility: visible;
  }
  li {
    &:first-child {
      dt + a {
        border-radius: 0;
      }
      > a {
        border-radius: 6px 6px 0 0;
        padding-top: 8px;
      }
    }

    &:last-child {
      > a {
        border-radius: 0 0 6px 6px;
        padding-bottom: 10px;
      }
    }

    &.active,
    &.selected {
      > a,
      > a.highlighted {
        background: @firm;
        color: @inverse;

        &:hover,
        &:focus {
          background: mix(@firm, black, 85%);
          color: @inverse;
        }
      }
    }
    > a {
      color: fade(@base, 75%);
      padding: 6px 15px 8px;
      text-decoration: none;
      .clearfix();
      .transition(background-color 0.25s);

      &:hover,
      &:active,
      &:focus {
        background: mix(@inverse, @base, 85%);
        color: inherit;
        outline: none;
      }

      &.highlighted {
        background: mix(@inverse, @base, 73.5%);
        color: @inverse;
        
        &:hover,
        &:focus {
          background: mix(@inverse, @base, 66%);
          color: @inverse;
        }
      }

      &:before {
        float: right;
        margin-top: 3px;
      }
    }

    // Submenu title
    dt {
      font-weight: 300;
      margin-bottom: 3px;
      margin-top: 12px;
      padding: 0 15px;
    }
  }
}

// Dropdown expands to top
.dropup,
.navbar-fixed-bottom .dropdown {
  .dropdown-menu {
    margin-bottom: 8px;
  }
  .dropdown-arrow {
    border-bottom: none;
    border-top: 8px outset mix(@inverse, @base, 94%);
    bottom: 100%;
    top: auto;
  }
}

// Second level nav
.navbar-fixed-bottom .nav > li > ul:before {
  border-bottom: none;
  border-top: 9px outset @base;
  bottom: 4px;
  top: auto;
}

.open {
  &.dropup {
    > .dropdown-menu {
      margin-bottom: 18px;
    }
    > .dropdown-arrow {
      margin-bottom: 10px;

      &.dropdown-arrow-inverse {
        border-top-color: @base;
      }
    }
  }
  > .dropdown-arrow {
    margin-top: 9px;
    opacity: 1;
  }
}

// Arrows
// --------------------------------------------------
.dropdown-arrow {
  border-style: solid;
  border-width: 0 9px 9px 9px;
  border-color: transparent transparent mix(@inverse, @base, 94%) transparent;
  height: 0;
  margin-top: 0;
  opacity: 0;
  position: absolute;
  right: 13px;
  top: 100%;
  width: 0;
  z-index: 10;  
  -webkit-transform: rotate(360deg); // Make corners smooth
  .transition(.25s);
}

// Alternate Color
// --------------------------------------------------
.dropdown-inverse {
  background-color: @base;
  color: mix(@inverse, black, 80%);
  padding: 4px 0 6px;

  li {
    margin: 0 4px -2px;
    &:first-child,
    &:last-child {
      > a {
        border-radius: 2px;
        padding-bottom: 7px;
        padding-top: 5px;
      }
      dt + a {
        border-radius: 2px;
      }
    }

    &.active,
    &.selected {
      > a {
        background: @firm;
        color: @inverse;
        position: relative;
        z-index: 1;
      }
    }
    dt {
      padding-left: 11px;
      padding-right: 11px;
    }
    .divider {
      margin-left: 11px;
      margin-right: 11px;
    }
    > a {
      border-radius: 2px;
      color: @inverse;
      padding: 5px 11px 7px;

      &:hover,
      &:active,
      &:focus {
        background: mix(@base, black, 85%);
      }
      &.highlighted {
        background: mix(@base, @inverse, 85%);
        &:hover,
        &:focus {
          background: mix(@base, @inverse, 75%);
        }
      }
    }
    .divider {
      background-color: mix(@base, white, 85%);
      border-bottom-color: mix(@base, white, 85%);
    }
  }
}