@use 'libs/components/theme/src/lib/styles/variables' as variables;
@use './variables' as sky-ag-grid-variables;

.ag-theme-sky-data-grid-modern-light,
.ag-theme-sky-data-grid-modern-light-compact {
  border-top: 2px solid transparent;

  .ag-row-hover::before {
    background-color: transparent;
  }

  .ag-cell:not(.ag-cell-wrap-text) .ag-cell-wrapper {
    align-items: flex-start;
  }

  .ag-root-wrapper {
    border: none;
  }

  .ag-cell {
    border-block-end: none;
    border-block-start: none;
  }

  .ag-cell.sky-ag-grid-cell-invalid {
    border: 1px solid var(--sky-highlight-color-danger);
  }

  .ag-row:not(.ag-row-first) {
    border-top: none;
  }

  .ag-header,
  .ag-row {
    border-bottom-style: dotted;

    + .ag-row-last {
      border-bottom-style: dotted;
    }
  }
}

.ag-theme-sky-data-entry-grid-modern-light,
.ag-theme-sky-data-entry-grid-modern-light-compact {
  border-top: sky-ag-grid-variables.$sky-standard-border;

  .ag-popup {
    .ag-popup-editor {
      background-color: transparent;

      sky-input-box {
        --sky-background-color-input-box-group: var(--ag-background-color);
      }
    }

    .ag-select-list {
      box-shadow: variables.$sky-theme-modern-elevation-4-shadow-size
        variables.$sky-theme-modern-elevation-4-shadow-color;

      .ag-select-list-item {
        cursor: pointer;
        border: 1px solid transparent;

        &:focus-visible,
        &:hover,
        &.ag-active-item {
          background-color: transparent;
          border-color: variables.$sky-theme-modern-border-color-primary-dark;
        }
      }
    }
  }

  .ag-cell:not(.ag-cell-wrap-text) .ag-cell-wrapper {
    align-items: flex-start;
  }

  .ag-cell:hover {
    border: 1px solid variables.$sky-theme-modern-border-color-primary-dark;
  }

  .ag-cell.sky-ag-grid-cell-invalid {
    border: 1px solid var(--sky-highlight-color-danger);
  }

  .sky-ag-grid-cell-editable {
    .ag-select {
      .ag-picker-field-display {
        margin-top: 2px;
        margin-left: 9px;
      }
    }
  }

  .sky-ag-grid-cell-uneditable:not(.sky-ag-grid-cell-row-selector) {
    background-color: var(--sky-background-color-disabled);
  }

  .ag-row:not(.ag-row-first) {
    border-top: none;
  }

  .ag-row {
    &.ag-row-focus {
      z-index: 1;
    }

    .ag-cell.ag-cell-focus {
      .ag-select {
        .ag-picker-field-display {
          margin-top: 6px;
          margin-left: 9px;
        }
      }
    }
  }
}

.ag-theme-sky-data-grid-modern-light,
.ag-theme-sky-data-entry-grid-modern-light {
  @include sky-ag-grid-variables.skyux-cell-wrap-text(
    sky-ag-grid-variables.$sky-cell-wrap-text-padding-modern,
    sky-ag-grid-variables.$sky-cell-wrap-text-line-height-modern
  );
}

.ag-theme-sky-data-grid-modern-light-compact,
.ag-theme-sky-data-entry-grid-modern-light-compact {
  @include sky-ag-grid-variables.skyux-cell-wrap-text(
    sky-ag-grid-variables.$sky-cell-wrap-text-padding-modern-compact,
    sky-ag-grid-variables.$sky-cell-wrap-text-line-height-modern
  );
}
