/* TomSelect */

.ts-control .item {
    display: initial;
    align-items: initial;
}

.atlas-select.home {
    max-width: 800px;
}

.atlas-select .highlight {
    /* Highlight phylum in atlas selection */
    background: rgb(255 237 40 / 40%);
    border-radius: 1px;
}

.atlas-select .ts-dropdown {
    z-index: 1030; /* higher than subnavbar */
}

.atlas-select .ts-dropdown-content {
    max-height: 50vh;
}

.ts-dropdown .selected {
    background-color: var(--primary-color);
    color: #fff;
}

.ts-dropdown.plugin-optgroup_columns .optgroup {
    /* transition: all 0.1s ease; */

    /* word-break: break-word; */
    white-space: nowrap;
}

.ts-dropdown.plugin-optgroup_columns .optgroup:has(.active) {
    min-width: 260px; /* Change width to display more info on selected option */
    white-space: wrap;
}

@media (width <= 768px) {
    .ts-dropdown.plugin-optgroup_columns .ts-dropdown-content {
        display: initial;
    }
}

.species-meta {
    display: none;
}

.species-meta:has(:is(.highlight, .search-highlight)) {
    display: inline-block;
}

.ts-control::before {
    opacity: 0;
    transition: opacity 0.2s;
    animation: none;
    z-index: 2;
    position: absolute;
    display: block;
    top: 12px;
    right: 36px;
    width: 16px;
    height: 16px;

    /* SVG spinner from https://fontawesome.com/icons/spinner */
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath d='M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z'/%3E%3C/svg%3E");
}

.focus .ts-control {
    border: 1px solid #ced4da;
    box-shadow: 0 0 0 0.25rem #ced4da;
}

.ts-control:focus-within {
    box-shadow: 0 0 0 0.25rem var(--hover-border-color);
}

.ts-control.loading::before {
    opacity: 1;
    animation: fa-spin 2s infinite linear;
}

.ts-control.multi .ts-control > div.active {
    background: var(--primary-color);
    color: #fff;
    border: 0 solid transparent;
}

.ts-control.multi .ts-control > div.active span.badge {
    background: var(--bs-tertiary-color) !important;
}

.ts-control .remove {
    color: var(--hover-color);
}

.ts-control div.active .remove {
    color: white;
}

.bca-search .ts-control::after {
    display: none !important;
}

.bca-search .ts-dropdown {
    width: 400px !important;
    left: auto !important;
    right: 0 !important;
    z-index: 1040;
}

.bca-search .ts-dropdown-content {
    max-height: 80vh;
}

.bca-search input[type="search"] {
    width: 100% !important;
}
