/* Запретить скролл основной страницы если открыто окно */
body:has(.window-visible) {
    overflow: hidden;
}

/* Контейнер окна */
.window {
    visibility: hidden;
    position: fixed;

    perspective: 500px;
    perspective-origin: 50% 0;

    top: 10px;

}

.window-visible {
    visibility: visible;
}

/* Само окно */
.window>div {
    opacity: 0;
    background-color: white;
}


/* Заголовок окна */
.window .head {
    background-color: #34495e;
    color: white;
    display: flex;
    justify-content: space-between;
}


/* Текст заголовка окна */
.window div[data-head-title] {
    line-height: 34px;
    flex-grow: 1;
    padding-left: 10px;
}


/* Заголовок тревоги */
.window-alert .head {
    background-color: #c0392b;
    color: white;
}


/* Контейнер кнопок в заголовке окна */
.window div[data-head-buttons] {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 0;
    margin: 0;
}

/* Кнопка в заголовке окна */
.window div[data-head-buttons] span {
    display: block;
    margin: 0;
    padding: 0;
    height: 34px;
    width: 34px;
    line-height: 34px;
    font-size: 20px;
    cursor: pointer;
    text-align: center;
}

/* Содержание окна */
.window .body {
    padding: 15px;
    position: relative;
    overflow-y: auto;
    max-height: calc(100dvh - 34px - 15px - 15px - 20px);
}

.window+div:has(div[data-bottom]) .body {
    max-height: calc(100dvh - 34px - 15px - 15px - 68px);
}


/* Низ окна, который не участвует в прокрутке. */
.window div[data-bottom] {
    padding: 15px;

    /* Его высота всегда 68px */
    height: 68px;

    box-sizing: border-box;

    overflow: hidden;
}

/* Кнопка внизу окна */
.window .oneButton {
    display: block;
    margin: 10px 0 0 auto;

}

/* Фон окна */
.windowUnder {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    overflow: auto;
    background: rgba(0, 0, 0, 0.5);

    transition: opacity 500ms;
    opacity: 0;
}


.window-width-200 {
    width: 200px;
}

.window-width-300 {
    width: 300px;
}

.windowWidth400px {
    width: 400px;
}

.window-width-500 {
    width: 500px;
}

.windowWidth600px {
    width: 600px;
}

.windowWidth700px {
    width: 700px;
}

.windowWidth1000px {
    width: 1000px;
}


.windowWidthFull {
    width: 95vw;
}


/* Меню для окна */

/* Заголовок окна, первый div */
.window-menu .head {
    background-color: #080e2c;
}

/* Заголовки разделов */
.window-menu .body div {
    border-bottom: 1px solid #eee;
    padding-bottom: 7px;
}


/* Заголовки разделов, кроме первого */
.window-menu .body div:not(:first-child) {
    margin-top: 30px;
}

/* Пункты меню */
.window-menu .body a {
    display: block;
    padding: 10px 0px 10px 0px;
    text-decoration: none;
    color: #2c3e50;
    cursor: pointer;
}

.window-menu .body a:first-child {
    padding-top: 0;
}


.window-menu .body a:last-child {
    padding-bottom: 0;
}


/* Медиа запросы в самом низу потому что они переопределяют уже имеющееся */

/* Мобильная версия */
@media (max-width: 576px) {

    /* Время анимации */
    .window>div {
        transition: opacity 150ms, transform 250ms;
    }

    .windowInCenter {
        width: calc(100% - 20px);
        top: 10px;
        left: 10px;
    }

    .windowInCenter>div {
        transform: translateY(-50%) rotateX(-10deg) translateY(50%);
    }

    .windowInCenterAnimationEnd>div {
        transform: translateY(-50%) rotateX(0) translateY(50%);
        opacity: 1;
    }

    .windowOverElement {
        width: calc(100% - 16px);
        top: 10px;
        left: 10px;
    }


    .windowOverElement>div {
        transform: translateY(-50%) rotateX(-10deg) translateY(50%);
    }

    .windowOverElementAnimationEnd>div {
        transform: translateY(-50%) rotateX(0) translateY(50%);
        opacity: 1;
    }


}

/* Настольная версия */
@media (min-width: 576px) {

    /* В настольной версии при наведении на кнопку есть подсветка */
    .window div[data-head-buttons] span:hover {
        background-color: var(--hover-color);
        color: white;
    }

    /* Пункты меню */
    #menuWindow .body a:hover {
        color: var(--hover-color);
    }

    /* Время анимации */
    .window>div {
        transition: opacity 150ms, transform 250ms;
    }

    .windowInCenter>div {
        transform: translateY(-50%) rotateX(-10deg) translateY(50%);
    }

    .windowInCenterAnimationEnd>div {
        transform: translateY(-50%) rotateX(0) translateY(50%);
        opacity: 1;
    }


    .windowOverElement>div {
        transform: translateY(-50%) rotateX(-10deg) translateY(50%);
    }


    .windowOverElementAnimationEnd>div {
        transform: translateY(-50%) rotateX(0) translateY(50%);
        opacity: 1;
    }

    .window-menu .head {
        display: none;
    }

}