// ---------------------------------------------------------------------------
// Cart
//
// Two columns on desktop: the line items on the left, the totals and the
// inquiry form stacked on the right. Everything sits on soft cards built from
// the brown/rose palette so the page reads as one piece with the shop.
// ---------------------------------------------------------------------------

$cart-line: rgba($brown, 0.18);
$cart-line-soft: rgba($brown, 0.1);
$cart-muted: rgba($brown, 0.65);
$cart-radius: 14px;

.ant-woo-content {
    margin-bottom: 60px;
    padding: 0 20px;
}

// Empty cart -----------------------------------------------------------------

.woocommerce {
    .wc-empty-cart-message {
        margin: 0 20px 30px;
        width: auto;
        text-align: center;

        .cart-empty {
            font-family: $raleway;
            font-weight: 500;
            font-size: 22px;
            line-height: 32px;
            color: $brown;
            margin: 0;
        }
    }

    .return-to-shop {
        margin: 0 20px 50px;
        text-align: center;

        .button {
            display: inline-block;
            width: fit-content;
            padding: 14px 40px;
            border-radius: 100px;
            border: 1px solid $brown;
            background: transparent;
            color: $brown;
            font-family: $raleway;
            font-size: 16px;
            font-style: normal;
            font-weight: 600;
            line-height: 24px;
            text-decoration: none;
            transition: all 0.35s ease;

            &:hover {
                background: $brown;
                color: $white;
            }
        }
    }
}

// Line items -----------------------------------------------------------------

