@import "../../../node_modules/bootstrap/scss/_functions"; // required to pull in nested bootstrap grid

// scss-docs-start grid-breakpoints
$grid-breakpoints: (
    xs: 0,
    sm: 576px,
    md: 768px,
    lg: 992px,
    xl: 1200px,
    xxl: 1400px
) !default;

@import "~bootstrap/scss/mixins/breakpoints";
@import "components/buttons";

.cfw-side-cart-open-trigger {
    cursor: pointer;
}

body.admin-bar {
    #cfw-side-cart {
        top: 32px;
        height: calc(100vh - 32px);

        @include media-breakpoint-down(lg) {
            top: 0;
            height: 100vh;
        }
    }
}

#cfw-side-cart-overlay {
    opacity: 0;
    position: fixed;
    background: rgba(0, 0, 0, 0.6);
    left: 0;
    top: 0;
    width: 100%;
    z-index: 999998;
    visibility: hidden;
    height: 100vh;
}

// Requires grid
@import "utility-classes";

#cfw-side-cart {
    font-size: 16px;
    box-sizing: border-box;
    position: fixed;
    width: 100%;
    max-width: 480px;
    height: 100%;
    overflow-x: hidden;
    overflow-y: visible;
    background: var(--cfw-body-background-color) !important;
    font-family: var(--cfw-body-font-family);
    right: -480px;
    top: 0;
    z-index: 999999;
    color: var(--cfw-body-text-color);
    text-rendering: optimizelegibility !important;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: grayscale;
    word-break: normal;
    line-height: 1;
    visibility: hidden;

    .slick-dots button {
        font-size: 8px;

        &:hover {
            background: none;
            color: initial;
            font-size: 8px;
        }
    }

    @import "variables";
    @import "custom-properties";

    @import "components/side-cart/cart-table";

    #cfw-cart .cart-item-row .cfw-cart-item-image {
        padding-top: 0;
    }

    @import "components/cart-summary/cart-item-quantity-control";
    @import "components/order-bump";
    @import "compatibility/woocommerce-subscriptions";
    @import "compatibility/woocommerce-product-bundles";

    #cfw_order_bumps_below_cart_items {
        display: block !important;
    }

    // Bootstrap 5.0 Grid
    @import "grid";

    // Checkbox
    @import "components/form-fields";

    // Alerts
    @import "components/alerts";

    * {
        box-sizing: border-box;
        word-break: normal;
    }

    h1, h2, h3, h4, h5, h6, h7 {
        font-family: var(--cfw-heading-font-family) !important;
    }

    a:not(.cfw-primary-btn):not(.cfw-secondary-btn) {
        color: var(--cfw-body-link-color);
    }

    .cfw-module {
        margin-bottom: 1em;
    }

    #cfw-side-cart-form {
        display: flex;
        flex-direction: column;
        height: 100%;
        padding: 1.5em 0;
        position: relative;
    }

    .cfw-side-cart-contents-header,
    .cfw-side-cart-contents-footer {
        margin-left: 1.5em;
        margin-right: 1.5em;
    }

    .cfw-side-cart-contents-header {
        flex-shrink: 0;
        text-align: center;

        .cfw-side-cart-close-btn {
            position: absolute;
            left: 1.5em;
            top: 1.5em;
            cursor: pointer;

            svg {
                margin-left: -4px;
                width: 40px;
                transition: margin-left 0.3s ease;
            }

            &:hover {
                svg {
                    margin-left: 6px;
                }
            }
        }
    }

    .cfw-side-cart-contents {
        flex-grow: 1;
        overflow-y: auto;

        h2 {
            margin-top: 2em;
            text-align: center;
            font-size: 1.2em;
            font-weight: 600;
        }

        .woocommerce-notices-wrapper {
            margin-top: 1em;

            :before {
                content: '';
            }
        }
    }

    .cfw-side-cart-contents-footer {
        flex-shrink: 0;

        .cfw-side-cart-contents-footer-border-shim {
            padding-top: 1em;
            border-top: 1px solid #d3d4d5;
        }
    }

    table {
        width: 100%;
        border: none;
        table-layout: auto;

        td, th {
            text-transform: none;
            background: var(--cfw-body-background-color) !important;
            border: none;
        }
    }

    .cfw-side-cart-totals table {
        border-collapse: collapse;

        tr {
            td, th {
                padding: 10px 0;
            }
        }

        tr.order-total {
            border-top: 2px solid #000;
        }
    }

    .cart-item-row > * {
        border-bottom: 1px solid rgb(211, 212, 213);
    }

    .cfw-cart-item-image-wrap {
        margin-top: 10px;
    }

    .cfw-side-cart-totals {
        table {
            border-spacing: 0 1em;
            th, td {
                padding: 0;
                text-align: left;
            }

            td {
                text-align: right;
            }
        }
    }

    .cfw-cart-item-subtotal {
        position: relative;
    }

    .cfw-remove-item-button {
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
        opacity: 0;
        position: absolute;
        top: 8px;
        right: 0;
        font-size: 0.9em;
        color: var(--cfw-body-text-color);
        font-weight: bold;
        transition: all 0.3s ease;
    }

    tr:hover .cfw-remove-item-button {
        opacity: 1;
    }

    @include media-breakpoint-down(lg) {
        .cfw-remove-item-button {
            opacity: 1;
        }
    }

    .cfw-primary-btn {
        display: block;
        text-align: center;
        width: 100%;
        text-transform: capitalize;
        line-height: 1.6em;
    }

    .cfw-secondary-btn {
        line-height: normal;
    }

    .wc-proceed-to-checkout > *:not(:last-child) {
        margin-bottom: 0.5em;
    }

    .visually-hidden {
        border: 0;
        clip: rect(0, 0, 0, 0);
        clip: rect(0 0 0 0);
        width: 2px;
        height: 2px;
        margin: -2px;
        overflow: hidden;
        padding: 0;
        position: absolute;
    }

    .blockUI.blockOverlay::before {
        background: none;
    }

    .wc-proceed-to-checkout {
        padding-top: 0;
    }

    .amount {
        color: var(--cfw-body-text-color);
    }

    tr.order-total {
        display: table-row;
    }

    .cfw-side-cart-free-shipping-progress-wrap {
        margin-top: 1em;
    }

    .cfw-side-cart-free-shipping-progress-wrap p {
        margin-bottom: 0.75em;
    }

    .cfw-side-cart-free-shipping-progress {
        background-color: var(--cfw-side-cart-free-shipping-progress-background, #f5f5f5 );
    }

    .cfw-side-cart-free-shipping-progress-indicator {
        background: var(--cfw-side-cart-free-shipping-progress-indicator);
        height: 0.5em;
    }

    .cfw-order-bump-header label {
        align-items: center;
    }

    .blockUI::before {
        content: "";
    }

    .cfw-side-cart-coupon-wrap {
        margin-bottom: 2em;

        .form-row {
            input[type="text"], input[type="tel"], input[type="email"], input[type="password"] {
                font-size: 14px;
            }

            .cfw-secondary-btn {
                font-size: 14px;
            }
        }
    }

    .woocommerce-remove-coupon {
        display: none;
    }

    //#cfw-alert-container {
    //    position: absolute;
    //    left: 0;
    //    right: 0;
    //    top: 0;
    //}

    @include media-breakpoint-down(lg) {
        width: 100%;
    }
}

