:root {
    --tc-aq-gap: 8px;
    --tc-aq-height: 44px;
    --tc-aq-add-bg: #FF4D8D;
    --tc-aq-add-color: #ffffff;
    --tc-aq-add-border-color: transparent;
    --tc-aq-add-radius: 40px;
}

.tc-ajax-qty-control {
    display: flex;
    align-items: center;
    gap: var(--tc-aq-gap, 8px);
    width: 100%;
}

.tc-ajax-qty-control:not(.has-items) .tc-add {
    display: inline-flex !important;
}

.tc-ajax-qty-control:not(.has-items) .tc-qty {
    display: none !important;
}

.tc-ajax-qty-control.has-items .tc-add {
    display: none !important;
}

.tc-ajax-qty-control.has-items .tc-qty {
    display: inline-flex !important;
}

.tc-ajax-qty-control .tc-add {
    width: 100%;
    justify-content: center;
    align-items: center;
    min-height: var(--tc-aq-height, 44px);
    padding: 12px 24px;
    background: var(--tc-aq-add-bg);
    color: var(--tc-aq-add-color);
    border: 1px solid var(--tc-aq-add-border-color);
    border-radius: var(--tc-aq-add-radius);
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s;
}

/* Базовые стили для кнопок во всех контекстах (кроме чекаута) */
.tc-ajax-qty-control .tc-minus,
.tc-ajax-qty-control .tc-plus {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: var(--tc-aq-pm-bg, #FF4D8D);
    background: var(--tc-aq-pm-bg, #FF4D8D);
    color: var(--tc-aq-pm-color, #fff);
    border: none;
    border-radius: var(--tc-aq-pm-radius, 40px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tc-ajax-qty-control .tc-minus:hover,
.tc-ajax-qty-control .tc-plus:hover {
    background-color: var(--tc-aq-pm-bg-hover, #000);
    background: var(--tc-aq-pm-bg-hover, #000);
    color: var(--tc-aq-pm-color-hover, #fff);
}

/* АГРЕССИВНЫЕ стили ТОЛЬКО ПРИ ОФОРМЛЕНИИ ЗАКАЗА (структура и выравнивание) */
.tc-context-checkout .tc-minus,
.tc-context-checkout .tc-plus {
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0 !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    border-style: solid;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.tc-ajax-qty-control .tc-count {
    flex: 1;
    min-width: 40px;
    height: 44px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid #ddd;
    background: #fff;
    color: #111;
    border-radius: 40px;
}

#order_review .woocommerce-checkout-review-order-table {
    display: table !important;
    width: 100% !important;
    border: none !important;
}

#order_review .woocommerce-checkout-review-order-table thead {
    display: none !important;
}

#order_review .woocommerce-checkout-review-order-table tbody {
    display: table-row-group !important;
}

#order_review .woocommerce-checkout-review-order-table tbody tr {
    display: table-row !important;
}

#order_review .woocommerce-checkout-review-order-table tbody td.product-total {
    display: none !important;
}

#order_review .woocommerce-checkout-review-order-table tbody td.product-name {
    display: table-cell !important;
    width: 100% !important;
    padding: 12px 20px !important;
    border-bottom: 1px solid #eee !important;
    box-sizing: border-box !important;
    font-size: 0 !important;
}

#order_review .woocommerce-checkout-review-order-table tbody td.product-name .ecm-checkout-row-wrapper {
    font-size: 14px !important;
    line-height: 1.4 !important;
}

#order_review .woocommerce-checkout-review-order-table tbody td.product-name>.product-quantity {
    display: none !important;
}

#order_review .woocommerce-checkout-review-order-table tfoot {
    display: block !important;
    width: 100% !important;
}

#order_review .woocommerce-checkout-review-order-table tfoot tr {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    border-bottom: 1px solid #f4f4f4 !important;
    padding: 10px 0 !important;
}

#order_review .woocommerce-checkout-review-order-table tfoot th {
    display: block !important;
    text-align: left !important;
    padding: 10px 20px !important;
    border: none !important;
    color: #666 !important;
    font-weight: normal !important;
    flex: 1 !important;
}

#order_review .woocommerce-checkout-review-order-table tfoot td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    text-align: right !important;
    padding: 10px 20px !important;
    white-space: normal !important;
    border: none !important;
    flex: 0 1 auto !important;
    min-width: 240px !important;
}

#order_review .woocommerce-checkout-review-order-table tfoot tr.order-total th,
#order_review .woocommerce-checkout-review-order-table tfoot tr.order-total td {
    font-weight: bold !important;
    color: #000 !important;
    font-size: 16px !important;
}

/* Скрываем промежуточный подытог (первое Итого) */
#order_review .woocommerce-checkout-review-order-table tfoot tr.cart-subtotal {
    display: none !important;
}

#order_review ul#shipping_method {
    list-style: none !important;
    margin: 12px 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-end !important;
}

