/* ==========================================================================
   Her Peptides — cart page
   Depends on style.css (tokens, header/footer), shop.css (.crumbs, .shop-card,
   .shop-trust) and commerce.css (panels, buttons, fields, .quantity, coupons).

   Table markup follows WooCommerce's cart template: .woocommerce-cart-form,
   table.shop_table.cart, .cart_item, .product-remove/-thumbnail/-name/-price/
   -quantity/-subtotal, .cart-collaterals > .cart_totals, .wc-proceed-to-checkout.
   Every <td> carries data-title so the responsive stack can label itself the
   way shop_table_responsive does.
   ========================================================================== */

/* ============================== free ship meter ============================== */

.cart-meter {
    margin-bottom: 20px;
    padding: 15px 18px;
    border: 1px solid #f7e7ee;
    border-radius: 14px;
    background: linear-gradient(120deg, #fdf5f8, #fff 70%);
}

.cart-meter p {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    color: #574f52;
    font-size: 13.5px;
    line-height: 1.5;
}

.cart-meter p i {
    color: var(--pink);
    font-size: 18px;
}

.cart-meter strong {
    color: var(--pink-dark);
    font-weight: 700;
}

.cart-meter-track {
    position: relative;
    height: 7px;
    border-radius: 4px;
    background: #f8e4ec;
    overflow: hidden;
}

.cart-meter-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--pink), var(--pink-dark));
    transition: width .35s ease;
}

