/*
 * SPDX-FileCopyrightText: 2023 Siemens AG
 *
 * SPDX-License-Identifier: MIT
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

@use 'mixins/hover';
@use 'legacy/mixins/fonts';
@use 'common-variables' as vars;

.dropdown-group {
  margin: 0.687rem;
  display: block;
  position: relative;
  width: 21.562rem;
  border-radius: 0.25rem;
  background-color: #f8f9fa;
  border: solid 0.062rem rgba(0, 0, 0, 0.25);

  .dropdown-group-title {
    display: block;
    position: relative;
    font-size: 0.875rem;
    text-align: left;
    margin: 0.937rem 0 1.25rem 0.937rem;
  }

  .dropdown-group-content {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    height: 11.562rem;
    margin: 0.937rem 0 0.937rem 0.937rem;

    > * {
      margin-bottom: 1rem;
    }
  }
}

.dropdown-group-submit {
  display: flex;
  justify-content: space-between;
  margin: 0 0.687rem 0 0.687rem;
}

.dropdown-menu {
  position: absolute;

  background-color: var(--theme-menu--background);
  border: var(--theme-menu--border-thickness) solid
    var(--theme-menu--border--color);
  border-radius: var(--theme-menu--border-radius);
  max-width: 100vw;
  padding: vars.$tiny-space 0;
  transition: background-color var(--theme-default-time);
  box-shadow: var(--theme-menu--box-shadow);

  @include fonts.text-default-single;

  &.xl > .dropdown-item {
    height: 2.5rem;
    line-height: 2.187rem;
  }
}

.dropdown-header {
  display: flex;
  align-items: center;
  height: vars.$large-control-height;
  color: var(--theme-menu-header--color);
  padding: 0 vars.$default-space;
}

.dropdown-buttons {
  display: flex;
  padding: vars.$tiny-space vars.$small-space;

  ix-icon-button + ix-icon-button {
    margin-inline-start: vars.$small-space;
  }
}

.dropdown-item {
  display: flex;
  height: 2.5rem;
  position: relative;
  align-items: center;
  cursor: pointer;
  padding: 0 vars.$x-large-space;
  border: 1px solid transparent;
  color: var(--theme-menu-item--color);
  background-color: transparent;

  &:focus-visible {
    background-color: var(--theme-menu-item--background);
    color: var(--theme-menu-item--color);
  }

  &:focus-visible {
    outline: none;
    background-color: var(--theme-menu-item--background);
    border-color: #119fff;
    color: var(--theme-menu-item--color--focus);
  }

  @include hover.hover {
    color: var(--theme-menu-item--color--hover);
    background-color: var(--theme-menu-item--background--hover);
  }

  @include hover.active {
    color: var(--theme-menu-item--color--active);
    background-color: var(--theme-menu-item--background--active);
  }

  &.disabled,
  &:disabled {
    color: var(--theme-menu-item--color--disabled);
    background-color: var(--theme-menu-item--background--disabled);
  }

  > a,
  a:hover,
  a:active {
    color: var(--theme-color-std-text);
  }

  > .glyph {
    color: var(--theme-menu-item-icon--color);

    &.disabled {
      color: var(--color-weak-text);
    }

    &.glyph-single-check {
      color: var(--theme-menu-item-icon-check--color);
    }

    margin-inline-end: vars.$small-space;
  }
}

.dropdown-item {
  > input[type='checkbox'] + label {
    margin-bottom: 0px;

    &::before {
      margin-right: 1rem;
    }
  }
}

.dropdown-divider {
  border-top: 1px solid var(--theme-menu-separator--background);
  margin: vars.$tiny-space 0;
}

button.dropdown-toggle {
  position: relative;
  padding-right: 1.5rem;
}

button.dropdown-toggle::after {
  position: absolute;
  top: 45%;
  right: 0.5rem;
}
