$go-cart-modal-width: 420px !default;
$go-cart-modal-height: 220px !default;
$go-cart-modal-bg: #ffffff !default;
$go-cart-drawer-width: 480px !default;
$go-cart-drawer-header-height: 60px !default;
$go-cart-drawer-footer-height: 170px !default;
$go-cart-drawer-subtotal-height: 50px !default;
$go-cart-drawer-bg: #ffffff !default;
$go-cart-mini-cart-width: 480px !default;
$go-cart-mini-cart-height: 480px !default;
$go-cart-mini-cart-footer-height: 100px !default;
$go-cart-mini-cart-subtotal-height: 50px !default;
$go-cart-mini-cart-bg: #ffffff !default;
$go-cart-overlay-bg: rgba(0, 0, 0, 0.4) !default;
$go-cart-transition: all .3s ease-in-out !default;
$go-cart-item-border: #f5f5f5 !default;
$go-cart-quantity-number-color: #000000 !default;
$go-cart-quantity-button-border: #f5f5f5 !default;
$go-cart-z-index-base: 0 !default;

.go-cart {

    &__modal {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: $go-cart-z-index-base + 50;
        display: flex;
        align-items: center;
        width: 100%;
        max-width: $go-cart-modal-width;
        height: $go-cart-modal-height;
        background-color: $go-cart-modal-bg;
        transition: $go-cart-transition;
        opacity: 0;
        visibility: hidden;
        backface-visibility: hidden;

        &.is-open {
            opacity: 1;
            visibility: visible;
        }

    }

    &__overlay {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: $go-cart-z-index-base + 30;
        background-color: $go-cart-overlay-bg;
        transition: $go-cart-transition;
        opacity: 0;
        visibility: hidden;
        backface-visibility: hidden;

        &.is-open {
            opacity: 1;
            visibility: visible;
        }

    }

    &__drawer {
        position: fixed;
        top: 0;
        right: -#{$go-cart-drawer-width};
        z-index: $go-cart-z-index-base + 40;
        width: 100%;
        max-width: $go-cart-drawer-width;
        height: 100%;
        background-color: $go-cart-drawer-bg;
        transition: $go-cart-transition;
        backface-visibility: hidden;

        &.is-open {
            transform: translateX(-#{$go-cart-drawer-width});
        }

        &--left {
            right: auto;
            left: -#{$go-cart-drawer-width};

            &.is-open {
                transform: translateX($go-cart-drawer-width);
            }

        }

    }

    &__mini-cart {
        position: absolute;
        top: 100%;
        left: 0;
        z-index: $go-cart-z-index-base + 40;
        width: $go-cart-mini-cart-width;
        height: $go-cart-mini-cart-height;
        background-color: $go-cart-mini-cart-bg;
        transition: all .3s ease-in-out;
        opacity: 0;
        visibility: hidden;
        cursor: auto;
        backface-visibility: hidden;

        &.is-open {
            opacity: 1;
            visibility: visible;
        }

    }

    &__empty {
        text-align: center;
        padding: 40px 0;
    }

    &__trigger {
        position: relative;
        cursor: pointer;
    }

    &__button {
        background: black;
        color: white;
        padding: 20px 10px;
        text-align: center;
        cursor: pointer;
    }

}

.go-cart-modal {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    &__close {
        position: absolute;
        z-index: $go-cart-z-index-base + 10;
        right: 20px;
        top: 20px;
        line-height: 0;
        cursor: pointer;
    }

    &__content {
        width: 100%;
        padding: 20px;
        text-align: center;
    }

    &__buttons {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px 20px;
    }

}

.go-cart-drawer {
    position: relative;
    height: 100%;

    &__header {
        width: 100%;
        height: $go-cart-drawer-header-height;
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding: 0 30px;
    }

    &__close {
        cursor: pointer;
        line-height: 0;
    }

    &__content {
        height: calc(100% - #{$go-cart-drawer-footer-height} - #{$go-cart-drawer-header-height} - #{$go-cart-drawer-subtotal-height});
        overflow: hidden;
        overflow-y: scroll;
        padding: 0 30px;
    }

    &__subtotal {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: $go-cart-drawer-subtotal-height;
        padding: 0 30px;
        transition: $go-cart-transition;
    }

    &__footer {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;
        height: $go-cart-drawer-footer-height;
        padding: 20px 30px;
        transition: $go-cart-transition;
    }

}

.go-cart-mini-cart {
    position: relative;

    &__content {
        position: relative;
        height: calc(#{$go-cart-mini-cart-height} - #{$go-cart-mini-cart-footer-height} - #{$go-cart-mini-cart-subtotal-height});
        overflow: hidden;
        overflow-y: scroll;
        padding: 0 30px;
    }

    &__subtotal {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        height: $go-cart-mini-cart-subtotal-height;
        padding: 0 30px;
        transition: $go-cart-transition;
    }

    &__footer {
        display: flex;
        justify-content: space-between;
        width: 100%;
        height: $go-cart-mini-cart-footer-height;
        text-align: center;
        padding: 20px 30px;
        transition: $go-cart-transition;
    }

}

.go-cart-item {

    &__single {
        position: relative;
        transition: $go-cart-transition;
        padding: 15px 0;
        border-bottom: 1px solid $go-cart-item-border;
    }

    &__info-wrapper {
        position: relative;
        display: flex;
    }

    &__info {
        max-width: 250px;
        line-height: 1.18;
        padding: 10px 10px 10px 30px;
    }

    &__image {
        width: 90px;
        height: 110px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

    &__title {
        vertical-align: top;
    }

    &__variant {
        position: relative;
        top: 5px;
    }

    &__quantity {
        position: absolute;
        bottom: 10px;
        display: flex;
        align-items: center;
    }

    &__quantity-label {
        margin-right: 5px;
    }

    &__quantity-number {
        width: 30px;
        height: 24px;
        margin: 0;
        text-align: center;
        font-size: 1rem;
        color: $go-cart-quantity-number-color;
        border: none;
        outline: none;
        -moz-appearance: textfield;

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

    }

    &__quantity-button {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid $go-cart-quantity-button-border;
        font-size: 1rem;
        padding: 0 5px;
        margin: 0 2px;
        cursor: pointer;
        user-select: none;
    }

    &__price {
        position: absolute;
        bottom: 25px;
        right: 0;
    }

    &__remove {
        position: absolute;
        right: 0;
        top: 25px;
        cursor: pointer;
    }

}


.go-cart-modal-item {
    position: relative;
    display: flex;

    &__info {
        max-width: 250px;
        padding: 10px 10px 10px 30px;
        line-height: 1.18;
    }

    &__image {
        width: 90px;
        height: 110px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }

}

.is-invisible {
    opacity: 0;
    visibility: hidden;
}
