@charset "UTF-8";

@use 'sass:math';

.auto-select-body {
  background: #fff;
  box-shadow: 0 12px 12px rgba(0, 0, 0, 0.12);
  //overflow: hidden;

  @include mq(sm) {
    min-height: 25.8rem;
    //max-height: calc(100vh - #{map_get($mq-container-indents, "sx")});
    border-top-right-radius: $border-radius-base;
    border-top-left-radius: $border-radius-base;
  }

  @include mq(sx) {
    margin-top: calc(-1 * #{map_get($mq-container-indents, 'sm')} / 4);
    padding-top: calc(#{map_get($mq-container-indents, 'sm')} / 4);
    border-bottom-right-radius: $border-radius-base;
    border-bottom-left-radius: $border-radius-base;
    //box-shadow: 0 12px 12px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.07);
  }

  &--min-height {
    min-height: auto;
  }

  &--dropdown-type {
    @include mq(sx) {
      box-shadow: 0 0 0 1px $color-n-lightest;
    }
  }

  &--mq-sm-fixed-footer {
    margin-bottom: calc(#{map_get($mq-container-indents, 'sx')} - 1px);
  }

  &__dont-find-auto {
    @include text-base(700);
    display: none;
    justify-content: center;
    align-items: center;
    width: 100%;

    height: map_get($mq-container-indents, 'sx');
    border-top: 1px solid $color-n-lightest;

    @include mq(sm-md) {
      display: flex;
    }

    &:focus {
      outline: none;
    }
  }

  &__input {
    display: block;
    border-bottom: 1px solid $color-n-lightest;

    &:not(.auto-select-body__input--all-bp) {
      @include mq(sx) {
        display: none;
      }
    }

    &.auto-select-body__input---all-bp {
      @include mq(sx) {
        margin-top: -4px; // magic number;
        border-top: 1px solid $color-n-lightest;
      }
    }

    input {
      &:focus {
        outline: none;
      }
    }

    + .auto-select-body__container {
      border-top: 1px solid $color-n-lightest;
    }
  }

  &__container {
    @include scroll-not-scrollbar(hidden, auto);

    max-height: 376px;

    @include mq(sm) {
      max-height: calc(100vh - #{map_get($mq-container-indents, 'sx')} - 65px);
    }

    @include mq(sx) {
      padding: map_get($mq-container-indents, 'sm') * 0.5 - 1px 0 map_get($mq-container-indents, 'sm') * 0.5;
    }

    &--no-fixed-height {
      max-height: none;
    }
  }

  &__container-grid {
    @include mq(sx) {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
      margin: {
        right: -1 * map_get($mq-container-indents, 'sm') * 0.5;
        left: -1 * map_get($mq-container-indents, 'sm') * 0.5;
      }
    }
  }

  &__container-grid-col {
    @include mq(sx) {
      @include col-size(math.div(1, 3));

      &--full-width {
        @include mq(sx) {
          width: 100%;
        }
      }

      &--inline-block {
        display: inline-block;
      }
    }
  }

  &__item {
    @include interact(background-color, $color-lightest-border);

    position: relative;
    display: block;
    padding: map_get($mq-container-indents, 'sm') * 0.5 map_get($mq-container-indents, 'sm');
    width: 100%;
    text-align: left;
    transition: background-color $transition-duration-base-min;

    @include mq(sm) {
      @include text-base-big(500);

      padding: 20px map_get($mq-container-indents, 'sm') 19px;
      border-bottom: 1px solid $color-n-lightest;
    }

    &:focus {
      outline: none;
    }

    &.auto-select-body__item--type-icon {
      position: relative;

      .auto-select-body__container-grid & {
        @include mq(sx) {
          padding-left: 5.2rem;
        }
      }

      &.is-checked {
        padding-right: 5.2rem;

        .icon {
          opacity: 1;
        }
      }
    }

    .auto-select-body__container-grid & {
      @include mq(sx) {
        @include interact(background-color, #fff);
        @include interact(text-decoration, underline);

        &:focus {
          text-decoration: underline;
        }
      }
    }
  }

  &__list-item-input {
    @include size(100%);

    position: absolute;
    top: 0;
    right: 0;
    z-index: 1;
    outline: none;
    cursor: pointer;

    &:hover {
      + .auto-select-body__list-item-content-icon {
        border-color: $color-base;
      }

      + .auto-select-body__list-item-content-icon {
        @include mq(sm) {
          border-color: $color-base;
        }
      }

      + .interactive-user-popover-body__list-item-content .interactive-user-popover-body__list-item-content-icon-clear {
        background-color: $color-gray;
      }
    }

    &:focus {
      + .auto-select-body__list-item-content-icon {
        border-color: $color-base;
      }

      + .interactive-user-popover-body__list-item-content .interactive-user-popover-body__list-item-content-icon-clear {
        background-color: $color-gray;
      }
    }

    .is-checked &,
    &:checked {
      + .auto-select-body__list-item-content-icon {
        border-color: $brand-turquoise;
        background: $brand-turquoise;

        .icon {
          opacity: 1;
        }
      }

      &:hover {
        + .auto-select-body__list-item-content-icon {
          border-color: $brand-green-pea;
          background-color: $brand-green-pea;
        }
      }

      &:focus {
        + .auto-select-body__list-item-content-icon {
          border-color: $brand-green-pea;
          background-color: $brand-green-pea;
        }
      }
    }
  }

  &__item-header,
  &__item-description {
    //@include ellipsis(100%, block);

    display: block;
  }

  &__list-item-content-icon {
    @include size(2rem);

    position: absolute;
    top: 20px;
    right: map_get($mq-container-indents, 'sm');
    min-width: 2rem;
    border-radius: 50%;
    border: 1px solid $color-gray;
    transition: border-color $transition-duration-base-min, background-color $transition-duration-base-min;

    @include mq(sx) {
      top: map_get($mq-container-indents, 'sm') * 0.5;
    }

    &[data-color-name='#fff'],
    &[data-color-name='#ffffff'],
    &[data-color-name='white'] {
      > .icon {
        fill: $color-base;
      }
    }

    > .icon {
      @include size(100%);

      position: absolute;
      top: 0;
      left: 0;
      fill: #fff;
      opacity: 0;
      transition: opacity $transition-duration-base-min;
    }

    .auto-select-body__container-grid & {
      @include mq(sx) {
        right: auto;
        left: map_get($mq-container-indents, 'sm');
      }
    }
  }

  &__item-header {
    font-weight: 500;
  }

  &__item-description {
    color: $color-lighter;
  }

  &__item-description {
    color: $color-placeholder;
  }
}
