/*
// .tm-cart
// .tm-cart-alert
// .tm-cart-footer
*/

/* ---------------- */

/*
// .tm-cart
*/
.tm-cart {
    --tm-cart--image-size: 6rem;
    --tm-cart--border-color: rgba(0, 0, 0, .15);

    width: 100%;
    font-size: 15px;
    border-spacing: 0;
}
.tm-cart a {
    color: inherit;
    text-decoration: none;
}
.tm-cart a:hover {
    text-decoration: underline;
}
.tm-cart th,
.tm-cart td {
    vertical-align: center;
}
.tm-cart th {
    color: #757575;
    font-weight: normal;
}
.tm-cart thead {
    font-size: 14px;
}
.tm-cart tfoot td {
    white-space: nowrap;
}
.tm-cart__item-image img {
    width: var(--tm-cart--image-size);
    height: var(--tm-cart--image-size);
    object-fit: cover;
    display: block;
}
.tm-cart__item-name {
    line-height: 1.3;
}
.tm-cart__item-options {
    font-size: 12px;
    line-height: 1.5;
    color: #777;
    list-style: none;
    padding: 0;
    margin: 4px 0 0;
}
.tm-cart__item-price,
.tm-cart__item-total {
    white-space: nowrap;
}
.tm-cart__item-total--loading {
    position: relative;
    color: transparent;
}
.tm-cart__item-total--loading:after {
    --tm-loader-size: 14px;

    position: absolute;
    content: '';

    width: var(--tm-loader-size);
    height: var(--tm-loader-size);
    right: 0;
    top: calc(50% - var(--tm-loader-size) / 2);
    border-radius: calc(var(--tm-loader-size) / 2);
    border: 2px solid #000;
    border-top-color: transparent;
    opacity: .25;
    pointer-events: none;

    animation-name: tm-loader-animation;
    animation-duration: .5s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.tm-cart__item-quantity input {
    width: 5.75rem;
}
.tm-cart__remove {
    font-size: 10px;
    display: flex;
    border: none;
    padding: 10px;
    color: rgba(0, 0, 0, .3);
    background: transparent;
    border-radius: 50%;
    transition: background-color .12s;
    cursor: pointer;
}
.tm-cart__remove:not(.tm-cart__remove--loading):hover {
    background: rgba(0, 0, 0, .06);
}
.tm-cart__remove:not(.tm-cart__remove--loading):active {
    transition-duration: 0s;
    background: rgba(0, 0, 0, .08);
}
.tm-cart__remove--loading {
    position: relative;
    color: transparent;
}
.tm-cart__remove--loading,
.tm-cart__remove--loading[type=submit]:not(:disabled) {
    cursor: default;
}
.tm-cart__remove--loading:before {
    --tm-loader-size: 14px;
    --tm-font-color: #333;

    position: absolute;
    content: '';

    width: var(--tm-loader-size);
    height: var(--tm-loader-size);
    left: calc(50% - var(--tm-loader-size) / 2);
    top: calc(50% - var(--tm-loader-size) / 2);
    border-radius: calc(var(--tm-loader-size) / 2);
    border: 2px solid #000;
    border-top-color: transparent;
    opacity: .25;

    animation-name: tm-loader-animation;
    animation-duration: .5s;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}
.tm-cart__header-price,
.tm-cart__header-total {
    text-align: right;
}
.tm-cart__header-quantity {
    text-align: center;
}

@media (max-width: 374.98px) {
    .tm-cart {
        --tm-cart--image-size: 5rem;
    }
}
@media (max-width: 340px) {
    .tm-cart {
        --tm-cart--image-size: 4rem;
    }
}
@media (max-width: 767.98px) {
    .tm-cart thead {
        display: none;
    }
    .tm-cart,
    .tm-cart tbody,
    .tm-cart tfoot {
        display: block;
    }
    .tm-cart tbody tr {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto auto auto;
    }
    .tm-cart__item-image {
        grid-column: 1;
        grid-row: 1 / 5;
    }
    .tm-cart__item-name {
        align-self: center;
    }
    .tm-cart__item-remove {
        grid-column: 3;
        grid-row: 1;
    }
    .tm-cart__item-price {
        grid-column: 2 / 4;
        grid-row: 2;
    }
    .tm-cart__item-quantity {
        grid-column: 2 / 4;
        grid-row: 3;
    }
    .tm-cart__item-total {
        grid-column: 2 / 4;
        grid-row: 4;
    }

    .tm-cart th,
    .tm-cart td {
        padding: 0;
    }
    .tm-cart tbody tr + tr {
        border-top: 1px solid var(--tm-cart--border-color);
        padding-top: 20px;
        margin-top: 18px;
    }
    .tm-cart__item-image {
        margin-right: 16px;
    }
    .tm-cart__item-name {
        margin-right: 12px;
    }
    .tm-cart__item-name,
    .tm-cart__item-remove {
        margin-bottom: 10px;
    }
    .tm-cart__item-price,
    .tm-cart__item-quantity,
    .tm-cart__item-total {
        display: flex;
        align-items: center;
        font-size: 12px;
    }
    .tm-cart__item-quantity,
    .tm-cart__item-total {
        margin-top: 8px;
    }
    .tm-cart__item-price:before,
    .tm-cart__item-quantity:before,
    .tm-cart__item-total:before {
        content: attr(data-title);
        margin-right: auto;
        flex-grow: 1;
        color: #212529;
    }
    .tm-cart__remove {
        margin: -4px;
    }
    .tm-cart tfoot {
        border-top: 1px solid var(--tm-cart--border-color);
        padding-top: 16px;
        margin-top: 20px;
    }
    .tm-cart tfoot tr {
        display: flex;
    }
    .tm-cart tfoot tr + tr {
        padding-top: 4px;
    }
    .tm-cart tfoot th {
        display: block;
        padding-right: 20px;
        flex-grow: 1;
    }
}
@media (min-width: 768px) {
    /* paddings */
    .tm-cart th,
    .tm-cart td {
        padding: 0;
    }
    .tm-cart thead tr > * {
        padding-bottom: 12px;
    }
    .tm-cart tbody tr > *  {
        padding-top: 20px;
        padding-bottom: 20px;
    }
    .tm-cart tfoot tr + tr > * {
        padding-top: 8px;
    }
    .tm-cart tfoot tr:first-child > *  {
        padding-top: 16px;
    }
    .tm-cart tfoot tr:last-child > *  {
        padding-bottom: 16px;
    }
    .tm-cart tr > * + * {
        padding-left: 20px;
    }
    /* border */
    .tm-cart {
        border-bottom: 1px solid var(--tm-cart--border-color);
    }
    .tm-cart tbody th,
    .tm-cart tbody td,
    .tm-cart tfoot tr:first-child th,
    .tm-cart tfoot tr:first-child td {
        border-top: 1px solid var(--tm-cart--border-color);
    }

    .tm-cart__item-image,
    .tm-cart__item-total,
    .tm-cart__item-remove {
        width: 1px;
    }

    .tm-cart__item-price {
        text-align: right;
    }
    .tm-cart__item-quantity {
        text-align: center;
    }
    .tm-cart__item-total {
        text-align: right;
    }
    .tm-cart tfoot {
        text-align: right;
    }
}

/*
// .tm-cart-alert
*/
.tm-cart-alert {
    margin-bottom: 24px;
}

/*
// .tm-cart-footer
*/
.tm-cart-footer {
    display: flex;
    margin-top: 24px;
}
.tm-cart-footer__form {
    flex-grow: 1;
    display: flex;
}
.tm-cart-footer__form input {
    max-width: 320px;
}
.tm-cart-footer__form > * + * {
    margin-left: 8px;
}
.tm-cart-footer__actions {
    display: flex;
    margin-left: 64px;
}
.tm-cart-footer__actions > * {
    margin-left: 8px;
}

@media (min-width: 1200px) {
    .tm-cart-footer {
        margin-top: 32px;
    }
}
@media (max-width: 767.98px) {
    .tm-cart-footer {
        flex-direction: column;
    }
    .tm-cart-footer__form {
        order: 1;
        border-top: 1px solid rgba(0, 0, 0, .15);
        padding-top: 24px;
        margin-top: 24px;
    }
    .tm-cart-footer__actions {
        margin-left: auto;
    }
}
@media (max-width: 767.98px) {
    .tm-cart-footer__form input {
        max-width: none;
    }
}
