/*
 * DO NOT EDIT THIS FILE.
 * See the following change record for more information,
 * https://www.drupal.org/node/3084859
 * @preserve
 */

/**
 * @file
 * Claro styles for Tables.
 */

table {
  --cell-padding-y: var(--admin-space-density-m);
  --cell-padding-x: var(--admin-space-m);

  width: 100%;
  margin-block: var(--admin-space-l);
  border-collapse: collapse;

  thead {
    border-radius: var(--admin-radius-m);
    background: transparent;

    tr {
      border-block-end: 2px solid var(--admin-color-border-loud);

      &:hover {
        background: transparent;
      }
    }
  }

  th {
    background: var(--admin-color-bg-surface);
    font-size: var(--admin-font-size-s);
    font-weight: var(--admin-font-weight-bold);

    &,
    .form-item__label {
      color: var(--admin-color-text-loud);
    }
  }

  tbody {
    tr {
      border-block-end: 1px solid var(--admin-color-border-table);
    }

    td {
      height: auto;
      padding: var(--cell-padding-y) var(--cell-padding-x);
    }
  }

  tr,
  tr:focus-within,
  .draggable-table.tabledrag-disabled tr {
    color: var(--admin-color-text);
    background-color: transparent;

    &:hover {
      color: var(--admin-color-text);
      background: var(--admin-color-bg-item);
    }

    &.selected:hover {
      background: transparent;
    }
  }

  tr.selected {
    .gin--dark-mode & {
      border-color: rgb(255, 255, 255, 0.2);
    }

    td {
      background-color: var(--admin-color-bg-item-hover);
    }
  }

  td {
    a {
      -webkit-text-decoration: none;
      text-decoration: none;

      &:hover {
        -webkit-text-decoration: underline;
        text-decoration: underline;
        text-decoration-style: var(--admin-link-decoration-style);
      }
    }

    .group-label {
      color: var(--admin-color-text-loud);
    }
  }

  &.gin--sticky-table-header {
    position: sticky;
    z-index: 97;
    visibility: hidden;
    overflow: hidden;
    width: auto !important;
    margin-block-start: calc(var(--admin-space-xs) * -1);
    inset-block-start: calc(var(--admin-theme-toolbar-y-offset) + var(--admin-theme-height-sticky) - 1px);

    tr {
      display: block;
      width: max-content;
    }
  }
}

table.sticky-header {
  inset-inline-start: auto !important;
  min-width: 100%;
  max-width: fit-content;
  background: transparent;
}

table.position-sticky,
table.sticky-header {
  thead {
    position: static;
  }

  &.--is-processed thead {
    pointer-events: none;

    tr {
      border-color: transparent;

      .sortable-heading.is-active > a::before {
        display: none;
      }
    }
  }
}

caption {
  text-align: start;
}

th {
  position: relative;
  box-sizing: border-box;
  height: var(--admin-space-2xl);
  padding: var(--admin-space-xs) var(--admin-space-m);
  text-align: start;
  color: var(--admin-color-text);
  background: var(--admin-color-bg-surface-nested);
  line-height: 1.25rem;
  /* 20px */
}

table th {
  @media (min-width: 61em) {
    height: auto;
    padding: var(--admin-space-m);
  }
}

/* The actual sort link. */

