/**
* DevExtreme (widgets/ios7/gridBase.ios7.less)
* Version: 20.1.10
* Build date: Fri Jan 15 2021
*
* Copyright (c) 2012 - 2021 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
@import (once) "./form.ios7.less";
@import (once) "./button.ios7.less";
@import (once) "./treeView.ios7.less";
@import (once) "./popup.ios7.less";
@import (once) "./contextMenu.ios7.less";
@import (once) "./scrollable.ios7.less";
@import (once) "./scrollView.ios7.less";
@import (once) "./filterBuilder.ios7.less";
@import (once) "./checkBox.ios7.less";
@import (once) "./overlay.ios7.less";
@import (once) "./menu.ios7.less";
@import (once) "./list.ios7.less";
@import (once) "./toolbar.ios7.less";
@import (once) "./pager.ios7.less";
@import (once) "./loadIndicator.ios7.less";
@import (once) "./loadPanel.ios7.less";
@import (once) "./validation.ios7.less";
@import (once) "./tooltip.ios7.less";
@import (once) "./textBox.ios7.less";
@import (once) "./numberBox.ios7.less";
@import (once) "./selectBox.ios7.less";
@import (once) "./dateBox.ios7.less";

.grid-base(@widgetName) {
    @GRID_BASE_CELL_PADDING: 7px;
    @GRID_BASE_DRAG_HEADER_FIRST_SHADOW: 0 0 1px ~"@{@{widgetName}-drag-header-first-shadow-color}";
    @GRID_BASE_DRAG_HEADER_SECOND_SHADOW: 0 1px 3px ~"@{@{widgetName}-drag-header-second-shadow-color}";
    @GRID_BASE_BUTTON_SIZE: 21px;
    @GRID_BASE_GROUP_COLUMN_ICONS_SIZE: 24px;
    @GRID_BASE_CONTEXT_MENU_SORT_ICON_SIZE: 20px;
    @GRID_BASE_COMMAND_EDIT_COLUMN_WIDTH: 115px;
    @GRID_BASE_ADAPTIVE_TEXT_PADDING: 8px;
    @GRID_BASE_CHECKBOX_ICON_SIZE: 20px;
    @GRID_BASE_TREEVIEW_SEARCH_MARGIN: 10px;

    .dx-@{widgetName}-checkbox-size {
        .dx-checkbox-icon {
            width: @GRID_BASE_CHECKBOX_ICON_SIZE;
            height: @GRID_BASE_CHECKBOX_ICON_SIZE;
        }

        &.dx-checkbox-indeterminate {
            .dx-checkbox-icon::before {
                width: 10px;
                height: 10px;
            }
        }
    }

    .dx-@{widgetName},
    .dx-@{widgetName}-container {
        .dx-menu-items-container {
            .dx-menu-item {
                .dx-icon-context-menu-sort-asc {
                    .dx-icon(sortuptext);
                    .dx-icon-sizing(@GRID_BASE_CONTEXT_MENU_SORT_ICON_SIZE);
                }

                .dx-icon-context-menu-sort-desc {
                    .dx-icon(sortdowntext);
                    .dx-icon-sizing(@GRID_BASE_CONTEXT_MENU_SORT_ICON_SIZE);
                }
            }
        }

        .dx-menu-item-content .dx-icon {
            color: ~"@{@{widgetName}-filter-operation-color}";
        }

        .dx-icon-filter-operation-equals {
            .dx-icon(equal);
        }

        .dx-icon-filter-operation-default {
            .dx-icon(find);
        }

        .dx-icon-filter-operation-not-equals {
            .dx-icon(notequal);
        }

        .dx-icon-filter-operation-less {
            .dx-icon(less);
        }

        .dx-icon-filter-operation-less-equal {
            .dx-icon(lessorequal);
        }

        .dx-icon-filter-operation-greater {
            .dx-icon(greater);
        }

        .dx-icon-filter-operation-greater-equal {
            .dx-icon(greaterorequal);
        }

        .dx-icon-filter-operation-contains {
            .dx-icon(contains);
        }

        .dx-icon-filter-operation-not-contains {
            .dx-icon(doesnotcontain);
        }

        .dx-icon-filter-operation-starts-with {
            .dx-icon(startswith);
        }

        .dx-icon-filter-operation-ends-with {
            .dx-icon(endswith);
        }

        .dx-icon-filter-operation-between {
            .dx-icon(range);
        }
    }

    .dx-@{widgetName} {
        .dx-menu {
            .dx-menu-item.dx-state-focused,
            .dx-menu-item.dx-state-active {
                background-color: transparent;
            }

            .dx-menu-horizontal {
                .dx-menu-item-content {
                    padding: 8px 0 6px 7px;
                }
            }
        }

        .dx-row-alt {
            & > td,
            & > tr > td {
                background-color: ~"@{@{widgetName}-row-alternation-color}";
            }

            &.dx-row:not(.dx-row-removed) {
                border-bottom-color: ~"@{@{widgetName}-row-alternation-color}";
            }
        }

        .dx-row-lines > td {
            border-bottom: ~"@{@{widgetName}-border}";
        }

        .dx-column-lines > td {
            border-left-width: 0;
        }


        .dx-editor-cell {
            .dx-texteditor {
                .dx-texteditor-container {
                    border: none;
                }

                .dx-texteditor-input {
                    border-radius: 0;
                    border-width: 0;
                    background: ~"@{@{widgetName}-editor-background}";
                }

                &.dx-searchbox {
                    .dx-texteditor-input,
                    .dx-placeholder:before {
                        padding-left: @SEARCH_ICON_SIZE + @SEARCH_ICON_OFFSET * 2;

                        .dx-rtl &,
                        .dx-rtl& {
                            padding-right: @SEARCH_ICON_SIZE + @SEARCH_ICON_OFFSET * 2;
                        }
                    }
                }
            }

            .dx-dropdowneditor-icon {
                box-shadow: none;
            }
        }

        .dx-error-row {
            .dx-closebutton {
                float: right;
                margin: @GRID_BASE_CELL_PADDING + 1px;
                .dx-icon(close);
                .dx-icon-sizing(24px);
            }

            .dx-error-message {
                padding: @GRID_BASE_CELL_PADDING;
                padding-right: 35px;
            }
        }

        .dx-@{widgetName}-content .dx-@{widgetName}-table .dx-row {
            .dx-command-edit-with-icons {
                .dx-link {
                    .dx-icon-sizing(18px);

                    margin: 0 3px;

                    &:not(.dx-link-icon) {
                        width: auto;
                    }
                }
            }
        }

        .dx-@{widgetName}-rowsview .dx-virtual-row > td[style*="text-align: right"]:before {
            background-position-y: 34px;
        }
    }

    .dx-@{widgetName}-edit-popup .dx-error-message {
        padding: @GRID_BASE_CELL_PADDING;
    }

    .dx-@{widgetName}-content .dx-@{widgetName}-table {
        .dx-row {
            .dx-command-edit {
                width: @GRID_BASE_COMMAND_EDIT_COLUMN_WIDTH;
                min-width: @GRID_BASE_COMMAND_EDIT_COLUMN_WIDTH;
            }

            .dx-command-expand.dx-@{widgetName}-group-space {
                vertical-align: middle;
            }
        }
    }

    .dx-@{widgetName}-filter-range-overlay .dx-overlay-content {
        border: ~"@{@{widgetName}-border}";
        overflow: inherit;
        box-shadow: 2px 2px 3px fade(black, 15%);

        .dx-texteditor-container {
            border: none;
        }

        &,
        .dx-texteditor-container {
            border-radius: 0;
        }

        .dx-editor-container.dx-highlight-outline::after {
            border-color: ~"@{@{widgetName}-data-modified-color}";
            left: 0;
        }

        .dx-texteditor {
            .dx-texteditor-input {
                background-color: ~"@{@{widgetName}-base-background-color}";
                padding: @GRID_BASE_CELL_PADDING;
            }

            &.dx-state-focused:after {
                border: 2px solid ~"@{@{widgetName}-focus-color}";
            }
        }
    }

    .dx-@{widgetName}-headers,
    .dx-@{widgetName}-rowsview {
        .dx-texteditor-input {
            padding: @GRID_BASE_CELL_PADDING;
        }

        .dx-dropdowneditor-button-visible {
            &.dx-show-clear-button {
                &.dx-invalid,
                &.dx-valid,
                &.dx-validation-pending {
                    .dx-texteditor-input {
                        padding-right: @TEXTEDITOR_INVALID_BADGE_WIDTH;
                    }

                    &.dx-rtl .dx-texteditor-input {
                        padding: @GRID_BASE_CELL_PADDING;
                        padding-left: @TEXTEDITOR_INVALID_BADGE_WIDTH;
                    }
                }
            }

            &.dx-invalid,
            &.dx-valid,
            &.dx-validation-pending {
                .dx-texteditor-input {
                    padding-right: @TEXTEDITOR_INVALID_BADGE_WIDTH;
                }

                &.dx-rtl .dx-texteditor-input {
                    padding: @GRID_BASE_CELL_PADDING;
                    padding-left: @TEXTEDITOR_INVALID_BADGE_WIDTH;
                }
            }
        }
    }

    .dx-@{widgetName}-export-menu {
        .dx-menu-items-container {
            .dx-icon {
                color: ~"@{@{widgetName}-context-menu-icons-color}";
            }
        }
    }

    .dx-@{widgetName}-header-text {
        text-transform: uppercase;
        font-size: 0.9em;
        font-weight: bold;
    }

    .dx-@{widgetName}-column-chooser-list {
        .dx-empty-message {
            bottom: 40%;
            color: ~"@{@{widgetName}-base-color}";
            padding: 0 10px;
        }
    }

    .dx-@{widgetName}-column-chooser {
        &.dx-@{widgetName}-column-chooser-mode-drag {
            .dx-treeview-search {
                margin-bottom: @GRID_BASE_TREEVIEW_SEARCH_MARGIN;
            }
        }

        &.dx-@{widgetName}-column-chooser-mode-select {
            .dx-popup-content {
                padding: 10px;
            }
        }

        &.dx-@{widgetName}-column-chooser-mode-drag { // stylelint-disable-line no-duplicate-selectors
            .dx-popup-content {
                padding: 20px;
            }
        }

        .dx-overlay-content {
            border-radius: 0;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

            .dx-popup-content {
                .dx-list-item-content::after {
                    height: 0;
                }

                .dx-column-chooser-item {
                    padding: 0;
                    border: ~"@{@{widgetName}-border}";
                    box-shadow: 0 1px 3px -1px rgba(0, 0, 0, 0.2);
                    background-color: ~"@{@{widgetName}-headers-background-color}";

                    .dx-treeview-item-content {
                        text-transform: uppercase;
                        font-size: 0.9em;
                        font-weight: bold;
                        color: ~"@{@{widgetName}-headers-color}";
                        padding: @GRID_BASE_CELL_PADDING;

                        &::after {
                            margin-top: 0;
                        }
                    }
                }
            }
        }
    }

    .dx-@{widgetName}-drag-header {
        box-shadow: @GRID_BASE_DRAG_HEADER_FIRST_SHADOW, @GRID_BASE_DRAG_HEADER_SECOND_SHADOW;
        text-transform: uppercase;
        font-size: 0.9em;
        font-weight: bold;
        color: ~"@{@{widgetName}-headers-color}";
        background-color: ~"@{@{widgetName}-drag-header-background-color}";
        padding: @GRID_BASE_CELL_PADDING;
        border: ~"@{@{widgetName}-drag-header-border}";
    }

    .dx-@{widgetName}-columns-separator {
        background-color: ~"@{@{widgetName}-headers-separator-color}";
    }

    .dx-@{widgetName}-columns-separator-transparent {
        background-color: transparent;
    }

    .dx-@{widgetName}-focus-overlay {
        border: 2px solid ~"@{@{widgetName}-focus-color}";
    }

    .dx-data-row.dx-state-hover {
        &:not(.dx-selection):not(.dx-row-inserted):not(.dx-row-removed):not(.dx-edit-row) {
            & > td:not(.dx-focused) {
                background-color: ~"@{@{widgetName}-hover-background}";

                &.dx-@{widgetName}-group-space {
                    border-right-color: ~"@{@{widgetName}-hover-background}";
                }
            }

            & > .dx-@{widgetName}-readonly .dx-texteditor {
                .dx-texteditor-input {
                    background-color: ~"@{@{widgetName}-hover-background}";
                }
            }

            &.dx-row:not(.dx-row-lines) {
                border-bottom-color: ~"@{@{widgetName}-hover-background}";
            }

            & > td.dx-pointer-events-none {
                background-color: transparent;
            }
        }
    }

    .dx-header-row {
        text-transform: uppercase;
        font-size: 0.9em;
        font-weight: bold;
    }

    .dx-@{widgetName}-headers {
        color: ~"@{@{widgetName}-headers-color}";
        touch-action: pinch-zoom;

        .dx-@{widgetName}-table {
            .dx-row {
                &.dx-header-row > td {
                    background-color: ~"@{@{widgetName}-headers-background-color}";
                }

                & > td {
                    border-bottom: ~"@{@{widgetName}-border}";
                }
            }
        }

        .dx-@{widgetName}-drop-highlight.dx-row {
            & > td {
                background-color: ~"@{@{widgetName}-headers-drop-highlight-background-color}";
            }
        }

        .dx-column-lines > td {
            border-left: ~"@{@{widgetName}-border}";
            border-right: ~"@{@{widgetName}-border}";
        }
    }

    .dx-@{widgetName}-filter-row {
        .dx-menu .dx-overlay-content {
            color: @IOS7_FONT_COLOR;
        }

        .dx-menu-item {
            &.dx-state-focused {
                background-color: transparent;

                &:after {
                    border: 2px solid ~"@{@{widgetName}-focus-color}";
                }

                &.dx-menu-item-expanded {
                    &:after {
                        border-color: transparent;
                    }
                }
            }
        }

        .dx-highlight-outline {
            &::after {
                border-color: ~"@{@{widgetName}-data-modified-color}";
            }
        }
    }

    .dx-@{widgetName}-header-panel {
        border-bottom: ~"@{@{widgetName}-border}";

        .dx-toolbar {
            background: ~"@{@{widgetName}-base-background-color}";
            padding-bottom: ~"@{@{widgetName}-header-panel-padding-bottom}";
            height: 49px;
        }

        .dx-toolbar-item {
            padding: 0 0 0 5px;
        }

        .dx-toolbar-button:not(.dx-state-disabled) {
            .dx-apply-button {
                .dx-button-content {
                    background-color: ~"@{@{widgetName}-apply-button-color}";
                }
            }
        }

        .dx-link {
            padding: @GRID_BASE_CELL_PADDING 0 @GRID_BASE_CELL_PADDING 10px;
        }
    }

    .dx-@{widgetName}-toolbar-button {
        .dx-icon-column-chooser {
            .dx-icon(columnchooser);
        }

        .dx-icon-edit-button-addrow {
            .dx-icon(add);
        }


        .dx-icon-edit-button-cancel {
            .dx-icon(revert);
        }

        .dx-icon-edit-button-save {
            .dx-icon(save);
        }

        .dx-icon-apply-filter {
            .dx-icon(filter);
        }

        .dx-icon-export-to {
            .dx-icon(export);
        }

        .dx-icon-export-excel-button {
            .dx-icon(xlsxfile);
        }

        .dx-icon {
            .dx-icon-sizing(@GRID_BASE_BUTTON_SIZE);

            color: #7f7f7f;
        }
    }

    .dx-@{widgetName}-search-panel {
        margin-left: 20px;
    }

    .dx-@{widgetName}-rowsview {
        .dx-row {
            border-top: ~"@{@{widgetName}-row-border}";
            border-bottom: ~"@{@{widgetName}-row-border}";

            &.dx-edit-row > td {
                border-top: ~"@{@{widgetName}-border}";
                border-bottom: ~"@{@{widgetName}-border}";
            }
        }

        .dx-data-row {
            .dx-validator.dx-@{widgetName}-invalid {
                .dx-highlight-outline::after {
                    border: 1px solid ~"@{@{widgetName}-data-faded-invalid-color}";
                }

                &.dx-focused > .dx-highlight-outline::after {
                    border: 1px solid ~"@{@{widgetName}-data-invalid-color}";
                }
            }

            .dx-invalid-message {
                .dx-overlay-content {
                    padding: 10px 17px 9px;
                    border-radius: 0;
                }
            }

            .dx-cell-modified {
                .dx-highlight-outline {
                    &::after {
                        border-color: ~"@{@{widgetName}-data-modified-color}";
                    }
                }
            }
        }

        .dx-adaptive-detail-row {
            .dx-adaptive-item-text {
                padding-top: @GRID_BASE_ADAPTIVE_TEXT_PADDING;
                padding-bottom: @GRID_BASE_ADAPTIVE_TEXT_PADDING;
                padding-left: @GRID_BASE_ADAPTIVE_TEXT_PADDING;
            }
        }

        .dx-adaptive-detail-row { // stylelint-disable-line no-duplicate-selectors
            .dx-@{widgetName}-invalid {
                border-radius: 6px;
                border: 1px solid ~"@{@{widgetName}-data-invalid-color}";

                &.dx-adaptive-item-text {
                    padding-top: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 1;
                    padding-bottom: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 1;
                    padding-left: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 1;
                }
            }
        }

        .dx-item-modified {
            border-radius: 6px;
            border: 2px solid ~"@{@{widgetName}-data-modified-color}";

            &.dx-adaptive-item-text {
                padding-top: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 2;
                padding-bottom: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 2;
                padding-left: @GRID_BASE_ADAPTIVE_TEXT_PADDING - 2;
            }
        }

        .dx-row-removed > td {
            background-color: ~"@{@{widgetName}-data-modified-color}";
            border-top: 1px solid ~"@{@{widgetName}-data-modified-color}";
            border-bottom: 1px solid ~"@{@{widgetName}-data-modified-color}";
        }

        .dx-selection,
        .dx-selection.dx-row:hover {
            & > td,
            & > tr > td {
                background-color: ~"@{@{widgetName}-selection-background}";

                &.dx-editor-cell {
                    background-color: @IOS7_SELECTION_BACKGROUND;
                }

                &.dx-@{widgetName}-group-space {
                    border-right-color: ~"@{@{widgetName}-selection-background}";
                }
            }

            & > td.dx-focused {
                background-color: transparent;
            }

            &:not(.dx-row-lines) {
                border-bottom-color: ~"@{@{widgetName}-selection-background}";
            }
        }

        .dx-master-detail-row {
            & > td {
                border-top: ~"@{@{widgetName}-border}";
                border-bottom: ~"@{@{widgetName}-border}";
            }
        }

        .dx-master-detail-row:not(.dx-@{widgetName}-edit-form) {
            > .dx-@{widgetName}-group-space,
            .dx-master-detail-cell {
                background-color: ~"@{@{widgetName}-master-detail-cell-background-color}";
            }
        }

        td {
            &.dx-validation-pending {
                position: relative;
                padding: 0;

                .dx-highlight-outline {
                    padding-right: @TEXTEDITOR_INVALID_BADGE_WIDTH;

                    .dx-rtl&,
                    .dx-rtl & {
                        padding-left: @TEXTEDITOR_INVALID_BADGE_WIDTH;
                        padding-right: 0;
                    }
                }

                .dx-pending-indicator {
                    .pending-indicator-ios7();
                    .texteditor-validation-icon-offset();

                    background-color: @datagrid-base-background-color;
                }
            }
        }
    }

    .dx-@{widgetName}-search-text {
        background-color: ~"@{@{widgetName}-search-text-background}";
    }

    .dx-@{widgetName}-nodata {
        color: ~"@{@{widgetName}-nodata-color}";
        font-size: ~"@{@{widgetName}-nodata-font-size}";
    }

    .dx-@{widgetName}-export-menu { // stylelint-disable-line no-duplicate-selectors
        .dx-menu-item {
            .dx-checkbox {
                .dx-checkbox-text {
                    padding-left: 32px;
                }
            }
        }
    }

    .dx-@{widgetName}-bottom-load-panel {
        border-top: ~"@{@{widgetName}-border}";
    }

    .dx-@{widgetName}-pager {
        border-top: 3px double ~"@{@{widgetName}-border-color}";

        &.dx-widget {
            color: ~"@{@{widgetName}-base-color}";
        }
    }

    .dx-@{widgetName}-total-footer {
        border-top: ~"@{@{widgetName}-border}";
    }

    .dx-@{widgetName}-revert-tooltip {
        .dx-overlay-content {
            min-width: 32px;

            .dx-popup-content {
                border-radius: 4px;
            }
        }

        .dx-revert-button {
            background-color: ~"@{@{widgetName}-data-invalid-color}";
            padding: 6px;

            &.dx-button-has-icon {
                .dx-icon {
                    margin: 0;
                    color: @VALIDATION_MESSAGE_COLOR;

                    .dx-icon-sizing(20px);
                }
            }
        }
    }

    .dx-rtl {
        .dx-@{widgetName}-header-panel {
            .dx-toolbar-item {
                padding: 0 5px 0 0;
            }
        }

        .dx-data-row.dx-state-hover {
            &:not(.dx-selection):not(.dx-row-inserted):not(.dx-row-removed):not(.dx-edit-row) {
                & > td,
                & > tr > td {
                    &:not(.dx-focused) {
                        &.dx-@{widgetName}-group-space {
                            border-left-color: ~"@{@{widgetName}-hover-background}";
                        }
                    }
                }
            }
        }

        .dx-@{widgetName} {
            .dx-menu {
                .dx-menu-horizontal {
                    .dx-menu-item-content {
                        padding: 8px 11px 7px 0;
                    }
                }
            }
        }

        .dx-editor-cell {
            .dx-texteditor.dx-numberbox-spin,
            .dx-dropdowneditor.dx-dropdowneditor-button-visible {
                .dx-texteditor-input {
                    padding-right: @GRID_BASE_CELL_PADDING;
                }
            }
        }

        .dx-@{widgetName}-rowsview {
            .dx-selection,
            .dx-selection.dx-row:hover {
                & > td,
                & > th > td {
                    &:not(.dx-focused) {
                        &.dx-@{widgetName}-group-space {
                            border-left-color: ~"@{@{widgetName}-selection-background}";
                        }
                    }
                }
            }
        }

        .dx-@{widgetName}-search-panel {
            margin-left: 0;
            margin-right: 20px;
        }
    }
}
