/* ============================================
   CHOICES.JS THEME - LIGHT & DARK MODE
   ============================================ */

/* ---------- BASE / LIGHT MODE ---------- */

.choices {
  position: relative;
  margin-bottom: 0;
  font-size: 0.875rem;
}

.choices:focus {
  outline: none;
}

.choices:last-child {
  margin-bottom: 0;
}

.choices.is-disabled .choices__inner,
.choices.is-disabled .choices__input {
  background-color: var(--bs-gray-100, #f8f9fa);
  cursor: not-allowed;
  user-select: none;
}

.choices.is-disabled .choices__item {
  cursor: not-allowed;
}

/* ---------- INNER CONTAINER ---------- */

.choices__inner {
  display: inline-block;
  vertical-align: top;
  width: 100%;
  background-color: var(--bs-body-bg, #ffffff);
  padding: 0.375rem 2.25rem 0.375rem 0.75rem;
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.375rem);
  font-size: 0.875rem;
  min-height: calc(1.5em + 0.75rem + 2px);
  overflow: hidden;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.is-focused .choices__inner,
.is-open .choices__inner {
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
}

.choices__list--single {
  display: inline-block;
  padding: 0;
  width: 100%;
}

.choices__list--single .choices__item {
  width: 100%;
}

/* ---------- DROPDOWN ---------- */

.choices__list--dropdown,
.choices__list[aria-expanded] {
  visibility: hidden;
  z-index: 1000;
  position: absolute;
  width: 100%;
  background-color: var(--bs-body-bg, #ffffff);
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: var(--bs-border-radius, 0.375rem);
  top: 100%;
  margin-top: 4px;
  padding: 0;
  list-style: none;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  word-break: break-all;
  will-change: visibility;
}

.is-active.choices__list--dropdown,
.is-active.choices__list[aria-expanded] {
  visibility: visible;
}

.choices__list--dropdown .choices__list,
.choices__list[aria-expanded] .choices__list {
  position: relative;
  max-height: 200px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  will-change: scroll-position;
}

.choices__list--dropdown .choices__item,
.choices__list[aria-expanded] .choices__item {
  position: relative;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: var(--bs-body-color, #212529);
}

.choices__list--dropdown .choices__item--selectable.is-highlighted,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background-color: var(--bs-primary, #0d6efd);
  color: #ffffff;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted::after,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted::after {
  color: #ffffff;
}

/* ---------- ITEMS (SELECTED) ---------- */

.choices__list--multiple {
  display: inline;
}

.choices__list--multiple .choices__item {
  display: inline-block;
  vertical-align: middle;
  border-radius: var(--bs-border-radius-sm, 0.25rem);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  margin-right: 0.375rem;
  margin-bottom: 0.25rem;
  background-color: var(--bs-primary, #0d6efd);
  border: 1px solid var(--bs-primary, #0d6efd);
  color: #ffffff;
  word-break: break-all;
  box-sizing: border-box;
}

.choices__list--multiple .choices__item.is-highlighted {
  background-color: var(--bs-danger, #dc3545);
  border: 1px solid var(--bs-danger, #dc3545);
}

/* ---------- INPUT ---------- */

.choices__input {
  display: inline-block;
  vertical-align: baseline;
  background-color: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  font-size: 0.875rem;
  color: var(--bs-body-color, #212529);
  max-width: 100%;
}

.choices__input:focus {
  outline: 0;
}

.choices__input::placeholder {
  color: var(--bs-gray-500, #adb5bd);
  opacity: 1;
}

/* ---------- PLACEHOLDER ---------- */

.choices__placeholder {
  opacity: 0.5;
  color: var(--bs-gray-500, #adb5bd);
}

/* ---------- BUTTONS / ICONS ---------- */

.choices__button {
  text-indent: -9999px;
  appearance: none;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
}

.choices__button:focus {
  outline: none;
}

.choices__list--single .choices__button {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  padding: 0;
  background-size: 12px;
  position: absolute;
  top: 50%;
  right: 0;
  margin-top: -10px;
  margin-right: 30px;
  height: 20px;
  width: 20px;
  border-radius: 10em;
  opacity: 0.5;
}

.choices__list--single .choices__button:hover,
.choices__list--single .choices__button:focus {
  opacity: 1;
}

.choices__list--multiple .choices__button {
  position: relative;
  display: inline-block;
  margin-top: 0;
  margin-right: -4px;
  margin-bottom: 0;
  margin-left: 8px;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  background-size: 12px;
  width: 12px;
  line-height: 1;
  opacity: 0.75;
  border-radius: 0;
}

.choices__list--multiple .choices__button:hover,
.choices__list--multiple .choices__button:focus {
  opacity: 1;
}

/* ---------- ARROW / DROPDOWN INDICATOR ---------- */

.choices[data-type*="select-one"]:after {
  content: "";
  height: 0;
  width: 0;
  border-style: solid;
  border-color: var(--bs-gray-500, #adb5bd) transparent transparent transparent;
  border-width: 5px;
  position: absolute;
  right: 11.5px;
  top: 50%;
  margin-top: -2.5px;
  pointer-events: none;
}

.choices[data-type*="select-one"].is-open:after {
  border-color: transparent transparent var(--bs-gray-500, #adb5bd) transparent;
  margin-top: -7.5px;
}

.choices[data-type*="select-one"] .choices__button {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
  padding: 0;
  background-size: 12px;
  position: absolute;
  top: 50%;
  right: 0;
  margin-top: -10px;
  margin-right: 30px;
  height: 20px;
  width: 20px;
  border-radius: 10em;
  opacity: 0.5;
}

.choices[data-type*="select-one"] .choices__button:hover,
.choices[data-type*="select-one"] .choices__button:focus {
  opacity: 1;
}

/* ---------- HEADING / GROUP ---------- */

.choices__heading {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  color: var(--bs-gray-500, #adb5bd);
  border-bottom: 1px solid var(--bs-border-color, #dee2e6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- DISABLED STATE ---------- */

.choices__item.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- NO RESULTS / NO CHOICES ---------- */

.choices__list--dropdown .choices__item--selectable.is-highlighted::after,
.choices__list[aria-expanded] .choices__item--selectable.is-highlighted::after {
  content: attr(data-select-text);
  font-size: 0.75rem;
  opacity: 0;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
}

.choices__item--selectable:hover::after {
  opacity: 1;
}

.choices__item--disabled {
  opacity: 0.5;
  cursor: not-allowed;
  user-select: none;
}

/* ---------- LOADING STATE ---------- */

.choices[data-type*="select-one"].is-loading .choices__inner:after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid var(--bs-border-color, #dee2e6);
  border-top-color: var(--bs-primary, #0d6efd);
  border-radius: 50%;
  animation: choices-spin 0.5s linear infinite;
}

@keyframes choices-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ============================================
   DARK MODE - [data-pc-theme="dark"]
   ============================================ */

[data-pc-theme="dark"] .choices__inner {
  background-color: var(--bs-body-bg, #0f172a);
  border-color: var(--bs-border-color, #303f50);
  color: var(--bs-body-color, #bfbfbf);
}

[data-pc-theme="dark"] .choices__inner:hover {
  border-color: var(--bs-gray-600, #6c757d);
}

[data-pc-theme="dark"] .is-focused .choices__inner,
[data-pc-theme="dark"] .is-open .choices__inner {
  border-color: var(--bs-primary, #0d6efd);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb, 13, 110, 253), 0.25);
}

[data-pc-theme="dark"] .choices__input {
  color: var(--bs-body-color, #bfbfbf);
  background-color: transparent;
}

[data-pc-theme="dark"] .choices__input::placeholder {
  color: var(--bs-gray-500, #6f747f);
  opacity: 0.6;
}

[data-pc-theme="dark"] .choices__placeholder {
  color: var(--bs-gray-500, #6f747f);
  opacity: 0.5;
}

/* ---------- DROPDOWN DARK ---------- */

[data-pc-theme="dark"] .choices__list--dropdown,
[data-pc-theme="dark"] .choices__list[aria-expanded] {
  background-color: var(--pc-header-submenu-background, #111a31);
  border-color: var(--bs-border-color, #303f50);
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
}

[data-pc-theme="dark"] .choices__list--dropdown .choices__item,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__item {
  color: var(--bs-body-color, #bfbfbf);
}

[data-pc-theme="dark"] .choices__list--dropdown .choices__item--selectable.is-highlighted,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
  background-color: var(--bs-primary, #0d6efd);
  color: #ffffff;
}

[data-pc-theme="dark"] .choices__heading {
  color: var(--bs-gray-500, #6f747f);
  border-bottom-color: var(--bs-border-color, #303f50);
}

/* ---------- DISABLED DARK ---------- */

[data-pc-theme="dark"] .choices.is-disabled .choices__inner,
[data-pc-theme="dark"] .choices.is-disabled .choices__input {
  background-color: var(--pc-active-background, #19212a);
  opacity: 0.6;
}

/* ---------- ARROW DARK ---------- */

[data-pc-theme="dark"] .choices[data-type*="select-one"]:after {
  border-color: var(--bs-gray-500, #6f747f) transparent transparent transparent;
}

[data-pc-theme="dark"] .choices[data-type*="select-one"].is-open:after {
  border-color: transparent transparent var(--bs-gray-500, #6f747f) transparent;
}

/* ---------- CLOSE BUTTON DARK ---------- */

[data-pc-theme="dark"] .choices__list--single .choices__button {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f747f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}

[data-pc-theme="dark"] .choices[data-type*="select-one"] .choices__button {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f747f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}

/* ---------- LOADING DARK ---------- */

[data-pc-theme="dark"] .choices[data-type*="select-one"].is-loading .choices__inner:after {
  border-color: var(--bs-border-color, #303f50);
  border-top-color: var(--bs-primary, #0d6efd);
}

/* ---------- SCROLLBAR DARK ---------- */

[data-pc-theme="dark"] .choices__list--dropdown .choices__list::-webkit-scrollbar,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__list::-webkit-scrollbar {
  width: 6px;
}

[data-pc-theme="dark"] .choices__list--dropdown .choices__list::-webkit-scrollbar-track,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__list::-webkit-scrollbar-track {
  background: var(--pc-active-background, #19212a);
  border-radius: 3px;
}

[data-pc-theme="dark"] .choices__list--dropdown .choices__list::-webkit-scrollbar-thumb,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__list::-webkit-scrollbar-thumb {
  background: var(--bs-gray-600, #303f50);
  border-radius: 3px;
}

[data-pc-theme="dark"] .choices__list--dropdown .choices__list::-webkit-scrollbar-thumb:hover,
[data-pc-theme="dark"] .choices__list[aria-expanded] .choices__list::-webkit-scrollbar-thumb:hover {
  background: var(--bs-gray-500, #6f747f);
}

/* ============================================
   FORM VALIDATION STATES
   ============================================ */

.was-validated .choices__inner:invalid,
.choices.is-invalid .choices__inner {
  border-color: var(--bs-danger, #dc3545);
}

.was-validated .choices__inner:invalid.is-focused,
.was-validated .choices__inner:invalid.is-open,
.choices.is-invalid .choices__inner.is-focused,
.choices.is-invalid .choices__inner.is-open {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb, 220, 53, 69), 0.25);
}

.was-validated .choices__inner:valid,
.choices.is-valid .choices__inner {
  border-color: var(--bs-success, #198754);
}

.was-validated .choices__inner:valid.is-focused,
.was-validated .choices__inner:valid.is-open,
.choices.is-valid .choices__inner.is-focused,
.choices.is-valid .choices__inner.is-open {
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-success-rgb, 25, 135, 84), 0.25);
}

/* ============================================
   SIZE VARIANTS (MATCH BOOTSTRAP)
   ============================================ */

.form-control-sm + .choices .choices__inner,
.input-group-sm .choices .choices__inner {
  padding: 0.25rem 2rem 0.25rem 0.5rem;
  font-size: 0.8125rem;
  min-height: calc(1.5em + 0.5rem + 2px);
}

.form-control-lg + .choices .choices__inner,
.input-group-lg .choices .choices__inner {
  padding: 0.5rem 2.5rem 0.5rem 1rem;
  font-size: 1rem;
  min-height: calc(1.5em + 1rem + 2px);
}

/* ============================================
   RTL SUPPORT
   ============================================ */

[dir="rtl"] .choices__inner {
  padding-right: 0.75rem;
  padding-left: 2.25rem;
}

[dir="rtl"] .choices[data-type*="select-one"]:after {
  right: auto;
  left: 11.5px;
}

[dir="rtl"] .choices__list--single .choices__button {
  right: auto;
  left: 0;
  margin-right: 0;
  margin-left: 30px;
}

[dir="rtl"] .choices__list--multiple .choices__button {
  margin-left: -4px;
  margin-right: 8px;
  padding-left: 0;
  padding-right: 16px;
  border-left: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.35);
}

[dir="rtl"] .choices__list--dropdown .choices__item--selectable.is-highlighted::after,
[dir="rtl"] .choices__list[aria-expanded] .choices__item--selectable.is-highlighted::after {
  right: auto;
  left: 10px;
}