/* Address autocomplete — Postcode.eu suggestions + manual / Wijzig UI */

#vmt-sell-checkout .vmt-checkout-address-manual {
    grid-column: 1 / -1;
    margin: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

#vmt-sell-checkout .vmt-checkout-address-manual[hidden] {
    display: none !important;
}

#vmt-sell-checkout .vmt-checkout-address-manual>.vmt-checkout-field {
    grid-column: span 1;
}

#vmt-sell-checkout .vmt-checkout-field--search,
#vmt-sell-checkout .vmt-checkout-field--autocomplete {
    position: relative;
    overflow: visible;
}

/* Locked selected address — gray bar with text + Wijzig inside */
#vmt-sell-checkout .vmt-checkout-address-locked {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-background-primary);
    box-sizing: border-box;
}

#vmt-sell-checkout .vmt-checkout-address-locked[hidden] {
    display: none !important;
}

#vmt-sell-checkout .vmt-checkout-address-locked-text {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 16px;
    line-height: 24px;
    color: var(--color-text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#vmt-sell-checkout .vmt-checkout-address-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
}

#vmt-sell-checkout .vmt-checkout-address-edit:hover {
    color: var(--color-text-primary);
}

#vmt-sell-checkout .vmt-checkout-address-edit .bi {
    font-size: 14px;
}

#vmt-sell-checkout .vmt-checkout-field--search.is-address-locked .vmt-checkout-control-box,
#vmt-sell-checkout .vmt-checkout-field--search.is-address-locked .vmt-checkout-autocomplete-list {
    display: none !important;
}

#vmt-sell-checkout .vmt-checkout-address-manual-toggle {
    display: inline-block;
    align-self: flex-start;
    margin-top: 4px;
    margin-left: 4px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-text-placeholder);
    font-size: 13px;
    font-weight: 500;
    line-height: 18px;
    text-decoration: underline;
    cursor: pointer;
}

#vmt-sell-checkout .vmt-checkout-address-manual-toggle:hover {
    color: var(--color-text-primary);
}

#vmt-sell-checkout .vmt-checkout-address-manual-toggle[hidden] {
    display: none !important;
}

/* Suggestions panel — sibling of .vmt-checkout-control-box inside .vmt-checkout-field */
#vmt-sell-checkout .vmt-checkout-autocomplete-list {
    margin: 0;
    padding: 8px 0;
    list-style: none;
    width: 100%;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--color-text-primary) 12%, transparent);
    max-height: 260px;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-sizing: border-box;
    z-index: 30;
}

/* Desktop: absolute relative to .vmt-checkout-field; top auto → static position under control-box */
@media only screen and (min-width: 600px) {

    #vmt-sell-checkout .vmt-checkout-field--search .vmt-checkout-autocomplete-list,
    #vmt-sell-checkout .vmt-checkout-field--autocomplete .vmt-checkout-autocomplete-list {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        top: 50px;
    }
}

/* Mobile: in document flow directly under the field */
@media only screen and (max-width: 599px) {
    #vmt-sell-checkout .vmt-checkout-field--search {
        scroll-margin-top: 72px;
    }

    #vmt-sell-checkout .vmt-checkout-field--search .vmt-checkout-autocomplete-list,
    #vmt-sell-checkout .vmt-checkout-field--autocomplete .vmt-checkout-autocomplete-list {
        position: unset;
        max-height: 220px;
        margin-top: 8px;
    }
}

#vmt-sell-checkout .vmt-checkout-autocomplete-list[hidden] {
    display: none !important;
}

#vmt-sell-checkout .vmt-checkout-autocomplete-list.is-open:not([hidden]) {
    display: block !important;
}

.vmt-checkout-autocomplete-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 14px 10px 16px;
    cursor: pointer;
}

.vmt-checkout-autocomplete-item:hover,
.vmt-checkout-autocomplete-item.is-active {
    background: color-mix(in srgb, var(--color-success) 12%, transparent);
}

.vmt-checkout-autocomplete-item-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}

.vmt-checkout-autocomplete-item-title {
    font-size: 15px;
    line-height: 22px;
    color: var(--color-text-primary);
}

.vmt-checkout-autocomplete-item-sub {
    font-size: 13px;
    line-height: 18px;
    color: var(--color-text-secondary);
}

.vmt-checkout-autocomplete-item .bi-chevron-right {
    flex: 0 0 auto;
    font-size: 14px;
    line-height: 1;
    color: var(--color-text-placeholder);
}

.vmt-checkout-autocomplete-item:hover .bi-chevron-right,
.vmt-checkout-autocomplete-item.is-active .bi-chevron-right {
    color: var(--color-text-primary);
}

.vmt-checkout-autocomplete-item.is-address .bi-chevron-right {
    opacity: 0.55;
}

.vmt-checkout-autocomplete-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    list-style: none;
    color: var(--color-text-secondary);
    font-size: 14px;
    line-height: 20px;
    cursor: default;
}

.vmt-checkout-autocomplete-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid color-mix(in srgb, var(--color-text-primary) 12%, transparent);
    border-top-color: var(--color-text-primary);
    border-radius: 50%;
    animation: vmt-checkout-address-spin 0.7s linear infinite;
    flex: 0 0 auto;
}

@keyframes vmt-checkout-address-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 820px) {
    #vmt-sell-checkout .vmt-checkout-address-manual {
        grid-template-columns: 1fr;
    }
}