@mixin featureTable() {
  .esri-feature-table {
    --icon-size: 64px;

    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;

    &__content {
      overflow: hidden;

      calcite-pagination {
        justify-content: center;
      }
    }

    &__collapsed {
      min-width: 500px;

      &:not(:last-child) {
        border-inline-end: var(--calcite-border-width-sm) solid var(--calcite-color-text-2);
        min-width: 300px;
        max-width: 300px;
      }
    }

    &__expanded {
      display: flex;
      min-width: 300px;

      &:not(:last-child) {
        border-inline-end: var(--calcite-border-width-sm) solid var(--calcite-color-text-2);
      }

      &.esri-feature-table__table-container--attachments:last-child {
        flex: 2 1 0;

        calcite-panel {
          min-width: fit-content;

          > div:first-child {
            flex: 2 1 0;
          }
        }

        .esri-feature-table__collapsed {
          max-width: inherit;
        }
      }
    }

    &__table-container {
      display: flex;
      flex: 1 1 0;
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      min-height: 0;

      calcite-panel > div {
        overflow-y: auto;
      }

      calcite-panel div {
        display: flex;
        flex: 1 1 0;

        .esri-feature-table__attachments-view__list {
          flex: 1 1 0;
          border-block-start: var(--calcite-border-width-sm) solid var(--calcite-color-text-2);
          min-width: 480px;
          overflow-y: auto;

          &__filesize {
            display: flex;
            align-items: center;
            margin-inline-end: var(--calcite-spacing-md);
            cursor: default;
            height: 100%;
          }
        }
      }
    }

    &__table-navigation {
      --calcite-label-margin-bottom: 0;

      display: flex;
      align-items: center;
      background-color: var(--calcite-color-foreground-1);
      padding-block-start: var(--calcite-spacing-base); // Height of calcite progress component
      width: 100%;
      line-height: initial;

      calcite-action:first-child {
        transform: scaleX(-1);
        border-inline-end: var(--calcite-border-width-sm) solid var(--calcite-color-border-3);
      }

      calcite-chip {
        --calcite-chip-close-icon-color: var(--calcite-color-text-inverse);

        margin-inline-end: var(--calcite-spacing-md);
      }

      calcite-label {
        border-inline-end: var(--calcite-border-width-sm) solid var(--calcite-color-border-3);
        padding-inline: var(--calcite-spacing-md);
        height: 100%;
      }

      calcite-action {
        display: flex;
        overflow: hidden;
      }

      div:last-child {
        display: flex;
        float: inline-end;
        align-items: center;
        margin-inline: auto 0;
        height: 100%;
      }

      calcite-action:last-child {
        display: flex;
        float: inline-end;
        margin-inline: auto 0;
      }
    }

    &__attachments-view {
      border-block-start: var(--calcite-border-width-sm) solid var(--calcite-color-text-2);
      background-color: var(--calcite-color-foreground-1);
      min-width: 300px;

      &__content {
        flex-direction: column;
        align-items: center;
        background-color: var(--calcite-color-background);
        padding: var(--calcite-spacing-md);
        width: 100%;
        max-height: 100%;
        overflow-y: auto;
      }

      &__details,
      &__drop-area {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
      }

      &__details {
        padding: var(--calcite-spacing-xl);
        max-height: 100%;

        img {
          display: block;
          padding: var(--calcite-spacing-sm);
          max-width: 100%;
          max-height: 100%;
        }

        calcite-action {
          --calcite-action-text-color: var(--calcite-color-brand);

          position: sticky;
        }
      }

      &__drop-area {
        border: var(--calcite-border-width-sm) dashed var(--calcite-color-border-input);
        border-radius: var(--calcite-corner-radius-sm);
        text-align: center;

        &__label {
          margin-bottom: var(--calcite-spacing-md);
          font-size: var(--calcite-font-size-md);
        }

        &__message {
          margin-bottom: var(--calcite-spacing-md);
          word-break: break-all;
        }

        form {
          display: flex;
          justify-content: center;

          fieldset {
            display: flex;
            flex-direction: column;
            align-items: center;
            border: none;

            calcite-button,
            span {
              margin-bottom: var(--calcite-spacing-sm);
            }
          }
        }
      }

      &__icon {
        margin-bottom: var(--calcite-spacing-md);
        block-size: var(--icon-size);
        inline-size: var(--icon-size);
      }

      &__information {
        flex-direction: column;
        padding: var(--calcite-spacing-md);
        max-width: 200px;
        overflow-y: auto;

        &__data {
          margin-block-end: var(--calcite-spacing-md);
          word-wrap: break-word;
          color: var(--calcite-color-text-1);
        }

        &__label {
          color: var(--calcite-color-text-3);
          font-weight: $font-weight;
        }

        calcite-button,
        calcite-icon,
        img {
          margin-block-end: var(--calcite-spacing-md);
        }
      }

      &__list-item {
        &--delete {
          border-inline-start: var(--calcite-border-width-sm) solid var(--calcite-color-border-3);
        }
      }

      &__list__thumbnail {
        align-items: center;
        justify-content: center;
        margin-block: var(--calcite-spacing-sm);

        span {
          display: flex;
          align-items: center;
          justify-content: center;
          border: var(--calcite-border-width-sm) solid var(--calcite-color-border-3);
          border-radius: var(--calcite-corner-radius-sm);
          width: var(--icon-size);
          height: var(--icon-size);
          overflow: hidden;
          color: $font-color;
        }
      }
    }

    &__menu-popover {
      calcite-list {
        // Avoid issues with menu growing outside of the viewport
        // 260px is roughly the height of a filter and 5 menu items.
        // No scrollbar should be shown until there are 6+ menu items.
        max-width: 300px;
        max-height: 260px;
        overflow-y: auto;
      }
    }

    &__dialog {
      --calcite-dialog-content-space: 0;

      &__header {
        display: flex;
        flex-direction: row;
        gap: var(--calcite-spacing-sm);
        justify-content: space-between;
        width: 100%;

        span {
          align-self: center;
          word-break: break-all;
        }
      }

      &__content {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
        align-items: center;
        justify-content: center;
      }

      calcite-progress {
        position: sticky;
        top: 0;
        margin-bottom: var(--calcite-spacing-sm);
      }

      calcite-pagination {
        justify-content: center;
        width: 100%;
      }

      img {
        width: auto;
        max-width: 100%;
      }
    }

    &__footer__message {
      display: flex;
      gap: var(--calcite-spacing-sm);
      align-items: center;
      margin: 0 var(--calcite-spacing-md);
    }

    &__footer__icon {
      &--danger {
        color: var(--calcite-color-status-danger);
      }

      &--success {
        color: var(--calcite-color-status-success);
      }
    }

    .esri-grid {
      background-color: inherit;

      &__grid {
        width: 100%;
        height: 100%;
      }
    }

    calcite-scrim > div:first-child {
      position: relative;
      min-width: 300px;
      max-width: 400px;
      max-height: 100%;
    }
  }

  .esri-feature-table__layer-switcher-menu {
    display: flex;
    align-items: center;
  }

  .esri-attachments-column__button,
  .esri-column__show-related-records-button {
    --calcite-offset-invert-focus: 2;
  }

  .esri-column__show-related-records-button {
    display: flex;
    height: 100%;
  }

  .esri-attachments-column__button {
    overflow: hidden;

    > div {
      display: flex;
      overflow: hidden;

      > div:first-child {
        margin-inline-end: var(--calcite-spacing-xxl);
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      span {
        position: absolute;
        inset-inline-end: var(--calcite-spacing-xxxl);
        align-self: center;
      }
    }
  }

  .esri-attachments-column__content {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    overflow: hidden;

    > div:first-child {
      overflow: hidden;
      text-overflow: ellipsis;
      line-height: 0;
    }
  }

  .esri-attachments-column__button,
  .esri-attachments-column__content {
    calcite-icon,
    img {
      display: inline-flex;
      margin-inline-end: var(--calcite-spacing-xxs);
      max-width: var(--calcite-spacing-xxl);
      max-height: var(--calcite-spacing-xxl);
      vertical-align: middle;
    }
  }
}

@if $include_FeatureTable == true {
  @include featureTable();
}