.sortable-heading {
  padding: var(--admin-space-xs) var(--admin-space-m);

  & > a {
    display: block;
    padding-block: var(--admin-space-xs);
    padding-inline: 0 1.5rem;
    -webkit-text-decoration: none;
    text-decoration: none;
    color: inherit;

    &:focus,
    &:hover {
      -webkit-text-decoration: none;
      text-decoration: none;

      &::before {
        border-color: inherit;
        border-block-end-width: 0.1875rem;
      }

      &::after {
        opacity: 1;
      }
    }

    &::before {
      position: absolute;
      z-index: 0;
      inset-block-start: 0;
      inset-inline-end: 1rem;
      inset-block-end: -2px;
      inset-inline-start: 1rem;
      display: block;
      content: "";
      border-bottom: 0.125rem solid transparent;
    }

    &::after {
      position: absolute;
      inset-block-start: 50%;
      inset-inline-end: 1rem;
      width: 0.875rem;
      height: 1rem;
      margin-block-start: -0.5rem;
      content: "";
      opacity: 0.5;
      background: var(--admin-color-text-soft);
      background-size: contain;
      mask-image: var(--admin-icon-sort);
      mask-repeat: no-repeat;
      mask-position: center center;

      [dir="rtl"] & {
        /* Horizontally flip the element. */
        transform: scaleX(-1);
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8'%3e%3cpath d='M1.75.25v1.5h10.5V.25zm0 3v1.5h7.5v-1.5zm0 3v1.5h4.5v-1.5z' fill='%23000f33'/%3e%3c/svg%3e");

        @media (forced-colors: active) {
          mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8'%3e%3cpath d='M1.75.25v1.5h10.5V.25zm0 3v1.5h7.5v-1.5zm0 3v1.5h4.5v-1.5z' fill='%23000f33'/%3e%3c/svg%3e") no-repeat 50% 50%;
        }
      }

      @media (forced-colors: active) {
        opacity: 1;
        background: linktext;
        mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8'%3e%3cpath d='M1.75.25v1.5h10.5V.25zm0 3v1.5h7.5v-1.5zm0 3v1.5h4.5v-1.5z' fill='%23000f33'/%3e%3c/svg%3e") no-repeat 50% 50%;
      }
    }
  }

  &.is-active > a {
    color: var(--admin-color-link);

    &::before {
      /* border-bottom: 0.1875rem solid var(--admin-color-link); */
      border-block-end: 0.1875rem solid var(--admin-color-primary-active);
      background-color: var(--admin-color-bg-item);
      border-start-start-radius: var(--admin-radius-s);
      border-start-end-radius: var(--admin-radius-s);
    }

    &::after {
      content: none;
    }

    &,
    &:hover,
    &:active {
      color: var(--admin-color-primary-active);
    }
  }

  &.is-active > a::before,
  > a:hover::before {
    width: 100%;
    inset-inline-start: 0;
  }
}

tr {
  border-bottom: 0.0625rem solid var(--admin-color-border);

  &:hover,
  &:focus-within {
    color: var(--admin-color-text);
    background: var(--admin-color-bg-item-hover);
  }

  &.color-warning:hover,
  &.color-warning:focus {
    color: var(--admin-color-text);
    background: #fdf8ed;
  }

  &.color-error:hover,
  &.color-error:focus {
    color: var(--admin-color-text);
    background: #fcf4f2;
  }
}

tr,
.draggable-table.tabledrag-disabled tr {
  color: var(--admin-color-text);
  background: var(--admin-color-bg-disabled);
}

thead tr {
  border: 0;
}

td {
  box-sizing: border-box;
  height: 4rem;
  padding: var(--admin-space-xs) var(--admin-space-m);
  text-align: start;

  & .item-list ul {
    margin: 0;
  }

  &.is-active {
    background: none;
  }
}

/**
 * Target every .form-element input that parent is a form-item of a table cell.
 * This ignores the filter format select of the textarea editor.
 */

td {
  & > .form-item {
    display: flex;
    align-items: center;
  }

  & > .form-item > .form-item__prefix {
    margin-inline-end: var(--admin-space-xs);
    white-space: nowrap;
  }

  & > .form-item > .form-item__suffix {
    margin-inline-start: var(--admin-space-xs);
    white-space: nowrap;
  }

  & > .form-item > .form-element,
  & > .ajax-new-content > .form-item > .form-element,
  & > .form-item > .claro-autocomplete,
  & > .form-item > .claro-autocomplete > .form-element,
  & > .ajax-new-content > .form-item > .claro-autocomplete,
  & > .ajax-new-content > .form-item > .claro-autocomplete > .form-element {
    width: 100%;
  }

  & > .form-item > .form-element--type-select,
  & > .ajax-new-content > .form-item > .form-element--type-select {
    width: max-content;
    min-width: 100%;
  }
}

/* Win over table-file-multiple-widget. */

th.is-disabled.is-disabled {
  color: var(--admin-color-text-disabled);
}

/* Force browsers to calculate the width of a 'select all' <th> element. */

th.select-all {
  width: 1px;
}

/**
 * Captions.
 */

.caption {
  margin-block-end: 1.25rem;
  /* 20px */
}

tfoot {
  font-weight: bold;

  & tr {
    &:last-child {
      border-bottom: 0;
    }

    &:first-child td {
      /* Intentionally a stronger divider than --admin-color-border; kept on the
         gray ramp so it isn't lightened to the default border tint. */
      border-top: 0.0625rem solid var(--admin-color-gray-500);
    }
  }
}

