/*
 * KingSoft / Osapa 2.2.4 migration — Phase 10
 * Final storefront polish before technical upgrades:
 * - Polish empty mini-cart labels (translations are in functions.php)
 * - clean text-only close control in the off-canvas cart
 * - keep long search queries clear of the magnifier button
 * - align quantity and add-to-cart button on one row
 * - contain checkout/order/shipping content inside the review column
 */

/* --------------------------------------------------------------------------
 * Off-canvas mini-cart: keep one clear close action — the text "Zamknij".
 * The parent theme draws a second animated X with ::before / ::after.
 * ----------------------------------------------------------------------- */
.ftc-off-canvas-cart .off-canvas-cart-title a.close-cart {
    position: static !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 4px 0 !important;
    right: auto !important;
    line-height: 1.2 !important;
    text-decoration: underline;
}

.ftc-off-canvas-cart .off-canvas-cart-title a.close-cart::before,
.ftc-off-canvas-cart .off-canvas-cart-title a.close-cart::after {
    content: none !important;
    display: none !important;
}

/* --------------------------------------------------------------------------
 * Header search: reserve a permanent clickable area for the magnifier.
 * Long queries stay inside the input and end with an ellipsis instead of
 * running underneath the search button.
 * ----------------------------------------------------------------------- */
.header-content .ftc-search-product .ftc-search {
    position: relative !important;
    width: 270px !important;
    max-width: 270px !important;
}

.header-content .ftc-search-product .ftc-search form,
.header-content .ftc-search-product .ftc-search .ftc_search_ajax {
    width: 100% !important;
    max-width: 100% !important;
}

.header-content .ftc-search-product .ftc_search_ajax input[type="text"] {
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 42px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.header-content .ftc-search-product .ftc-search .search-button {
    position: absolute !important;
    z-index: 20 !important;
    top: 0 !important;
    right: 0 !important;
    float: none !important;
    width: 36px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 2px 0 0 !important;
    background: #fff !important;
    text-align: right !important;
}

/* --------------------------------------------------------------------------
 * Single product: quantity and red add-to-cart button on one clean row.
 * Phase 9 fixed the internal - 1 + control; Phase 10 fixes the outer layout.
 * ----------------------------------------------------------------------- */
.single-product #content div.product .summary .woocommerce-variation-add-to-cart.variations_button,
.single-product #content div.product .summary form.cart:not(.variations_form) {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 24px !important;
}

.single-product #content div.product .summary .woocommerce-variation-add-to-cart.variations_button .quantity,
.single-product #content div.product .summary form.cart:not(.variations_form) .quantity {
    flex: 0 0 auto !important;
    margin: 0 !important;
}

.single-product #content div.product .summary .woocommerce-variation-add-to-cart.variations_button .single_add_to_cart_button,
.single-product #content div.product .summary form.cart:not(.variations_form) .single_add_to_cart_button {
    float: none !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    align-self: center !important;
}

/* --------------------------------------------------------------------------
 * Checkout: Osapa 2.2.4 mixes newer WooCommerce table markup with old width
 * rules. The old "min-width: 350px" on every cart cell makes the order table
 * overflow its grey review box, which is why shipping/InPost content collides
 * with the border. Keep the current templates and repair only the layout.
 * ----------------------------------------------------------------------- */
.woocommerce-checkout .woocommerce-checkout-review-order {
    box-sizing: border-box !important;
    min-width: 0 !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order .woocommerce-checkout-review-order-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout form.checkout table.shop_table tbody tr.cart_item > td,
.woocommerce-checkout .woocommerce-checkout-review-order-table th,
.woocommerce-checkout .woocommerce-checkout-review-order-table td {
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table .product-name {
    display: table-cell !important;
    width: auto !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table .product-total {
    width: 120px !important;
    min-width: 100px !important;
    white-space: nowrap !important;
}

/* Current WooCommerce shipping row: stable two-column layout. */
.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 {
    vertical-align: top !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > th,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > th {
    width: 120px !important;
    min-width: 120px !important;
    padding: 15px 12px 15px 0 !important;
    text-align: left !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > td,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > td {
    width: auto !important;
    min-width: 0 !important;
    padding: 12px 0 12px 12px !important;
    overflow: visible !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method li {
    width: 100% !important;
    max-width: 100% !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    text-align: right !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table #shipping_method input[type="radio"] + label {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: flex-end !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 34px 0 0 !important;
    position: relative !important;
    line-height: 1.35 !important;
    text-align: right !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
}

/* Keep InPost selector/search elements inside the order-review column. */
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping td > *,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping td > *,
.woocommerce-checkout .woocommerce-checkout-review-order-table [class*="inpost"],
.woocommerce-checkout .woocommerce-checkout-review-order-table [id*="inpost"] {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping td input[type="text"],
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping td select,
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping td input[type="text"],
.woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping td select {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 991px) {
    .woocommerce-checkout .col2-set,
    .woocommerce-checkout .woocommerce-checkout-review-order {
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        padding-right: 0 !important;
        position: static !important;
    }
}

@media (max-width: 599px) {
    .header-content .ftc-search-product .ftc-search {
        width: 100% !important;
        max-width: 100% !important;
    }

    .single-product #content div.product .summary .woocommerce-variation-add-to-cart.variations_button,
    .single-product #content div.product .summary form.cart:not(.variations_form) {
        gap: 14px !important;
    }

    .woocommerce-checkout .woocommerce-checkout-review-order-table .product-total {
        width: 90px !important;
        min-width: 80px !important;
    }

    .woocommerce-checkout .woocommerce-checkout-review-order-table tr.woocommerce-shipping-totals.shipping > th,
    .woocommerce-checkout .woocommerce-checkout-review-order-table tr.shipping > th {
        width: 90px !important;
        min-width: 90px !important;
    }
}
