/* Printella Cart — card-like layout */

/* Page title */
.printella .woocommerce-cart .entry-title {
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 24px;
}

/* 2-column grid: products + summary */
.printella-cart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
    max-width: var(--printella-max-width, 1400px);
    margin: 0 auto;
    padding: 24px 16px;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Prevent grid overflow */
.printella-cart-products {
    min-width: 0;
    overflow: hidden;
}
.printella-cart-products .shop_table,
.printella-cart-products .cart_item,
.printella-cart-item__meta,
.printella-cart-item__controls,
.printella-cart-item__meta .product-name,
.printella-cart-item__meta .product-name a {
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Summary sticky */
.printella-cart-summary {
    position: sticky;
    top: 24px;
    min-width: 0;
}

/* ===== Cart items (card list, no table headers) ===== */
.printella-cart-products .shop_table {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: none;
    background: none;
    width: 100%;
    table-layout: fixed;
    overflow: hidden;
}

/* Reset any WC table defaults */
.printella-cart-products .shop_table,
.printella-cart-products .shop_table * {
    border-spacing: 0;
    border-collapse: collapse;
}

/* Hide default WC table styles */
.printella-cart-products .shop_table thead,
.printella-cart-products .shop_table tfoot {
    display: none;
}

/* Single cart item — card */
.printella-cart-products .cart_item {
    position: relative;
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s ease;
}
.printella-cart-products .cart_item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

/* Row 1: Product meta (thumbnail + name/variations) */
.printella-cart-item__meta {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 14px;
    align-items: start;
    margin-bottom: 16px;
}

.printella-cart-item__meta .product-thumbnail {
    width: 96px;
    height: 96px;
    border-radius: 8px;
    overflow: hidden;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
}
.printella-cart-item__meta .product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.printella-cart-item__meta .product-name a {
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    text-decoration: none;
}
.printella-cart-item__meta .product-name a:hover {
    color: var(--color-wishlist, #E63E7A);
}

/* Variation meta — badge pills (dt+dd pairs) */
.printella-cart-item__meta .product-name dl.variation {
    margin: 8px 0 0;
    display: block;
    padding: 0;
    font-size: 0;
}
.printella-cart-item__meta .product-name dl.variation dt {
    display: inline;
    font-size: 0.75rem;
    color: #666;
    font-weight: 400;
    margin: 0;
    padding: 5px 0 5px 10px;
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-right: none;
    border-radius: 5px 0 0 5px;
    line-height: 2.4;
}
.printella-cart-item__meta .product-name dl.variation dd {
    display: inline;
    font-size: 0.75rem;
    color: #444;
    font-weight: 500;
    margin: 0 8px 0 0;
    padding: 5px 10px 5px 4px;
    background: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-left: none;
    border-radius: 0 5px 5px 0;
    line-height: 2.4;
}
.printella-cart-item__meta .product-name dl.variation dd p {
    margin: 0;
    display: inline;
}

/* Scale badge — violet accent */
.printella-cart-item__meta .product-name dl.variation dt.variation-Skalawzoru {
    background: #f3f2ff;
    border-color: #e0defc;
    color: #7a7aaa;
}
.printella-cart-item__meta .product-name dl.variation dd.variation-Skalawzoru {
    background: #f3f2ff;
    border-color: #e0defc;
    color: #4a4a7a;
}

/* WC item data (scale badge — subtle violet) */
.printella-cart-item__meta .product-name .wc-item-meta {
    margin: 6px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
    list-style: none;
}
.printella-cart-item__meta .product-name .wc-item-meta li {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    background: #f3f2ff;
    border: 1px solid #e0defc;
    border-radius: 5px;
    line-height: 1.4;
    padding: 5px 10px;
    margin: 0;
}
.printella-cart-item__meta .product-name .wc-item-meta li .wc-item-meta-label {
    color: #7a7aaa;
    font-weight: 400;
    margin-right: 4px;
}
.printella-cart-item__meta .product-name .wc-item-meta li p {
    margin: 0;
    display: inline;
    color: #4a4a7a;
    font-weight: 600;
}

/* Row 2: Controls & pricing */
.printella-cart-item__controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 32px;
    padding-left: 112px; /* 96px thumb + 16px gap */
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f2f2f2;
}

/* Controls columns */
.printella-cart-item__controls .product-price,
.printella-cart-item__controls .product-quantity,
.printella-cart-item__controls .product-subtotal {
    display: flex;
    align-items: center;
}

.printella-cart-item__controls .product-price {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
}
.printella-cart-item__controls .product-price {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    line-height: 1.2;
}
.printella-cart-item__controls .product-price del,
.printella-cart-item__controls .product-price del .woocommerce-Price-amount {
    display: block;
    color: #bbb;
    opacity: 1;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.2;
}
.printella-cart-item__controls .product-price del .woocommerce-Price-currencySymbol {
    display: none;
}
.printella-cart-item__controls .product-price ins {
    display: block;
    text-decoration: none;
    font-weight: 500;
    color: #222;
}

.printella-cart-item__controls .product-quantity {
    flex-shrink: 0;
}

/* Quantity stepper — cart-specific size override */
.printella-cart-item__controls .quantity-wrapper {
    height: 36px;
}
.printella-cart-item__controls .quantity-wrapper input.qty {
    width: 40px;
    font-size: 0.8125rem;
}
.printella-cart-item__controls .quantity-wrapper .quantity-btn {
    width: 32px;
    font-size: 1rem;
}

.printella-cart-item__controls .product-subtotal {
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
}

/* Remove button — top-right corner of card */
.printella-cart-products .cart_item > .product-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
}
.printella .printella-cart-products .cart_item > .product-remove a.remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: #9ca3af !important;
    font-size: inherit;
    line-height: inherit;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.printella .printella-cart-products .cart_item > .product-remove a.remove:hover {
    color: var(--color-wishlist, #E63E7A) !important;
    background: #fff !important;
}
.printella-cart-products .cart_item > .product-remove .remove svg {
    display: block;
}

/* Cart actions */
.printella-cart-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    height: 56px;
}
.printella-cart-actions > .button[name="update_cart"] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* Coupon toggle — inline expand */
.printella-coupon-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
}
.printella .printella-coupon-trigger,
.printella .printella-coupon-trigger:visited {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
}
.printella .printella-coupon-trigger:hover {
    color: #1a1a1a;
    text-decoration: none;
}