#ant-cart-form {
    .shop_table {
        display: block;
        width: 100%;
        border: 1px solid $cart-line !important;
        border-radius: $cart-radius !important;
        border-collapse: separate !important;
        border-spacing: 0;
        overflow: hidden;
        background: $white;
        margin-bottom: 0;

        thead,
        tbody {
            display: block;
            width: 100%;
        }

        // Column headings only make sense once the rows are laid out as
        // columns, which happens at 992px and up.
        thead {
            display: none;
            background: $rose;

            th {
                background: $rose;
                font-family: $raleway;
                font-weight: 600;
                font-size: 12px;
                line-height: 16px;
                letter-spacing: 1px;
                text-transform: uppercase;
                color: $brown;
                text-align: left;
                padding: 16px 12px;
                border: 0;
                white-space: nowrap;
            }
        }

        tr {
            td {
                font-family: $raleway;
                font-weight: 400;
                font-size: 16px;
                line-height: 24px;
                color: $brown;
                background-color: transparent !important;
                border-top: 0 !important;
                border-bottom: 1px solid $cart-line-soft;
                padding: 18px 12px;
                vertical-align: middle;
            }

            &:last-child td {
                border-bottom: 0;
            }
        }

        .cart_item {
            transition: background-color 0.3s ease;

            &:hover {
                background-color: rgba($rose, 0.45);
            }
        }

        // Remove: the template prints a bare "X", so swap in a proper glyph
        // and give it a target big enough to hit.
        .product-remove {
            .remove {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 30px;
                height: 30px;
                border-radius: 50%;
                border: 1px solid $cart-line;
                color: $brown !important;
                background: transparent !important;
                position: relative;
                flex-shrink: 0;
                font-size: 0;
                text-decoration: none;
                transition: all 0.3s ease;

                &::before,
                &::after {
                    content: "";
                    position: absolute;
                    top: 50%;
                    left: 50%;
                    width: 12px;
                    height: 1px;
                    background: currentColor;
                }

                &::before {
                    transform: translate(-50%, -50%) rotate(45deg);
                }

                &::after {
                    transform: translate(-50%, -50%) rotate(-45deg);
                }

                &:hover {
                    background: $brown !important;
                    border-color: $brown;
                    color: $white !important;
                    transform: rotate(90deg);
                }
            }
        }

        .product-thumbnail {
            img {
                display: block;
                width: 78px;
                height: 78px;
                max-width: none;
                object-fit: cover;
                border-radius: 10px;
                border: 1px solid $cart-line-soft;
            }
        }

        .product-name {
            a {
                font-family: $raleway;
                font-weight: 500;
                color: $brown;
                text-decoration: none;
                border-bottom: 1px solid transparent;
                transition: border-color 0.3s ease;

                &:hover {
                    border-bottom-color: $brown;
                }
            }

            .variation {
                margin: 6px 0 0;
                font-size: 13px;
                line-height: 20px;
                color: $cart-muted;

                dt,
                dd {
                    margin: 0;
                }
            }
        }

        .product-subtotal {
            font-weight: 600;
        }

        .quantity {
            display: inline-block;

            input.qty {
                width: 68px;
                height: 42px;
                border: 1px solid $cart-line;
                border-radius: 8px;
                background: $white;
                font-family: $raleway;
                font-size: 16px;
                color: $brown;
                text-align: center;
                padding: 0 4px;
                transition: border-color 0.3s ease, box-shadow 0.3s ease;

                &:focus {
                    outline: 0;
                    border-color: $brown;
                    box-shadow: 0 0 0 3px rgba($brown, 0.12);
                }

                &::-webkit-outer-spin-button,
                &::-webkit-inner-spin-button {
                    -webkit-appearance: none;
                    margin: 0;
                }

                &[type="number"] {
                    -moz-appearance: textfield;
                }
            }
        }

        // Coupon + update cart
        .actions {
            background: rgba($rose, 0.4) !important;
            padding: 20px 16px;
        }

        .coupon {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 12px;
        }

        #coupon_code {
            flex: 1 1 auto;
            min-width: 0;
            height: 44px;
            border: 1px solid $cart-line;
            border-radius: 100px;
            background: $white;
            font-family: $raleway;
            font-size: 15px;
            color: $brown;
            margin-bottom: 0;
            padding: 0 20px;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;

            &::placeholder {
                color: $cart-muted;
            }

            &:focus {
                outline: 0;
                border-color: $brown;
                box-shadow: 0 0 0 3px rgba($brown, 0.12);
            }
        }

        .button {
            font-family: $raleway;
            font-weight: 600;
            font-size: 15px;
            line-height: 44px;
            letter-spacing: 0.3px;
            color: $white;
            text-decoration: none;
            text-align: center;
            height: 44px;
            border: 1px solid $brown;
            border-radius: 100px;
            background-color: $brown;
            padding: 0 32px !important;
            display: block;
            width: 100%;
            margin: 0;
            cursor: pointer;
            transition: all 0.35s ease;

            &:hover {
                background-color: transparent;
                color: $brown;
            }

            &[disabled],
            &:disabled {
                opacity: 0.4;
                cursor: not-allowed;

                &:hover {
                    background-color: $brown;
                    color: $white;
                }
            }
        }

        // The coupon button sits inside the pill group, so it hugs its label.
        .coupon .button {
            width: auto;
            flex: 0 0 auto;
        }

        [name="update_cart"] {
            background-color: transparent;
            color: $brown;

            &:hover {
                background-color: $brown;
                color: $white;
            }
        }
    }

    .cart-delivery-notice {
        margin-top: 20px;
        margin-bottom: 20px;

        p {
            background-color: $brown;
            border-radius: 10px;
            font-family: $raleway;
            font-weight: 400;
            font-size: 16px;
            line-height: 24px;
            color: $white;
            text-align: center;
            margin: 0;
            padding: 14px 20px;
        }
    }
}

// Totals + inquiry form ------------------------------------------------------

