/* Override tom-select avec CSS vanilla pour AssetMapper */

.ts-control {
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: white;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.ts-control:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ts-control input {
  padding-right: 1.25rem !important;
  font-size: 0.875rem !important;
  margin: 0 !important;
  border: none;
  outline: none;
  background: transparent;
}

.ts-wrapper.plugin-remove_button .item {
  border-radius: 0.375rem !important;
  background-color: #e5e7eb !important;
  padding: 0.25rem 0.5rem !important;
  margin: 0.125rem !important;
  display: inline-flex !important;
  align-items: center !important;
}

.ts-wrapper.multi .ts-control > div {
  padding: 0;
  margin: 0;
  padding-left: 0.25rem;
}

.ts-wrapper.plugin-remove_button .item .remove {
  border: none;
  font-size: 1.125rem;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 0 0.375rem 0.375rem 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  margin-left: 0.25rem;
}

.ts-wrapper.plugin-remove_button .item .remove:hover {
  color: #ef4444;
}

.ts-dropdown {
  border-radius: 0.375rem !important;
  border: 1px solid #d1d5db !important;
  border-top: 1px solid #d1d5db !important;
  background: white !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
  z-index: 1000 !important;
}

.ts-dropdown [data-selectable].option, 
.ts-dropdown .no-results {
  padding: 0.5rem;
  cursor: pointer;
}

.ts-dropdown [data-selectable].option:first-child {
  border-radius: 0.375rem 0.375rem 0 0;
}

.ts-dropdown [data-selectable].option:last-child {
  border-radius: 0 0 0.375rem 0.375rem;
}

.ts-dropdown .create:hover, 
.ts-dropdown .option:hover, 
.ts-dropdown .active {
  background-color: #e0e7ff;
  color: #3730a3;
}

.ts-dropdown .spinner {
  height: auto;
  width: auto;
}

.ts-dropdown .spinner:after {
  height: 1.25rem;
  width: 1.25rem;
  border: 2px solid #6366f1;
  border-top-color: transparent;
  padding: 0;
  margin: 0;
  display: inline-block;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Flèche pour select simple */
.ts-wrapper:not(.form-control):not(.form-select).single .ts-control {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Force la spécificité pour éviter les conflits */
.ts-wrapper .ts-control,
body .ts-wrapper .ts-control {
  width: 100% !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
}