.cfw-side-cart-quantity-wrap {
    display: inline-flex;
    align-items: center;
    color: var(--cfw-side-cart-icon-text-color, #222);
    position: relative;
    flex-direction: row;
    vertical-align: middle;
    transition: all 0.3s ease;

    svg {
        width: var(--cfw-side-cart-icon-width, 34px);
        color: var(--cfw-side-cart-icon-color, #222);
    }

    svg:not(.cfw-side-cart-icon-solid) {
        fill: none;
    }

    .cfw-side-cart-quantity {
        font-size: 16px;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
        font-weight: 400;
        letter-spacing: 0.3px;
        line-height: 20px;
        padding-left: 0.25em;
    }
}

.cfw-side-cart-floating-button {
    position: fixed;
    bottom: var(--cfw-side-cart-button-bottom-position, 20px);
    right: var(--cfw-side-cart-button-right-position, 20px);
    background: var(--cfw-side-cart-button-background, #fff);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--cfw-side-cart-button-box-shadow, 0 2px 10px rgba(0, 0, 0, 0.372863) );
    cursor: pointer;
    text-rendering: optimizelegibility !important;
    -webkit-font-smoothing: subpixel-antialiased;
    -moz-osx-font-smoothing: grayscale;
    z-index: 999997;
    color: #222;
    text-transform: none;

    &:hover .cfw-side-cart-quantity-wrap {
        opacity: 0.5;
    }
}

body.woocommerce-cart {
    .cfw-side-cart-floating-button {
        display: none;
    }
}

body.cfw-side-cart-open {
    overflow: hidden;

    #cfw-side-cart-overlay {
        animation-name: cfw-side-cart-fade-in;
        animation-duration: 0.4s;
        animation-iteration-count: 1;
        animation-timing-function: ease;
        animation-fill-mode: both;
    }

    #cfw-side-cart {
        right: 0;
        animation-name: cfw-side-cart-slide-in;
        animation-duration: 0.4s;
        animation-iteration-count: 1;
        animation-timing-function: ease;
        animation-fill-mode: both;
    }
}

body.cfw-side-cart-close {
    #cfw-side-cart-overlay {
        visibility: visible;
        animation-name: cfw-side-cart-fade-out;
        animation-duration: 0.4s;
        animation-iteration-count: 1;
        animation-timing-function: ease;
        animation-fill-mode: both;
    }

    #cfw-side-cart {
        right: -480px;
        animation-name: cfw-side-cart-slide-out;
        animation-duration: 0.4s;
        animation-iteration-count: 1;
        animation-timing-function: ease;
        animation-fill-mode: both;
    }
}

html[dir="rtl"] .cfw-side-cart-close-btn svg {
    transform: scaleX(-1);
}


@keyframes cfw-side-cart-fade-in {
    0% {
        visibility: visible;
        opacity: 0;
    }
    100% {
        visibility: visible;
        opacity: 1;
    }
}

@keyframes cfw-side-cart-slide-in {
    0% {
        visibility: visible;
        right: -480px;
    }
    100% {
        visibility: visible;
        right: 0;
    }
}

@keyframes cfw-side-cart-fade-out {
    0% {
        opacity: 1;
    }
    100% {
        visibility: hidden;
        opacity: 0;
    }
}

@keyframes cfw-side-cart-slide-out {
    0% {
        visibility: visible;
        right: 0;
    }
    100% {
        visibility: hidden;
        right: -480px;
    }
}