/*
 * Animalart — Cart Page UI.
 *
 * Camada visual escopada ao body.woocommerce-cart. A tabela, os hooks e as
 * ações continuam sendo os nativos do WooCommerce; este módulo somente
 * reorganiza superfícies, densidade, metadados e responsividade.
 */

body.woocommerce-cart {
    overflow-x: hidden;
    --animalart-cart-gap: clamp(20px, 3vw, 40px);
    --animalart-cart-surface: var(--studioalmadolar-surface, #fff);
    --animalart-cart-surface-muted: var(--animalart-surface-muted, #f7f7f7);
    --animalart-cart-line: var(--animalart-line, #e5e5e5);
    --animalart-cart-ink: var(--animalart-ink, #171717);
    --animalart-cart-muted: var(--animalart-muted, #666);
    --animalart-cart-radius: 14px;
    --animalart-cart-control-radius: 10px;
}

/* No carrinho, o painel fixed fechado não deve aumentar o scrollWidth do
   documento. O estado aberto continua sendo controlado pela classe nativa
   `.is-open` do minicart.js. */
body.woocommerce-cart .studioalmadolar-minicart__panel {
    right: -100%;
    transform: none;
    transition: right 0.35s ease, visibility 0.35s ease;
}

body.woocommerce-cart .studioalmadolar-minicart__panel.is-open {
    right: 0;
}

/* O header usa um container amplo no desktop; esta contenção contextual
   impede que as ações fixas provoquem overflow somente na Cart Page. */
body.woocommerce-cart .site-header__inner {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding-inline: clamp(16px, 3vw, 32px);
}

body.woocommerce-cart .site-main.animalart-page-shell {
    max-width: 1440px;
}

body.woocommerce-cart .animalart-page-shell__content {
    max-width: none;
}

body.woocommerce-cart .woocommerce {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.85fr);
    gap: var(--animalart-cart-gap);
    align-items: start;
    color: var(--animalart-cart-ink);
}

body.woocommerce-cart .woocommerce-notices-wrapper {
    grid-column: 1 / -1;
}

body.woocommerce-cart .woocommerce-cart-form,
body.woocommerce-cart .cart_totals {
    box-sizing: border-box;
    border: 1px solid var(--animalart-cart-line);
    border-radius: var(--animalart-cart-radius);
    background: var(--animalart-cart-surface);
}

body.woocommerce-cart .woocommerce-cart-form {
    min-width: 0;
    overflow: hidden;
}

body.woocommerce-cart .shop_table.cart {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

body.woocommerce-cart .shop_table.cart thead {
    background: var(--animalart-cart-surface-muted);
}

body.woocommerce-cart .shop_table.cart thead th {
    padding: 16px 12px;
    border: 0;
    border-bottom: 1px solid var(--animalart-cart-line);
    color: var(--animalart-cart-muted);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
}

body.woocommerce-cart .shop_table.cart thead th.product-remove,
body.woocommerce-cart .shop_table.cart thead th.product-thumbnail {
    font-size: 0;
}

body.woocommerce-cart .shop_table.cart thead th.product-remove,
body.woocommerce-cart .shop_table.cart tbody td.product-remove {
    width: 46px;
    text-align: center;
}

body.woocommerce-cart .shop_table.cart thead th.product-thumbnail,
body.woocommerce-cart .shop_table.cart tbody td.product-thumbnail {
    width: 82px;
}

body.woocommerce-cart .shop_table.cart thead th.product-price,
body.woocommerce-cart .shop_table.cart tbody td.product-price {
    width: 112px;
}

body.woocommerce-cart .shop_table.cart thead th.product-quantity,
body.woocommerce-cart .shop_table.cart tbody td.product-quantity {
    width: 132px;
}

body.woocommerce-cart .shop_table.cart thead th.product-subtotal,
body.woocommerce-cart .shop_table.cart tbody td.product-subtotal {
    width: 126px;
}

body.woocommerce-cart .shop_table.cart tbody td {
    padding: 18px 12px;
    border: 0;
    border-bottom: 1px solid var(--animalart-cart-line);
    color: var(--animalart-cart-ink);
    vertical-align: top;
}

body.woocommerce-cart .shop_table.cart tbody tr:last-child td {
    border-bottom: 0;
}

body.woocommerce-cart .shop_table.cart tbody tr.component_container_table_item td {
    padding-top: 22px;
    padding-bottom: 14px;
    border-top: 1px solid var(--animalart-cart-line);
    border-bottom: 0;
}

body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td {
    padding-top: 8px;
    padding-bottom: 8px;
    background: var(--animalart-cart-surface-muted);
    color: var(--animalart-cart-muted);
    font-size: 0.92rem;
}

body.woocommerce-cart .shop_table.cart tbody tr.component_table_item:last-of-type td {
    padding-bottom: 18px;
}

body.woocommerce-cart .shop_table.cart .product-remove a.remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--studioalmadolar-danger, #a33);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

body.woocommerce-cart .shop_table.cart .product-remove a.remove:hover {
    background: var(--animalart-yellow-soft, #fff9d6);
    color: var(--animalart-cart-ink);
}

body.woocommerce-cart .shop_table.cart .product-thumbnail img {
    display: block;
    width: 64px;
    height: 64px;
    border-radius: var(--animalart-cart-control-radius);
    object-fit: cover;
}

body.woocommerce-cart .shop_table.cart .product-name {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
}

body.woocommerce-cart .shop_table.cart .product-name > a:not(.remove) {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
}

body.woocommerce-cart .shop_table.cart .product-name > a:not(.remove):hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* O Composite Products da Cart Page entrega `div.component-name` com
   `dl.component` diretamente dentro da célula product-name. A grade mantém
   Anel n: e o valor na mesma linha, inclusive no mobile. */
body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 6px;
    row-gap: 4px;
    align-items: baseline;
    min-width: 0;
    margin: 4px 0 0;
    color: inherit;
    font-size: inherit;
}

body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component dt,
body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component dd,
body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component dd p,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation dt,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation dd,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation dd p {
    display: block;
    min-width: 0;
    margin: 0;
    padding: 0;
}

body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component dt,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation dt {
    font-weight: 600;
    white-space: nowrap;
}

body.woocommerce-cart .shop_table.cart td.product-name .component-name dl.component dd,
body.woocommerce-cart .shop_table.cart td.product-name dl.variation dd {
    overflow-wrap: anywhere;
}

body.woocommerce-cart .shop_table.cart td.product-price,
body.woocommerce-cart .shop_table.cart td.product-subtotal {
    white-space: nowrap;
}

body.woocommerce-cart .shop_table.cart td.product-subtotal {
    font-weight: 600;
    text-align: right;
}

body.woocommerce-cart .shop_table.cart td.product-quantity {
    text-align: center;
}

body.woocommerce-cart .shop_table.cart td.product-quantity .quantity {
    display: inline-flex;
    width: auto;
    max-width: 100%;
}

body.woocommerce-cart .shop_table.cart td.product-quantity input.qty {
    box-sizing: border-box;
    width: 76px;
    min-height: 44px;
    border: 1px solid var(--animalart-cart-line);
    border-radius: var(--animalart-cart-control-radius);
    background: var(--animalart-cart-surface);
    color: var(--animalart-cart-ink);
    text-align: center;
}

body.woocommerce-cart .shop_table.cart tr.component_table_item td.product-quantity {
    color: var(--animalart-cart-muted);
    font-size: 0.9rem;
}

body.woocommerce-cart .shop_table.cart .actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-top: 1px solid var(--animalart-cart-line);
    background: var(--animalart-cart-surface-muted);
}

body.woocommerce-cart .shop_table.cart .actions .coupon {
    display: flex;
    flex: 1 1 360px;
    align-items: center;
    gap: 8px;
    min-width: 240px;
}

body.woocommerce-cart .shop_table.cart .actions .coupon label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.woocommerce-cart .shop_table.cart .actions .coupon input.input-text {
    flex: 1 1 auto;
    box-sizing: border-box;
    min-height: 46px;
    min-width: 0;
    border: 1px solid var(--animalart-cart-line);
    border-radius: var(--animalart-cart-control-radius);
    background: var(--animalart-cart-surface);
    color: var(--animalart-cart-ink);
}

body.woocommerce-cart .shop_table.cart .actions button,
body.woocommerce-cart .shop_table.cart .actions .button {
    min-height: 46px;
    border-radius: var(--animalart-cart-control-radius);
    padding: 0 18px;
    border: 1px solid var(--studioalmadolar-accent, #2f2a26);
    background: var(--animalart-cart-surface);
    color: var(--studioalmadolar-accent, #2f2a26);
    font-weight: 600;
}

body.woocommerce-cart .shop_table.cart .actions button:hover,
body.woocommerce-cart .shop_table.cart .actions .button:hover {
    background: var(--animalart-yellow-soft, #fff9d6);
}

body.woocommerce-cart .cart-collaterals {
    min-width: 0;
    margin: 0;
}

body.woocommerce-cart .cart_totals {
    width: 100%;
    float: none;
    margin: 0;
    padding: clamp(20px, 3vw, 28px);
}

@media (min-width: 783px) {
    body.woocommerce-cart .cart_totals {
        position: sticky;
        top: 24px;
    }
}

body.woocommerce-cart .cart_totals h2 {
    margin: 0 0 20px;
    color: var(--animalart-cart-ink);
    font-size: clamp(1.35rem, 2vw, 1.75rem);
}

body.woocommerce-cart .cart_totals table {
    width: 100%;
    margin: 0;
    border: 0;
    border-collapse: collapse;
}

body.woocommerce-cart .cart_totals table th,
body.woocommerce-cart .cart_totals table td {
    padding: 12px 0;
    border: 0;
    border-bottom: 1px solid var(--animalart-cart-line);
    vertical-align: top;
}

body.woocommerce-cart .cart_totals table th {
    color: var(--animalart-cart-muted);
    font-weight: 400;
    text-align: left;
}

body.woocommerce-cart .cart_totals table td {
    color: var(--animalart-cart-ink);
    font-weight: 600;
    text-align: right;
}

body.woocommerce-cart .cart_totals table tr.order-total th,
body.woocommerce-cart .cart_totals table tr.order-total td {
    padding-top: 18px;
    border-bottom: 0;
    color: var(--animalart-cart-ink);
    font-size: 1.12rem;
    font-weight: 900;
}

body.woocommerce-cart .cart_totals .woocommerce-shipping-calculator {
    margin-top: 8px;
}

body.woocommerce-cart .cart_totals .shipping-calculator-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: var(--studioalmadolar-link, #5d3c28);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
}

body.woocommerce-cart .cart_totals .shipping-calculator-form {
    margin-top: 12px;
}

body.woocommerce-cart .cart_totals .shipping-calculator-form input,
body.woocommerce-cart .cart_totals .shipping-calculator-form select {
    box-sizing: border-box;
    min-height: 46px;
    border: 1px solid var(--animalart-cart-line);
    border-radius: var(--animalart-cart-control-radius);
    background: var(--animalart-cart-surface);
}

body.woocommerce-cart .cart_totals .wc-proceed-to-checkout {
    margin: 22px 0 0;
    padding: 0;
}

body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
    display: flex;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    margin: 0;
    border-radius: var(--animalart-cart-control-radius);
    background: var(--studioalmadolar-accent, #2f2a26);
    color: var(--studioalmadolar-accent-contrast, #fff);
    font-size: 1rem;
    font-weight: 900;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    transition: filter 0.15s ease, transform 0.15s ease;
}

body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

body.woocommerce-cart a:focus-visible,
body.woocommerce-cart button:focus-visible,
body.woocommerce-cart input:focus-visible,
body.woocommerce-cart select:focus-visible,
body.woocommerce-cart textarea:focus-visible {
    outline: 3px solid var(--animalart-yellow, #ffcd00);
    outline-offset: 3px;
}

body.woocommerce-cart .woocommerce-info,
body.woocommerce-cart .woocommerce-message,
body.woocommerce-cart .woocommerce-error {
    box-sizing: border-box;
    margin: 0;
    border-radius: var(--animalart-cart-control-radius);
}

@media (max-width: 782px) {
    body.woocommerce-cart .woocommerce {
        display: block;
    }

    body.woocommerce-cart .woocommerce-notices-wrapper {
        margin-bottom: 18px;
    }

    body.woocommerce-cart .woocommerce-cart-form {
        overflow: visible;
        border-radius: var(--animalart-cart-radius);
    }

    body.woocommerce-cart .shop_table.cart,
    body.woocommerce-cart .shop_table.cart tbody {
        display: block;
    }

    body.woocommerce-cart .shop_table.cart thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item {
        display: grid;
        grid-template-columns: 36px 56px minmax(0, 1fr) auto;
        grid-template-areas:
            'remove thumbnail name subtotal'
            'remove thumbnail price subtotal'
            'remove thumbnail quantity subtotal';
        gap: 4px 10px;
        align-items: start;
        box-sizing: border-box;
        width: 100%;
        padding: 16px 12px;
        border-bottom: 1px solid var(--animalart-cart-line);
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item:last-child {
        border-bottom: 0;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td {
        display: block;
        width: auto;
        min-width: 0;
        box-sizing: border-box;
        padding: 0;
        border: 0;
        background: transparent;
        text-align: left;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-remove {
        grid-area: remove;
        width: 36px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-thumbnail {
        grid-area: thumbnail;
        width: 56px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-thumbnail img {
        width: 56px;
        height: 56px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-name {
        grid-area: name;
        width: auto;
        padding-top: 2px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-price {
        grid-area: price;
        width: auto;
        padding-top: 2px;
        color: var(--animalart-cart-muted);
        font-size: 0.86rem;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-price::before {
        content: 'Preço: ';
        font-weight: 600;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-quantity {
        grid-area: quantity;
        width: auto;
        text-align: left;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-quantity::before {
        content: 'Quantidade';
        display: block;
        margin-bottom: 4px;
        color: var(--animalart-cart-muted);
        font-size: 0.76rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-subtotal {
        grid-area: subtotal;
        width: auto;
        align-self: start;
        padding-top: 2px;
        font-size: 0.98rem;
        text-align: right;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.cart_item td.product-subtotal::before {
        content: 'Subtotal';
        display: block;
        margin-bottom: 4px;
        color: var(--animalart-cart-muted);
        font-size: 0.76rem;
        font-weight: 600;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_container_table_item {
        grid-template-areas:
            'remove thumbnail name subtotal'
            'remove thumbnail price subtotal'
            'remove thumbnail quantity subtotal';
        padding-top: 18px;
        border-top: 1px solid var(--animalart-cart-line);
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item {
        grid-template-columns: 36px 44px minmax(0, 1fr) auto;
        grid-template-areas: 'remove thumbnail name quantity';
        gap: 6px 8px;
        padding: 10px 12px;
        background: var(--animalart-cart-surface-muted);
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-thumbnail {
        width: 44px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-thumbnail img {
        width: 44px;
        height: 44px;
        border-radius: 8px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-name {
        align-self: center;
        padding: 0;
        color: var(--animalart-cart-ink);
        font-size: 0.88rem;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-name .component-name dl.component,
    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-name dl.variation {
        margin: 0;
        column-gap: 4px;
        row-gap: 2px;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-price,
    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-subtotal {
        display: none;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-quantity {
        align-self: center;
        color: var(--animalart-cart-muted);
        font-size: 0.86rem;
        text-align: right;
    }

    body.woocommerce-cart .shop_table.cart tbody tr.component_table_item td.product-quantity::before {
        display: none;
    }

    body.woocommerce-cart .shop_table.cart .actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 12px;
    }

    body.woocommerce-cart .shop_table.cart .actions .coupon {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
        min-width: 0;
    }

    body.woocommerce-cart .shop_table.cart .actions .coupon button,
    body.woocommerce-cart .shop_table.cart .actions button[name='update_cart'] {
        width: 100%;
    }

    body.woocommerce-cart .cart-collaterals {
        margin-top: 20px;
    }

    body.woocommerce-cart .cart_totals {
        padding: 20px 16px;
    }

    body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
        min-height: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.woocommerce-cart .shop_table.cart .product-remove a.remove,
    body.woocommerce-cart .cart_totals .wc-proceed-to-checkout a.checkout-button {
        transition: none;
    }
}
