// ====================== Dropdown menus =======================

// Dropdown arrow and 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;

  &.caret-tp { 
    border-top-color: rgba(0,0,0,0.3);
  }
  
  // Caret Sizes
  &.caret-xs { border-width: 2px; }
  &.caret-sm { border-width: 3px; }
  &.caret-lg { border-width: 5px; }
}

// Dropdown wrapper
.dropdown {
  position: relative;
}

// Dropdown Menu Sizes
.dropdown-menu.dropdown-sm { min-width: 120px; }
.dropdown-menu.dropdown-sm li { margin-bottom: 0; }
.dropdown-menu.dropdown-sm li a {
  font-size: 13px;
  padding: 2px 12px;
}

.dropdown-toggle:focus {
  outline: 0;
}

// Dropdown menu
.dropdown-menu {
  position: absolute;
  top: 100% + 5px;
  left: 0;
  z-index: @zindex-dropdown;
  display: none;
  float: left;
  min-width: 160px;
  padding: 14px 0;
  margin: 2px 0 0;
  list-style: none;
  font-size: @font-size-small;
  text-align: left;
  background-color: @dropdown-bg;
  border: 0;
  border-radius: @border-radius-base;
  .box-shadow(1px 2px 0 rgba(0,0,0,0.1));
  background-clip: padding-box;

  &.pull-right {
    right: 0;
    left: auto;
  }

  // Dividers
  .divider {
    .nav-divider(@dropdown-divider-bg-dark);
  }
  
  // Links within Dropdown menu
  > li > a {
    display: block;
    padding: 5px 18px;
    clear: both;
    color: @dropdown-link-color;
    font-weight: normal;
    line-height: @line-height-base;
    white-space: nowrap;   }
}

// Dropdown menu dark
.bg-dark .dropdown-menu {
  background-color: @dropdown-bg-dark;
  border: 1px solid @dropdown-border-dark;
  .box-shadow(none);

  // Dividers in dropdown
  .divider {
    .nav-divider(@dropdown-divider-bg-dark);
  }

  // Links in dropdown menu
  > li > a {
    color: @dropdown-link-color-dark;
  }
}

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

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

// Dark Active state
.dropdown-menu > .active > a {
  &,
  &:hover,
  &:focus {
    color: @dropdown-link-active-color-dark;
    background-color: @brand-dark;
  }
}

// Disabled state
.dropdown-menu > .disabled > a {
  &,
  &:hover,
  &:focus {
    color: @dropdown-link-disabled-color;
  }
}
// Remove hover / focus effects
.dropdown-menu > .disabled > a {
  &:hover,
  &:focus {
    text-decoration: none;
    background-color: transparent;
    background-image: none;
    .reset-filter();
    cursor: not-allowed;
  }
}

// Open dropdown state
.open {
  // Show menu
  > .dropdown-menu {
    display: block;
  }

  > a {
    outline: 0;
  }
}

// Menu positioning
.dropdown-menu-right {
  left: auto;
  right: 0;
}
.dropdown-menu-left {
  left: 0;
  right: auto;
}

// Dropdown section header
.dropdown-header {
  display: block;
  padding: 3px 20px;
  font-size: @font-size-small;
  line-height: @line-height-base;
  color: @dropdown-header-color;
  white-space: nowrap;
}

// Backdrop to catch body clicks on mobile
.dropdown-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: (@zindex-dropdown - 10);
}

// Dropdown -> right
.pull-right > .dropdown-menu {
  right: 0;
  left: auto;
}


.dropup,
.navbar-fixed-bottom .dropdown {
  // Caret reverse
  .caret {
    border-top: 0;
    border-bottom: @caret-width-base solid;
    content: "";
  }
  .dropdown-menu {
    top: auto;
    bottom: 100%;
    margin-bottom: 1px;
  }
}


// Responsive styles
@media (min-width: @grid-float-breakpoint) {
  .navbar-right {
    .dropdown-menu {
      .dropdown-menu-right();
    }
    .dropdown-menu-left {
      .dropdown-menu-left();
    }
  }
}