/**
 * Responsive table cells.
 */

th.priority-low,
th.priority-medium,
td.priority-low,
td.priority-medium {
  display: none;
}

@media screen and (min-width: 38em) {
  th.priority-medium,
  td.priority-medium {
    display: table-cell;
  }
}

@media screen and (min-width: 60em) {
  th.priority-low,
  td.priority-low {
    display: table-cell;
  }
}

.gin-table-scroll-wrapper {
  clear: both;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  margin-block-start: calc(var(--admin-space-xs) * -1);
}

.gin-horizontal-scroll-shadow {
  background-color: var(--admin-color-bg-surface);
  background-image: linear-gradient(to right, var(--admin-color-bg-surface), var(--admin-color-bg-surface)), linear-gradient(to right, var(--admin-color-bg-surface), var(--admin-color-bg-surface)), linear-gradient(to right, rgb(0, 0, 0, 0.125), rgb(255, 255, 255, 0)), linear-gradient(to left, rgb(0, 0, 0, 0.125), rgb(255, 255, 255, 0));
  background-repeat: no-repeat;
  background-attachment: local, local, scroll, scroll;
  background-position:
    left center,
    right center,
    left center,
    right center;
  background-size:
    1.5rem 100%,
    1.5rem 100%,
    0.75rem 100%,
    0.75rem 100%;

  &:dir(rtl) {
    background-image: linear-gradient(to left, var(--admin-color-bg-surface), var(--admin-color-bg-surface)), linear-gradient(to left, var(--admin-color-bg-surface), var(--admin-color-bg-surface)), linear-gradient(to left, rgb(0, 0, 0, 0.125), rgb(255, 255, 255, 0)), linear-gradient(to right, rgb(0, 0, 0, 0.125), rgb(255, 255, 255, 0));
    background-position:
      right center,
      left center,
      right center,
      left center;
  }
}

.tablesort {
  background-color: var(--admin-color-primary-active);
  background-image: none;
  mask-image: var(--admin-icon-sort);
  mask-repeat: no-repeat;
  mask-position: 0 50%;
}

.tablesort--asc {
  mask-image: var(--admin-icon-sort-asc);

  @media (forced-colors: active) {
    background: linktext;
  }
}

.tablesort--desc {
  mask-image: var(--admin-icon-sort-desc);

  @media (forced-colors: active) {
    background: linktext;
  }
}

.field-plugin-settings-edit-wrapper {
  float: inline-end;

  + a {
    float: inline-start;
  }
}

.region-title {
  border-block-end: 2px solid var(--admin-color-text);
}

.field-multiple-table {
  th {
    padding-block: var(--admin-space-xs);
    padding-inline: var(--admin-space-l) var(--admin-space-m);
    border-block-end: 0;
    background: transparent;

    &.th__order {
      padding: 0;
      font-size: 0;
    }
  }

  thead {
    th {
      background: var(--admin-color-bg-header);

      &:first-of-type {
        border-start-start-radius: var(--admin-radius-m);
        border-end-start-radius: var(--admin-radius-m);
      }
    }

    &:not(:has(th:last-of-type:not([style*="display: none"]))) th:nth-last-of-type(2),
    th:last-of-type:not([style*="display: none"]) {
      border-start-end-radius: var(--admin-radius-m);
      border-end-end-radius: var(--admin-radius-m);
    }

    tr {
      border-block-end: 0;
    }

    .field-label .label,
    .form-item__label--multiple-value-form {
      display: inline-block;
      margin: 0;
      padding: var(--admin-space-xs) 0;
      letter-spacing: -0.025em;
      color: var(--admin-color-primary-active);
      font-size: var(--admin-font-size-l);
      font-weight: var(--admin-font-weight-bold);
      line-height: 1.33333em;
    }
  }

  tr .form-item:not(:last-of-type) {
    margin-block-end: var(--admin-space-m);
  }

  /* Fixes paragraphs extending beyond layout */
  .ck.ck-toolbar.ck-toolbar_grouping > .ck-toolbar__items {
    flex-wrap: wrap;
  }
}

.gin-layer-wrapper .views-table {
  margin-block-start: 0;
}

table td.field-plugin-summary-cell {
  vertical-align: middle;
}

table .views-field.views-field-operations {
  text-align: end;
}