.printella-coupon-form {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.25s ease;
}
.printella-coupon-toggle.is-open .printella-coupon-form {
    max-width: 360px;
    opacity: 1;
}
.printella-coupon-form input.input-text {
    width: 180px;
    height: 36px;
    padding: 0 12px;
    font-size: 0.8125rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    flex-shrink: 0;
}
.printella-coupon-form .button {
    height: 36px;
    padding: 0 14px;
    font-size: 0.8125rem;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Coupon applied — hide toggle, show applied coupons */
.printella .woocommerce-cart .cart-discount .coupon-name {
    font-weight: 600;
}
.printella .woocommerce-cart .cart-discount .coupon-name::after {
    content: ' ✔';
    color: #16a34a;
}

/* ===== Summary sidebar ===== */
/* Override WC layout: float:right + width:48% on cart_totals */
.printella .printella-cart-summary .cart-collaterals,
.printella .woocommerce-cart .cart-collaterals {
    width: 100%;
    float: none;
}
.printella .printella-cart-summary .cart-collaterals::before,
.printella .printella-cart-summary .cart-collaterals::after {
    display: none;
}
.printella .printella-cart-summary .cart_totals,
.printella.woocommerce .cart-collaterals .cart_totals,
.printella.woocommerce-page .cart-collaterals .cart_totals {
    float: none;
    width: 100%;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    font-family: inherit;
}
.printella .printella-cart-summary .cross-sells,
.printella.woocommerce .cart-collaterals .cross-sells,
.printella.woocommerce-page .cart-collaterals .cross-sells {
    float: none;
    width: 100%;
}

.printella .printella-cart-summary .cart_totals * {
    font-family: inherit;
}

.printella .printella-cart-summary .cart_totals h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 16px;
    color: #1a1a1a;
}

.printella-cart-summary .cart_totals table {
    width: 100%;
    border: none;
}
.printella-cart-summary .cart_totals table th,
.printella-cart-summary .cart_totals table td,
.printella-cart-summary .cart_totals table tr:nth-child(odd) th,
.printella-cart-summary .cart_totals table tr:nth-child(odd) td,
.printella-cart-summary .cart_totals table tr:hover th,
.printella-cart-summary .cart_totals table tr:hover td {
    padding: 8px 0;
    font-size: 0.875rem;
    background: transparent;
}
.printella-cart-summary .cart_totals table th,
.printella-cart-summary .cart_totals table td {
    border: none;
}
.printella-cart-summary .cart_totals table th {
    font-weight: 500;
    color: #6b7280;
    text-align: left;
}
.printella-cart-summary .cart_totals table td {
    text-align: right;
    font-weight: 500;
}
.printella .woocommerce-cart .cart-collaterals .cart_totals tr td,
.printella .woocommerce-cart .cart-collaterals .cart_totals tr th {
    border-top: none;
    border-bottom: none;
}
.woocommerce-cart .cart-collaterals .cart_totals tr td,
.woocommerce-cart .cart-collaterals .cart_totals tr th {
    border-top: none;
    border-bottom: none;
}

