/* Casa Modesta - Cart Styles (Bypassing Table Layout) */

.woocommerce-cart .cm-app-container {
    padding: 24px 16px;
}

/* Force the table into a CSS Flex/Grid layout to create cards */
.woocommerce-cart-form__contents,
.woocommerce-cart-form__contents tbody,
.woocommerce-cart-form__contents tr.woocommerce-cart-form__cart-item {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.woocommerce-cart-form__contents thead {
    display: none; /* Hide table headers */
}

/* Individual Product Card */
.woocommerce-cart-form__cart-item {
    background-color: var(--cm-surface);
    border: 1px solid var(--cm-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    display: grid !important;
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: 12px 16px;
    box-shadow: 0 4px 12px var(--cm-shadow);
}

/* Image */
.woocommerce-cart-form__cart-item .product-thumbnail {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 80px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--cm-surface-2);
    border: 1px solid var(--cm-border);
    padding: 0;
}

.cm-cart-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Details */
.woocommerce-cart-form__cart-item .product-name {
    grid-column: 2;
    grid-row: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.cm-cart-item-cat {
    font-size: 10px;
    font-weight: 700;
    color: var(--cm-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.cm-cart-item-title a {
    font-family: var(--cm-font-primary);
    font-size: 14px;
    font-weight: 600;
    color: var(--cm-ink);
    text-decoration: none;
}

/* Price & Quantity Row */
.woocommerce-cart-form__cart-item .product-price,
.woocommerce-cart-form__cart-item .product-subtotal {
    display: none; /* Hide individual price columns, we show subtotal */
}

.woocommerce-cart-form__cart-item .product-quantity {
    grid-column: 2;
    grid-row: 2;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Quantity Input Styling */
.quantity {
    display: flex;
    align-items: center;
    background-color: var(--cm-surface-2);
    border: 1px solid var(--cm-border);
    border-radius: 20px;
    padding: 2px 8px;
}
/* 1. Base styling for the quantity input */
.quantity input.qty {
    width: 30px;
    height: 24px;
    background: transparent;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--cm-ink);
    padding: 0;
}

/* 2. Hide the arrows in Chrome, Safari, Edge, and Opera */
.quantity input.qty::-webkit-outer-spin-button,
.quantity input.qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* 3. Hide the arrows in Firefox */
.quantity input.qty[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}


/* Remove Button */
.woocommerce-cart-form__cart-item .product-remove {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 0;
}

.woocommerce-cart-form__cart-item .product-remove a.remove {
    color: var(--cm-muted);
    font-size: 20px;
    font-weight: 300;
    text-decoration: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--cm-surface-2);
    transition: background-color 0.2s ease;
}

.woocommerce-cart-form__cart-item .product-remove a.remove:hover {
    background-color: var(--cm-border);
    color: var(--cm-ink);
}

/* Coupon & Actions */
.actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 0 !important;
    border: none !important;
}

.coupon {
    display: flex;
    gap: 8px;
    width: 100%;
}

.coupon input.input-text {
    flex: 1;
    height: 44px;
    border-radius: 8px;
    border: 1px solid var(--cm-border);
    background-color: var(--cm-surface);
    color: var(--cm-ink);
    padding: 0 16px;
    font-size: 14px;
}

.coupon button.button {
    height: 44px;
    border-radius: 8px;
    background-color: var(--cm-ink);
    color: var(--cm-bg);
    border: none;
    padding: 0 20px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

button[name="update_cart"] {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    background-color: var(--cm-surface-2);
    color: var(--cm-ink);
    border: 1px solid var(--cm-border);
    font-weight: 600;
}

/* Cart Totals */
.cart-collaterals {
    margin-top: 32px;
}

.cart_totals {
    background-color: var(--cm-surface);
    border: 1px solid var(--cm-border);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 12px var(--cm-shadow);
}

.cart_totals h2 {
    font-family: var(--cm-font-serif);
    font-size: 20px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--cm-border);
    padding-bottom: 12px;
}

.shop_table.shop_table_responsive {
    width: 100%;
    border-collapse: collapse;
}

.shop_table.shop_table_responsive tr {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--cm-border);
}

.shop_table.shop_table_responsive th {
    font-weight: 500;
    color: var(--cm-muted);
    text-align: left;
}

.shop_table.shop_table_responsive td {
    font-weight: 700;
    color: var(--cm-ink);
    text-align: right;
}

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

.checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 50px;
    background-color: var(--cm-accent);
    color: var(--cm-bg);
    border-radius: 25px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(198, 157, 88, 0.3);
}