/*
// .cart
*/
@import '../variables';
@import '../mixins/direction';
@import '../mixins/breakpoints';


.cart {
    display: flex;
}
.cart__table {
    flex-grow: 1;
}
.cart__totals {
    width: 360px;
    flex-shrink: 0;

    // @include direction {
    //     #{$margin-inline-start}: 50px;
    // }
}
.cart__totals-table {
    width: 100%;
    margin-bottom: 32px;
    font-size: 15px;

    a:hover {
        text-decoration: underline;
    }

    &,
    thead,
    tbody,
    tfoot,
    tr,
    th,
    td {
        display: block;
    }

    tr:after {
        display: block;
        content: '';
        clear: both;
    }

    th,
    td {
        padding: 0;
    }
    th {
        @include direction {
            float: $inline-start;
        }
    }
    td {
        @include direction {
            text-align: $inline-end;
        }
    }

    thead,
    tbody {
        line-height: 20px;
    }

    tbody {
        tr {
            & > * {
                padding-top: 8px;
            }
        }
        tr:last-child {
            & > * {
                padding-bottom: 10px;
            }
        }
    }

    tfoot {
        font-size: 20px;

        th {
            font-weight: $font-weight-medium;
        }

        td, th {
            padding-top: 12px;
            border-top: 1px solid map_get($card-scheme, divider);
        }
        td {
            letter-spacing: -.02em;
        }
    }
}


@include media-breakpoint-down(xl) {
    .cart {
        flex-wrap: wrap;
    }
    .cart__table {
        width: 100%;
    }
    .cart__totals {
        margin-top: 40px;
        width: 400px;

        @include direction {
            #{$margin-inline-start}: auto;
        }
    }
}
@include media-breakpoint-down(md) {
    .cart__totals {
        width: 360px;

        @include direction {
            #{$margin-inline-start}: 0;
        }
    }
}
@include media-breakpoint-down(sm) {
    .cart__totals {
        width: 100%;
    }
}

// Barra fija inferior con totales (solo telefono, mismo diseño que la tarjeta de total)
.cart-sticky-total {
    display: none;
}

@include media-breakpoint-down(md) {
    .cart-sticky-total {
        display: flex;
        flex-direction: column;
        gap: 6px;
        position: fixed;
        bottom: 0;
        inset-inline-start: 0;
        inset-inline-end: 0;
        z-index: 100;
        background: #ffffff;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
        border-top: 1px solid #eee;
        border-radius: 10px 10px 0 0;
        padding: 14px 20px;
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }

    .cart-sticky-total__item {
        display: flex;
        justify-content: space-between;
        align-items: baseline;
    }

    .cart-sticky-total__label {
        font-size: 14px;
        font-weight: 500;
        color: #555;
    }

    .cart-sticky-total__value {
        font-size: 16px;
        font-weight: $font-weight-bold;
        color: #222;
    }

    // Espacio para que la barra no tape el contenido
    .cart {
        padding-bottom: 100px;
    }
}
