/* Shared Google-backed address search component. */
.address-autocomplete {
    display: grid;
    gap: 8px;
    margin: 0 0 14px;
    position: relative;
}

.address-autocomplete-search {
    display: grid;
    gap: 5px;
    max-width: 1040px;
    width: 100%;
}

.address-autocomplete-search > label {
    margin: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.5;
}

.address-autocomplete-search-control {
    position: relative;
}

.address-autocomplete .address-autocomplete-search input {
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 450;
    line-height: 1.5;
    padding-right: 42px;
    width: 100%;
}

/* Suppress browser-specific resets so every address search uses one fixed Ratio action. */
.address-autocomplete .address-autocomplete-search input::-webkit-search-cancel-button {
    appearance: none;
    -webkit-appearance: none;
}

.address-autocomplete .address-autocomplete-search input::placeholder {
    color: #8798a7;
    font-size: 12px;
    font-style: italic;
    font-weight: 450;
    opacity: 1;
}

.address-autocomplete-clear {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    color: #607786;
    cursor: pointer;
    display: flex;
    height: 30px;
    justify-content: center;
    line-height: 1;
    min-height: 30px;
    opacity: 1;
    padding: 0;
    pointer-events: auto;
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    transition: background-color .15s ease, color .15s ease, opacity .12s ease;
    visibility: visible;
    width: 30px;
}

.address-autocomplete-clear:hover {
    background: #e7eff3;
    box-shadow: none;
    color: #17364b;
    transform: translateY(-50%);
}

.address-autocomplete-clear:active {
    transform: translateY(-50%);
}

.address-autocomplete-clear:focus-visible {
    outline: 3px solid rgba(49, 95, 121, .22);
    outline-offset: 1px;
}

.address-autocomplete-clear[hidden] {
    display: none;
}

.address-autocomplete-clear svg {
    display: block;
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-width: 2.2;
}

.address-autocomplete-suggestions {
    background: #fff;
    border: 1px solid #bdd0dc;
    border-radius: 9px;
    box-shadow: 0 12px 28px rgba(22, 52, 72, .14);
    display: grid;
    gap: 2px;
    left: 0;
    max-width: 1040px;
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
    position: absolute;
    top: 65px;
    width: 100%;
    z-index: 30;
}

.address-autocomplete-suggestions[hidden] {
    display: none;
}

.address-autocomplete-option {
    align-items: center;
    background: #fff;
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    color: #17364b;
    cursor: pointer;
    display: flex;
    font-size: .8rem;
    font-weight: 500;
    justify-content: flex-start;
    line-height: 1.35;
    min-height: 0;
    padding: 10px 12px;
    text-align: left;
    transform: none;
    width: 100%;
}

.address-autocomplete-option:hover,
.address-autocomplete-option.is-active {
    background: #edf6fa;
    box-shadow: none;
    color: #17364b;
    transform: none;
}

.address-autocomplete-option:focus-visible {
    outline: 2px solid #4b91ba;
    outline-offset: -2px;
}

.address-autocomplete-feedback {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    max-width: 1040px;
    margin-top: -5px;
    padding-right: 90px;
    position: relative;
    width: 100%;
}

.address-autocomplete-status {
    color: #607786;
    font-size: .76rem;
    margin: 0;
}

.address-autocomplete-status:empty {
    display: none;
}

.address-autocomplete-status.is-busy {
    color: #245f83;
}

.address-autocomplete-status.is-verified {
    color: #187047;
    font-weight: 400;
}

.address-autocomplete-status.is-warning,
.address-autocomplete-status.is-error {
    color: #a44f19;
    font-weight: 700;
}

.address-autocomplete-attribution {
    color: #5f6d76;
    flex: none;
    font-size: .68rem;
    font-style: italic;
    font-weight: 400;
    position: absolute;
    right: 0;
    top: 0;
}

/* The parent grid supplies the gap below compact address feedback. */
.address-autocomplete > .address-autocomplete-manual {
    align-items: center;
    align-self: start;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #4a6170;
    cursor: pointer;
    display: inline-flex;
    flex-direction: row !important;
    font-size: .77rem;
    font-weight: 700;
    gap: 7px;
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
    max-width: 100%;
    padding: 7px 10px;
    width: fit-content;
}

.address-autocomplete > .address-autocomplete-manual:hover {
    border-color: transparent;
    color: #29485f;
}

