/* -------------------------------------------
    Popup
        - Popup
        - Popup Close
        - Popup Content
        - Popup Login
        - Popup Newsletter
        - Popup Video
        - Popup Zoom, Flip effect
        - Popup Product
        - Popup Product Quickview Zoom
---------------------------------------------- */
// issue: not optimized newsletter, (newsletter,login,quickview)

// Popup
.mfp-wrap,
.mfp-bg {
    z-index: 10000;
}

.mfp-bg {
    background: #000;
    opacity: 0;
    transition: opacity .3s ease-out;

    &.mfp-ready {
        opacity: .7;
    }
}

.mfp-container {
    padding: 4rem 20px;
}

.mfp-preloader {
    margin-top: 0;
}

.mfp-counter:not(:empty) {
    background: rgba(0, 0, 0, .3);
    padding: 3px 10px;
    color: var(--alpha-change-color-light-1);
}

.mfp-bottom-bar {
    .mfp-title {
        padding-#{$left}: 1em;
    }

    .mfp-counter {
        #{$right}: 1em;
    }
}

// Popup Close
.mfp-fade.mfp-bg.mfp-ready {
    opacity: 0.4
}

.mfp-bg.mfp-removing,
.mfp-bg.mfp-removing.mfp-fade {
    opacity: 0;
}

// .mfp-product .product {
//     box-shadow: 0 10px 20px 5px rgba(0,0,0,0.2);
// }
.mfp-ready .product.skeleton-body {
    box-shadow: none;
}

.mfp-close {
    transform: rotateZ(45deg);
    transition: transform .3s;
    opacity: 1;
    width: 18px;
    height: 18px;
    text-indent: if-ltr(-9999px, 9999px);

    .mfp-wrap & {
        top: 20px;
        #{$right}: 20px;
    }

    .mfp-content & {
        top: -25px;
        #{$right}: 0;
    }

    .mfp-image-holder &,
    .mfp-iframe-holder & {
        top: 15px;
        #{$right}: 0;
    }

    // .mfp-removing &, // issue
    span {
        display: none;
    }

    &::before,
    &::after {
        content: '';
        display: block;
        position: absolute;
        background: #fff;
        width: 2px;
        height: 100%;
        top: 0;
        left: calc(50% - 1px);
    }

    &::before {
        width: 100%;
        height: 2px;
        top: calc(50% - 1px);
        left: 0;
    }

    &:hover,
    &:focus {
        transform: rotateZ(135deg) scale(1.5);
        cursor: pointer !important;
    }
}

// Popup Content

.mfp-content>* {
    position: relative;
    margin: auto;
    background: var(--alpha-change-color-light-1);
    box-shadow: 5px 5px 20px rgba(0, 0, 0, .1);
    opacity: 0;

    .mfp-ready & {
        opacity: 1;
    }

    .mfp-removing & {
        opacity: 0;
    }
}

.mfp-with-zoom .mfp-container,
.mfp-with-zoom.mfp-bg {
    opacity: 0;
    -webkit-backface-visibility: hidden;
    transition: all 0.3s ease-out;
}

.mfp-with-zoom.mfp-ready .mfp-container {
    opacity: 1;
}

.mfp-with-zoom.mfp-ready.mfp-bg {
    opacity: 0.8;
}

.mfp-with-zoom.mfp-removing .mfp-container,
.mfp-with-zoom.mfp-removing.mfp-bg {
    opacity: 0;
}

.mfp-title {
    padding-#{$left}: 26px;
}

