/*
 * 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 'legacy/mixins/fonts';

@mixin bs-legacy-support {
  --bs-table-color-type: initial;
  --bs-table-bg-type: initial;
  --bs-table-color-state: initial;
  --bs-table-bg-state: initial;
  --bs-table-color: var(--theme-table--color);
  --bs-table-bg: var(--theme-table--background);
  --bs-table-border-color: var(--theme-table--border-color);
  --bs-table-accent-bg: transparent;
  --bs-table-striped-color: var(--theme-table--color);
  --bs-table-striped-bg: var(--theme-table-data-row-alt--background);
  --bs-table-active-color: var(--theme-table--color);
  --bs-table-active-bg: var(--theme-table-data-row-alt--background--active);
  --bs-table-hover-color: var(--theme-table--color);
  --bs-table-hover-bg: var(--theme-table-data-row-alt--background--hover);
}

.ix-table {
  box-sizing: border-box;
  border-spacing: 0px;
  width: 100%;
  margin-bottom: 1rem;
  color: var(--theme-color-std-text);
  vertical-align: top;
  border-color: var(--theme-table--border-color);
  @include fonts.text-default;
  @include bs-legacy-support;

  --ix-table-background: var(--theme-table--background);

  // TODO(IX-???): Will be removed after web component implementation is available
  @include bs-legacy-support;
}

.ix-table-striped > tbody > tr:nth-of-type(odd) > * {
  --ix-table-background: var(--theme-table-data-row-alt--background);
}

.ix-table thead {
  background-color: var(--theme-table-header-row--background);
}

.ix-table > thead {
  vertical-align: bottom;
}

.ix-table > :not(caption) > * > * {
  padding: 0.5rem 0.5rem;
  background-color: var(--ix-table-background);
  border-bottom-width: 1px;
  box-shadow: inset 0 0 0 9999px transparent;
}

.ix-table th,
.ix-table td {
  border-bottom-color: var(--theme-table-data-row--border-color);
}

.ix-table {
  thead,
  tbody,
  tfoot,
  tr,
  td,
  th {
    text-align: left;
  }
}
