/*
 * The popup of the company site - <dialog> of popup.js (uaMarket.popup), the markup - blocks/popup.html.twig of the site
 * template. The look of the colorbox frame it replaced (colorbox/colorbox.css: the styles of the content stay there).
 * --sf-popup-backdrop - the darkness of the backdrop (0..1), set by the JS.
 */
/* the background - of the dialog too: the box with a scrollbar at a fractional width (a zoom of 125%) leaves a gap of
   a part of a pixel by the scrollbar - the backdrop showed through as a black line */
.sfPopup {
    padding: 0;
    border: 0;
    background: #f8f8f8;
    border-radius: 5px;
    max-width: calc(100vw - 30px);
    max-height: calc(100vh - 30px);
    overflow: visible;
}
.sfPopup::backdrop {
    background: #000;
    opacity: var(--sf-popup-backdrop, 0.85);
}
.sfPopup-box {
    position: relative;
    box-sizing: border-box;
    max-height: calc(100vh - 30px);
    overflow: auto;
    padding: 23px 37px 25px 17px;
    background: #f8f8f8;
    border-radius: 5px;
}
.sfPopup-close {
    position: absolute;
    top: 34px;
    right: 34px;
    z-index: 1000;
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    background: url(colorbox/images/closeButPopup.png) no-repeat 0 0;
    cursor: pointer;
}
.sfPopup-close:hover {
    background-position: 0 -10px;
}

/* the animations (colorbox: the fading of 300 ms): the popup appears - also with a new content (popup.js restarts
   it), the backdrop darkens; closing - CLOSE_MS of popup.js (200 ms) */
.sfPopup[open] {
    animation: sfPopupIn 0.3s ease-out;
}
.sfPopup[open]::backdrop {
    animation: sfPopupFade 0.3s ease-out;
}
.sfPopup.sfPopup--closing {
    animation: sfPopupOut 0.2s ease-in forwards;
}
/* .sfPopup. - the dialog is still [open] while closing: the specificity of .sfPopup[open]::backdrop */
.sfPopup.sfPopup--closing::backdrop {
    animation: sfPopupFadeOut 0.2s ease-in forwards;
}
@keyframes sfPopupIn {
    from { opacity: 0; transform: scale(0.96); }
}
@keyframes sfPopupOut {
    to { opacity: 0; transform: scale(0.96); }
}
@keyframes sfPopupFade {
    from { opacity: 0; }
}
@keyframes sfPopupFadeOut {
    to { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .sfPopup[open],
    .sfPopup[open]::backdrop,
    .sfPopup.sfPopup--closing,
    .sfPopup.sfPopup--closing::backdrop {
        animation: none;
    }
}

/* the content comes from the server (popup.js, loading()): only the backdrop, no box */
.sfPopup--waiting {
    background: transparent;
}
.sfPopup--waiting .sfPopup-box {
    display: none;
}

/* the loader of an image of the gallery; the spinner - after 0.3 s: a loaded quickly image - no blinking of it */
.sfPopup--loading .sfPopup-box {
    width: 80px;
    height: 80px;
    padding: 0;
}
.sfPopup--loading .sfPopup-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url(colorbox/images/loading.gif) no-repeat center center;
    animation: sfPopupFade 0.2s ease-out 0.3s backwards;
}
.sfPopup--loading .sfPopup-close,
.sfPopup--loading .sfPopup-content {
    display: none;
}

/* the popups hidden on the page - shown in the dialog (fonts.css: #cboxLoadedContent of the portal) */
.sfPopup-content .popup.popup_window {
    display: block;
}
.sfPopup-content #orderForm .orderFormSend {
    display: block;
}

/* the images: up to 60% x 85% of the window, the item gallery - 95% */
.sfGallery {
    margin: 0;
}
.sfGallery img {
    display: block;
    max-width: calc(60vw - 54px);
    max-height: calc(85vh - 81px);
    margin: 0 auto;
}
.sfPopup--large .sfGallery img {
    max-width: calc(95vw - 54px);
    max-height: calc(95vh - 81px);
}
.sfGallery-bar {
    position: relative;
    min-height: 25px;
    margin-top: 8px;
    padding: 0 140px;
    color: #949494;
    line-height: 25px;
    text-align: center;
}
.sfGallery-previous,
.sfGallery-next {
    position: absolute;
    bottom: 0;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 0;
    background: url(colorbox/images/controls.png) no-repeat -75px 0;
    cursor: pointer;
}
.sfGallery-previous {
    left: 0;
}
.sfGallery-previous:hover {
    background-position: -75px -25px;
}
.sfGallery-next {
    left: 27px;
    background-position: -50px 0;
}
.sfGallery-next:hover {
    background-position: -50px -25px;
}
.sfGallery-previous[hidden],
.sfGallery-next[hidden] {
    display: none;
}
.sfGallery-counter {
    position: absolute;
    bottom: 0;
    left: 70px;
}

/* the phones: full screen */
@media (max-width: 800px) {
    .sfPopup {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        border-radius: 0;
    }
    .sfPopup-box {
        height: 100%;
        max-height: none;
        border-radius: 0;
    }
    /* the loader - in the middle, not the full screen */
    .sfPopup.sfPopup--loading {
        width: auto;
        height: auto;
        margin: auto;
        border-radius: 5px;
    }
    .sfPopup--loading .sfPopup-box {
        border-radius: 5px;
    }
    .sfPopup-content {
        width: auto !important;
    }
    .sfGallery img,
    .sfPopup--large .sfGallery img {
        max-width: 100%;
        max-height: calc(100vh - 81px);
    }
    .sfGallery-bar {
        padding: 0 0 0 70px;
        text-align: left;
    }
    .sfGallery-counter {
        position: static;
        margin-right: 10px;
    }
}
@media (max-width: 530px) {
    .sfPopup-box {
        padding-left: 17px;
        padding-right: 17px;
    }
    .sfPopup-close {
        top: 13px;
        right: 20px;
    }
}

/* the loading over an element (motion.js, uaMarket.motion.busy; was the jQuery plugin blockUI): the element - inert */
.sfBusy-host {
    position: relative;
}
.sfBusy {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.4) url(../default/images/loading.gif) no-repeat center center;
    cursor: wait;
    animation: sfPopupFade 0.3s;
}
.sfBusy--instant {
    animation: none;
}
@media (prefers-reduced-motion: reduce) {
    .sfBusy {
        animation: none;
    }
}
