/**
 * Customização do Choices.js para integração com Bootstrap
 */

/* Ajustar altura do input para corresponder aos inputs do Bootstrap */
.choices__inner {
  min-height: 38px !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
  border-radius: 0.25rem !important;
  border: 1px solid #dee2e6 !important;
}

/* Ajustar altura do input quando tem valor selecionado */
.choices__list--single {
  padding: 0 !important;
}

.choices__list--single .choices__item {
  padding: 0 !important;
}

/* Ajustar dropdown list z-index - abaixo do footer mas acima do conteúdo */
.choices__list--dropdown {
  z-index: 100 !important;
}

/* Garantir que o dropdown apareça acima da sidebar e outros elementos, mas abaixo do footer */
.choices[data-type*="select-one"] .choices__list--dropdown,
.choices[data-type*="select-multiple"] .choices__list--dropdown {
  z-index: 100 !important;
}

/* Ajustar dropdown quando está aberto */
.choices.is-open .choices__list--dropdown {
  z-index: 100 !important;
}

/* Ajustar padding do placeholder */
.choices__placeholder {
  opacity: 0.5 !important;
}

/* Ajustar altura dos itens no dropdown */
.choices__list--dropdown .choices__item {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
}

/* Ajustar input de busca */
.choices__input {
  padding: 0.5rem 0.75rem !important;
  font-size: 0.875rem !important;
  margin-bottom: 0 !important;
}

/* Remover espaçamento extra */
.choices[data-type*="select-one"]::after {
  right: 11.5px !important;
  margin-top: -2.5px !important;
}

/* Tema escuro - ajustar cores conforme tema do sistema */
body[data-theme="dark"] .choices__inner {
  background-color: #2c3e50 !important;
  border-color: #34495e !important;
  color: #ecf0f1 !important;
}

body[data-theme="dark"] .choices__list--dropdown {
  background-color: #2c3e50 !important;
  border-color: #34495e !important;
}

body[data-theme="dark"] .choices__list--dropdown .choices__item {
  color: #ecf0f1 !important;
}

body[data-theme="dark"] .choices__list--dropdown .choices__item--selectable.is-highlighted {
  background-color: #34495e !important;
}

body[data-theme="dark"] .choices__input {
  background-color: #34495e !important;
  color: #ecf0f1 !important;
}

/* Ajustar largura do dropdown para não cortar conteúdo */
.choices__list--dropdown {
  width: 100% !important;
}

/* Garantir que o wrapper do choices tenha a largura correta */
.choices {
  width: 100% !important;
  margin-bottom: 0 !important;
}

/* Ajuste para formulários inline */
.form-select + .choices {
  display: none;
}

/* Corrigir overflow de cards que cortam o dropdown */
.card-body:has(.choices) {
  overflow: visible !important;
}

.card:has(.choices) {
  overflow: visible !important;
}

/* Forçar overflow visible para todos os containers que possam ter Choices.js */
.row:has(.choices),
.col:has(.choices),
.col-md-12:has(.choices),
.container-fluid:has(.choices) {
  overflow: visible !important;
}

/* Caso específico para cards com dropdown */
.card .card-body .choices {
  position: relative;
  overflow: visible !important;
}

/* Garantir que o dropdown não seja cortado por containers pai */
.choices__list--dropdown.is-active {
  overflow: visible !important;
}

/* Remover overflow hidden de card-body quando houver choices dentro */
.card-body {
  overflow: visible;
}

/* Sobrescrever qualquer overflow hidden de cards */
.card {
  overflow: visible;
}