.address-autocomplete-manual > input[type="checkbox"] {
    box-sizing: border-box;
    flex: 0 0 20px;
    height: 20px;
    margin: 0;
    min-height: 20px;
    padding: 0;
    width: 20px;
}

.address-autocomplete-manual > input[type="checkbox"]:checked {
    background: #dc8515;
    border-color: #dc8515;
    box-shadow: 0 2px 6px rgba(220, 133, 21, .22);
}

.address-autocomplete > .address-autocomplete-manual.is-active {
    background: #fff7e9;
    border-color: #edca8f;
    color: #774610;
}

/* Structured manual address fields mirror commercial document controls. */
[data-address-manual-fields] > label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 750;
}

/* Country-aware postal fields use the shared brandbook spacing and control geometry. */
.postal-address-fields,
.order-delivery-address-fields.postal-address-fields {
    display: grid;
    gap: 12px 16px;
    grid-template-areas:
        "country country country . . . . . . . . ."
        "street street street street street street street street number number addition addition"
        "line-2 line-2 line-2 line-2 line-2 line-2 line-2 line-2 . . . ."
        "postal-code postal-code postal-code city city city city city state state state state";
    grid-template-columns: repeat(12, minmax(0, 1fr));
}

.postal-address-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.postal-address-field[hidden] {
    display: none;
}

.postal-address-field--country {
    grid-area: country;
}

.postal-address-field--street {
    grid-area: street;
}

.postal-address-field--number {
    grid-area: number;
}

.postal-address-field--addition {
    grid-area: addition;
}

.postal-address-field--line-2 {
    grid-area: line-2;
}

.postal-address-field--postal-code {
    grid-area: postal-code;
}

.postal-address-field--city {
    grid-area: city;
}

.postal-address-field--state {
    grid-area: state;
}

.postal-address-fields .postal-address-field > label {
    align-items: baseline;
    color: var(--text);
    display: flex;
    flex-direction: row;
    font-size: 11px;
    font-weight: 750;
    gap: 3px;
    line-height: 1.5;
    margin: 0;
}

.postal-address-fields .postal-address-field > input,
.postal-address-fields .postal-address-field > select,
.postal-address-fields .postal-address-field .searchable-combobox-input {
    box-sizing: border-box;
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    font-style: normal;
    font-weight: 450;
    line-height: 1.5;
    margin: 0;
    min-height: 40px;
    width: 100%;
}

.postal-address-fields .postal-address-field > input::placeholder,
.postal-address-fields .postal-address-field .searchable-combobox-input::placeholder {
    color: #8798a7;
    font-size: 12px;
    font-style: italic;
    font-weight: 450;
    opacity: 1;
}

.postal-address-field .searchable-combobox {
    margin-top: 0;
}

.postal-address-field .errorlist {
    color: var(--danger);
    font-size: .76rem;
    margin: 0;
    padding-left: 18px;
}

[data-address-manual-fields] > label > input {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background-color: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
    font-weight: 450;
}

[data-address-fields] [data-address-part][readonly],
.address-autocomplete [data-address-query][readonly],
.postal-address-fields .postal-address-field .searchable-combobox-input:disabled {
    background-color: var(--interface-locked-surface);
    color: var(--interface-locked-text);
    -webkit-text-fill-color: var(--interface-locked-text);
    opacity: 1;
    cursor: default;
}

/* An editable provider query uses the same white surface as manual address input. */
.address-autocomplete .address-autocomplete-search input:not([readonly]):not(:disabled) {
    background-color: var(--surface);
    -webkit-text-fill-color: var(--text);
}

.address-autocomplete .errorlist {
    color: #a32626;
    font-size: .76rem;
    margin: 0;
    padding-left: 18px;
}

@media (max-width: 980px) {
    .postal-address-fields,
    .order-delivery-address-fields.postal-address-fields {
        grid-template-areas:
            "country ."
            "street street"
            "number addition"
            "line-2 line-2"
            "postal-code city"
            "state state";
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .address-autocomplete-feedback {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
        padding-right: 0;
    }

    .address-autocomplete-attribution {
        position: static;
    }

    .postal-address-fields,
    .order-delivery-address-fields.postal-address-fields {
        grid-template-areas:
            "country"
            "street"
            "number"
            "addition"
            "line-2"
            "postal-code"
            "city"
            "state";
        grid-template-columns: 1fr;
    }
}

/* Hidden structured address groups stay collapsed at every responsive breakpoint. */
.postal-address-fields[hidden],
.order-delivery-address-fields.postal-address-fields[hidden] {
    display: none;
}
