/**
 * Copyright Aquera Inc 2025
 *
 * This source code is licensed under the BSD-3-Clause license found in the
 * LICENSE file in the root directory of this source tree.
 */

import { css } from 'lit';

/**
 * Grid Cell Item CSS
 */
export const styles = css`
  :host {
    --padding: var(--nile-spacing-xl, var(--ng-spacing-lg)) var(--nile-spacing-10px, var(--ng-spacing-3xl));
    --height: 44px;
    box-sizing: border-box;
    min-width: 0;
    white-space: nowrap;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: var(--padding);
    min-height: var(--height);
    height: auto;
    font-size: 14px;
    font-weight: 400;
    font-family: var(--nile-font-family-sans-serif, var(--ng-font-family-body));
  }

  .cell-item-base {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--nile-colors-dark-900, var(--ng-colors-text-tertiary-600));
  }

  ::slotted(*) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  :host(:last-child) .resize-handle {
    border-right: none;
    display: none;
  }

  .resize-handle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    cursor: ew-resize;
    touch-action: none;
    z-index: 1;
    width: 2px;
    border-right: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
    display: block;
  }

  :host(.shadow-right) {
    box-shadow: var(--nile-box-shadow-14, var(--ng-shadow-xs));
    background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
    z-index: 1;
  }

  :host(.shadow-left) {
    box-shadow: var(--nile-box-shadow-14, var(--ng-shadow-xs));
    background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
    z-index: 2;
  }

  :host-context(nile-grid-row[hover]:hover),
  :host-context(nile-grid-row[hover]:hover):host([data-sticky]) {
    background-color: var(--nile-colors-neutral-100);
  }

  :host-context(nile-grid-row[selected]),
  :host-context(nile-grid-row[selected]):host([data-sticky]) {
    background-color: var(--nile-colors-primary-100) !important;
  }

  :host(.cell-rowspan) {
    position: absolute;
    z-index: 1;
    background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
  }
`;

export default [styles];