#order_review ul#shipping_method li {
    margin: 0 !important;
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    border: 2px solid #eaeaea !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    cursor: pointer !important;
    transition: all 0.25s ease-in-out !important;
    box-sizing: border-box !important;
    position: relative !important;
    width: auto !important;
    min-width: 220px !important;
    white-space: nowrap !important;
}

#order_review ul#shipping_method li:hover {
    border-color: #d1d1d1 !important;
    background-color: #fafafa !important;
}

#order_review ul#shipping_method li:has(input[type="radio"]:checked) {
    border-color: #ED1A5D !important;
    background-color: rgba(237, 26, 93, 0.04) !important;
}

#order_review ul#shipping_method li input[type="radio"] {
    accent-color: #ED1A5D !important;
    width: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

#order_review ul#shipping_method label {
    display: inline-block !important;
    margin: 0 !important;
    font-weight: 500 !important;
    color: #1a1a1a !important;
    cursor: pointer !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    width: auto !important;
    text-align: center !important;
}

#order_review ul#shipping_method li:has(input[type="radio"]:checked) label {
    color: #ED1A5D !important;
    font-weight: 600 !important;
}

/* Агрессивные стили для кнопки Яндекса (все устройства) */
#order_review .yandex-delivery-select-pvz-button,
#order_review button.select-pvz-button,
#order_review a.select-pvz-button,
#order_review .wc-yandex-choose-pickup-point button,
#order_review button.wc-yandex-choose-pickup-point,
#order_review a.wc-yandex-choose-pickup-point,
#order_review .wc-yandex-delivery-choose-pickup-point,
#order_review tfoot td button,
.yandex-delivery-select-pvz-button,
button.wc-yandex-choose-pickup-point,
.wc-yandex-delivery-choose-pickup-point {
    background-color: #ED1A5D !important;
    color: #ffffff !important;
    border: 2px solid #ED1A5D !important;
    border-radius: 12px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    cursor: pointer !important;
    transition: all 0.25s ease-in-out !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    margin: 10px 0 !important;
    text-decoration: none !important;
    width: auto !important;
    min-width: 220px !important;
    box-sizing: border-box !important;
}

#order_review .yandex-delivery-select-pvz-button:hover,
#order_review button.select-pvz-button:hover,
#order_review a.select-pvz-button:hover,
#order_review .wc-yandex-choose-pickup-point button:hover,
#order_review button.wc-yandex-choose-pickup-point:hover,
#order_review a.wc-yandex-choose-pickup-point:hover,
#order_review tfoot td button:hover,
.yandex-delivery-select-pvz-button:hover,
button.wc-yandex-choose-pickup-point:hover,
.wc-yandex-delivery-choose-pickup-point:hover {
    background-color: #d11451 !important;
    border-color: #d11451 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(237, 26, 93, 0.2) !important;
}

/* Фикс для вставки внутри flex-ряда */
#order_review tfoot tr.shipping {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
}

#order_review tfoot tr.shipping th {
    display: block !important;
}

#order_review tfoot tr.shipping td {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
}

/* Наш кастомный ряд товара */
.ecm-checkout-row-wrapper {
    display: block !important;
    width: 100% !important;
}

.ecm-checkout-row {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}

.ecm-checkout-item-left {
    display: flex !important;
    align-items: center !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.ecm-checkout-name-text {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.ecm-checkout-item-right {
    flex: 0 0 auto !important;
    /* Убрал фиксированную ширину, чтобы не вылезало */
    text-align: right !important;
    white-space: nowrap !important;
    margin-left: auto !important;
    padding-left: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0 !important;
}

.tc-context-checkout {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 130px !important;
    /* Фиксированная ширина для кнопок, чтобы они стояли ровно */
    flex-shrink: 0 !important;
}

.ecm-checkout-price {
    font-weight: 500;
    color: #000;
    min-width: 85px !important;
    /* Даем цене больше места */
    text-align: right !important;
    flex-shrink: 0 !important;
}

.ecm-qty-label {
    margin-left: 5px !important;
}

@media (max-width: 768px) {

    #order_review .woocommerce-checkout-review-order-table tbody td.product-name,
    #order_review .woocommerce-checkout-review-order-table tfoot th,
    #order_review .woocommerce-checkout-review-order-table tfoot td {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* На мобилках ставим цену и кнопки в колонку (цена сверху через reverse) */
    .ecm-checkout-item-right {
        flex-direction: column-reverse !important;
        align-items: flex-end !important;
        flex: 0 0 auto !important;
        gap: 8px !important;
    }

    .tc-context-checkout {
        width: auto !important;
        justify-content: flex-end !important;
    }

    .ecm-checkout-price {
        width: auto !important;
    }

    #order_review .yandex-delivery-select-pvz-button,
    #order_review button.select-pvz-button,
    #order_review .wc-yandex-choose-pickup-point button,
    #order_review button.wc-yandex-choose-pickup-point,
    #order_review tfoot td button {
        max-width: 100% !important;
        width: auto !important;
        min-width: 220px !important;
        font-size: 14px !important;
    }
}