.cart-meter.is-unlocked .cart-meter-fill {
    background: linear-gradient(90deg, #56b189, #3d8f68);
}

.cart-meter.is-unlocked p i {
    color: #3d8f68;
}

/* ================================ cart table ================================ */

/*
 * woocommerce.css draws its own furniture on every shop_table —
 * `table.shop_table { border: 1px solid …; border-radius: 5px; margin: 0 -1px
 * 24px 0 }` and `table.shop_table td { border-top: 1px solid … }` — which puts
 * a rounded box around the cart and a second box around the totals. The design
 * separates rows with a single hairline and no outer frame, so the plugin's
 * chrome is cleared first. `.woocommerce` is included so this outranks it
 * whichever order the two stylesheets happen to load in.
 */
.woocommerce table.shop_table.cart,
.woocommerce table.shop_table.cart-totals-table,
table.shop_table.cart,
table.shop_table.cart-totals-table {
    margin: 0;
    border: 0;
    border-radius: 0;
    border-collapse: collapse;
    border-spacing: 0;
}

.woocommerce table.shop_table.cart td,
.woocommerce table.shop_table.cart th,
.woocommerce table.shop_table.cart-totals-table td,
.woocommerce table.shop_table.cart-totals-table th {
    border-top: 0;
}

.woocommerce-cart-form {
    margin: 0;
}

.shop_table.cart {
    table-layout: fixed;
}

/* table-layout: fixed takes these literally, so they must be real widths */
.shop_table.cart th.product-thumbnail {
    width: 96px;
}

.shop_table.cart th.product-remove {
    width: 48px;
}

.shop_table.cart th.product-name {
    width: auto;
}

.shop_table.cart th.product-price {
    width: 120px;
}

.shop_table.cart th.product-quantity {
    width: 140px;
}

.shop_table.cart th.product-subtotal {
    width: 120px;
    text-align: right;
}

/*
 * the hairlines the design uses in place of the plugin's boxed rows. These
 * carry `.woocommerce table` so they outrank the plugin's own cell padding —
 * see the note over the base rules in commerce.css.
 */
.woocommerce table.shop_table.cart thead th {
    padding: 0 0 12px;
    border-bottom: 1px solid #f2dbe4;
}

.woocommerce table.shop_table.cart tbody tr + tr td {
    border-top: 1px solid #f7ecf1;
}

.woocommerce table.shop_table.cart td {
    padding: 18px 10px;
}

.woocommerce table.shop_table.cart td:first-child {
    padding-left: 0;
}

.woocommerce table.shop_table.cart td:last-child {
    padding-right: 0;
}

.cart_item {
    transition: opacity .25s ease, transform .25s ease;
}

.cart_item.is-removing {
    opacity: 0;
    transform: translateX(-14px);
}

/* -------------------------------- thumbnail -------------------------------- */

.cart_item .product-thumbnail {
    width: 92px;
}

.cart_item .product-thumbnail a {
    display: block;
    overflow: hidden;
    width: 82px;
    aspect-ratio: 1 / 1;
    border: 1px solid #f7e7ee;
    border-radius: 12px;
    background: linear-gradient(170deg, #fdeaf2 0%, #fbdfe9 58%, #f7d3e1 100%);
}

.cart_item .product-thumbnail img {
    width: 100%;
    height: 100%;
    padding: 8%;
    object-fit: contain;
}

/* ---------------------------------- name ---------------------------------- */

.cart_item .product-name a {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
}

.cart_item .product-name a:hover {
    color: var(--pink-dark);
}

/* see the note on the same block in checkout.css — dt/dd pairs must not be
   split by wrapping, and wpautop's <p> inside each dd needs its margin off */
.cart_item .variation {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 3px 10px;
    margin: 7px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.cart_item .variation dt {
    margin: 0;
    font-weight: 600;
}

.cart_item .variation dd {
    margin: 0;
    font-weight: 500;
}

.cart_item .variation dd p {
    margin: 0;
}

.cart-item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
}

.cart-stock {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #3d8f68;
    font-size: 11.5px;
    font-weight: 600;
}

.cart-stock i {
    font-size: 14px;
}

.cart-stock.is-low {
    color: #a3701a;
}

.cart-sku {
    color: #a2969b;
    font-size: 11.5px;
    font-weight: 500;
}

/* ------------------------------ price / totals ------------------------------ */

.cart_item .product-price {
    color: #574f52;
    font-size: 14px;
}

.cart_item .product-subtotal {
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
    text-align: right;
}

/* --------------------------------- remove --------------------------------- */

.cart_item .product-remove {
    width: 44px;
    text-align: right;
}

.product-remove .remove {
    display: grid;
    width: 30px;
    height: 30px;
    margin-left: auto;
    place-content: center;
    border: 1px solid #f2dbe4;
    border-radius: 50%;
    color: #9a8f93;
    background: #fff;
    font-size: 15px;
    line-height: 1;
    transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.product-remove .remove:hover {
    border-color: #e8a9b4;
    color: #c8484c;
    background: #fdf3f3;
}

.product-remove .remove:focus-visible {
    outline: 2px solid var(--pink);
    outline-offset: 2px;
}

/* ------------------------------ actions strip ------------------------------ */

.cart-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #f2dbe4;
}

.cart-actions .coupon {
    flex: 1 1 320px;
}

.cart-actions .cart-actions-right {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cart-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

/* ================================== totals ================================== */

.cart-collaterals {
    position: sticky;
    top: 96px;
    margin-bottom: 16px;
}

.cart_totals h2 {
    margin: 0 0 16px;
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 700;
}

/*
 * The plugin pins this label column at `width: 35%`, which leaves the shipping
 * cards beside it too narrow to hold a method name and its price on one line.
 * Matching its selector shape lets the column size to the labels the way the
 * design does, and the same prefix keeps the plugin's cell padding out.
 */
.woocommerce table.shop_table.cart-totals-table th {
    width: auto;
    padding: 12px 14px 12px 0;
    border-bottom: 1px solid #f7ecf1;
    color: #6d6367;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
}

.woocommerce table.shop_table.cart-totals-table td {
    padding: 12px 0;
    border-bottom: 1px solid #f7ecf1;
    font-size: 14px;
    text-align: right;
}

.woocommerce table.shop_table.cart-totals-table .shipping th,
.woocommerce table.shop_table.cart-totals-table .shipping td {
    padding-top: 16px;
    vertical-align: top;
    text-align: left;
}

.woocommerce table.shop_table.cart-totals-table .cart-discount th,
.woocommerce table.shop_table.cart-totals-table .cart-discount td {
    color: #3d8f68;
}

.woocommerce table.shop_table.cart-totals-table .order-total th,
.woocommerce table.shop_table.cart-totals-table .order-total td {
    padding-top: 16px;
    border-bottom: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}

.shop_table.cart-totals-table .order-total .woocommerce-Price-amount {
    font-size: 22px;
    font-weight: 700;
}

.order-total-note {
    display: block;
    margin-top: 2px;
    color: #a2969b;
    font-size: 11.5px;
    font-weight: 500;
}

.wc-proceed-to-checkout {
    margin-top: 18px;
}

.wc-proceed-to-checkout .checkout-button {
    width: 100%;
    padding: 14px 22px;
    font-size: 15.5px;
}

/* express / alternate checkout buttons sit under the primary CTA */
.cart-express {
    margin-top: 12px;
}

.cart-express-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0 12px;
    color: #a2969b;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.cart-express-label::before,
.cart-express-label::after {
    flex: 1;
    height: 1px;
    background: #f2dbe4;
    content: "";
}

.cart-express-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.cart-express-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 11px 12px;
    border: 1px solid #e6dade;
    border-radius: 10px;
    background: #fff;
    color: #3a3336;
    font-size: 13px;
    font-weight: 700;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.cart-express-btn:hover {
    border-color: #cfc2c8;
    box-shadow: 0 6px 16px rgba(120, 90, 105, .12);
}

.cart-express-btn i {
    font-size: 16px;
}

/* =============================== empty state =============================== */

.cart-empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 46px 26px 50px;
    border: 1px dashed var(--pink-soft);
    border-radius: 18px;
    background: #fdf7fa;
    text-align: center;
}

.cart-empty-icon {
    display: grid;
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    place-content: center;
    border-radius: 50%;
    color: var(--pink);
    background: #fff;
    font-size: 34px;
    line-height: 1;
    box-shadow: 0 10px 26px rgba(200, 130, 165, .16);
}

.cart-empty h2 {
    margin: 0 0 8px;
    font-size: 26px;
}

.cart-empty p {
    max-width: 340px;
    margin: 0 auto 22px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

/* =============================== cross-sells =============================== */

.cross-sells .shop-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ================================ responsive ================================ */

@media (max-width: 1199.98px) {
    .cross-sells .shop-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .cart-collaterals {
        position: static;
        margin-top: 28px;
    }

    .shop_table.cart th.product-price {
        width: 100px;
    }

    .shop_table.cart th.product-quantity {
        width: 128px;
    }

    .cross-sells .shop-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ------------------------- stacked rows on phones ------------------------- */
/* mirrors WooCommerce's shop_table_responsive: the header row is dropped and
   each cell labels itself from its data-title. */
@media (max-width: 767.98px) {
    .shop_table.cart {
        table-layout: auto;
    }

    .shop_table.cart thead {
        display: none;
    }

    .shop_table.cart,
    .shop_table.cart tbody,
    .shop_table.cart tr,
    .shop_table.cart td {
        display: block;
        width: 100%;
    }

    .shop_table.cart tr.cart_item {
        position: relative;
        display: grid;
        grid-template-columns: 82px minmax(0, 1fr);
        column-gap: 14px;
        margin-bottom: 14px;
        padding: 14px 14px 12px;
        border: 1px solid #f7e7ee;
        border-radius: 14px;
        background: #fff;
    }

    /* outranks the desktop `tbody tr + tr td` hairline, which carries the
       plugin-beating `.woocommerce table` prefix */
    .woocommerce table.shop_table.cart tbody tr.cart_item td {
        padding: 0;
        border: 0;
    }

    .cart_item .product-thumbnail {
        grid-row: 1 / span 2;
        width: auto;
    }

    .cart_item .product-thumbnail a {
        width: 82px;
    }

    .cart_item .product-name {
        padding-right: 34px !important;
    }

    /* price collapses into the name block — the subtotal is what matters here */
    .cart_item .product-price {
        display: none !important;
    }

    .cart_item .product-quantity,
    .cart_item .product-subtotal {
        display: flex !important;
        align-items: center;
        gap: 8px;
        margin-top: 12px;
    }

    .cart_item .product-quantity {
        justify-content: flex-start;
    }

    .cart_item .product-subtotal {
        justify-content: space-between;
        grid-column: 2;
        margin-top: 10px;
        padding-top: 10px !important;
        border-top: 1px dashed #f4e2ea !important;
        text-align: left;
    }

    .cart_item .product-subtotal::before {
        color: #6d6367;
        content: attr(data-title);
        font-size: 12px;
        font-weight: 600;
    }

    .cart_item .product-remove {
        position: absolute;
        top: 12px;
        right: 12px;
        width: auto;
    }

    /* Drop the totals out of table layout so the shipping radios can own a
       full-width row. Half-measures don't work: a block-level th/td inside a
       real table is re-wrapped in an anonymous cell no wider than column 1,
       and narrowing the label column instead squeezes every other row. */
    .shop_table.cart-totals-table,
    .shop_table.cart-totals-table tbody,
    .shop_table.cart-totals-table tr,
    .woocommerce table.shop_table.cart-totals-table th,
    .woocommerce table.shop_table.cart-totals-table td {
        display: block;
        width: auto;
    }

    .shop_table.cart-totals-table tr {
        display: flex;
        align-items: baseline;
        justify-content: space-between;
        gap: 14px;
        padding: 12px 0;
        border-bottom: 1px solid #f7ecf1;
    }

    /* these have to match the desktop rules selector for selector to win on
       source order — a media query adds no specificity of its own */
    .woocommerce table.shop_table.cart-totals-table th,
    .woocommerce table.shop_table.cart-totals-table td,
    .woocommerce table.shop_table.cart-totals-table .shipping th,
    .woocommerce table.shop_table.cart-totals-table .shipping td,
    .woocommerce table.shop_table.cart-totals-table .order-total th,
    .woocommerce table.shop_table.cart-totals-table .order-total td {
        padding: 0;
        border-bottom: 0;
    }

    .shop_table.cart-totals-table tr:last-child {
        border-bottom: 0;
    }

    .shop_table.cart-totals-table .shipping {
        display: block;
    }

    .woocommerce table.shop_table.cart-totals-table .shipping th {
        padding-bottom: 10px;
    }

    .cart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    /* the desktop `flex: 1 1 320px` becomes a HEIGHT basis in a column
       container, which stretches the wrapped coupon rows apart */
    .cart-actions .coupon {
        flex: 0 0 auto;
        align-content: flex-start;
    }

    .cart-actions .cart-actions-right {
        justify-content: stretch;
    }

    .cart-actions .cart-actions-right .button {
        flex: 1;
    }

    .cross-sells .shop-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cart-express-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .shop_table.cart tr.cart_item {
        grid-template-columns: 68px minmax(0, 1fr);
    }

    .cart_item .product-thumbnail a {
        width: 68px;
    }

    .cart_item .product-name a {
        font-size: 14px;
    }

    .cart-empty {
        padding: 36px 18px 40px;
    }
}
