/**
 * Cart page (woocommerce/cart/*.php). Loaded on the cart and the checkout: the
 * colour tokens and the page header with the order steps
 * (storefckarpaty_order_page_header()) are shared; the checkout's own styles
 * are in checkout.css.
 */

.woocommerce-cart,
.woocommerce-checkout {
    --cart-ink: #000;
    --cart-muted: #6d6d6d;
    --cart-line: #e5e5e5;
    --cart-surface: #f6f6f6;
    --cart-accent: #128108;
    --cart-accent-dark: #0d5f06;
    --cart-danger: #b81c23;
}

/* ---- Page header: order steps and "Кошик · 2 товари" (cart and checkout) ------------- */
/* Storefront pads full-width cart and checkout pages' headers (.storefront-full-width-content.woocommerce-cart .entry-header). */
.woocommerce-cart .hentry .cart-page-header,
.woocommerce-checkout .hentry .cart-page-header,
.storefront-full-width-content.woocommerce-cart .cart-page-header,
.storefront-full-width-content.woocommerce-checkout .cart-page-header {
    /* No breadcrumbs above, so the header keeps its own space. */
    margin: 28px 0 24px;
    padding: 0;
    text-align: left;
    border: 0;
}

.woocommerce-cart .cart-page-header__title,
.woocommerce-checkout .cart-page-header__title {
    margin: 0;
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.2;
    text-align: left;
}

.cart-page-header__count {
    color: var(--cart-muted);
    font-size: .55em;
    font-weight: 400;
    white-space: nowrap;
}

.cart-steps {
    margin: 0 0 20px;
}

.cart-steps__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.cart-steps__item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: #8a8a8a;
    font-size: 14px;
}

.cart-steps__item:not(:last-child)::after {
    content: "";
    width: 40px;
    height: 1px;
    background-color: #cfcfcf;
}

.cart-steps__item.is-current {
    color: var(--cart-ink);
}

.cart-steps__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #cfcfcf;
    border-radius: 50%;
    font-size: 13px;
}

.cart-steps__item.is-done {
    color: var(--cart-ink);
}

.cart-steps__item.is-done::after {
    background-color: var(--cart-accent);
}

.cart-steps__link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: inherit;
    text-decoration: none;
}

.cart-steps__link:hover .cart-steps__label,
.cart-steps__link:focus .cart-steps__label {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cart-steps__item.is-done .cart-steps__num {
    background-color: #fff;
    border-color: var(--cart-accent);
    color: var(--cart-accent);
}

.cart-steps__item.is-current .cart-steps__num {
    background-color: var(--cart-accent);
    border-color: var(--cart-accent);
    color: #fff;
}

/* Phones: only the current step keeps its label on screen, so the steps fit one line. */
@media (max-width: 480px) {
    .cart-steps__item:not(:last-child)::after {
        width: 16px;
    }

    .cart-steps__item:not(.is-current) .cart-steps__label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(1px, 1px, 1px, 1px);
        white-space: nowrap;
    }
}

/* ---- Layout: items | totals, cross-sells under ------------------------------------- */
.woocommerce-cart .entry-content > .woocommerce {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px 40px;
}

.woocommerce-cart .entry-content > .woocommerce > * {
    grid-column: 1 / -1;
    min-width: 0;
}

.woocommerce-cart .entry-content > .woocommerce > .woocommerce-notices-wrapper:empty {
    display: none;
}

/* Notices sit between the title and the items; the grid gap is the space under them. */
.woocommerce-cart .entry-content > .woocommerce > .woocommerce-notices-wrapper > :last-child {
    margin-bottom: 0;
}

@media (min-width: 1024px) {
    .woocommerce-cart .entry-content > .woocommerce {
        grid-template-columns: minmax(0, 1fr) 360px;
        align-items: start;
    }

    .woocommerce-cart .entry-content > .woocommerce > .cart-form {
        grid-column: 1;
    }

    /* Beside the items, top-aligned; not sticky, so it stays level with them. */
    .woocommerce-cart .entry-content > .woocommerce > .cart-collaterals {
        grid-column: 2;
        grid-row: span 2;
    }
}

/* ---- Items --------------------------------------------------------------------------- */
.cart-form {
    margin: 0;
}

/* The item layout follows the width of the list, not of the screen: beside the
   totals on a laptop the list is about as narrow as a tablet. */
.cart-items {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-item {
    display: grid;
    align-items: center;
    gap: 12px 16px;
    /* Phones: photo, name and remove on top; quantity and sum on the row below. */
    grid-template-areas:
        "thumb info info remove"
        "qty qty sum sum";
    grid-template-columns: 72px auto minmax(0, 1fr) 44px;
    padding: 14px;
    background-color: #fff;
    border: 1px solid var(--cart-line);
}

@container (min-width: 560px) {
    .cart-item {
        grid-template-areas: "thumb info qty sum remove";
        grid-template-columns: 96px minmax(0, 1fr) auto 110px 44px;
        gap: 12px 20px;
        padding: 16px;
    }
}

.cart-item__thumb {
    grid-area: thumb;
    align-self: start;
}

.cart-item__thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background-color: var(--cart-surface);
}

