.form-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    padding: 24px;
    background: #00000080;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.form-overlay,
.form-overlay * {
    box-sizing: border-box;
}

.form-overlay.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.form-overlay__panel {
    width: 100%;
    max-width: 710px;
    max-height: 100%;
    max-height: 100dvh;
    max-height: 100svh;
    min-width: 0;
}

.form-overlay__box {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    max-height: calc(100svh - 48px);
    padding: 32px;
    overflow: auto;
    box-sizing: border-box;
    background: #ffffff;
    border-radius: 16px;
    font-family: var(--wp--preset--font-family--barlow);
}

.form-overlay__close {
    width: 32px;
    min-width: 32px;
    height: 32px;
    margin: 0 0 16px auto;
    padding: 0;
    appearance: none;
    cursor: pointer;
    background: transparent url("../../../assets/images/menu-close.svg") center center / 24px 24px no-repeat;
    border: 0;
    border-radius: 0;
}

.form-overlay__close:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary);
    outline-offset: 4px;
}

.form-overlay__content {
    width: 100%;
    min-width: 0;
}

.form-overlay__content > *:first-child {
    margin-top: 0;
}

.form-overlay__content > *:last-child {
    margin-bottom: 0;
}

.form-overlay__content iframe,
.form-overlay__content img,
.form-overlay__content .form-popup,
.form-overlay__content .b24-form,
.form-overlay__content .b24-form-wrapper,
.form-overlay__content .contact-form-wrapper {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 781px) {
    .form-overlay {
        padding: 16px;
    }

    .form-overlay__box {
        max-height: calc(100vh - 32px);
        max-height: calc(100dvh - 32px);
        max-height: calc(100svh - 32px);
        padding: 24px 16px;
    }

    .form-overlay__close {
        margin-bottom: 12px;
    }
}

body.form-overlay-open {
    overflow: hidden;
}