// Popup - Login
.login-popup {
    max-width: 50rem;
    margin: 0 auto 0;
    padding: 3.5rem 5rem 4.5rem;

    .tab {
        overflow: hidden;
    }

    .nav-tabs .nav-item {
        margin: 1rem 1rem 0;

        .nav-link {
            padding: 0 0 1px;
            color: rgba(35, 36, 37, 0.5);
            font-size: 1.6rem;
            font-weight: 700;
            line-height: 2.43;
        }
    }


    input[type="text"],
    input[type="password"],
    input[type="email"] {
        padding: .95rem 2rem;
    }

    .login {
        display: block;
    }

    .nav {
        border-bottom: 1px solid var(--alpha-change-border-color);

        &.nav-tabs {
            margin: -1rem -1rem 0 -1rem;
        }
    }

    .tab .nav>li {
        margin-bottom: -1px;

        &.show>a,
        >.active {
            color: var(--alpha-change-color-dark-1);
            border-color: var(--alpha-primary-color);
        }
    }

    .tab-content .tab-pane {
        padding-top: 1.8rem;
        padding-bottom: 0;
    }

    form {
        font-size: 1.3rem;
        margin-bottom: 2.3rem;
    }

    .woocommerce-form-login p {
        font-size: inherit;
        line-height: 1.84;
    }

    .social-login p {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .social-icons {
        margin: 0;
    }

    .social-icon {
        font-size: 1.8rem;
        width: auto;
        height: auto;
        margin: 4px 15px;
    }

    .d-loading:before {
        background: transparent;
    }
}

@include mq(md, max) {
    .login-popup {
        padding: 3.5rem 20px;
    }
}

.mfp-login .mfp-preloader {
    max-width: 50rem;
    transform: translateY(-50%);
    width: calc(100% - 42px);
    margin-left: auto;
    margin-right: auto;
}

.login-popup .d-loading {
    background: transparent;
}

.mfp-login.offcanvas-type {
    .mfp-container {
        padding: 0;
        animation: 0.4s ease-out slideInRight;
    }

    .mfp-content {
        height: 100%;
    }

    .mfp-preloader {
        overflow: hidden;
        width: 40rem;
        transform: none;
        height: 100%;
        top: 0;
        #{$right}: 0;
        margin: 0;
        #{$left}: auto;
    }

    .login-popup {
        position: relative;
        width: 37rem;
        height: 100%;
        margin: side-values(0 0 0 auto);
        padding-left: 3rem;
        padding-right: 3rem;
        background: #fff;
        overflow: hidden auto;
    }
}

@include mq(sm, max) {
    .mfp-login.offcanvas-type .login-popup {
        width: 29.5rem;
        padding: 2rem;
    }
}

// Popup - Newsletter
.mfp-alpha {
    .mfp-content {
        width: 100%;
        display: inline-flex;
    }

    .mfp-container {
        animation-duration: .55s;
        animation-fill-mode: none;
        padding: 0;
    }

    .popup {
        max-width: 90%;
        position: relative;
        margin: 0;
        background: transparent;
    }

    .alpha-popup-content {
        display: flex;
        background-color: var(--alpha-change-color-light-1);
        overflow: hidden;
        height: 100%;

        >* {
            flex: 0 0 100%;
            max-width: 100%;
        }
    }
}

.mfp-popup-template .mfp-preloader {
    max-width: 60rem;
    transform: translateY(-50%);
    margin-left: auto;
    margin-right: auto;
    height: 40rem;
    background: var(--alpha-change-color-light-1);
    transition: max-width .3s;
}

// Popup - Video
.mfp-video-popup {
    .mfp-content {
        max-width: 1000px;
    }

    video {
        width: 100%;
    }
}

// Popup Zoom, Flip effect: issue: used?

// .mfp-ready.mfp-zoom-popup .mfp-content{
//     transform: scale(1); 
// }
// .mfp-zoom-popup .mfp-content, .mfp-removing.mfp-zoom-popup .mfp-content {
//     transition: .2s ease-in-out; 
//     transform: scale(0.8); 
// }
// .mfp-ready.mfp-flip-popup .mfp-content {
//     transform: translateY(0) perspective( 600px ) rotateX( 0 ); 
// }
// .mfp-flip-popup .mfp-content, .mfp-removing.mfp-flip-popup .mfp-content {
//     transition: .3s ease-out;
//     transform: translateY(-20px) perspective( 600px ) rotateX( 20deg );
// }

.mfp-figure {
    line-height: normal;
}

// Responsive

// Popup - Product
@if use(quickview) {
    .mfp-ready+.mfp-product .product {
        opacity: 1;
    }

    .mfp-product {
        z-index: 2999;

        &.mfp-zoom {
            cursor: pointer;
        }

        .mfp-container {
            padding: 4rem 3rem 2rem;
        }

        .mfp-content {
            padding: 0;
        }

        .mfp-content,
        .mfp-preloader {
            max-width: 90rem;
            width: 100%;
            margin: auto;
        }

        .mfp-preloader {
            transform: translateY(-50%);
            width: calc(100% - 6rem);
        }

        div.woocommerce-product-gallery {
            margin-bottom: 0;
        }

        .product-quickview {
            --alpha-gap: 15px;
        }

        .product {
            opacity: 0;
            transition: opacity .3s;
            background: var(--alpha-change-color-light-1);
            padding: 1.5rem;
            min-height: 40rem;
            margin-bottom: 3rem;

            &.row {
                width: 100%;
                margin-left: 0;
                margin-right: 0;
            }

            >.col-md-6 {
                padding-left: 15px;
                padding-right: 15px;
            }
        }

        .product_title {
            margin-top: 1rem;
            margin-bottom: 1.2rem;
        }

        .woocommerce-product-details__short-description p {
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            margin-bottom: 1.3rem;
        }

        .price {
            margin: 1.9rem 0;
        }

        .cart label {
            min-width: 5.5rem;
        }

        .quantity-wrapper {
            .quantity {
                margin-#{$right}: 1rem;
            }
        }

        .product-single div.summary {
            padding-left: 0;
        }

        .mfp-close {
            position: absolute;
            top: -2.7rem;
            #{$right}: 0;
        }

        .single_variation_wrap .price {
            margin: 0;
        }

        @include mq(md) {
            .product-gallery {
                margin-bottom: 0;
            }

            &:not(.mfp-offcanvas) .summary {
                position: absolute;
                width: calc(100% - 30px);
                overflow-y: auto;
                height: calc(100% - 30px);
                max-height: 600px;
            }
        }

        @include mq(md, max) {
            .product {
                padding: 1rem;
            }

            .summary {
                padding: 0;
            }
        }
    }

    .mfp-preloader>.product {
        margin-bottom: 1rem;
    }

    // Zoom Product
    .mfp-zoom {

        .mfp-container,
        &.mfp-bg {
            opacity: 0;
            -webkit-backface-visibility: hidden;
            transition: all 0.3s ease-out;
        }

        &.mfp-ready .mfp-container {
            opacity: 1;
        }

        &.mfp-ready.mfp-bg {
            opacity: 0.4;
        }

        &.mfp-removing .mfp-container,
        &.mfp-removing.mfp-bg {
            opacity: 0;
        }

        .mfp-content {
            transform: translate(25%);
            transition: transform .35s linear;
        }

        &.zoom-start3 .mfp-content {
            transform: none;
        }

        .mfp-figure {
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            clip-path: inset(30px 50% 140px 30px);

            &.vertical {
                clip-path: inset(30px 50% 30px 120px);
            }
        }

        .mfp-content .product {
            opacity: 1;
            height: 100%;
        }

        .d-loading {
            background: none;
        }
    }

    .mfp-figure:after {
        content: none;
    }

    img.mfp-img {
        padding: 0;
    }

    @include mq(lg) {
        .mfp-figure.vertical {
            .col-md-6:first-child {
                overflow: hidden;
            }

            .mfp-img {
                margin-#{$left}: 110px;
                width: calc(100% - 110px);
            }

            .thumbs {
                position: absolute;
                top: 0;
                left: 10px;
                width: 110px;
            }
        }
    }

    .mfp-figure:not(.vertical) .thumbs {
        display: flex;

        >img {
            flex: 0 0 25%;
            max-width: 25%;
        }
    }

    .mfp-animated-image {
        box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.15);
        margin: 5px;
    }

    .product-quickvied-loading {
        &.product {
            padding: 2.5rem 1.5rem;
        }

        img {
            width: 100%;
            border: 5px solid transparent;
        }

        .product {
            padding: 2.5rem;
        }
    }

    .mfp-image-holder .mfp-close {
        width: 18px;
        top: -30px;
        color: transparent;
    }

    // Load Animation
    .mfp-anim {
        .summary>* {
            opacity: 0;
            transform: translateY(30px);
            transition: transform 0.55s cubic-bezier(.2, .75, .5, 1), opacity 0.55s cubic-bezier(.2, .75, .5, 1);
            transition-delay: .35s;
        }

        .summary> :nth-child(1) {
            transition-delay: .05s;
        }

        .summary> :nth-child(2) {
            transition-delay: .1s;
        }

        .summary> :nth-child(3) {
            transition-delay: .15s;
        }

        .summary> :nth-child(4) {
            transition-delay: .2s;
        }

        .summary> :nth-child(5) {
            transition-delay: .25s;
        }

        .summary> :nth-child(6) {
            transition-delay: .3s;
        }

        &.mfp-anim-finish .summary>* {
            opacity: 1;
            transform: none;
        }
    }

    // Off Canvas
    .mfp-offcanvas {
        .mfp-ready+& {
            .mfp-container {
                animation: .4s ease-out if-ltr(slideInRight, slideInLeft);
            }
        }

        .mfp-removing+& {
            .mfp-container {
                animation: .4s ease-in if-ltr(slideOutRight, slideOutLeft);
            }

            .mfp-container .mfp-content,
            .mfp-content>* {
                opacity: 1;
            }
        }

        .mfp-bg {
            transition: .4s;
        }

        .mfp-container {
            padding: 0;
            text-align: $right;
        }

        .mfp-content {
            width: 100%;
            height: 100vh;
            overflow-y: auto;
        }

        .mfp-close {
            position: fixed;
            right: 42rem;
            top: 2rem;
            background: var(--alpha-change-color-light-1);
            border-radius: 50%;
            width: 30px;
            height: 30px;

            &:before,
            &:after {
                background: var(--alpha-body-color);
                transition: transform .3s;
            }

            &:before {
                width: 50%;
                left: 50%;
                transform: translateX(-50%);
            }

            &:after {
                height: 50%;
                top: 50%;
                transform: translateY(-50%);
            }

            &:hover,
            &:focus {
                transform: rotateZ(45deg);

                &:before {
                    transform: translateX(-50%) rotateZ(-45deg);
                }

                &:after {
                    transform: translateY(-50%) rotateZ(45deg);
                }
            }
        }

        // Product Quickview
        div.woocommerce-product-gallery {
            padding: 0;
            margin-bottom: 2rem;
        }

        .product {
            width: 40rem;
            height: 100%;
            padding: 1.5rem;
            margin: side-values(0 0 0 auto);
            overflow-x: hidden;
            overflow-y: auto;
        }

        .mfp-preloader {
            overflow: hidden;
            width: 40rem;
            transform: none;
            height: 100%;
            top: 0;
            right: 0;
            margin: 0;
            left: auto;
        }
    }

    @include mq(sm, max) {
        .mfp-offcanvas {
            .product {
                width: 29.5rem;
            }

            .mfp-close {
                right: 0;
                top: .5rem;
            }
        }
    }
}

.product-video-popup {
    .mfp-content {
        max-width: 83rem;
    }

    video {
        width: 100%;
    }
}

// Off Canvas - For Pages (Cart Compare Wishlist Review Login)
.offcanvas {
    .offcanvas-overlay {
        position: fixed;
        #{$left}: 0;
        width: 100vw;
        top: -10vh;
        height: 120vh;
        background: rgba(0, 0, 0, .3);
        z-index: 9998;
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s, visibility .3s;
    }

    .offcanvas-content {
        padding: 2.9rem 3rem;
        width: 34rem;
        max-width: 95vw;
        position: fixed;
        top: 0;
        #{$right}: 0;
        height: 100%;
        min-width: auto;
        overflow: auto;
        opacity: 1;
        visibility: hidden;
        transition: transform 0.3s, visibility 0.3s;
        transform: translateX(if-ltr(100%, -100%));
        z-index: 9999;
        color: var(--alpha-body-color);
        background-color: var(--alpha-change-color-light-1);

        .btn-close {
            font-weight: 400;
        }
    }

    &.opened .offcanvas-overlay {
        visibility: visible;
        opacity: 1;
    }

    &.opened .offcanvas-content {
        visibility: visible;
        transform: translateX(0);
    }
}