/*
 * Cart page — premium redesign.
 * Loaded only on the Cart page (see inc/cart-page.php: is_cart()).
 * Loaded after style.css so these rules win without needing to fight
 * the old !important table.shop_table overflow-x rules there.
 */

body.woocommerce-cart .woocommerce {
    align-items: flex-start !important;
}

/* ---------- Card shell around the whole items list ---------- */
body.woocommerce-cart .woocommerce-cart-form {
    background: #ffffff !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05) !important;
    padding: 10px 25px !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart table.shop_table {
    display: block !important;
    overflow-x: visible !important;
    white-space: normal !important;
    border: none !important;
    box-shadow: none !important;
    margin-top: 0 !important;
}
body.woocommerce-cart table.shop_table thead { display: none !important; }
body.woocommerce-cart table.shop_table tbody,
body.woocommerce-cart table.shop_table tr,
body.woocommerce-cart table.shop_table td {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* ---------- Each product = one premium row/card ---------- */
body.woocommerce-cart table.shop_table tr.cart_item {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 18px !important;
    padding: 22px 0 !important;
    border: none !important;
    border-bottom: 1px solid #f2f2f2 !important;
    transition: background 0.2s ease !important;
}
body.woocommerce-cart table.shop_table tr.cart_item:last-child { border-bottom: none !important; }
body.woocommerce-cart table.shop_table tr.cart_item:hover { background: #fdfbfc !important; }

body.woocommerce-cart table.shop_table td.product-remove {
    order: 4 !important;
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    text-align: center !important;
}
body.woocommerce-cart table.shop_table td.product-remove a.remove {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    background: #f8fafc !important;
    color: #94a3b8 !important;
    font-size: 20px !important;
    line-height: 1 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}
body.woocommerce-cart table.shop_table td.product-remove a.remove:hover {
    background: #fde8ee !important;
    color: #e11d48 !important;
    transform: rotate(90deg) !important;
}

body.woocommerce-cart table.shop_table td.product-thumbnail {
    order: 1 !important;
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}
body.woocommerce-cart table.shop_table td.product-thumbnail img {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    border: 1px solid #f0f0f0 !important;
}

body.woocommerce-cart table.shop_table td.product-name {
    order: 2 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}
body.woocommerce-cart table.shop_table td.product-name a {
    font-size: 15px !important;
    line-height: 1.4 !important;
    display: block !important;
}
body.woocommerce-cart table.shop_table td.product-name dl.variation {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 4px 10px !important;
    font-size: 12px !important;
    color: #6b7280 !important;
    margin: 6px 0 0 !important;
    padding: 0 !important;
}
body.woocommerce-cart table.shop_table td.product-name dl.variation dt { font-weight: 600 !important; margin: 0 !important; }
body.woocommerce-cart table.shop_table td.product-name dl.variation dd,
body.woocommerce-cart table.shop_table td.product-name dl.variation p { margin: 0 !important; }

/* Native qty input stays for accessibility / no-JS fallback; JS wraps it
   with − / + buttons (assets/js/cart-qty.js) styled below. */
body.woocommerce-cart table.shop_table td.product-quantity {
    order: 3 !important;
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
}
body.woocommerce-cart .sp-cart-qty {
    display: inline-flex !important;
    align-items: center !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    height: 38px !important;
    overflow: hidden !important;
    transition: opacity 0.2s ease !important;
}
body.woocommerce-cart .sp-cart-qty.is-updating { opacity: 0.55 !important; pointer-events: none !important; }
body.woocommerce-cart .sp-cart-qty .sp-qty-btn {
    background: transparent !important;
    border: none !important;
    color: #0f172a !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    width: 34px !important;
    height: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease, color 0.2s ease !important;
}
body.woocommerce-cart .sp-cart-qty .sp-qty-btn:hover { background: #FC5A8D !important; color: #fff !important; }
body.woocommerce-cart .sp-cart-qty input.qty {
    width: 40px !important;
    border: none !important;
    background: transparent !important;
    text-align: center !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    padding: 0 !important;
    -moz-appearance: textfield !important;
}
body.woocommerce-cart .sp-cart-qty input.qty::-webkit-outer-spin-button,
body.woocommerce-cart .sp-cart-qty input.qty::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }

body.woocommerce-cart table.shop_table td.product-price,
body.woocommerce-cart table.shop_table td.product-subtotal {
    order: 5 !important;
    width: auto !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    text-align: right !important;
    font-weight: 700 !important;
    color: #111 !important;
    font-size: 16px !important;
    min-width: 90px !important;
}
body.woocommerce-cart table.shop_table td.product-price { display: none !important; } /* unit price hidden — subtotal already covers it, avoids clutter */

/* Update-cart / coupon action row */
body.woocommerce-cart table.shop_table .actions {
    background: transparent !important;
    padding: 20px 0 0 !important;
    border-top: 1px dashed #eee !important;
    margin-top: 10px !important;
}

/* ---------- Order-summary card (kept, lightly polished) ---------- */
body.woocommerce-cart .cart-collaterals .cart_totals {
    position: sticky !important;
    top: 20px !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table {
    width: 100% !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 12px 0 !important;
    border-bottom: 1px dashed #f1f5f9 !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table tr:last-child { border-bottom: none !important; }
body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table th,
body.woocommerce-cart .cart-collaterals .cart_totals table.shop_table td {
    display: block !important;
    width: auto !important;
    border: none !important;
    padding: 0 !important;
    font-weight: 500 !important;
    color: #64748b !important;
}
body.woocommerce-cart .cart-collaterals .cart_totals .order-total th,
body.woocommerce-cart .cart-collaterals .cart_totals .order-total td {
    font-weight: 800 !important;
    color: #111 !important;
    font-size: 18px !important;
}

/* Empty cart state */
body.woocommerce-cart .cart-empty {
    background: #fff !important;
    border: 1px solid #f0f0f0 !important;
    border-radius: 16px !important;
    padding: 50px 25px !important;
    text-align: center !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.05) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 16px !important;
}

/* ============================================================
   Mobile: stacked premium cards, nothing touches the screen edge
   ============================================================ */
@media (max-width: 768px) {
    body.woocommerce-cart .woocommerce { padding: 0 12px !important; }
    body.woocommerce-cart .woocommerce-cart-form { padding: 6px 14px !important; border-radius: 14px !important; }

    body.woocommerce-cart table.shop_table tr.cart_item {
        flex-wrap: wrap !important;
        position: relative !important;
        padding: 18px 0 18px 0 !important;
        row-gap: 10px !important;
    }
    body.woocommerce-cart table.shop_table td.product-thumbnail { order: 1 !important; }
    body.woocommerce-cart table.shop_table td.product-thumbnail img { width: 64px !important; height: 64px !important; }
    body.woocommerce-cart table.shop_table td.product-name {
        order: 2 !important;
        flex: 1 1 calc(100% - 82px) !important;
        padding-right: 40px !important; /* room for the remove button, top-right */
    }
    body.woocommerce-cart table.shop_table td.product-name a { font-size: 14px !important; }
    body.woocommerce-cart table.shop_table td.product-remove {
        order: 3 !important;
        position: absolute !important;
        top: 18px !important;
        right: 0 !important;
    }
    body.woocommerce-cart table.shop_table td.product-remove a.remove { width: 28px !important; height: 28px !important; font-size: 16px !important; }
    body.woocommerce-cart table.shop_table td.product-quantity {
        order: 4 !important;
        flex: 1 1 auto !important;
        padding-left: 82px !important; /* aligns under the name, past the image */
    }
    body.woocommerce-cart .sp-cart-qty { height: 34px !important; }
    body.woocommerce-cart .sp-cart-qty .sp-qty-btn { width: 30px !important; font-size: 15px !important; }
    body.woocommerce-cart table.shop_table td.product-subtotal {
        order: 5 !important;
        flex: 0 0 auto !important;
        margin-left: auto !important;
        font-size: 15px !important;
        min-width: 0 !important;
    }

    body.woocommerce-cart table.shop_table .actions .coupon { gap: 8px !important; }

    body.woocommerce-cart .cart-collaterals .cart_totals { padding: 25px 20px !important; }
}
