/*
 * KingSoft / Osapa 2.2.4 migration — Phase 11
 * Final checkout/account/order polish found during end-to-end testing.
 *
 * Scope:
 * - vertically center add-to-cart icon/text inside the red button
 * - remove old black focus rectangles in My Account while keeping an
 *   accessible red keyboard focus
 * - give checkout shipping methods the full available width
 * - tidy the order-received summary, table totals and address columns
 */

/* --------------------------------------------------------------------------
 * Single product: the button box was aligned, but its icon/text baseline sat
 * a touch low. Use flex centering and a 1px optical lift.
 * ----------------------------------------------------------------------- */
.single-product #content div.product .summary .single_add_to_cart_button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    min-height: 46px !important;
    line-height: 1 !important;
    padding-top: 0 !important;
    padding-bottom: 2px !important;
    vertical-align: middle !important;
}

.single-product #content div.product .summary .single_add_to_cart_button::before,
.single-product #content div.product .summary .single_add_to_cart_button::after {
    align-self: center !important;
    line-height: 1 !important;
}

/* --------------------------------------------------------------------------
 * My Account: remove the legacy black click/focus rectangle. Keyboard users
 * still get a clean red focus indication instead of losing focus visibility.
 * ----------------------------------------------------------------------- */
.woocommerce-account .woocommerce-MyAccount-navigation a:focus,
.woocommerce-account .woocommerce-MyAccount-navigation a:active {
    outline: none !important;
    box-shadow: none !important;
}

.woocommerce-account .woocommerce-MyAccount-navigation a:focus-visible {
    outline: 2px solid #ea0028 !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
}

/* Keep the two saved addresses level and equal-width on desktop. */
.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses {
    display: flex !important;
    align-items: stretch !important;
    flex-wrap: wrap !important;
    gap: 20px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses .woocommerce-Address {
    float: none !important;
    width: calc(50% - 10px) !important;
    padding: 0 !important;
}

.woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses .woocommerce-Address address {
    height: 100% !important;
}

/* --------------------------------------------------------------------------
 * Checkout: the price column is intentionally narrow, but a shipping-method
 * list cannot live inside that same 120px column. Turn only the shipping row
 * into a two-column grid so the options get the full remaining width.
 * ----------------------------------------------------------------------- */
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping {
    display: grid !important;
    grid-template-columns: 115px minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > th,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > td,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > th,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > th,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > th {
    padding: 16px 10px 16px 0 !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > td,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > td {
    padding: 12px 0 12px 14px !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method li {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    gap: 8px !important;
    width: 100% !important;
    margin: 9px 0 !important;
    text-align: right !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method input[type="radio"] {
    flex: 0 0 auto !important;
    margin: 3px 0 0 8px !important;
    order: 2 !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method input[type="radio"] + label {
    flex: 1 1 auto !important;
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    text-align: right !important;
    line-height: 1.35 !important;
    overflow-wrap: normal !important;
    word-break: normal !important;
}

/* --------------------------------------------------------------------------
 * Order received / thank-you page.
 * ----------------------------------------------------------------------- */
.woocommerce-order-received .woocommerce-thankyou-order-received,
.woocommerce-order-received .woocommerce-notice--success {
    margin-bottom: 0 !important;
}

.woocommerce-order-received .woocommerce-order-overview {
    margin-top: 38px !important;
    margin-bottom: 48px !important;
}

/* "ŁĄCZNIE" and all values in the money column line up on the right. */
.woocommerce-order-received .woocommerce-order-details table.order_details thead th:last-child,
.woocommerce-order-received .woocommerce-order-details table.woocommerce-table--order-details thead th:last-child,
.woocommerce-order-received .woocommerce-order-details table.order_details tbody td:last-child,
.woocommerce-order-received .woocommerce-order-details table.woocommerce-table--order-details tbody td:last-child,
.woocommerce-order-received .woocommerce-order-details table.order_details tfoot td,
.woocommerce-order-received .woocommerce-order-details table.woocommerce-table--order-details tfoot td {
    text-align: right !important;
}

.woocommerce-order-received .woocommerce-order-details table.order_details thead th:last-child,
.woocommerce-order-received .woocommerce-order-details table.woocommerce-table--order-details thead th:last-child {
    white-space: nowrap !important;
}

/* Billing and shipping addresses side-by-side and level. */
.woocommerce-order-received .woocommerce-customer-details .woocommerce-columns--addresses,
.woocommerce-order-received .woocommerce-customer-details .addresses {
    display: flex !important;
    align-items: stretch !important;
    gap: 32px !important;
    width: 100% !important;
    margin: 0 !important;
}

.woocommerce-order-received .woocommerce-customer-details .woocommerce-column--billing-address,
.woocommerce-order-received .woocommerce-customer-details .woocommerce-column--shipping-address,
.woocommerce-order-received .woocommerce-customer-details .woocommerce-column {
    float: none !important;
    flex: 1 1 0 !important;
    width: calc(50% - 16px) !important;
    max-width: calc(50% - 16px) !important;
    margin: 0 !important;
}

.woocommerce-order-received .woocommerce-customer-details .woocommerce-column h2,
.woocommerce-order-received .woocommerce-customer-details .woocommerce-column address {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

@media (max-width: 767px) {
    .woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses {
        display: block !important;
    }

    .woocommerce-account .woocommerce-MyAccount-content .woocommerce-Addresses .woocommerce-Address {
        width: 100% !important;
        margin-bottom: 20px !important;
    }

    .woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping,
    .woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping {
        grid-template-columns: 90px minmax(0, 1fr) !important;
    }

    .woocommerce-order-received .woocommerce-customer-details .woocommerce-columns--addresses,
    .woocommerce-order-received .woocommerce-customer-details .addresses {
        display: block !important;
    }

    .woocommerce-order-received .woocommerce-customer-details .woocommerce-column--billing-address,
    .woocommerce-order-received .woocommerce-customer-details .woocommerce-column--shipping-address,
    .woocommerce-order-received .woocommerce-customer-details .woocommerce-column {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 28px !important;
    }
}
