/* Modal skeleton: backdrop blur, placeholder layer, single content slot */

html.modal-skeleton-scroll-lock,
html.modal-skeleton-scroll-lock body {
    overflow: hidden;
}

.modal-skeleton {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.modal-skeleton--open {
    opacity: 1;
    pointer-events: auto;
}

.modal-skeleton__backdrop {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: 0;
}

/* Blur sits under the ornament image so the page is blurred, not the decoration. */
.modal-skeleton__blur {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background-color: rgba(249, 249, 249, 0.35);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    /* Closed modal root uses opacity:0; children must not steal hits (see MDN pointer-events). */
    pointer-events: none;
}

.modal-skeleton__bg-placeholder {
    position: absolute;
    left: -110px;
    bottom: -130px;
    width: 704px;
    height: 704px;
    display: block;
    z-index: 1;
    pointer-events: none;
}

.modal-skeleton--open .modal-skeleton__blur {
    pointer-events: auto;
}

/* Stage: horizontal center always (justify-content). Vertical: top vs center via modifiers. */
.modal-skeleton__stage {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding-left: 24px;
    padding-right: 24px;
    pointer-events: none;
}

/* Mode 1: 24px from top, centered horizontally */
.modal-skeleton--align-top .modal-skeleton__stage {
    align-items: flex-start;
    padding-top: 24px;
}

/* Mode 2: centered vertically and horizontally */
.modal-skeleton--align-center .modal-skeleton__stage {
    align-items: center;
    padding-top: 0;
}

.modal-skeleton__panel {
    pointer-events: none;
    width: 100%;
    max-width: min(1232px, calc(100vw - 48px));
    min-height: 0;
    max-height: min(720px, calc(100vh - 48px));
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(26, 26, 26, 0.12);
    box-sizing: border-box;
}

.modal-skeleton--open .modal-skeleton__panel {
    pointer-events: auto;
}

.modal-skeleton__slot {
    width: 100%;
    max-width: 100%;
    height: fit-content;
    box-sizing: border-box;
}

/* Мастер «Создать мероприятие» на welcome: размер и обводка как в макете ЗАГС */
.modal-skeleton--create-event-wizard .modal-skeleton__panel {
    width: min(1232px, calc(100vw - 48px));
    max-width: min(1232px, calc(100vw - 48px));
    max-height: min(946px, calc(100vh - 48px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-skeleton--create-event-wizard .modal-skeleton__slot {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-skeleton--supplier-login-wizard .modal-skeleton__panel {
    width: min(1280px, calc(100vw - 48px));
    max-width: min(1280px, calc(100vw - 48px));
    max-height: min(946px, calc(100vh - 48px));
    max-height: min(946px, calc(100dvh - 48px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-skeleton--supplier-login-wizard .modal-skeleton__slot {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Shared modal close control (<x-modal-close-button />), use on any modal */

.modal-close-button {
    position: relative;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

.modal-close-button__img {
    display: block;
    width: 24px;
    height: 24px;
}

.modal-close-button__sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 1440px) {
    .modal-skeleton__stage {
        padding-left: 20px;
        padding-right: 20px;
    }

    .modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 20px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__panel {
        width: min(1232px, calc(100vw - 40px));
        max-width: min(1232px, calc(100vw - 40px));
        max-height: min(946px, calc(100vh - 40px));
    }

    .modal-skeleton__bg-placeholder {
        width: 560px;
        height: 560px;
        left: -90px;
        bottom: -100px;
    }
}

@media (max-width: 1024px) {
    .modal-skeleton__stage {
        padding-left: 16px;
        padding-right: 16px;
    }

    .modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 16px;
    }

    .modal-skeleton__panel {
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        border-radius: 18px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__panel {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        max-height: calc(100vh - 32px);
        border-radius: 24px;
    }

    .modal-skeleton__bg-placeholder {
        width: 480px;
        height: 480px;
    }
}

@media (max-width: 768px) {
    .modal-skeleton__stage {
        padding-left: 12px;
        padding-right: 12px;
    }

    .modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 12px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__stage {
        padding-left: 0;
        padding-right: 0;
        align-items: stretch;
    }

    .modal-skeleton--create-event-wizard.modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 0;
        align-items: stretch;
    }

    .modal-skeleton__panel {
        max-width: calc(100vw - 24px);
        max-height: calc(100vh - 24px);
        border-radius: 16px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__panel {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: 100%;
        min-height: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .modal-skeleton--supplier-login-wizard .modal-skeleton__stage {
        padding-left: 0;
        padding-right: 0;
        align-items: stretch;
    }

    .modal-skeleton--supplier-login-wizard.modal-skeleton--align-top .modal-skeleton__stage,
    .modal-skeleton--supplier-login-wizard.modal-skeleton--align-center .modal-skeleton__stage {
        padding-top: 0;
        align-items: stretch;
    }

    .modal-skeleton--supplier-login-wizard .modal-skeleton__panel {
        width: 100%;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        min-height: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .modal-skeleton__bg-placeholder {
        width: 320px;
        height: 320px;
        left: -60px;
        bottom: -60px;
        opacity: 0.6;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__bg-placeholder {
        opacity: 0.45;
    }
}

@media (max-width: 440px) {
    .modal-skeleton__stage {
        padding-left: 8px;
        padding-right: 8px;
    }

    .modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 8px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__stage {
        padding-left: 0;
        padding-right: 0;
    }

    .modal-skeleton--create-event-wizard.modal-skeleton--align-top .modal-skeleton__stage {
        padding-top: 0;
    }

    .modal-skeleton__panel {
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
        border-radius: 12px;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__panel {
        width: 100%;
        max-width: none;
        height: 100%;
        max-height: 100%;
        min-height: 0;
        border-radius: 0;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .modal-skeleton--create-event-wizard .modal-skeleton__bg-placeholder {
        display: none;
    }
}
