#ariadne-menu {
  flex: 0 1 max-content;
  width: max-content;
  max-width: 100%;
  padding: 0.4em;
  margin: 0;

  display: flex;
  align-items: center;
  gap: 0.25em;
  min-width: 0;

  background-color: var(--background-main);
  border-radius: var(--grid-corners-radius);
  /* border: 1px solid rgba(255, 255, 255, 0.02); */

  .forminput {
    background: none;
    select {
      background: none;
      color: #fff;
      color-scheme: dark;
      /* not on firefox,
      for now firefox will have full width selects */
      field-sizing: content;
    }
  }
}

.dropmenu {
  --hover-bg: rgba(255, 255, 255, 0.1);
  position: relative;
  flex: 0 0 auto;
  min-width: 0;

  button {
    background: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 0.5em;
    text-align: left;
  }

  .droparrow {
    display: inline-block;
    width: 0.33em;
    aspect-ratio: 1;
    --br: 1px solid #fff;
    border-left: var(--br);
    border-bottom: var(--br);
    transform-origin: center center;
    transform: rotate(-45deg) translate(50%, 0);
    opacity: 0.33;
  }

  .dropmenu-choices {
    position: absolute;
    z-index: 1;
    top: 0;
    left: 0;
    width: auto;
    min-width: 25ch;
    margin: 2.25em 0 0 0;
    padding: 0.25em;
    max-height: 20em;
    overflow: hidden;

    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    gap: 0.5em;

    border-radius: var(--grid-corners-radius);
    background-color: var(--background-main);
    color: var(--text-primary);

    opacity: 0;
    pointer-events: none;

    transition: opacity var(--spd-insp) ease;

    box-shadow: 0 1em 1em rgba(0, 0, 0, 0.33);

    .dropmenu-choices-list {
      overflow: hidden;
      overflow-y: scroll;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      justify-content: start;
      gap: 0.25em;
    }

    .dropmenu-search {
      display: flex;
      align-items: center;
      gap: 0.5em;
      border: 1px solid rgba(255, 255, 255, 0.05);

      box-shadow: 0 0.2em 0.6em rgba(0, 0, 0, 0.125);
      border-radius: var(--inner-border-radius);

      color: #fff;
      padding: 0.25em 0.5em;
      .icon {
        font-size: 1em;
        opacity: 0.33;
      }
      input {
        border: none;
        border-radius: 0;

        background: none;
        color: #fff;
        width: 100%;
        padding: 0em;
      }
    }
  }

  .dropmenu-choice-label {
    width: 100%;
    position: relative;

    &::after {
      content: '';
      position: absolute;
      top: 50%;
      left: 50%;
      width: calc(100% + 0.25em);
      height: calc(100% + 1em);
      transform: translate(-50%, -50%);
      background: none;
    }
  }

  .dropmenu-current {
    position: relative;
    z-index: 1;

    .icon.cur {
      opacity: 0.3;
      font-size: 0.9em;
    }
  }

  &::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 186%;
    background: none;
    transform: translate(-50%, -50%);
    z-index: 0;
    cursor: pointer;
  }

  &.open {
    .dropmenu-choices {
      pointer-events: all;
      opacity: 1;
    }
    .dropmenu-current {
      background-color: var(--hover-bg);
    }
    .dropmenu-current {
      .icon.cur {
        opacity: 1;
      }
    }
  }

  .dropmenu-current:hover,
  .dropmenu-current:focus-visible {
    background-color: var(--hover-bg);
  }

  &.companyselect .dropmenu-current {
    font-weight: 600;
  }

  .dropmenu-current,
  .dropmenu-choice {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5em;
    padding: 0.33em 0.5em;
    width: 100%;
    text-align: left;
    border-radius: calc(var(--grid-corners-radius) * 0.5);

    transition: background-color var(--spd-insp) ease;

    .icon {
      font-size: 1em;
    }
    .settings {
      opacity: 0;
      pointer-events: none;
      transform-origin: center center;
      transition:
        opacity var(--spd-insp) ease,
        transform calc(var(--spd-insp) * 2) ease;
    }

    &:hover {
      background-color: var(--hover-bg);
      .settings {
        opacity: 0.33;
        pointer-events: all;

        &:hover {
          opacity: 1;
          transform: rotate(180deg);
        }
      }
    }
  }
  .dropmenu-current:has(.droparrow),
  .dropmenu-current:has(.icon) {
    grid-template-columns: 1fr auto;
  }
  .dropmenu-current:has(.icon):has(.droparrow) {
    grid-template-columns: auto 1fr auto;
  }

  &.has-settings {
    .dropmenu-choice {
      grid-template-columns: 1fr auto;
    }
  }

  &.readonly:hover {
    &::after {
      cursor: default;
    }

    .dropmenu-current {
      background-color: initial;
      cursor: default;
    }
  }
}

.dropmenu-label {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}
