/*
 * Copyright (c) 2010, 2025 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
 */
.table-field {
  &.alternative > label.top { /* NOSONAR overqualify by purpose to make it more specific than default rule in FormField.less */
    padding-bottom: @top-label-border-padding-bottom;
  }

  & > .table {
    border: 1px solid @control-border-color;
    border-radius: @control-border-radius;
    background-color: @control-background-color;
    overflow: hidden; /* necessary due to rounded borders and background color*/

    &.alternative {
      border-radius: @control-alternative-border-radius;
    }

    .table-field-no-rows-selected-focus();
  }
}

// Mixin for focus border
// The variables --table-focus-* allow to change the color of the focus shadow and border of the table only, not the one of the menu items or filter
.table-field-no-rows-selected-focus {
  &.no-rows-selected:has(.table-data:is(:focus, .focused):not(.keyboard-navigation)) {
    // Show focus border on whole table field when clicking or on programmatic focus and not on the row itself because it looks cleaner
    #scout.focus-border(var(--table-focus-box-shadow-size, @focus-box-shadow-size), var(--table-focus-box-shadow-color, @focus-box-shadow-color), var(--table-focus-border-color, @focus-border-color));
  }

  &.has-error {
    border-color: @error-border-color;
    --table-focus-border-color: @error-border-color;
    --table-focus-box-shadow-color: @error-focus-box-shadow-color;
  }
}
