.Dropdown {
  position: relative;
}
.Dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--zindex-dropdown);
  display: none;
  min-width: 160px;
  padding: 8px 0;
  margin: 7px 0;
  background: var(--body-bg);
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--shadow-color);
  list-style: none;
  text-align: left;
  color: var(--text-color);
  font-size: 13px;
  line-height: 1.5;

  .open & {
    display: block;
  }

  > li {
    > a, > button, > span {
      padding: 8px 15px;
      display: flex;
      gap: 9px;
      align-items: center;
      width: 100%;
      color: var(--text-color);
      border-radius: 0;
      border: 0;
      background: none;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      box-shadow: none;
      text-align: left;
      font-size: 13px;
      font-weight: normal;
      text-decoration: none;
      cursor: pointer;
      line-height: 20px;

      .Button-icon {
        width: 16px;
        text-align: center;
        flex-shrink: 0;
      }

      &.hasSubContent {
        align-items: flex-start;
      }

      &.disabled {
        opacity: 0.4;
        background: none !important;
      }
    }
    > a, > button {
      &:hover {
        background: var(--control-bg);
      }
    }
    &.active {
      > a, > button, > .Dropdown-item {
        background: var(--control-bg);
      }
    }
  }
}
.Dropdown-menu--top {
  top: auto;
  bottom: 100%;
}
.Dropdown-menu--right {
  left: auto;
  right: 0;
}
.Dropdown-menu--inline {
  position: relative;
  display: block;
  box-shadow: none;
}
.Dropdown-header {
  padding: 10px 15px;
  color: var(--heading-color);
  text-transform: uppercase;
  font-size: 12px;
  font-weight: bold;
  margin-top: 8px;
  border-top: 1px solid var(--control-bg);
  white-space: nowrap;

  &:first-child {
    margin-top: -8px;
    border-top: 0;
  }
}
.Dropdown-separator {
  margin: 8px 0;
  background-color: var(--control-bg);
  height: 1px;
}


.dropdown-backdrop {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  z-index: calc(~"var(--zindex-dropdown) - 10");
}


.Dropdown--split {
  .Dropdown-toggle .Button-icon {
    display: none;
  }
  .Dropdown-toggle .Button-caret {
    display: inline;
    margin: 0;
  }

  &.itemCount1 {
    .Button {
      border-radius: var(--border-radius) !important;
    }
    .Dropdown-toggle {
      display: none;
    }
  }

  @media @tablet-up {
    &:not(.Dropdown--withMainAction) .Dropdown-menu li:first-child {
      &, + li.Dropdown-separator {
        display: none;
      }
    }
  }
}

.Dropdown--expanded() {
  .Dropdown-toggle {
    display: none;
  }
  .Dropdown-menu {
    display: block;
    border: 0;
    width: auto;
    margin: 0;
    padding: 0;
    min-width: 0;
    float: none;
    position: static;
    background: none;
    box-shadow: none;
  }
}


@media @phone {
  .Dropdown.open {
    z-index: var(--zindex-modal);
  }
  .Dropdown .Dropdown-menu {
    margin: 0;
    position: fixed;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    bottom: 0;
    top: auto;
    padding: 0;
    padding-bottom: 40px !important;
    display: block;
    max-height: 70vh;
    border-radius: 0;
    box-shadow: 0 2px 6px var(--shadow-color);
    visibility: hidden;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    transform: translate(0, 70vh);
    transition: transform 0.3s, visibility 0s 0.3s;

    > li {
      > a, > button {
        background: var(--body-bg);
        font-size: 16px;
        padding: 15px 20px;

        &.hasIcon {
          padding-left: 50px;
        }
        .Button-icon {
          font-size: 16px;
          margin-left: -30px;
        }
        &:hover {
          background: var(--control-bg);
        }
      }
    }
    > .active {
      > a, > button {
        &, &:hover {
          background: var(--primary-color) !important;
          color: #fff !important;
        }
      }
    }
    .open& {
      -webkit-transform: none;
              transform: none;
      visibility: visible;
      transition-delay: 0s;
    }
  }
  .Dropdown-separator {
    margin: 0;
  }
  .dropdown-backdrop {
    background: var(--overlay-bg);
    opacity: 0;
    transition: opacity 0.3s;
    transform: translate(0, 0);

    .open & {
      opacity: 1;
    }
  }
}

.AutocompleteDropdown {
  position: relative;
}

.GambitsAutocomplete {
  &-gambit {
    display: flex;
    align-items: center;

    > button {
      flex-grow: 1;
      cursor: pointer;
      gap: 4px;
      display: flex;
      align-items: center;
      padding: 8px 15px;
      margin: -8px 0 -8px -15px;
    }
    &-key {
      font-weight: bold;
    }
    &-value {
      color: var(--control-color);
    }
    &-actions {
      flex-shrink: 0;
      display: flex;
      color: var(--control-color);
      visibility: hidden;
      margin-inline-end: -14px;

      .Button {
        margin: -8px 0;
      }
    }
  }
}

li.active .GambitsAutocomplete-gambit-actions {
  visibility: visible;
}
