
@mixin ag-theme-base-part-grid-borders {

    .ag-cell {
        @include ag-theme-rtl(( border-right: ag-param(cell-horizontal-border) ));
        @include ag-theme-rtl(( border-right-width: 1px ));
    }

    .ag-cell.ag-cell-first-right-pinned:not(.ag-cell-range-left):not(.ag-cell-range-single-cell) {
        @include ag-border(critical, left);
    }

    .ag-cell.ag-cell-last-left-pinned:not(.ag-cell-range-right):not(.ag-cell-range-single-cell) {
        @include ag-border(critical, right);
    }

    .ag-row-selected {
        @include ag-color-property(background-color, selected-row-background-color);
    }

    // we do not want to color the range color when the cell is also focused
    .ag-cell-range-selected:not(.ag-cell-focus),
    .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-single-cell:not(.ag-cell-inline-editing) {
        @include ag-color-property(background-color, range-selection-background-color);

        &.ag-cell-range-chart {
            @include ag-color-property(background-color, range-selection-chart-background-color, true);

            &.ag-cell-range-chart-category {
                @include ag-color-property(background-color, range-selection-chart-category-background-color, true);
            }
        }
    }

    .ag-cell-range-selected-1:not(.ag-cell-focus),
    .ag-root:not(.ag-context-menu-open) .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-1:not(.ag-cell-inline-editing) {
        @include ag-color-property(background-color, range-selection-background-color-1);
    }

    .ag-cell-range-selected-2:not(.ag-cell-focus),
    .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-2 {
        @include ag-color-property(background-color, range-selection-background-color-2);
    }

    .ag-cell-range-selected-3:not(.ag-cell-focus),
    .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-3 {
        @include ag-color-property(background-color, range-selection-background-color-3);
    }

    .ag-cell-range-selected-4:not(.ag-cell-focus),
    .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-4 {
        @include ag-color-property(background-color, range-selection-background-color-4);
    }

    .ag-cell.ag-cell-range-selected:not(.ag-cell-range-single-cell) {
        &.ag-cell-range-top {
            @include ag-color-property(border-top-color, range-selection-border-color);
        }
        &.ag-cell-range-right {
            @include ag-color-property(border-right-color, range-selection-border-color);
        }
        &.ag-cell-range-bottom {
            @include ag-color-property(border-bottom-color, range-selection-border-color);
        }
        &.ag-cell-range-left {
            @include ag-color-property(border-left-color, range-selection-border-color);
        }
    }

    // ltr/rtl needed so that this overrides the rtl/ltr styles of pinned column borders
    .ag-ltr, .ag-rtl {
        .ag-has-focus .ag-cell-focus:not(.ag-cell-range-selected),
        .ag-context-menu-open .ag-cell-focus:not(.ag-cell-range-selected),
        .ag-has-focus .ag-full-width-row.ag-row-focus .ag-cell-wrapper.ag-row-group,
        .ag-cell-range-single-cell,
        .ag-cell-range-single-cell.ag-cell-range-handle {
            border: 1px solid;
            @include ag-color-property(border-color, range-selection-border-color);
            outline: initial;
        }
    }

    .ag-cell.ag-selection-fill-top,
    .ag-cell.ag-selection-fill-top.ag-cell-range-selected {
        border-top: 1px dashed;
        @include ag-color-property(border-top-color, range-selection-border-color);
    }

    .ag-cell.ag-selection-fill-right,
    .ag-cell.ag-selection-fill-right.ag-cell-range-selected {
        @include ag-theme-rtl((border-right: 1px dashed), $color-param: range-selection-border-color);
    }

    .ag-cell.ag-selection-fill-bottom,
    .ag-cell.ag-selection-fill-bottom.ag-cell-range-selected {
        border-bottom: 1px dashed;
        @include ag-color-property(border-bottom-color, range-selection-border-color);
    }

    .ag-cell.ag-selection-fill-left,
    .ag-cell.ag-selection-fill-left.ag-cell-range-selected {
        @include ag-theme-rtl((border-left: 1px dashed), $color-param: range-selection-border-color);
    }

    %ag-selection-handle {
        position: absolute;
        width: 6px;
        height: 6px;
        bottom: -1px;
        @include ag-theme-rtl((right: -1px));
        @include ag-color-property(background-color, range-selection-border-color);
    }

    .ag-fill-handle {
        @extend %ag-selection-handle;
        cursor: cell;
    }

    .ag-range-handle {
        @extend %ag-selection-handle;
        cursor: nwse-resize;
    }

    .ag-cell-inline-editing {
        @include ag-color-property(border-color, input-focus-border-color, $important: true);
    }
}
