/*
 * Copyright (c) 2010, 2023 BSI Business Systems Integration AG
 *
 * This program and the accompanying materials are made
 * available under the terms of the Eclipse Public License 2.0
 * which is available at https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 */
.form-field-menu {
  // Remove y padding but keep x padding to have the same gap between form field menus and regular menus.
  padding-top: 0;
  padding-bottom: 0;
  cursor: default;
  color: @text-color;

  &:hover {
    color: @text-color;
    background-color: transparent;
  }

  &:active, &.active {
    background-color: transparent;
  }

  &:not(.has-text):not(.has-icon) {
    & > .form-field > label {
      margin-left: 0;
    }
  }

  & > .form-field {
    display: inline-block;
    position: relative;
    vertical-align: middle;

    & > label {
      margin-left: 8px;
    }

    &.disabled:not(.read-only) > label {
      /* Use same disabled color as for menu items */
      color: @menu-item-disabled-color;
    }
  }

  &:not(.has-icon) > .form-field:not(.no-mandatory-indicator) {
    // Remove margin left since the menu-item already has a padding
    // This reduces the gap between form field menus in the menu bar, but also improves the alignment in the context menu
    margin-left: -@mandatory-indicator-width;
  }

  & > .check-box-field.disabled:not(.read-only) > .field > .label,
  & > .radiobutton-group > .radiobutton-group-body > .radio-button.disabled:not(.read-only) > .field > .label,
  & > .radio-button.disabled:not(.read-only) > .field > .label {
    /* Use same disabled color as for menu items */
    color: @menu-item-disabled-color;
  }
}

.menubar-box > .form-field-menu {
  & > .string-field,
  & > .smart-field,
  & > .dropdown-field,
  & > .proposal-field,
  & > .number-field,
  & > .date-field,
  & > .tag-field,
  & > .file-chooser-field {
    margin-top: @menubar-field-menu-margin-y - @menubar-item-margin-y;
    margin-bottom: @menubar-field-menu-margin-y - @menubar-item-margin-y;
  }
}

:not(.main-menubar):not(.bounded) > .menubar-box > .form-field-menu {
  &.first {
    padding-left: 0;
  }

  &.last {
    padding-right: 0;
  }
}

/* Inside context menu popup -> set preferred size */
.context-menu > .form-field-menu {
  & > .text,
  & > .icon {
    flex: none;
  }

  & > .form-field {
    flex: 1 1 auto;
  }
}
