.foxbox-postcode-section .wa-fields-group {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px !important;
}

.foxbox-postcode-section .wa-field-wrapper {
    width: auto !important;
    margin: 0 !important;
}

.foxbox-postcode-section .wa-country-wrapper,
.foxbox-postcode-section.foxbox-country-uk .wa-zip-wrapper {
    grid-column: 1 / -1;
}

.foxbox-postcode-section .wa-country-wrapper { order: 1; }
.foxbox-postcode-section.foxbox-country-uk .wa-zip-wrapper { order: 2; }
.foxbox-postcode-section.foxbox-country-ie .wa-zip-wrapper,
.foxbox-postcode-section.foxbox-country-other .wa-zip-wrapper { order: 2; }
.foxbox-postcode-section.foxbox-country-ie .wa-region-wrapper,
.foxbox-postcode-section.foxbox-country-other .wa-region-wrapper { order: 3; }
.foxbox-postcode-section.foxbox-country-ie .wa-city-wrapper,
.foxbox-postcode-section.foxbox-country-other .wa-city-wrapper { order: 4; }

.foxbox-country-choice {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.foxbox-country-button {
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid rgba(129, 92, 246, .48);
    border-radius: 12px;
    color: #f7f4ff;
    background: rgba(129, 92, 246, .08);
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.foxbox-country-button:hover {
    border-color: #8b6cff;
    background: rgba(129, 92, 246, .16);
}

.foxbox-country-button:focus-visible {
    outline: 3px solid rgba(255, 139, 61, .8);
    outline-offset: 2px;
}

.foxbox-country-button.is-active {
    border-color: #8b6cff;
    background: linear-gradient(135deg, #6f51e8, #8a63f6);
    box-shadow: 0 8px 22px rgba(103, 75, 224, .24);
}

.foxbox-postcode-section .wa-country-wrapper > .wa-label {
    display: none;
}

.foxbox-postcode-section .wa-country-wrapper > .js-country-field {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.foxbox-postcode-section .wa-country-wrapper.is-other-country > .js-country-field {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    padding: .75rem 1rem !important;
    margin: 10px 0 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
    border: var(--bs-border-width, 1px) solid var(--bs-border-color, #555) !important;
}

.foxbox-postcode-section.foxbox-country-uk:not(.foxbox-manual-mode) .wa-region-wrapper,
.foxbox-postcode-section.foxbox-country-uk:not(.foxbox-manual-mode) .wa-city-wrapper {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.foxbox-postcode-status {
    display: none;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.35;
}

.foxbox-postcode-status:not(.is-idle):not(:empty) {
    display: flex;
}

.foxbox-postcode-status-icon {
    display: inline-grid;
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 8px;
    font-weight: 900;
}

.foxbox-postcode-status-copy {
    display: grid;
    gap: 2px;
}

.foxbox-postcode-status-copy strong {
    color: inherit;
    font-size: 14px;
}

.foxbox-postcode-status.is-loading {
    color: #cfc5ff;
    border-color: rgba(139, 108, 255, .28);
    background: rgba(139, 108, 255, .08);
}

.foxbox-postcode-status.is-loading .foxbox-postcode-status-icon {
    border: 2px solid rgba(139, 108, 255, .25);
    border-top-color: #8b6cff;
    border-radius: 50%;
    animation: foxbox-postcode-spin .7s linear infinite;
}

.foxbox-postcode-status.is-success {
    color: #f5f1ff;
    border-color: rgba(139, 108, 255, .46);
    background: linear-gradient(135deg, rgba(111, 81, 232, .22), rgba(255, 139, 61, .10));
}

.foxbox-postcode-status.is-success .foxbox-postcode-status-icon {
    color: #fff;
    background: #7654eb;
}

.foxbox-postcode-status.is-notice {
    color: #ffe5d2;
    border-color: rgba(255, 139, 61, .42);
    background: rgba(255, 139, 61, .10);
}

.foxbox-postcode-status.is-notice .foxbox-postcode-status-icon,
.foxbox-postcode-status.is-error .foxbox-postcode-status-icon {
    color: #241c35;
    background: #ff8b3d;
}

.foxbox-postcode-status.is-error {
    color: #ffd8ce;
    border-color: rgba(255, 107, 82, .42);
    background: rgba(255, 107, 82, .10);
}

.foxbox-manual-address {
    min-height: 44px;
    margin-top: 4px;
    padding: 8px 0;
    border: 0;
    color: #a78bfa;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.foxbox-postcode-section.foxbox-country-ie .foxbox-manual-address,
.foxbox-postcode-section.foxbox-country-other .foxbox-manual-address,
.foxbox-postcode-section.foxbox-manual-mode .foxbox-manual-address {
    display: none;
}

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

@media (max-width: 767.98px) {
    .foxbox-postcode-section .wa-fields-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 14px !important;
    }

    .foxbox-postcode-section .wa-country-wrapper,
    .foxbox-postcode-section.foxbox-country-uk .wa-zip-wrapper {
        grid-column: auto;
    }

    .foxbox-country-choice {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .foxbox-country-button[data-country="other"] {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .foxbox-country-button {
        transition: none;
    }

    .foxbox-postcode-status.is-loading .foxbox-postcode-status-icon {
        animation-duration: 1.4s;
    }
}
