.dropdown {
  position: relative;
  perspective: 400px;

  [data-toggle="dropdown"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1em center;
    background-size: .8em;
    padding-inline-end: 2.5em !important;
    cursor: default;
    user-select: none;
  }

  &.open {
    z-index: 999;
    > .dropdown-menu {
      visibility: visible;
      transform: rotateX(0);
      opacity: 1;
    }
    > a {
      outline: 0;
    }
  }

  .dropdown-menu {
    position: absolute;
    visibility: hidden;
    top: 100%;
    left: 0;
    float: left;
    min-width: 160px;
    margin: 0;
    padding: 0;
    list-style: none;
    text-align: start;
    background-color: #fff;
    border: 1px solid var(--default-border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
    background-clip: padding-box;
    transform-origin: 0px 0px;
    transform: rotateX(-25deg);
    transition: 250ms;
    opacity: 0;

    &.dropdown-menu-left, &.dropdown-menu-start {
      left: 0;
      right: auto;
    }
    &.dropdown-menu-right, &.dropdown-menu-end {
      left: auto;
      right: 0;
    }

    .divider, hr {
      height: 1px;
      margin: 9px 0;
      overflow: hidden;
      background-color: #e5e5e5;
    }

    > li > a, > li > span,
    > li > label {
      display: block;
      padding: ~"calc(var(--gutter-size)/4)" var(--gutter-size);
      clear: both;
      font-weight: normal;
      line-height: 1.42857143;
      color: inherit;
      white-space: nowrap;
      &:hover,
      &:focus {
        text-decoration: none;
        color: #262626;
        background-color: #f5f5f5;
      }
    }

    > .active > a,
    > .active > a:hover,
    > .active > a:focus {
      text-decoration: none;
      outline: 0;
      background-color: var(--navigation-background-color-active);
    }

    > .disabled > a,
    > .disabled > a:hover,
    > .disabled > a:focus {
      color: #777;
    }

    > .disabled > a:hover,
    > .disabled > a:focus {
      text-decoration: none;
      background-color: transparent;
      background-image: none;
      filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
      cursor: not-allowed;
    }

    @media (min-width: @media-breakpoint-sm) {
      .navbar-form {
        min-width: 320px;
        margin: var(--gutter-size);
      }
    }
  }

// Multi-level dropdown
  .dropdown {
    .dropdown-menu {
      top: 0;
      left: 100%;
    }
  }

  @media (max-width: (@media-breakpoint-sm - 1px)) {
    .dropdown-menu {
      display: none;
    }
    &.open {
      z-index: 999;
      > .dropdown-menu {
        display: block;
      }
    }
  }
}

html[dir="rtl"] {
  [data-toggle="dropdown"] {
    background-position: left 1em center;
  }
  .dropdown-menu {
    left: auto;
    right: 0;
    &.dropdown-menu-start {
      left: auto;
      right: 0;
    }
    &.dropdown-menu-end {
      left: 0;
      right: auto;
    }
  }
}

.dropdown-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: 990;
  background: rgba(0, 0, 0, .15);
}

.navbar-fixed-bottom .dropdown .dropdown-menu {
  top: auto;
  bottom: 100%;
  margin-bottom: 2px;
}
