/**
 * Cart — Compact layout for Composite Products.
 * Custom template: woocommerce/cart/cart.php
 */

/* ── Table base: compact cells, consistent font ──────────────────────────── */

.ce-cart {
    font-size: 14px;
}

.ce-cart td,
.ce-cart th {
    padding: 10px 12px !important;
    vertical-align: middle;
}

.ce-cart th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #999;
    font-weight: 400;
}

/* Subtotal: match sidebar totals style — light weight, same font */
.ce-cart td.product-subtotal {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 400 !important;
    font-size: 15px !important;
    color: #222;
}

/* Quantity input compact */
.ce-cart td.product-quantity .quantity input.qty {
    width: 44px;
    padding: 4px 2px;
    text-align: center;
    font-size: 13px;
}

/* Remove button compact */
.ce-cart td.product-remove {
    text-align: center;
}

/* Product name: clean typography */
.ce-cart td.product-name {
    font-size: 14px;
    line-height: 1.4;
}

.ce-cart td.product-name a {
    text-decoration: none;
    color: inherit;
}

.ce-cart td.product-name a:hover {
    color: var(--ce-green-dark, #2C4A2E);
}

/* ── Parent row ──────────────────────────────────────────────────────────── */

.ce-cart-parent > td {
    border-bottom: 2px solid var(--ce-green-dark, #2C4A2E) !important;
}

.ce-cart-parent td.product-name {
    font-weight: 700;
    font-size: 15px;
}

.ce-cart-parent td.product-subtotal {
    font-weight: 400 !important;
    font-size: 15px !important;
}

.ce-cart-parent__row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ce-cart-parent__thumb {
    flex-shrink: 0;
    width: 48px;
}

.ce-cart-parent__thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

.ce-cart-parent__info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 0;
}

/* Toggle button */
.ce-cart-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-left: 12px;
    vertical-align: middle;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ce-green-dark, #2C4A2E);
    background: rgba(44, 74, 46, 0.06);
    border: 1px solid rgba(44, 74, 46, 0.15);
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.ce-cart-toggle:hover {
    background: rgba(44, 74, 46, 0.12);
}

.ce-cart-toggle__arrow {
    display: inline-block;
    transition: transform 0.25s ease;
    font-size: 9px;
}

.ce-cart-toggle--collapsed .ce-cart-toggle__arrow {
    transform: rotate(-90deg);
}

/* ── Child rows: compact, indented ───────────────────────────────────────── */

.ce-cart-child {
    background: rgba(44, 74, 46, 0.02);
}

.ce-cart-child td {
    padding-top: 7px !important;
    padding-bottom: 7px !important;
}

.ce-cart-child td.product-name {
    padding-left: 32px !important;
    font-size: 13px;
    font-weight: 400;
}

/* Hide any remaining component meta from CP plugin */
.ce-cart-child td.product-name dl,
.ce-cart-child td.product-name .component_table_item_meta,
.ce-cart-child td.product-name .composite_table_item_meta {
    display: none;
}

.ce-cart-child td.product-subtotal {
    font-weight: 400 !important;
    font-size: 13px !important;
    color: #666;
}

/* Visual indent line for children */
.ce-cart-child td.product-remove {
    border-left: 3px solid rgba(44, 74, 46, 0.12);
}

/* ── Collapse ────────────────────────────────────────────────────────────── */

.ce-cart tr.ce-cart-child--hidden,
tr.ce-cart-child--hidden {
    display: none !important;
}

/* ── Regular product rows ────────────────────────────────────────────────── */

.ce-cart .cart_item:not(.ce-cart-parent):not(.ce-cart-child) .ce-cart-parent__thumb img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
}

/* ── Cart totals sidebar: match font style ───────────────────────────────── */

.cart_totals th,
.cart_totals td {
    font-variant-numeric: tabular-nums;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {

    /*
     * Override WC responsive table stacking.
     * Keep table layout so rows stay compact single-line.
     */
    .ce-cart,
    .ce-cart thead,
    .ce-cart tbody,
    .ce-cart tr:not(.ce-cart-child--hidden),
    .ce-cart th,
    .ce-cart td {
        display: revert !important;
    }

    .ce-cart thead {
        display: none !important;
    }

    /* Hide data-title labels WC adds */
    .ce-cart td::before {
        display: none !important;
    }

    .ce-cart {
        font-size: 13px;
    }

    .ce-cart td,
    .ce-cart th {
        padding: 6px 6px !important;
    }

    /* Parent row */
    .ce-cart-parent__thumb {
        width: 32px;
    }

    .ce-cart-parent__thumb img {
        width: 32px;
        height: 32px;
    }

    .ce-cart-parent__row {
        gap: 8px;
    }

    .ce-cart-parent td.product-name {
        font-size: 13px;
    }

    /* Toggle */
    .ce-cart-toggle {
        font-size: 10px;
        padding: 1px 7px;
        margin-left: 6px;
    }

    /* Remove button — reset WC responsive absolute positioning.
       WC selector: .woocommerce .shop_table.cart .product-remove (0,3,0)
       Our selector must match or exceed that specificity. */
    .woocommerce .ce-cart td.product-remove,
    .ce-cart.shop_table td.product-remove {
        display: table-cell !important;
        position: static !important;
        width: 32px !important;
        padding: 4px 2px !important;
        text-align: center;
    }

    .ce-cart td.product-remove .remove {
        font-size: 18px;
    }

    /* Quantity input */
    .ce-cart td.product-quantity {
        width: 50px !important;
        padding: 4px 2px !important;
    }

    .ce-cart td.product-quantity .quantity input.qty {
        width: 36px;
        padding: 3px 1px;
        font-size: 12px;
    }

    /* Subtotal */
    .ce-cart td.product-subtotal {
        font-size: 12px !important;
        padding: 4px 4px !important;
    }

    /* Child rows — compact text */
    .ce-cart-child td {
        padding-top: 4px !important;
        padding-bottom: 4px !important;
        font-size: 11px !important;
    }

    .ce-cart-child td.product-name {
        padding-left: 16px !important;
        font-size: 11px !important;
    }

    .ce-cart-child td.product-subtotal {
        font-size: 10px !important;
    }

    .ce-cart-child td.product-quantity .quantity input.qty {
        width: 30px;
        font-size: 11px !important;
    }

    .ce-cart-child td.product-remove {
        border-left-width: 2px;
    }

    /* Regular product thumbs */
    .ce-cart .cart_item:not(.ce-cart-parent):not(.ce-cart-child) .ce-cart-parent__thumb {
        width: 32px;
    }
    .ce-cart .cart_item:not(.ce-cart-parent):not(.ce-cart-child) .ce-cart-parent__thumb img {
        width: 32px;
        height: 32px;
    }

    /* Collapse must override WC responsive display — high specificity */
    .ce-cart tr.ce-cart-child--hidden,
    tr.ce-cart-child--hidden {
        display: none !important;
    }

    /* Actions row */
    .ce-cart .actions {
        padding: 8px 6px !important;
    }

    .ce-cart .coupon {
        display: flex;
        gap: 6px;
    }

    .ce-cart .coupon input.input-text {
        flex: 1;
        min-width: 0;
        font-size: 12px;
    }

    .ce-cart .coupon button {
        font-size: 11px;
        white-space: nowrap;
    }
}
