/* Address autocomplete (Adressevælger), as on jyskenergi.dk in NOE's red */
.autocomplete-container > div {
    position: relative;
    width: 100%;
}

.autocomplete-container input {
    width: 100%;
    box-sizing: border-box;
}

ul.dawa-autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    box-sizing: border-box;
    max-height: min(340px, 60vh);
    margin: 6px 0 0;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    text-align: left;
    border: 1px solid #dddddd;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);
    scrollbar-width: thin;
    scrollbar-color: rgba(18, 18, 18, 0.2) transparent;
}

ul.dawa-autocomplete-suggestions::-webkit-scrollbar {
    width: 12px;
}

ul.dawa-autocomplete-suggestions::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-radius: 12px;
    background-color: rgba(18, 18, 18, 0.2);
    background-clip: padding-box;
}

/* Every suggestion is two lines high: the street in dark bold, the rest below in grey */
.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion {
    position: relative;
    margin: 0;
    padding: 8px 12px 8px 42px;
    list-style: none;
    cursor: pointer;
    border: 0;
    border-radius: 6px;
    color: rgba(18, 18, 18, 0.6);
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
    transition: background-color 0.12s ease;
}

/* Scoped to the list so Gravity Forms 3's theme reset, loaded later with equal weight, cannot undo them */
.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion__street,
.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion__place {
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion__street {
    color: #121212;
    font-size: 16px;
    font-weight: 600;
    line-height: 20px;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion__place {
    font-size: 14px;
    line-height: 18px;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 11px;
    margin-top: -10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #f5e3e2 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23AE0F0A' d='M12 12q.825 0 1.413-.587Q14 10.825 14 10t-.587-1.413Q12.825 8 12 8t-1.412.587Q10 9.175 10 10t.588 1.413Q11.175 12 12 12Zm0 7.35q3.050-2.8 4.525-5.087Q18 11.975 18 10.2q0-2.725-1.738-4.462Q14.525 4 12 4T7.738 5.738Q6 7.475 6 10.2q0 1.775 1.475 4.063Q8.95 16.550 12 19.35ZM12 22q-4.025-3.425-6.012-6.363Q4 12.7 4 10.2q0-3.75 2.413-5.975Q8.825 2 12 2t5.587 2.225Q20 6.45 20 10.2q0 2.5-1.987 5.437Q16.025 18.575 12 22Z'/%3E%3C/svg%3E") center / 13px 13px no-repeat;
    transition: background-color 0.12s ease;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion + .dawa-autocomplete-suggestion {
    margin-top: 1px;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion.dawa-selected,
.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion:hover {
    background: #f5f5f5;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion.dawa-selected::before,
.dawa-autocomplete-suggestions .dawa-autocomplete-suggestion:hover::before {
    background-color: #ecc9c7;
}

/* While searching: a small spinner in the field.
   Doubled class: Gravity Forms 3's theme reset (position: unset, loaded later) has the weight of one class. */
.autocomplete-container.autocomplete-container {
    position: relative;
}

.autocomplete-container.dawa-searching::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 14px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    box-sizing: border-box;
    border: 2px solid rgba(18, 18, 18, 0.15);
    border-top-color: #AE0F0A;
    border-radius: 50%;
    pointer-events: none;
    animation: dawa-spin 0.7s linear infinite;
}

/* "Søger efter adresser …" until the first suggestions arrive, and "Ingen adresser fundet" */
.dawa-autocomplete-suggestions .dawa-autocomplete-status {
    position: relative;
    margin: 0;
    padding: 10px 12px;
    list-style: none;
    color: rgba(18, 18, 18, 0.6);
    font-size: 14px;
    line-height: 20px;
    text-align: left;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-status--loading {
    padding-left: 42px;
}

.dawa-autocomplete-suggestions .dawa-autocomplete-status--loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 14px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    box-sizing: border-box;
    border: 2px solid #f5e3e2;
    border-top-color: #AE0F0A;
    border-radius: 50%;
    animation: dawa-spin 0.7s linear infinite;
}

@keyframes dawa-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .dawa-autocomplete-suggestions .dawa-autocomplete-suggestion,
    .dawa-autocomplete-suggestions .dawa-autocomplete-suggestion::before {
        transition: none;
    }

    /* The ring stays as a still sign of searching */
    .autocomplete-container.dawa-searching::after,
    .dawa-autocomplete-suggestions .dawa-autocomplete-status--loading::before {
        animation: none;
    }
}
