/*
 * KingSoft / Osapa 2.2.4 migration — Phase 13
 * Final My Account address-row fix, checkout payment-radio fix, and content links.
 */

/* --------------------------------------------------------------------------
 * My Account > Addresses
 * The legacy clearfix ::before/::after became extra grid items in Phase 12,
 * which pushed the first card to the right and the second to the next row.
 * Remove those generated items and force a clean two-card row.
 * ----------------------------------------------------------------------- */
.woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses::before,
.woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses::after,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses::before,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses::after {
    content: none !important;
    display: none !important;
}

.woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    gap: 24px !important;
    width: 100% !important;
}

.woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses > .woocommerce-Address,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses > .woocommerce-Address {
    flex: 1 1 0 !important;
    width: 0 !important;
    max-width: none !important;
    min-width: 0 !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
    grid-column: auto !important;
    grid-row: auto !important;
    transform: none !important;
}

.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses > .u-column1,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses > .col-1 {
    order: 1 !important;
}

.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses > .u-column2,
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses > .col-2 {
    order: 2 !important;
}

/* --------------------------------------------------------------------------
 * Checkout payment methods
 * Osapa draws radio circles with label pseudo-elements. Phase 12 also exposed
 * the native radios, producing two circles per method and a one-row mismatch.
 * Keep one accessible input and one visible circle only.
 * ----------------------------------------------------------------------- */
.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method {
    position: relative !important;
    margin: 0 !important;
    padding: 13px 12px !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"] {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    opacity: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    box-shadow: none !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"] + label {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    min-height: 22px !important;
    margin: 0 !important;
    padding: 0 0 0 30px !important;
    color: #333 !important;
    cursor: pointer !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"] + label::before {
    content: '' !important;
    position: absolute !important;
    left: 0 !important;
    right: auto !important;
    top: 50% !important;
    width: 17px !important;
    height: 17px !important;
    border: 2px solid #b9b9b9 !important;
    border-radius: 50% !important;
    background: #fff !important;
    transform: translateY(-50%) !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"] + label::after {
    content: '' !important;
    position: absolute !important;
    left: 4px !important;
    right: auto !important;
    top: 50% !important;
    width: 9px !important;
    height: 9px !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #ea0028 !important;
    opacity: 0 !important;
    transform: translateY(-50%) !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"]:checked + label {
    color: #ea0028 !important;
    font-weight: 700 !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"]:checked + label::before {
    border-color: #ea0028 !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"]:checked + label::after {
    opacity: 1 !important;
}

.woocommerce-checkout #payment.woocommerce-checkout-payment ul.payment_methods li.wc_payment_method > input[type="radio"]:focus-visible + label {
    outline: 2px solid #ea0028 !important;
    outline-offset: 4px !important;
}

/* Keep payment descriptions clearly attached to the selected method. */
.woocommerce-checkout #payment.woocommerce-checkout-payment .payment_box {
    margin: 10px 0 0 30px !important;
}

/* Links created from the repeated "skontaktuj się z nami" phrase. */
a.kingsoft-contact-link {
    color: #ea0028;
    font-weight: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

a.kingsoft-contact-link:hover,
a.kingsoft-contact-link:focus-visible {
    color: #111b4c;
}

@media (max-width: 767px) {
    .woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses,
    .woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        gap: 20px !important;
    }

    .woocommerce-account .woocommerce-MyAccount-content .u-columns.woocommerce-Addresses.col2-set.addresses > .woocommerce-Address,
    .woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses.addresses > .woocommerce-Address {
        width: 100% !important;
        flex-basis: auto !important;
    }
}