#ant-cart-collaterals {
    .cart_totals {
        background: $rose;
        border: 1px solid $cart-line;
        border-radius: $cart-radius;
        padding: 28px 24px;
        margin-top: 30px;

        h2 {
            font-family: $raleway;
            font-weight: 600;
            font-size: 22px;
            line-height: 30px;
            letter-spacing: 0.4px;
            color: $brown;
            text-align: center;
            margin: 0 0 18px;
            padding-bottom: 14px;
            border-bottom: 1px solid $cart-line;
        }

        .shop_table {
            width: 100%;
            border: 0 !important;
            border-radius: 0 !important;
            margin-bottom: 0;
            background: transparent;

            th,
            td {
                font-family: $raleway;
                font-size: 16px;
                line-height: 24px;
                color: $brown;
                background: transparent !important;
                border: 0 !important;
                padding: 10px 0;
            }

            th {
                font-weight: 400;
                text-align: left;
                color: $cart-muted;
            }

            td::before {
                float: left;
                font-weight: 400;
                color: $cart-muted;
            }

            td {
                font-weight: 500;
                text-align: right;
            }

            .order-total {
                th,
                td {
                    font-size: 20px;
                    font-weight: 600;
                    color: $brown;
                    padding-top: 16px;
                    border-top: 1px solid $cart-line !important;
                }
            }
        }

        // The checkout button is removed via remove_action, so the wrapper is
        // usually empty - don't leave a gap where it used to be.
        .wc-proceed-to-checkout {
            padding: 0;

            &:empty {
                display: none;
            }

            .checkout-button {
                width: 100%;
                font-family: $raleway;
                font-weight: 600;
                font-size: 15px;
                line-height: 48px;
                color: $white;
                text-decoration: none;
                text-align: center;
                height: 48px;
                border: 1px solid $brown;
                border-radius: 100px;
                background-color: $brown !important;
                padding: 0 !important;
                display: block;
                margin: 20px 0 0;
                transition: all 0.35s ease;

                &:hover {
                    background-color: transparent !important;
                    color: $brown;
                }
            }
        }
    }
}

#ant-cart-collaterals .cart-inquiry-form {
    margin-top: 30px;
    padding: 28px 24px;
    border: 1px solid $cart-line;
    border-radius: $cart-radius;
    background: $white;

    h2 {
        font-family: $raleway;
        font-weight: 600;
        font-size: 22px;
        line-height: 30px;
        letter-spacing: 0.4px;
        color: $brown;
        text-align: center;
        margin: 0 0 18px;
        padding-bottom: 14px;
        border-bottom: 1px solid $cart-line;
    }

    form {
        display: flex;
        flex-wrap: wrap;
        gap: 14px;
    }

    .form-row {
        width: 100%;

        &.half {
            width: calc(50% - 7px);
        }
    }

    input,
    textarea {
        width: 100%;
        border: 1px solid $cart-line;
        border-radius: 8px;
        background: $white;
        padding: 14px 16px;
        font-family: $raleway;
        font-size: 15px;
        line-height: 22px;
        color: $brown;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
        outline: none;

        &::placeholder {
            color: $cart-muted;
        }

        &:focus {
            border-color: $brown;
            box-shadow: 0 0 0 3px rgba($brown, 0.12);
        }
    }

    textarea {
        height: 120px;
        resize: none;
    }

    button {
        width: 100%;
        height: 48px;
        border: 1px solid $brown;
        border-radius: 100px;
        background: $brown;
        color: $white;
        font-family: $raleway;
        font-weight: 600;
        font-size: 15px;
        letter-spacing: 0.3px;
        cursor: pointer;
        transition: all 0.35s ease;

        &:hover {
            background: transparent;
            color: $brown;
        }
    }
}

// Notices --------------------------------------------------------------------

.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    font-family: $raleway;
    margin-bottom: 30px !important;
    border-top: 0 !important;
    border-left: 3px solid $brown !important;
    border-radius: 10px !important;
    background: $rose !important;
    color: $brown !important;

    &::before {
        color: $brown !important;
    }

    .button {
        border-radius: 100px !important;
        background: $brown !important;
        color: $white !important;
    }
}

// Stacked cards on phones ----------------------------------------------------

