/* ========================================
   12. МОДАЛЬНОЕ ОКНО
   ======================================== */

.vb-callback-block {
    background: transparent !important;
}

.vb-callback-block__inner {
    display: flex;
    justify-content: center;
}

.vb-modal-shell[hidden] {
    display: none !important;
}

.vb-modal-shell {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10000;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.vb-modal-shell.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

html.vb-modal-open,
body.vb-modal-open {
    overscroll-behavior: contain;
}

.vb-modal {
    position: relative;
    width: min(100%, 720px);
    min-height: min(600px, calc(100vh - 80px));
    min-height: min(600px, calc(100dvh - 80px));
    max-height: calc(100vh - 80px);
    max-height: calc(100dvh - 80px);
    overflow-x: hidden;
    overflow-y: auto;
    border-radius: var(--vb-radius-block, 24px);
    background: var(--vb-color-bg, #fff);
    color: var(--vb-color-text, #3B4450);
    box-shadow: 0 24px 64px rgba(21, 27, 39, 0.18);
    transform: translateY(24px);
    transition: transform 0.3s ease;
    overscroll-behavior: contain;
}

.vb-modal-shell.active .vb-modal {
    transform: translateY(0);
}

.vb-modal__body {
    min-height: 100%;
    padding: 36px 32px 32px;
    box-sizing: border-box;
}

.vb-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
    background: var(--vb-color-gray, #eef1f2);
    border: none !important;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 0 !important;
    color: var(--vb-color-text);
    outline: none !important;
    appearance: none;
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: none !important;
    border: none !important;
}

.vb-modal__close::before {
    content: '×';
    display: block;
    font-size: 14px;
    color: currentColor;
}

.vb-modal__close:hover {
    background: var(--vb-color-dgray, #DDE1EC) !important;
    color: var(--vb-color-heading, #000) !important;
}

.vb-modal__close:focus,
.vb-modal__close:focus-visible,
.vb-modal__close:active {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.vb-modal__close::after {
    content: none !important;
}

.vb-modal__title {
    font-size: clamp(1.625rem, 1.2rem + 1vw, 2.2rem);
    color: var(--vb-color-heading, #000);
    margin: 0 0 0.75rem;
}

.vb-modal__subtitle {
    color: var(--vb-color-text);
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.vb-modal__form .vb-form-group {
    margin-bottom: 1rem;
}

.vb-modal__form input,
.vb-modal__form textarea,
.vb-modal__form select {
    width: 100%;
    padding: 0.95rem 1rem;
    font-family: var(--vb-font-family, inherit);
    font-size: 1rem;
    border: 1px solid var(--vb-color-dgray, #d6deec);
    border-radius: var(--vb-radius-form, 12px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background: var(--vb-color-bg, #fff);
}

.vb-modal__form input:focus,
.vb-modal__form textarea:focus,
.vb-modal__form select:focus {
    outline: none;
    border-color: var(--vb-color-primary);
    box-shadow: none;
}

.vb-modal__consent-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.vb-modal__consent-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

.vb-modal__consent-row label {
    font-size: 14px;
    line-height: 1.45;
    color: var(--vb-color-text);
}

.vb-modal__privacy {
    font-size: 12px;
    color: var(--vb-color-text-muted);
    margin: 12px 0 0;
    text-align: center;
}

.vb-modal__privacy a {
    text-decoration: none;
}

.vb-callback-btn {
    position: fixed;
    right: calc(2rem + var(--vb-scrollbar-compensation, 0px));
    bottom: 2rem;
    z-index: 9999;
    box-shadow: 0 10px 24px rgba(7, 51, 153, 0.18);
}

.vb-callback-btn:hover {
    transform: translateY(-2px);
}

.vb-callback-btn.vb-btn--secondary,
.vb-callback-btn.vb-btn--outline {
    background: var(--vb-color-bg, #fff);
}

.vb-callback-btn.vb-btn--secondary:hover,
.vb-callback-btn.vb-btn--outline:hover {
    background: var(--vb-color-primary) !important;
}

@media (max-width: 680px) {
    .vb-modal-shell {
        align-items: flex-start;
        padding: calc(env(safe-area-inset-top, 0px) + 50px) 16px 16px;
    }

    .vb-modal {
        width: 100%;
        min-height: min(600px, calc(100vh - env(safe-area-inset-top, 0px) - 66px));
        min-height: min(600px, calc(100dvh - env(safe-area-inset-top, 0px) - 66px));
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - 66px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 66px);
        border-radius: 18px;
    }

    .vb-modal__body {
        padding: 28px 20px 22px;
    }

    .vb-callback-btn {
        right: calc(1rem + var(--vb-scrollbar-compensation, 0px));
        bottom: 1rem;
        width: calc(100% - 2rem - var(--vb-scrollbar-compensation, 0px));
        justify-content: center;
    }
}

.vb-popup__content > :first-child {
    margin-top: 0;
}

.vb-popup__content > :last-child {
    margin-bottom: 0;
}

.vb-popup__content .wp-block-buttons {
    margin-bottom: 0;
}

.vb-popup__content .wp-block-image img {
    height: auto;
}

.vb-modal-shell.modal-center {
    align-items: center;
    justify-content: center;
}

.vb-modal-shell.modal-wide .vb-modal {
    width: min(100%, 960px);
}

.vb-modal-shell.modal-narrow .vb-modal {
    width: min(100%, 420px);
}

.vb-modal-shell.modal-bottom {
    align-items: flex-end;
    justify-content: center;
    padding: 24px 24px 0;
}

.vb-modal-shell.modal-bottom .vb-modal {
    width: min(100%, 760px);
    min-height: min(600px, calc(100vh - 24px));
    min-height: min(600px, calc(100dvh - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    border-radius: 24px 24px 0 0;
    transform: translateY(32px);
}

.vb-modal-shell.active.modal-bottom .vb-modal {
    transform: translateY(0);
}

.vb-modal-shell.modal-side,
.vb-modal-shell.modal-right,
.vb-modal-shell.modal-left {
    padding: 0;
    align-items: stretch;
}

.vb-modal-shell.modal-side,
.vb-modal-shell.modal-right {
    justify-content: flex-end;
}

.vb-modal-shell.modal-left {
    justify-content: flex-start;
}

.vb-modal-shell.modal-side .vb-modal,
.vb-modal-shell.modal-right .vb-modal,
.vb-modal-shell.modal-left .vb-modal {
    height: 100vh;
    max-height: 100vh;
    width: min(100%, 460px);
    border-radius: 0;
}

.vb-modal-shell.modal-side .vb-modal,
.vb-modal-shell.modal-right .vb-modal {
    transform: translateX(32px);
}

.vb-modal-shell.modal-left .vb-modal {
    transform: translateX(-32px);
}

.vb-modal-shell.active.modal-side .vb-modal,
.vb-modal-shell.active.modal-right .vb-modal,
.vb-modal-shell.active.modal-left .vb-modal {
    transform: translateX(0);
}

@media (max-width: 680px) {
    .vb-modal-shell.modal-side,
    .vb-modal-shell.modal-right,
    .vb-modal-shell.modal-left {
        padding: 0;
    }

    .vb-modal-shell.modal-side .vb-modal,
    .vb-modal-shell.modal-right .vb-modal,
    .vb-modal-shell.modal-left .vb-modal {
        width: 100%;
    }

    .vb-modal-shell.modal-bottom {
        padding: calc(env(safe-area-inset-top, 0px) + 50px) 0 0;
        align-items: flex-end;
    }

    .vb-modal-shell.modal-bottom .vb-modal {
        width: 100%;
        min-height: min(600px, calc(100vh - env(safe-area-inset-top, 0px) - 50px));
        min-height: min(600px, calc(100dvh - env(safe-area-inset-top, 0px) - 50px));
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - 50px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 50px);
        border-radius: 20px 20px 0 0;
    }
}

@media (max-width: 680px) and (max-height: 600px) {
    .vb-modal {
        min-height: 0;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - 66px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 66px);
    }

    .vb-modal-shell.modal-bottom .vb-modal {
        min-height: 0;
        max-height: calc(100vh - env(safe-area-inset-top, 0px) - 50px);
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 50px);
    }
}
