/*
 * Autocomplete de cidades e UFs
 * Simulador Engerádios
 */

.location-autocomplete {
    position: relative;
    width: 100%;
}

.location-autocomplete__input-wrap {
    position: relative;
    width: 100%;
}

.location-autocomplete__input-wrap::before {
    content: "";

    position: absolute;
    left: 15px;
    top: 50%;

    width: 14px;
    height: 14px;

    border: 2px solid #777b82;
    border-radius: 50%;

    transform: translateY(-58%);

    pointer-events: none;
}

.location-autocomplete__input-wrap::after {
    content: "";

    position: absolute;
    left: 27px;
    top: 58%;

    width: 7px;
    height: 2px;

    background: #777b82;
    border-radius: 2px;

    transform: rotate(45deg);

    pointer-events: none;
}

.location-autocomplete #sim-city {
    padding-left: 43px;
    padding-right: 45px;
}

.location-autocomplete__clear {
    position: absolute;
    z-index: 2;
    top: 50%;
    right: 10px;

    width: 30px;
    height: 30px;

    display: none;
    place-items: center;

    padding: 0;

    color: #666;

    background: transparent;
    border: 0;
    border-radius: 50%;

    font-size: 20px;
    line-height: 1;

    cursor: pointer;

    transform: translateY(-50%);
}

.location-autocomplete__clear.show {
    display: grid;
}

.location-autocomplete__clear:hover,
.location-autocomplete__clear:focus-visible {
    color: #fff;
    background: #d71920;
    outline: none;
}

.location-autocomplete__status {
    display: block;

    min-height: 20px;
    margin-top: 5px;

    color: #6a6d72;

    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.35;
}

.location-autocomplete__status.valid {
    color: #167244;
}

.location-autocomplete__status.invalid {
    color: #a90e14;
}

.location-autocomplete__list {
    position: absolute;
    z-index: 250;
    top: calc(100% - 20px);
    left: 0;
    right: 0;

    max-height: 340px;
    margin: 0;
    padding: 7px;

    overflow-y: auto;
    overscroll-behavior: contain;

    list-style: none;

    background: #fff;
    border: 1px solid #dedfe2;
    border-radius: 12px;

    box-shadow:
        0 18px 48px rgba(17, 17, 17, 0.18);

    scrollbar-width: thin;
    scrollbar-color: #bbb #f3f3f3;
}

.location-autocomplete__list[hidden] {
    display: none;
}

.location-autocomplete__option {
    width: 100%;

    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 14px;

    padding: 11px 12px;

    color: #222;

    background: transparent;
    border: 0;
    border-radius: 8px;

    text-align: left;

    cursor: pointer;
}

.location-autocomplete__option:hover,
.location-autocomplete__option.active {
    color: #a90e14;
    background: #fff1f2;
}

.location-autocomplete__city {
    display: block;

    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.3;
}

.location-autocomplete__state {
    display: block;

    margin-top: 2px;

    color: #777b82;

    font-size: 0.75rem;
    font-weight: 500;
}

.location-autocomplete__uf {
    min-width: 34px;
    padding: 5px 7px;

    color: #fff;

    background: #d71920;
    border-radius: 7px;

    font-size: 0.73rem;
    font-weight: 800;
    text-align: center;
}

.location-autocomplete mark {
    color: inherit;
    background: #ffd9db;
    border-radius: 3px;
}

.location-autocomplete__empty {
    padding: 18px;

    color: #686b70;

    font-size: 0.88rem;
    text-align: center;
}

.location-autocomplete__loading {
    position: absolute;
    right: 14px;
    top: 50%;

    width: 18px;
    height: 18px;

    border: 2px solid #ddd;
    border-top-color: #d71920;
    border-radius: 50%;

    transform: translateY(-50%);

    animation: location-spin 700ms linear infinite;
}

.location-autocomplete__loading[hidden] {
    display: none;
}

#sim-city[aria-invalid="true"] {
    border-color: #d71920;

    box-shadow:
        0 0 0 3px rgba(215, 25, 32, 0.1);
}

#sim-city[data-valid="true"] {
    border-color: #36a269;

    box-shadow:
        0 0 0 3px rgba(54, 162, 105, 0.1);
}

@keyframes location-spin {
    to {
        transform:
            translateY(-50%)
            rotate(360deg);
    }
}

@media (max-width: 620px) {
    .location-autocomplete__list {
        max-height: 280px;
    }

    .location-autocomplete__option {
        padding: 12px 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .location-autocomplete__loading {
        animation-duration: 1500ms;
    }
}
