@import '../../styles/constants';

$modal-overlay-background: rgba($primary-color-gray, 0.7);

.modal-open {
    overflow: hidden;
}

.ModalComponent {
    position: fixed;
    top: 0;
    left: 0;
    z-index: $z-index-modal;

    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 20px;

    visibility: hidden;

    &__overlay {
        position: fixed;
        top: 0;
        left: 0;

        width: 100%;
        height: 100%;

        background-color: $modal-overlay-background;
    }

    &__modal {
        position: relative;

        box-sizing: border-box;
        width: 100%;
        max-width: 600px;
        min-height: 200px;
        max-height: 100%;
        margin-top: 50px;
        padding: 30px;

        background-color: $primary-color-white;
        border-radius: 5px;
        box-shadow: 0 3px 5px $secondary-color-gray;
        opacity: 0;

        transition: margin-top 0.2s ease-in-out, opacity 0.2s ease-in-out;

        &--body {
            width: 100%;
            height: 100%;
        }
    }

    &__modal-close {
        position: absolute;
        top: 10px;
        right: 10px;

        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;

        cursor: pointer;

        transition: background-color 0.05s ease-in-out;

        &:hover {
            div {
                background-color: $primary-color-gray;

                transition: background-color 0.2s ease-in-out;
            }
        }

        div {
            width: 1px;
            height: 100%;

            background-color: $secondary-color-gray;
            transform: rotate(45deg);

            &::after {
                position: absolute;
                top: 0;
                left: 0;

                width: 1px;
                height: 100%;

                background-color: inherit;
                transform: rotate(-90deg);

                content: '';
            }
        }
    }

    &--visible {
        visibility: visible;

        .ModalComponent__modal {
            margin-top: 0;

            opacity: 1;
        }
    }
}
