@import "../../../../../../vendor/bootstrap/scss/functions";

// Atum Variables
@import "../../variables";
@import "../../variables-dark";

@import "../../../../../../vendor/bootstrap/scss/variables";
@import "../../../../../../vendor/bootstrap/scss/mixins";

// choices.js
@import "../../../../../../vendor/choicesjs/scss/choices";

.choices {
  border: $form-select-border; //$form-select-border-width solid $form-select-border-color;
  @include border-radius($form-select-border-radius, 0);
  @include box-shadow($form-select-box-shadow);

  &.is-focused {
    border-color: $form-select-focus-border-color;

    @if $enable-shadows {
      @include box-shadow($form-select-box-shadow, $form-select-focus-box-shadow);
    } @else {
      // Avoid using mixin so we can pass custom focus shadow properly
      box-shadow: $form-select-focus-box-shadow;
    }
  }
}

.choices__inner {
  min-height: 42px;
  padding: .1rem 1rem;
  margin-bottom: 0;
  font-size: 1rem;
  border: none;
  border-radius: 0;
}

.choices__input {
  padding: 0;
  margin-bottom: 0;
  font-size: 1rem;
  background-color: transparent;

  &::placeholder {
    color: $choices-input-placeholder; // $gray-700; // var(--gray-200);
    opacity: 1;
  }
}

.choices__list--dropdown {
  z-index: $zindex-popover;
}

.choices__list--single {
  padding: 7px 16px 0 4px;
}

.choices__list--multiple .choices__item {
  position: relative;
  margin: 2px;
  color: $choices-list-multiple-item; //$white;
  background-color: $choices-list-multiple-item-bg !important; // var(--template-bg-dark);
  margin-inline-end: 2px;
  border: 0;
  border-radius: $border-radius;

  &.is-highlighted {
    background-color: var(--template-bg-dark);
    opacity: .9;
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .choices__list--multiple .choices__item {
      &.is-highlighted {
        background-color: var(--gray-800);
      }
    }
  }
}

.choices .choices__list--dropdown {
  background-color: var(--body-bg);

  .choices__item {
    padding-inline-end: 10px;
  }

  .choices__item--selectable {
    &::after {
      display: none;
    }
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .choices .choices__list--dropdown {
      .choices__item--selectable {
        &.is-highlighted {
          background-color: var(--gray-800);
        }
      }
    }
  }
}

.choices__button_joomla {
  position: relative;
  padding: 0 10px;
  color: inherit;
  text-indent: -9999px;
  cursor: pointer;
  background: none;
  border: 0;
  opacity: .5;
  appearance: none;

  &::before {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: block;
    text-align: center;
    text-indent: 0;
    content: "\00d7";
  }

  &:hover,
  &:focus {
    opacity: 1;
  }

  &:focus {
    outline: none;
  }
}

.choices[data-type*="select-one"],
.choices[data-type*="select-multiple"] {
  .choices__inner {
    padding-inline-end: $form-select-indicator-padding;
    cursor: pointer;
    background: url("../../../images/select-bg.svg") no-repeat 100%/116rem;
    background-color: $form-select-bg;

    [dir="rtl"] & {
      background: url("../../../images/select-bg-rtl.svg") no-repeat 0/116rem;
      background-color: $form-select-bg;
    }
  }
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .choices[data-type*="select-one"],
    .choices[data-type*="select-multiple"] {
      .choices__inner {
        background: url("../../../images/select-bg-dark.svg") no-repeat 100%/116rem;
        background-color: $form-select-bg-dark;

        [dir="rtl"] & {
          background: url("../../../images/select-bg-rtl-dark.svg") no-repeat 0/116rem;
          background-color: $form-select-bg-dark;
        }
      }
    }
  }
}

@if $enable-dark-mode {
  [dir="rtl"][data-bs-theme="dark"] {
    .choices[data-type*="select-one"],
    .choices[data-type*="select-multiple"] {
      .choices__inner {
        background: url("../../../images/select-bg-rtl-dark.svg") no-repeat 0/116rem;
        background-color: $form-select-bg-dark;
      }
    }
  }
}

.choices[data-type*="select-one"] {
  .choices__input {
    background-color: $choices-input-bg; // var(--body-bg)/var(--gray-600)
  }

  .choices__item {
    display: flex;
    justify-content: space-between;
  }

  .choices__button_joomla {
    position: absolute;
    top: 50%;
    inset-inline-end: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    margin-block-start: -10px;
    margin-inline-end: 50px;
    border-radius: 10em;
    opacity: .5;

    &:hover,
    &:focus {
      opacity: 1;
    }

    &:focus {
      box-shadow: $choices__button_joomla-focus-box-shadow;
    }
  }

  &::after {
    display: none;
  }
}

.choices[data-type*="select-multiple"],
.choices[data-type*="text"] {
  .choices__input {
    padding: .35rem 0;
  }
}

.choices__heading {
  font-size: 1.2rem;
}

@if $enable-dark-mode {
  @include color-mode(dark) {
    .choices__heading {
      color: var(--gray-500);
    }
  }
}
