/* Checkout order items: clean, single-source layout overrides */

/*
 * Desktop mega menu: preserve the signed-off size/spacing.
 * UK stays single-line; other locales may wrap to 2 lines to avoid overflow.
 */
@media (min-width: 768px) {
    html:lang(en-GB) .navigation .level0 > .level-top > span {
        white-space: nowrap;
    }

    html:not(:lang(en-GB)) .navigation li.level0 {
        /* allow items to shrink (text can wrap) without changing row layout */
        flex: 0 1 auto !important;
        min-width: 0 !important;
    }

    html:not(:lang(en-GB)) .navigation .level0 > .level-top {
        /* override theme's large line-height so 2 lines can fit */
        line-height: normal !important;
        white-space: normal !important;
        min-height: 75px; /* matches original 47px line-height + 14px padding top/bottom */
        display: flex !important;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    html:not(:lang(en-GB)) .navigation .level0 > .level-top > span {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        line-height: 1.15;
        white-space: normal;
        overflow-wrap: break-word;
        hyphens: auto;
    }
}

.checkout-index-index .checkout-order-items #shopping-cart-table,
.checkout-index-index .checkout-order-items #shopping-cart-table > tbody,
.checkout-index-index .checkout-order-items #shopping-cart-table > tbody > tr.item-info,
.checkout-index-index .checkout-order-items #shopping-cart-table > tbody > tr.item-info > td.col.item {
    width: 100% !important;
}

.checkout-index-index .checkout-order-items #shopping-cart-table > tbody > tr.item-info > td.col.item {
    padding: 10px 0 !important;
    border: 0 !important;
}

.checkout-index-index .checkout-order-items #shopping-cart-table > tbody > tr.item-info > td.col.item[data-th]:before {
    display: none !important;
    content: none !important;
}

.checkout-index-index .checkout-order-items .checkout-item-layout {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    column-gap: 12px !important;
    align-items: start !important;
    width: 100% !important;
}

.checkout-index-index .checkout-order-items .checkout-item-layout .product-item-photo,
.checkout-index-index .checkout-order-items .checkout-item-layout .product-image-container,
.checkout-index-index .checkout-order-items .checkout-item-layout .product-image-wrapper,
.checkout-index-index .checkout-order-items .checkout-item-layout .product-image-photo {
    display: block !important;
    position: static !important;
    width: 92px !important;
    max-width: 92px !important;
    height: auto !important;
    margin: 0 !important;
}

.checkout-index-index .checkout-order-items .checkout-item-layout .product-item-details {
    display: flex !important;
    flex-direction: column;
    width: 100% !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
}

.checkout-index-index .checkout-order-items .checkout-item-layout .product-item-name,
.checkout-index-index .checkout-order-items .checkout-item-layout .product-item-name a {
    display: block !important;
    margin: 0 0 6px !important;
    text-align: left !important;
    font-weight: 400 !important;
    line-height: 1.35;
}

.checkout-index-index .checkout-order-items .checkout-item-meta {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    column-gap: 28px;
    row-gap: 0;
    width: 100% !important;
    margin: 0 !important;
}

.checkout-index-index .checkout-order-items .checkout-item-meta .checkout-item-meta-row {
    display: inline-flex !important;
    align-items: baseline;
    gap: 6px;
    margin: 0 !important;
    white-space: nowrap;
}

.checkout-index-index .checkout-order-items .checkout-item-meta .meta-label {
    font-weight: 700;
}

.checkout-index-index .checkout-order-items .checkout-item-meta .meta-value {
    font-weight: 400;
}

.checkout-index-index .checkout-payment-method .checkout-billing-address > .step-title {
    display: block;
    margin: 12px 0 10px;
}

.checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 10px;
}

.checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 3px 0 0;
    border: 1px solid #8ea2bd;
    border-radius: 3px;
    background: #ffffff;
    position: relative;
    cursor: pointer;
}

.checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block input[type="checkbox"]:checked {
    border-color: #1f8ac0;
    background: #1f8ac0;
}

.checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 2px;
    width: 8px;
    height: 12px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block label {
    margin: 0;
    line-height: 1.4;
    cursor: pointer;
}

@media (max-width: 769px) {
    html,
    body.checkout-index-index,
    .checkout-index-index .page-wrapper,
    .checkout-index-index .page-main {
        overflow-x: hidden !important;
    }

    .checkout-index-index .checkout-order-items #shopping-cart-table > tbody > tr.item-info {
        display: block !important;
        position: static !important;
        padding: 0 !important;
        border-bottom: 1px solid #d1d1d1;
    }

    .checkout-index-index .checkout-order-items .checkout-item-layout {
        grid-template-columns: 72px minmax(0, 1fr) !important;
        column-gap: 10px !important;
    }

    .checkout-index-index .checkout-order-items .checkout-item-layout .product-item-photo,
    .checkout-index-index .checkout-order-items .checkout-item-layout .product-image-container,
    .checkout-index-index .checkout-order-items .checkout-item-layout .product-image-wrapper,
    .checkout-index-index .checkout-order-items .checkout-item-layout .product-image-photo {
        width: 72px !important;
        max-width: 72px !important;
    }

    .checkout-index-index .checkout-order-items .checkout-item-meta {
        display: block !important;
        margin-top: 2px !important;
    }

    .checkout-index-index .checkout-order-items .checkout-item-meta .checkout-item-meta-row {
        display: flex !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .checkout-index-index .checkout-order-items .checkout-item-meta .checkout-item-meta-row .meta-value {
        margin-left: auto;
        text-align: right;
    }

    .checkout-index-index .checkout-payment-method .checkout-billing-address > .step-title {
        margin: 14px 0 10px;
    }

    .checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block {
        gap: 12px;
    }

    .checkout-index-index .checkout-payment-method .billing-address-same-as-shipping-block input[type="checkbox"] {
        width: 24px;
        min-width: 24px;
        height: 24px;
        margin-top: 2px;
    }

    .checkout-index-index .modals-wrapper {
        overflow-x: hidden;
    }

    .checkout-index-index .modal-popup .modal-inner-wrap,
    .checkout-index-index #checkout-agreements-modal,
    .checkout-index-index [id^="modal-content-"] {
        width: calc(100% - 24px) !important;
        max-width: calc(100% - 24px) !important;
        left: 0 !important;
        right: 0 !important;
        margin-left: auto !important;
        margin-right: auto !important;
        box-sizing: border-box;
    }
}
