@use "../../../../variables/index" as *;

@use "../../../mixins/c8y-scrollbar";

/**
 * C8Y Asset Selector Miller - Miller column view for asset selection
 *
 * Note: Uses $size-* tokens and $size-base for spacing and dimensions.
 *
 * Intentionally hardcoded values:
 * - Component-specific dimensions (200px, 312px): Column widths and heights
 * - Off-token spacing (30px): Width calculation
 * - CSS custom property (--c8y-root-component-padding: 8): Unitless value for calculations
 * - Percentages (33.333%, 100%): Layout and flex values
 * - Border widths (1px, 2px): Standard borders and outlines
 * - Negative offsets (-2px): Fine-tuning
 * - Z-index values (10, 20): Stacking order
 * - Box-shadow values: Border effects
 */

c8y-asset-selector-miller {
  display: block;
  position: relative;
  height: 100%;
  background: $component-background-default;
  .dropdown-menu &{
    height: 312px;
  }
}

.miller-view-wrapper {
  display: flex;
  overflow: auto;
  height: 100%;
  scroll-behavior: smooth;
  background: inherit;
  @include c8y-scrollbar.c8y-scrollbar();

  &.single-column {
    overflow: hidden;

    .miller-column {
      min-width: 100%;
      max-width: none;
      border-right: 0;
    }
  }
}

.miller-column {
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  @include c8y-scrollbar.c8y-scrollbar();
  border-right: 1px solid $component-border-color;
  max-width: 33.333%;
  min-width: 200px;

  &__header {
    background-color: $component-background-default;
    padding: $size-base;
    box-shadow: inset 0 -1px 0 $component-border-color;
    &.sticky-top {
      z-index: 20;
    }
    + c8y-asset-selector-node {
      position: relative;
      z-index: 10;
      background: inherit;
      display: block;
    }
  }
  &__selection{
    width: 100%;
    top:0;
    min-height: $size-40!important;

  }
  &__search{
    align-items: flex-start;
    flex-wrap: wrap;
    min-height: $size-48!important;
    &.miller-column__show-selected{
      min-height: $size-72!important;
    }
  }

  &__item {
    --c8y-root-component-padding: 8;
    background-color: $component-background-default;
    display: flex;
    align-items: center;
    min-height: calc($size-base * 4);

    &:hover:not(.miller-column__item--more) {
      box-shadow: inset 2px 0 0 0 $component-color-focus;
    }

    &.active {
      background-color: $component-realtime-added!important;
      box-shadow: inset 2px 0 0 0 $component-color-focus;
    }

    &__btn {
      background: transparent;
      color: $component-color-default;
      border: 0;
      display: flex;
      align-items: center;
      width: 100%;
      padding: 0 $component-padding;
      align-self: stretch;
      text-align: left;
      .active & {
        pointer-events: none;
      }
      &:focus {
        outline: 2px solid $component-brand-primary;
        outline-offset: -2px;
      }
    }

    &__checkbox {
      padding-left: $size-4;

      + .miller-column__item__btn {
        width: calc(100% - 30px);
        padding-left: $size-4;
      }
    }
  }
}