.cart-item__info {
    grid-area: info;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.cart-item__name {
    color: var(--cart-ink);
    font-size: 16px;
    line-height: 1.4;
    text-decoration: none;
}

.cart-item__name:hover,
.cart-item__name:focus {
    color: var(--cart-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cart-item__info dl.variation {
    margin: 0;
    color: var(--cart-muted);
    font-size: 13px;
}

.cart-item__info dl.variation dt,
.cart-item__info dl.variation dd,
.cart-item__info dl.variation p {
    display: inline;
    margin: 0;
}

.cart-item__info dl.variation dd::after {
    content: "";
    display: block;
}

.cart-item__info .backorder_notification {
    margin: 0;
    color: var(--cart-accent-dark);
    font-size: 13px;
}

.cart-item__unit {
    color: var(--cart-muted);
    font-size: 13px;
}

.cart-item__qty {
    grid-area: qty;
}

.cart-item__sum {
    grid-area: sum;
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}

.cart-item__remove {
    grid-area: remove;
    align-self: start;
    justify-self: end;
}

@container (min-width: 560px) {
    .cart-item__remove {
        align-self: center;
    }
}

/* Beats WooCommerce's and Storefront's round "×" (a.remove). */
.woocommerce-cart .cart-item__remove a.remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 0;
    background: none;
    color: var(--cart-muted) !important;
    font-size: 0;
    line-height: 1;
}

.woocommerce-cart .cart-item__remove a.remove::before {
    content: none;
}

.woocommerce-cart .cart-item__remove a.remove:hover,
.woocommerce-cart .cart-item__remove a.remove:focus {
    background-color: var(--cart-surface);
    color: var(--cart-danger) !important;
}

/* WooCommerce's cart.js blocks the form while it updates. */
.woocommerce-cart-form.processing {
    opacity: .6;
}

/* ---- Quantity stepper -------------------------------------------------------------- */
.cart-item__qty .quantity {
    display: inline-flex;
    align-items: stretch;
    height: 44px;
    border: 1px solid var(--cart-line);
    background-color: #fff;
}

.cart-item__qty .quantity:has(.qty:focus-visible) {
    outline: 2px solid var(--cart-ink);
    outline-offset: 2px;
}

/* Sold individually: WooCommerce prints a hidden field, so no buttons either. */
.cart-item__qty .quantity:has(input[type="hidden"]) {
    border: 0;
}

.cart-item__qty .quantity:has(input[type="hidden"]) .qty-btn {
    display: none;
}

.cart-item__qty .quantity input.qty[type] {
    width: 44px;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    font-size: 16px;
    text-align: center;
    -moz-appearance: textfield;
}

.cart-item__qty .quantity input.qty::-webkit-outer-spin-button,
.cart-item__qty .quantity input.qty::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

.cart-item__qty .quantity input.qty:focus {
    outline: none;
}

.woocommerce-cart .qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--cart-ink);
    cursor: pointer;
}

.woocommerce-cart .qty-btn::after {
    content: none;
}

.woocommerce-cart .qty-btn:hover {
    background-color: var(--cart-surface);
    color: var(--cart-ink);
}

.woocommerce-cart .qty-btn:disabled {
    background: transparent;
    color: #c4c4c4;
    cursor: default;
    opacity: 1;
}

.woocommerce-cart .qty-btn svg {
    display: block;
}

/* ---- Update button (browsers without JavaScript) ----------------------------------- */
.cart-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

.woocommerce-cart-form.is-auto-update .cart-actions {
    margin-top: 0;
}

/* ---- Promo code, inside "Разом" above "Оформити замовлення" -------------------------- */
.cart-coupon {
    margin: 0 0 16px;
    padding-top: 4px;
}

.cart-coupon summary {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--cart-muted);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    list-style: none;
}

.cart-coupon summary::-webkit-details-marker {
    display: none;
}

.cart-coupon summary:hover,
.cart-coupon summary:focus-visible {
    color: var(--cart-ink);
}

.cart-coupon__form {
    margin: 4px 0 0;
}

.cart-coupon__form.processing {
    opacity: .6;
}