@media only screen and (max-width: 991px) {
    #ant-cart-form {
        .shop_table {
            border: 0 !important;
            border-radius: 0 !important;
            overflow: visible;
            background: transparent;

            .cart_item {
                display: block;
                position: relative;
                border: 1px solid $cart-line;
                border-radius: $cart-radius;
                background: $white;
                padding: 16px 16px 16px 106px;
                margin-bottom: 16px;
                min-height: 110px;

                &:hover {
                    background-color: $white;
                }

                td {
                    display: block;
                    width: auto !important;
                    border-bottom: 0;
                    padding: 4px 0;
                    text-align: right !important;

                    &::before {
                        content: attr(data-title);
                        float: left;
                        font-weight: 500;
                        color: $cart-muted;
                    }
                }

                // Pull the thumbnail out of the stack and into the padded
                // gutter the row reserves on the left.
                td.product-thumbnail {
                    position: absolute;
                    top: 16px;
                    left: 16px;
                    padding: 0 !important;

                    &::before {
                        content: none !important;
                    }

                    img {
                        width: 74px;
                        height: 74px;
                    }
                }

                td.product-remove {
                    position: absolute;
                    top: 12px;
                    right: 12px;
                    padding: 0 !important;

                    &::before {
                        content: none !important;
                    }
                }

                td.product-name {
                    text-align: left !important;
                    padding-right: 34px !important;
                    margin-bottom: 6px;

                    &::before {
                        content: none !important;
                    }

                    a {
                        font-size: 17px;
                    }
                }
            }

            .actions {
                display: block;
                border: 1px solid $cart-line;
                border-radius: $cart-radius;
                background: rgba($rose, 0.6);
                padding: 18px 16px;
            }

            .coupon {
                margin-bottom: 12px;
            }

            #coupon_code {
                flex: 1 1 100%;
            }

            .coupon .button {
                width: 100%;
            }
        }
    }

    #ant-cart-collaterals .cart-inquiry-form {
        padding: 22px 18px;

        h2 {
            font-size: 20px;
        }
    }

    #ant-cart-collaterals .cart_totals {
        padding: 22px 18px;
    }
}

@media only screen and (min-width: 768px) {}

// Real table columns ---------------------------------------------------------

@media only screen and (min-width: 992px) {
    #ant-cart-form {
        .shop_table {
            thead {
                display: block !important;
            }

            thead tr,
            tbody tr {
                display: flex;
                align-items: stretch;
            }

            thead th,
            tbody td {
                display: flex !important;
                align-items: center;
                flex-shrink: 0;

                &::before {
                    content: none !important;
                }

                &.product-remove {
                    width: 5%;
                }

                &.product-thumbnail {
                    width: 12%;
                }

                &.product-name {
                    width: 28%;
                    text-align: left !important;
                }

                &.product-price {
                    width: 17%;
                    text-align: left !important;
                }

                &.product-quantity {
                    width: 18%;
                    text-align: left !important;
                }

                &.product-subtotal {
                    width: 20%;
                    text-align: left !important;
                }
            }

            .actions {
                display: flex !important;
                flex-wrap: wrap;
                align-items: center;
                justify-content: flex-end;
                gap: 16px;
                flex: 1 1 100%;
                width: 100%;
            }

            .coupon {
                flex: 1 1 auto;
                max-width: 420px;
                margin-right: auto;
                margin-bottom: 0;
            }

            [name="update_cart"] {
                width: auto;
                flex: 0 0 auto;
            }
        }

        .total-wrapper {
            width: 100%;
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;

            .cart-collaterals {
                width: 40%;
            }
        }

        .cart-delivery-notice {
            width: 100%;
            display: flex;
            justify-content: flex-end;

            p {
                width: 40%;
            }
        }
    }
}

// Viewport scaling on large screens ------------------------------------------

