/* ========== Loading spinner (shared) ========== */
.wpwc-loading {
    position: relative;
    opacity: 0.5;
    pointer-events: none;
}

.wpwc-loading::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.05);
    z-index: 2;
}

.wpwc-loading::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid #9E9E9E;
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: wpwc-spin 500ms infinite linear;
    z-index: 3;
}

@keyframes wpwc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== Classic checkout ========== */
.woocommerce form .form-row.address-field .select2-container,
.woocommerce form .form-row .select2-container {
    width: 100% !important;
}

#billing_address_2_field > label,
#shipping_address_2_field > label {
    width: 100% !important;
    opacity: 1 !important;
}

.woocommerce-shipping-fields::after {
    content: "";
    display: table;
    clear: both;
}

/* ========== Block checkout - custom selects ========== */

/* Container for province + district + ward on one row */
.wpwc-address-row {
    display: flex;
    gap: 12px;
    flex: 0 0 100%;
    width: 100%;
    grid-column: 1 / -1;
    box-sizing: border-box;
}

.wpwc-address-row > * {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: auto !important;
}

/* Hide native address_2 row & toggle (ward syncs via JS, not visible field) */
.wc-block-components-address-form [class*="address-form__address_2"],
.wc-block-components-address-form [class*="address_2-toggle"] {
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Mobile: stack selects vertically */
@media (max-width: 782px) {
    .wpwc-address-row {
        flex-direction: column;
        gap: 0;
    }

    .wpwc-address-row > * {
        flex: 0 0 auto !important;
        width: 100% !important;
    }
}