.cart-coupon .coupon {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cart-coupon .coupon input.input-text {
    flex: 1 1 0;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    background-color: #fff;
    border: 1px solid var(--cart-line);
}

.cart-coupon .coupon input.input-text.has-error {
    border-color: var(--cart-danger);
}

.cart-coupon .coupon .button {
    flex: none;
    min-height: 44px;
    margin: 0;
    padding-right: 16px;
    padding-left: 16px;
}

.cart-coupon .coupon-error-notice {
    flex: 0 0 100%;
    margin: 0;
    color: var(--cart-danger);
    font-size: 13px;
    text-align: left;
}

/* With JavaScript the cart updates by itself (assets/js/cart.js). */
.woocommerce-cart-form.is-auto-update .cart-actions__update {
    display: none;
}

/* ---- Totals -------------------------------------------------------------------------- */
.woocommerce-cart .cart-collaterals {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
}

/* WooCommerce's clearfix pseudo-elements would become flex items. */
.woocommerce-cart .cart-collaterals::before,
.woocommerce-cart .cart-collaterals::after {
    display: none;
}

.woocommerce-cart .cart-collaterals .cart_totals {
    float: none;
    width: auto;
    margin: 0;
    padding: 24px;
    background-color: var(--cart-surface);
    border: 1px solid var(--cart-line);
}

.woocommerce-cart .cart_totals h2 {
    margin: 0 0 12px;
    font-size: 24px;
}

.woocommerce-cart .cart_totals table.shop_table {
    width: 100%;
    margin: 0 0 8px;
    border: 0;
    border-collapse: collapse;
}

.woocommerce-cart .cart_totals table.shop_table th,
.woocommerce-cart .cart_totals table.shop_table td {
    padding: 14px 0;
    border: 0;
    border-top: 1px solid var(--cart-line);
    background: none;
    font-size: 15px;
    font-weight: 400;
    vertical-align: top;
}

.woocommerce-cart .cart_totals table.shop_table th {
    width: 40%;
    padding-right: 16px;
    color: var(--cart-muted);
    text-align: left;
}

.woocommerce-cart .cart_totals table.shop_table td {
    text-align: right;
}

.woocommerce-cart .cart_totals table.shop_table tr:first-child th,
.woocommerce-cart .cart_totals table.shop_table tr:first-child td {
    border-top: 0;
}

.woocommerce-cart .cart_totals .order-total th,
.woocommerce-cart .cart_totals .order-total td {
    padding-top: 18px;
    color: var(--cart-ink);
}

.woocommerce-cart .cart_totals .order-total .amount {
    font-size: 26px;
    font-weight: 700;
}

/* Phones: WooCommerce's responsive table hides the th and prints the label from data-title. */
.woocommerce-cart .cart_totals table.shop_table_responsive tr td::before {
    color: var(--cart-muted);
    font-weight: 400;
}

.woocommerce-cart .cart_totals table.shop_table_responsive tr.order-total td::before {
    color: var(--cart-ink);
}

/* Shipping row: the method, then small notes. */
.woocommerce-cart .cart_totals ul#shipping_method {
    margin: 0;
    padding: 0;
    list-style: none;
}

.woocommerce-cart .cart_totals ul#shipping_method li {
    margin: 0;
}

.woocommerce-cart .cart_totals .woocommerce-shipping-destination,
.woocommerce-cart .cart_totals .woocommerce-shipping-calculator,
.woocommerce-cart .cart_totals .woocommerce-shipping-totals p {
    margin: 6px 0 0;
    color: var(--cart-muted);
    font-size: 13px;
}

.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
    padding: 0;
}

.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px;
    margin: 0;
    padding: 0 24px;
    background-color: var(--cart-accent);
    color: #fff;
    font-size: 17px;
}

.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:focus {
    background-color: var(--cart-accent-dark);
    color: #fff;
}

/* Storefront adds an arrow icon after the button text. */
.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button::after {
    content: none;
}

.cart-collaterals__back {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--cart-muted);
    font-size: 14px;
    text-decoration: none;
}

.cart-collaterals__back:hover,
.cart-collaterals__back:focus {
    color: var(--cart-ink);
}

/* ---- Cross-sells --------------------------------------------------------------------- */
.woocommerce-cart .cross-sells {
    float: none;
    width: auto;
    margin-top: 32px;
}

.woocommerce-cart .cross-sells > h2 {
    margin: 0 0 24px;
    font-size: clamp(24px, 2.6vw, 30px);
}

/* ---- Empty cart ---------------------------------------------------------------------- */
.cart-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 56px 24px;
    background-color: var(--cart-surface);
    border: 1px solid var(--cart-line);
    text-align: center;
}

.cart-empty-state p {
    max-width: 460px;
    margin: 0;
    color: var(--cart-muted);
}

.cart-empty-state__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: #fff;
    color: var(--cart-accent);
}

.cart-empty-state__title {
    margin: 4px 0 0;
    font-size: 28px;
}

.cart-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}

.woocommerce-cart .cart-empty-state__shop {
    min-height: 48px;
    padding: 0 28px;
    display: inline-flex;
    align-items: center;
    background-color: var(--cart-accent);
    color: #fff;
}

.woocommerce-cart .cart-empty-state__shop:hover,
.woocommerce-cart .cart-empty-state__shop:focus {
    background-color: var(--cart-accent-dark);
    color: #fff;
}

.cart-empty-state__cats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.cart-empty-state__cat {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--cart-line);
    background-color: #fff;
    color: var(--cart-ink);
    font-size: 14px;
    text-decoration: none;
}

.cart-empty-state__cat:hover,
.cart-empty-state__cat:focus {
    border-color: var(--cart-accent);
    color: var(--cart-accent);
}