/* Row labels — override WC translations */
.printella-cart-summary .cart_totals .cart-subtotal th,
.printella-cart-summary .cart_totals .shipping th,
.printella-cart-summary .cart_totals .order-total th {
    visibility: hidden;
    position: relative;
}
.printella-cart-summary .cart_totals .cart-subtotal th::after,
.printella-cart-summary .cart_totals .shipping th::after,
.printella-cart-summary .cart_totals .order-total th::after {
    visibility: visible;
    position: absolute;
    left: 0;
    top: 8px;
}
.printella-cart-summary .cart_totals .cart-subtotal th::after {
    content: 'Produkty';
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}
.printella-cart-summary .cart_totals .shipping th::after {
    content: 'Wysyłka';
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
}

.printella-cart-summary .cart_totals .order-total th,
.printella-cart-summary .cart_totals .order-total td {
    padding-top: 16px;
}
.printella-cart-summary .cart_totals .order-total th::after {
    content: 'Do zapłaty';
    font-size: 1rem;
    font-weight: 600;
    color: #1a1a1a;
    top: 16px;
}
.printella-cart-summary .cart_totals .order-total td,
.printella-cart-summary .cart_totals .order-total td strong,
.printella-cart-summary .cart_totals .order-total td .woocommerce-Price-amount {
    font-weight: 700;
    font-size: 1.25rem;
    color: #1a1a1a;
}

/* Proceed to checkout button — filled primary */
.printella-cart-summary .wc-proceed-to-checkout {
    margin-top: 20px;
}
.printella .printella-cart-summary .wc-proceed-to-checkout .checkout-button,
.printella .printella-cart-summary .wc-proceed-to-checkout a.checkout-button {
    width: 100%;
    justify-content: center;
    background-color: var(--btn-primary);
    color: #fff;
    border: none;
    font-size: var(--btn-font-size);
    font-weight: var(--btn-font-weight);
    letter-spacing: var(--btn-letter-spacing);
    text-transform: uppercase;
    height: var(--btn-height);
    border-radius: var(--btn-radius);
}
.printella .printella-cart-summary .wc-proceed-to-checkout {
    margin-top: 20px;
    padding-bottom: 0;
    margin-bottom: 0;
}
.printella .printella-cart-summary .wc-proceed-to-checkout .checkout-button:hover,
.printella .printella-cart-summary .wc-proceed-to-checkout a.checkout-button:hover {
    background-color: var(--btn-primary-hover);
    color: #fff;
}

/* ===== Empty cart ===== */
.printella-cart-empty {
    text-align: center;
    padding: 80px 20px;
    max-width: 400px;
    margin: 0 auto;
}
.printella-cart-empty__icon {
    color: #d1d5db;
    margin-bottom: 24px;
}
.printella-cart-empty__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
}
.printella-cart-empty__text {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0 0 24px;
}
.printella-cart-empty__button {
    display: inline-flex;
}

/* ===== Loading state ===== */
.printella-cart--updating {
    pointer-events: none;
}
.printella-cart--updating .printella-cart-products {
    opacity: 0.5;
    transition: opacity 0.2s;
}

/* ===== Cross-sell ===== */
.printella-cart-layout .cross-sells {
    grid-column: 1 / -1;
    margin-top: 32px;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
    .printella-cart-layout {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 16px;
    }

    .printella-cart-summary {
        position: static;
    }

    .printella-cart-item__meta {
        grid-template-columns: 72px 1fr;
        gap: 12px;
    }

    .printella-cart-item__meta .product-thumbnail {
        width: 72px;
        height: 72px;
    }

    .printella-cart-item__controls {
        padding-left: 0;
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        gap: 12px;
        align-items: center;
        justify-items: center;
    }
    .printella-cart-item__controls .product-price {
        justify-self: start;
    }
    .printella-cart-item__controls .product-subtotal {
        justify-self: end;
    }

    /* Badge pills — wrap to new line on mobile */
    .printella-cart-item__meta .product-name dl.variation {
        white-space: normal;
    }
    .printella-cart-item__meta .product-name dl.variation dt,
    .printella-cart-item__meta .product-name dl.variation dd {
        font-size: 0.6875rem;
        padding: 3px 8px 3px 8px;
    }
    .printella-cart-item__meta .product-name dl.variation dt {
        padding-right: 0;
    }
    .printella-cart-item__meta .product-name dl.variation dd {
        padding-left: 3px;
        margin-right: 0;
        margin-bottom: 4px;
    }

    .printella-cart-actions {
        flex-wrap: wrap;
    }
    .printella-cart-actions .coupon {
        width: 100%;
    }

    /* Cross-sell */
    .printella-cart-layout .cross-sells {
        grid-column: 1;
    }
}
