/*
 * Shared searchable-select widget (used on the dashboard and analytics).
 * A native <select> is hidden and mirrored by an input + popover so it can be
 * typed-to-filter while all existing code keeps using the native select.
 * Styling matches the dashboard's filter controls exactly.
 */

/* Hide the native select once it has been enhanced */
select[data-searchable="true"] {
  display: none !important;
}

.fl-search-select {
  position: relative;
}

.fl-search-input {
  width: 100%;
  padding: 8px 12px;
  padding-right: 2.5rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  font-size: 0.875rem;
  color: #374151;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  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;
  text-overflow: ellipsis;
}

.fl-search-input::placeholder {
  color: #9ca3af;
}

.fl-search-input:focus,
.fl-search-select.open .fl-search-input {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.fl-search-popover {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.16);
  padding: 6px;
  display: none;
  z-index: 2500;
  /* Hide the scrollbar while keeping scroll */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.fl-search-popover::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.fl-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fl-search-option {
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #111827;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fl-search-option:hover,
.fl-search-option.active {
  background: rgba(108, 92, 231, 0.1);
}

.fl-search-option.selected {
  background: rgba(108, 92, 231, 0.16);
  border-color: rgba(108, 92, 231, 0.35);
}

.fl-search-empty {
  padding: 10px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}
