@import (reference) url('./Icon.less');
@import (reference) url('./Reset.less');
@import (reference) url('./SearchInput.less');

btu-form-filter {
  align-items: center;
  display: flex;
  justify-content: end;
  width: 100%;

  .FormFilter-icon {
    .Link;

    border: none;
    color: var(--color-black);
    margin-left: var(--gap-l);
  }
}

.FormFilter {
  &-container {
    .SearchInput;
    .SearchInput.is-filter;

    display: flex;
    flex-direction: row;
    opacity: 0;
    overflow: hidden;
    padding: 0 var(--gap-m);
    transform: scaleX(0);
    transform-origin: right;
    transition-duration: var(--time-xs);
    transition-property: opacity, transform;
    transition-timing-function: var(--ease-out);
    width: 40%;

    &.is-open {
      opacity: 1;
      transform: scaleX(1);
    }

    > btu-input {
      width: 100%;
    }
  }

  &-icon {
    --Link-color: var(--color-black);

    height: calc(var(--gap-s) * 2 + var(--Icon-size));
    overflow: hidden;
    top: 0;
    width: calc(var(--gap-s) * 2 + var(--Icon-size));

    &::after {
      &:extend(.Icon);

      content: 'search';
      margin-top: calc(0px - var(--Icon-size) / 2);
      position: absolute;
      right: var(--gap-s);
      top: 50%;
    }

    &::before {
      border-radius: 50%;
      content: '';
      display: block;
      height: 100%;
      opacity: 0;
      transition: opacity var(--time-m) var(--ease-in);
      width: 100%;
      z-index: -1;
    }

    &:hover {
      cursor: pointer;
    }

    &:hover::before {
      background-color: var(--color-gray2);
      opacity: 0.8;
    }

    &.is-open {
      &::after {
        content: 'close';
      }

      &::before {
        background-color: var(--color-gray3);
        opacity: 1;
      }
    }
  }
}

.CIG {
  &.is-filtering {
    > *,
    > .Tab > *,
    .PluginItem:not(.is-filterResult) {
      display: none;
    }

    > .Tab {
      display: block;
    }

    .is-filterResult,
    > *:has(.is-filterResult):not([hidden]) {
      display: block !important;

      &.CIG-row[data-tab]:not(.has-title),
      &.Tab[data-tab],
      &.CIG-title[data-tab] {
        margin-top: calc(var(--gap-xl) * 1.6);
        position: relative;
      }

      &.CIG-row[data-tab]:not(.has-title)::before,
      &.Tab[data-tab]::after,
      &.CIG-title[data-tab]::after {
        border-bottom: 1px solid var(--color-gray3);
        content: attr(data-tab);
        font-size: var(--fontSize-xs);
        font-weight: 100;
        line-height: var(--lineHeight-l);
        position: absolute;
        text-transform: uppercase;
        top: calc(var(--gap-l) * -1.6);
        width: 100%;
      }

      &.CIG-title[data-tab]::after {
        left: 0;
      }

      &.Tab[data-tab]::after,
      &.CIG-row[data-tab]:not(.has-title)::before {
        left: calc(var(--gap-m) * -1);
      }

      &.CIG-title {
        pointer-events: none;
      }

      .CIG-titleToggle {
        display: none;
      }
    }

    .FormFilter-message {
      display: block;
      margin: var(--gap-m) 0;
    }
  }

  &.is-loading {
    display: block;
    min-height: 80vh;
    visibility: visible;

    &::before {
      .Icon;

      animation: spin var(--time-xl) infinite ease-in-out;
      color: var(--color-black);
      content: 'autorenew';
      height: var(--Icon-size-l);
      left: 50%;
      margin-right: var(--gap-m);
      position: absolute;
      top: 50%;
      width: var(--Icon-size-l);
      z-index: 10;
    }
  }

  @keyframes spin {
    from {
      transform: rotate(0deg);
    }

    to {
      transform: rotate(360deg);
    }
  }
}
