@import '../../styles/colors', '../../styles/fonts', '../../styles/fontSizeCalculator', '../../styles/variables';

$zindex: $modal-zindex;
$padding: 33px;

body {
    &.modal-open {
        overflow-y: scroll;
        position: fixed;
        width: 100%;
        #coreApp::after {
            background: color(backgroundColorDisable);
            content: '';
            height: 100%;
            left: 0;
            mix-blend-mode: saturation;
            opacity: 1;
            position: fixed;
            top: 0;
            transition: opacity 150ms linear;
            width: 100%;
        }
    }
    &.modal-animate-out #coreApp::after {
        opacity: 0;
    }
}
.ui.modal {
    .modal-container {
        animation: slideInModal 200ms ease-out forwards;
        backface-visibility: hidden;
        background-color: color(backgroundColorInverse);
        border-radius: rem(3px);
        box-shadow: 0 15px 28px 0 rgba(0, 0, 0, 0.13);
        overflow-x: hidden;
    }
        .modal-container-inner {
            color: color(colorInverse);
            padding: 88px 11px $padding;
            position: relative;
            header {
                align-items: center;
                background-color: color(backgroundColorInverse);
                display: flex;
                flex-wrap: wrap;
                justify-content: flex-start;
                left: 0;
                padding: $padding 11px;
                position: fixed;
                top: 0;
                width: 100%;
                .title {
                    align-items: flex-start;
                    display: flex;
                    flex: 1 1 1px;
                    justify-content: flex-start;
                    margin: 0;
                    padding-right: 33px;
                    width: 100%;
                }
                .modal-close-button-container {
                    align-items: center;
                    display: flex;
                    flex: 0 1 1px;
                    height: 29px;
                    justify-content: center;
                    margin-bottom: 0;
                    width: 16px;
                }
                .ui.divider { flex: 0 1 100%; margin: 11px 0 0; }
            }
        }
    .modal-dimmer {
        animation: fadeInDimmer 150ms ease-out forwards;
        animation-delay: 100ms;
        backface-visibility: hidden;
        background-color: rgba(255, 255, 255, .3);
        height: 100%;
        left: 0;
        opacity: 0;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: $zindex + 2;
    }
    &.modal-animate-out {
        .modal-container { animation: slideOutModal 333ms forwards; }
        .modal-dimmer { animation: fadeOutDimmer 150ms ease-out forwards; }
    }
}

@media only screen and (min-width: 768px) {
    .ui.modal {
        padding: $padding;
        .modal-container { background-color: color(backgroundColor); }
        .modal-container-inner {
            color: inherit;
            padding: 88px $padding $padding;
            header {
                background-color: color(backgroundColor);
                padding: $padding $padding 22px;
                .modal-close-button-container {
                    height: 33px;
                    width: 33px;
                }
            }
        }
    }
}

@keyframes fadeInBlur {
    0% { filter: blur(0); }
    100% { filter: blur(1px); }
}

@keyframes fadeOutBlur {
    0% { filter: blur(1px); }
    100% { filter: blur(0); }
}

@keyframes fadeInDimmer {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fadeOutDimmer {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes slideInModal {
    0% { opacity: 0; transform: translateY(-44px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes slideOutModal {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-44px); }
}
