@mixin grid() {
  .esri-grid {
    // Uses shade of primary theme color for highlight
    $row-selected-color: rgba($button-color, 0.2);

    // Sets 'primary' color that other properties inherit from
    --lumo-base-color: #{$background-color};
    --lumo-primary-color: #{$button-color};
    --lumo-primary-text-color: var(--lumo-primary-color);
    --lumo-primary-color-10pct: #{$row-selected-color};

    // grid and checkbox background color(s) default and hover
    --lumo-contrast-20pct: #{$interactive-font-color};
    --lumo-contrast-30pct: #{$interactive-font-color--hover};

    // grid border color(s)
    --lumo-contrast-10pct: #{$background-color--hover};

    // row hover
    --lumo-row-background-hover: #{$background-color--hover};

    width: 100%;
    height: 100%;

    .esri-grid__content {
      background-color: inherit;
      width: 100%;
      height: 100%;
    }

    .esri-grid__grid {
      width: 100%;
      height: 100%;

      a {
        text-decoration: underline;
        color: $interactive-font-color;

        &:hover,
        &:focus {
          color: $interactive-font-color--hover;
        }
      }
    }

    .esri-column__sorter:hover {
      cursor: pointer;
    }

    .esri-column__sorter,
    .esri-column__header-label {
      display: flex;
      flex-grow: 1;
      align-items: center;
      margin: 0 5px;
      min-height: 28px;
      overflow: hidden;
    }

    .esri-column__header-label span {
      flex-grow: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .esri-column__header-content {
      display: flex;
      float: inline-start;
      align-items: center;
      justify-content: center;
      width: 100%;
      height: 100%;
      overflow: hidden;

      calcite-icon {
        float: inline-start;
        margin-inline-end: 2px;
        height: 100%;
      }

      calcite-dropdown {
        float: inline-end;
        max-height: 180px;

        // Avoid issues with menu growing outside of the viewport
        calcite-dropdown-group {
          max-width: 200px;
          overflow-x: auto;

          &:only-of-type {
            max-height: 180px;
            overflow: visible;
          }
        }

        &[open] {
          calcite-dropdown-item {
            display: flex;
          }
        }

        calcite-action {
          --calcite-color-foreground-1: transparent;
        }

        // Prevents frozen columns from appearing offset from the table edge on load.
        // This is because VaadinGrid's positioning logic accounts for 'hidden' calcite dropdown items,
        // since they use 'visibility: hidden' instead of 'display: none'.
        calcite-dropdown-item,
        calcite-dropdown-item[hidden] {
          display: none;
        }
      }
    }
  }

  .esri-column__action {
    --calcite-color-foreground-1: transparent;
  }

  .esri-column__header-menu-icon {
    margin-inline-end: $side-spacing;
  }

  .esri-column__cell-input {
    flex: 1 1 0;
    border: none;
    width: 100%;
    height: 100%;
  }

  .esri-column__cell__input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;

    input,
    select {
      position: absolute;
      top: 0;
      left: 0;
      padding: 0;
    }

    div,
    input,
    select {
      display: flex;
      width: 100%;
    }

    calcite-action-bar {
      background-color: transparent;
    }

    div:first-child {
      flex-direction: column;
    }

    calcite-input-time-zone {
      --calcite-dropdown-width: 200px;
    }

    // Remove top border between stacked components for cleaner look.
    // Only remove border on TimePicker when it's not the only visible component (2nd or last).
    // Always remove the top border from TimeZone component (always displayed last)
    calcite-input-time-picker:last-child,
    calcite-input-time-picker:nth-child(2),
    calcite-input-time-zone {
      margin-top: -1px;
    }
  }
}

@if $include_Grid == true {
  @include grid();
}
