@use '../../sass/variables' as *;
@use '../../sass/global' as *;

[popover] {
  outline: none;
  padding: 0;
  border: none;
}

.dropdown-content {
  padding-left: 0;
  list-style-type: none;
  @extend .z-depth-1;
  background-color: var(--md-sys-color-surface);
  margin: 0;
  display: none;
  min-width: 100px;
  overflow-y: auto;
  opacity: 0;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9999; // TODO: Check if this doesn't break other things
  transform-origin: 0 0;
  user-select: none;
  white-space: nowrap;
  
  li {
    clear: both;
    color: var(--md-sys-color-on-background);
    cursor: pointer;
    min-height: $dropdown-item-height;
    line-height: 1.5rem;
    width: 100%;
    text-align: left;

    &.divider {
      min-height: 0;
      height: 1px;
    }
    & > a, & > span {
      font-size: 16px;
      color: var(--md-sys-color-primary);
      display: block;
      line-height: 22px;
      padding: (($dropdown-item-height - 22) * 0.5) 16px;
    }
    & > span > label {
      top: 1px;
      left: 0;
      height: 18px;
    }
    // Icon alignment override
    & > a > i {
      height: inherit;
      line-height: inherit;
      float: left;
      margin: 0 24px 0 0;
      width: 24px;
    }
  }
  li:not(.disabled):hover, li.active {
    background-color: color-mix(in srgb, var(--md-sys-color-surface), var(--md-sys-color-on-surface) 8%);
  }
}

body.keyboard-focused {
  .dropdown-content li:focus {
    background-color: rgba(0, 0, 0, 0.12);
  }
}

// Input field specificity bugfix
.input-field.col .dropdown-content [type="checkbox"] + label {
  top: 1px;
  left: 0;
  height: 18px;
  transform: none;
}

.dropdown-trigger {
  cursor: pointer;
}
