/*
 * Copyright 2026 Hypergiant Galactic Systems Inc. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@reference '@accelint/design-foundation/styles';

@layer components.l1 {
  .headerCell {
    @apply p-m pr-none fg-primary-muted gap-xxs text-body-s flex items-center justify-between border-1 border-transparent text-left align-middle font-medium;

    @variant hover {
      @apply fg-primary-bold;
    }

    @variant selected {
      @apply bg-accent-primary-muted visible;

      border-top-color: var(--outline-accent-primary-bold);
      box-shadow:
        1px 0 0 0 var(--outline-accent-primary-bold),
        -1px 0 0 0 var(--outline-accent-primary-bold);
    }
  }

  .cell {
    @apply fg-primary-bold min-w-l font-display text-body-s p-m text-left align-middle;

    @variant selected {
      @apply bg-accent-primary-muted;

      box-shadow:
        1px 1px 0 0 var(--outline-accent-primary-bold),
        -1px 0 0 0 var(--outline-accent-primary-bold);
    }

    @variant selection-end {
      @apply border-b-1 border-b-[var(--outline-accent-primary-bold)];
    }
  }

  .row {
    @variant group-not-selected/tbody {
      @apply border-1 border-transparent;

      @variant first-of-type {
        border-top-color: var(--outline-static);
      }
    }

    @variant has-[+[data-selected]] {
      @variant not-selected {
        border-bottom-color: var(--outline-accent-primary-bold);
      }
    }

    @variant selected {
      @apply bg-accent-primary-muted;

      border-left-color: var(--outline-accent-primary-bold);
      border-right-color: var(--outline-accent-primary-bold);

      @variant not-has-[+[data-selected]] {
        border-bottom-color: var(--outline-accent-primary-bold);
      }

      @variant first-of-type {
        border-top-color: var(--outline-accent-primary-bold);
      }
    }
  }

  .hideInRow {
    /* making the `td` not visible was causing the bg color to not show for selected rows */
    & > * {
      @apply invisible;

      @variant group-hover/row {
        @apply visible;
      }
    }
  }

  .hideInHeader {
    @apply invisible;

    @variant group-hover/header-cell {
      @apply visible;
    }

    @variant group-selected/header-cell {
      @apply visible;
    }
  }
}
