/*
 * Combobox: a dropdown you can also type in.
 *
 * Markup is a .combo wrapper with a hidden input (the submitted value), a text
 * input (what the user reads and types) and a .combo-list of .combo-option
 * items. Behaviour lives in /js/combobox.js.
 */

.combo {
    position: relative;
}

.combo .combo-input {
    width: 100%;
    padding-right: 38px;
}

.combo-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 38px;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    color: #8a94a6;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* CSS caret, so the component does not depend on an icon font */
.combo-toggle::before {
    content: "";
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    transition: transform .2s ease;
}

.combo.open .combo-toggle::before {
    transform: rotate(180deg);
}

.combo-list {
    position: absolute;
    z-index: 1000;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
}

.combo-option,
.combo-empty {
    padding: 9px 12px;
    border-radius: 4px;
    font-size: .9rem;
    line-height: 1.2;
}

.combo-option {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.combo-option:hover,
.combo-option.active {
    background: rgba(0, 86, 179, .08);
    color: var(--primary-color, #0056b3);
}

.combo-option.selected {
    font-weight: 600;
}

.combo-option .combo-code {
    margin-left: auto;
    font-family: monospace;
    font-size: .75rem;
    letter-spacing: .5px;
    opacity: .55;
}

.combo-empty {
    color: #8a94a6;
    cursor: default;
}

/* Set by combobox.js when a required combo is submitted without a choice */
.combo.is-invalid .combo-input {
    border-color: #dc3545;
}