@media only screen and (min-width: 1200px) {

    .woocommerce {
        .wc-empty-cart-message {
            margin: 0 get-vw(160px) get-vw(30px);

            .cart-empty {
                font-size: get-vw(24px);
                line-height: get-vw(34px);
            }
        }

        .return-to-shop {
            margin: 0 get-vw(160px) get-vw(50px);

            .button {
                padding: get-vw(14px) get-vw(40px);
                border-radius: get-vw(100px);
                font-size: get-vw(16px);
                line-height: get-vw(24px);
            }
        }
    }

    .ant-woo-content {
        margin-bottom: get-vw(100px);
        padding: 0 get-vw(120px) 0;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: flex-start;
    }

    .woocommerce-notices-wrapper {
        width: 100%;
    }

    .wc-empty-cart-message {
        width: 100%;
    }

    #ant-cart-form {
        width: calc(70% - #{get-vw(20px)});

        .shop_table {
            border: get-vw(1px) solid $cart-line !important;
            border-radius: get-vw(14px) !important;

            thead th {
                font-size: get-vw(15px);
                line-height: get-vw(20px);
                letter-spacing: get-vw(1px);
                padding: get-vw(18px) get-vw(14px);
            }

            tr td {
                font-size: get-vw(18px);
                line-height: get-vw(30px);
                padding: get-vw(20px) get-vw(14px);
                border-bottom: get-vw(1px) solid $cart-line-soft;
            }

            .product-remove .remove {
                width: get-vw(34px);
                height: get-vw(34px);

                &::before,
                &::after {
                    width: get-vw(14px);
                    height: get-vw(1px);
                }
            }

            .product-thumbnail img {
                width: get-vw(100px);
                height: get-vw(100px);
                border-radius: get-vw(10px);
            }

            .product-name .variation {
                font-size: get-vw(14px);
                line-height: get-vw(22px);
            }

            .quantity input.qty {
                width: get-vw(80px);
                height: get-vw(48px);
                border-radius: get-vw(8px);
                font-size: get-vw(17px);
            }

            .actions {
                padding: get-vw(24px) get-vw(20px);
                gap: get-vw(16px);
            }

            .coupon {
                gap: get-vw(10px);
                max-width: get-vw(460px);
            }

            #coupon_code {
                height: get-vw(48px);
                border: get-vw(1px) solid $cart-line;
                border-radius: get-vw(100px);
                font-size: get-vw(16px);
                padding: 0 get-vw(22px);
            }

            .button {
                font-size: get-vw(16px);
                line-height: get-vw(48px);
                height: get-vw(48px);
                border-radius: get-vw(100px);
                padding: 0 get-vw(36px) !important;
            }
        }

        .cart-delivery-notice {
            margin-bottom: get-vw(20px);

            p {
                width: 100%;
                font-size: get-vw(16px);
                line-height: get-vw(24px);
                padding: get-vw(14px) get-vw(20px);
                border-radius: get-vw(10px);
            }
        }
    }

    #ant-cart-collaterals {
        width: calc(30% - #{get-vw(20px)});

        .cart_totals {
            width: 100%;
            border-radius: get-vw(14px);
            padding: get-vw(32px) get-vw(28px);
            margin-top: 0;

            h2 {
                font-size: get-vw(28px);
                line-height: get-vw(36px);
                margin-bottom: get-vw(20px);
                padding-bottom: get-vw(16px);
            }

            .shop_table {

                th,
                td {
                    font-size: get-vw(17px);
                    line-height: get-vw(26px);
                    padding: get-vw(10px) 0;
                }

                .order-total {

                    th,
                    td {
                        font-size: get-vw(22px);
                        padding-top: get-vw(18px);
                    }
                }
            }

            .wc-proceed-to-checkout .checkout-button {
                font-size: get-vw(16px);
                line-height: get-vw(52px);
                height: get-vw(52px);
                border-radius: get-vw(100px);
                margin-top: get-vw(20px);
            }
        }
    }

    #ant-cart-collaterals .cart-inquiry-form {
        margin-top: get-vw(30px);
        padding: get-vw(32px) get-vw(28px);
        border-radius: get-vw(14px);

        h2 {
            font-size: get-vw(28px);
            line-height: get-vw(36px);
            margin-bottom: get-vw(20px);
            padding-bottom: get-vw(16px);
        }

        form {
            gap: get-vw(14px);
        }

        input,
        textarea {
            border-radius: get-vw(8px);
            padding: get-vw(15px) get-vw(18px);
            font-size: get-vw(16px);
            line-height: get-vw(24px);
        }

        textarea {
            height: get-vw(130px);
        }

        button {
            height: get-vw(52px);
            border-radius: get-vw(100px);
            font-size: get-vw(16px);
        }
    }
}
