.kd-popup {
    position: fixed;
    display: flex;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    z-index: 1000;
    -webkit-transition: opacity .5s ease-out;
    -ms-transition: opacity .5s ease-out;
    -moz-transition: opacity .5s ease-out;
    -o-transition: opacity .5s ease-out;
    transition: opacity .5s ease-out;
    opacity: 0;
    visibility: hidden;
    padding: var(--kd-popup-padding, 0);
    background-color: var(--kd-overlay-background, transparent);
}

body.admin-bar .kd-popup.top-left,
body.admin-bar .kd-popup.top,
body.admin-bar .kd-popup.top-right,
body.admin-bar .kd-popup.full-screen {
    top: var(--wp-admin--admin-bar--height, 32px);
    height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px));
}

body:has(.kd-popup.open) {
    overflow: hidden;
}

.kd-popup.top-left {
    justify-content: flex-start;
    align-items: flex-start;
}

.kd-popup.top {
    justify-content: center;
    align-items: flex-start;
}

.kd-popup.top-right {
    justify-content: flex-end;
    align-items: flex-start;
}

.kd-popup.center-left {
    justify-content: flex-start;
    align-items: center;
}

.kd-popup.center {
    justify-content: center;
    align-items: center;
}

.kd-popup.center-right {
    justify-content: flex-end;
    align-items: center;
}

.kd-popup.open {
    opacity: 1;
    visibility: visible;
}

.kd-popup.bottom-left {
    justify-content: flex-start;
    align-items: flex-end;
}

.kd-popup.bottom {
    justify-content: center;
    align-items: flex-end;
}

.kd-popup.bottom-right {
    justify-content: flex-end;
    align-items: flex-end;
}

.kd-popup.top .kd-popup__container,
.kd-popup.bottom .kd-popup__container,
.kd-popup.full-screen .kd-popup__container {
    flex: 0 1 100%;
}

.kd-popup.full-screen .kd-popup__container {
    height: 100%;
}

.kd-popup.full-screen .kd-popup__container>.wp-block-group {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.kd-popup .kd-popup__container {
    position: relative;
    width: 100%;
    max-width: 800px;
    background-color: var(--kd-popup-background, transparent);
    overflow-y: auto;
}

.kd-popup .kd-popup__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 23px;
    height: 23px;
    cursor: pointer;
    z-index: 1;
    border: 0;
    background: transparent;

}

.kd-popup .kd-popup__close svg {
    display: block;
    width: 100%;
}

.kd-popup .kd-popup__close svg path {
    fill: var(--kd-popup-close-color, #000000);
}

.kd-popup .wp-block-columns-is-layout-flex.no-gutter {
    gap: 0;
}

@media only screen and (max-width: 1023px) {
    .kd-popup {
        padding: var(--kd-tb-popup-padding, 0);
    }
    .kd-popup .kd-popup__container {
        max-width: 600px;
    }
}

@media only screen and (max-width: 781px) {
    .kd-popup {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        padding: var(--kd-mb-popup-padding, 0);
    }

    .kd-popup .kd-popup__container {
        max-width: 400px;
    }

    body.admin-bar .kd-popup.top-left,
    body.admin-bar .kd-popup.top,
    body.admin-bar .kd-popup.top-right,
    body.admin-bar .kd-popup.full-screen {
        top: var(--wp-admin--admin-bar--height, 46px);
        height: calc(100dvh - var(--wp-admin--admin-bar--height, 46px));
    }

    .kd-popup.top-left,
    .kd-popup.top,
    .kd-popup.top-right {
        justify-content: center;
        align-items: flex-start;
    }

    .kd-popup.center-left,
    .kd-popup.center,
    .kd-popup.center-right {
        justify-content: center;
        align-items: center;
        padding: 10px;
    }

    .kd-popup.bottom-left,
    .kd-popup.bottom,
    .kd-popup.bottom-right {
        justify-content: center;
        align-items: flex-end;
    }

    .kd-popup.top-left .kd-popup__container,
    .kd-popup.top .kd-popup__container,
    .kd-popup.top-right .kd-popup__container,
    .kd-popup.bottom-left .kd-popup__container,
    .kd-popup.bottom .kd-popup__container,
    .kd-popup.bottom-right .kd-popup__container {
        flex: 0 1 100%;
    }

}

@media only screen and (max-width: 600px) {

    body.admin-bar .kd-popup.top-left,
    body.admin-bar .kd-popup.top,
    body.admin-bar .kd-popup.top-right,
    body.admin-bar .kd-popup.full-screen {
        top: 0;
        height: 100dvh;
    }
}