@import '../vars';

#safi-canvas-wrap {
    overflow: auto;
    position: absolute;
    background-color: $col-dark;
    top: 0;
    // bottom: 0;
    bottom: var(--safi-bottom-bar-height);
    left: var(--safi-sidebar-width);
    right: var(--safi-sidebar-width);

    // display: flex;
    // justify-content: center;
    // align-items: center;
    box-shadow: inset 0 0 15px #1e1d1e80;

    &::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }

    &::-webkit-scrollbar-thumb {
        background: #ffffff40;
        border-radius: 5px;
    }

    &::-webkit-scrollbar-thumb:hover {
        background: #ffffff80;
    }

    &::-webkit-scrollbar-track {
        background: $col-dark;
        border-radius: 0px;
        // box-shadow: inset 7px 10px 12px #f0f0f0;
    }

    &::-webkit-scrollbar-corner {
        background: $col-dark;
    }

    @at-root #safi-canvas-outer {

        position: relative;
        // width: var(--safi-canvas-height);
        // height: var(--safi-canvas-width);
        display: flex;
        justify-content: center;
        align-items: center;
    }

    @at-root #safi-bottom-bar {
        display: flex;
        position: absolute;
        // justify-content: center;
        align-items: center;
        right: 0;
        left: 0;
        bottom: 0;
        /* width: 100%; */
        background: $col-dark;
        height: var(--safi-bottom-bar-height);
        padding-left: var(--safi-sidebar-width);
        padding-right: var(--safi-sidebar-width);
        // border-top: 1px solid #{$plain-border-col};

        @at-root #safi-zoom {
            display: flex;
            user-select: none;
            // position: absolute;
            // bottom: 0;
            /* left: 0; */
            font-size: 14px;
            color: #7a7a7a;
            z-index: 1;
            // margin: 5px;
            margin-left: 10px;
            margin-right: 10px;

            &:hover {
                color: $col-light;
            }
        }

        @at-root #safi-info-helper {
            color: white;
        }
    }

    @at-root .safi-zoom-btn {
        user-select: none;
        width: 24px;
        height: 24px;
        display: flex;
        justify-content: center;
        align-items: center;
        /* font-size: 14px; */
        /* border: 1px solid; */
        box-sizing: border-box;
        cursor: pointer;
        border-radius: 4px;

        &:hover {
            background-color: $col-accent;
        }
    }

    @at-root .safi-tiny-btn {
        color: #7a7a7a;
        user-select: none;
        width: 24px;
        height: 24px;
        margin-right: 8px;
        display: flex;
        justify-content: center;
        align-items: center;
        /* font-size: 14px; */
        /* border: 1px solid; */
        box-sizing: border-box;
        cursor: pointer;
        border-radius: 4px;

        &:hover {
            color: white;
        }
    }

    @at-root #safi-zoom-value {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0 4px;
        /* border-top: 1px solid; */
        /* border-bottom: 1px solid; */
    }

    #safi-canvas {
        background-color: #fff;
        // width: 720px;
        // height: 480px;
        position: relative;
        // margin: 5%;


        @at-root #safi-condition-area {
            height: 100%;
        }

        @at-root #safi-condition-overlay {
            // display: none;
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            left: 0;
            justify-content: center;
            align-items: center;
            background: rgba($col-accent, .2);
            z-index: 1001;


            &.--active {
                display: flex;
            }

            &:hover {
                opacity: 1 !important;
            }
        }

        @at-root #safi-col-overlay {
            display: none;
            position: absolute;
            top: 0;
            bottom: 0;
            right: 0;
            left: 0;
            justify-content: center;
            align-items: center;
            background: rgba($col-accent, .2);
            z-index: 10;

            &.--active {
                display: flex;
            }

            &:hover {
                opacity: 1 !important;
            }


            @at-root #safi-area-selection {
                position: absolute;
                width: 100%;
                height: 100%;

                @at-root .safi-area {
                    cursor: pointer;
                    position: absolute;
                    width: 100%;
                    background-color: rgba($col-accent-alt2, .5);
                    border: 1px solid $col-accent-alt2;
                    box-sizing: border-box;
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    color: $col-light;
                    font-weight: 600;
                    font-size: 2em;
                }
            }

            .col-layouts {
                display: flex;
                // font-family: monospace;
                flex-wrap: wrap;
                flex-basis: 90%;
                justify-content: center;
                font-size: 18px;


                .layout-item {
                    background-color: #525056;
                    padding: 8px;
                    color: white;
                    text-align: center;
                    margin: 5px;
                    border-radius: 4px;
                    cursor: pointer;

                    &:hover {
                        background-color: $col-accent;
                    }
                }

                .cancel {
                    cursor: pointer;
                    color: white;
                    position: absolute;
                    bottom: 10px;
                    right: 10px;
                    font-size: 0.75em;

                    &:hover {
                        text-decoration: underline;
                    }
                }
            }
        }

        &.--show-grid::after {
            content: '';
            width: 100%;
            height: 100%;
            position: absolute;
            // background-color: #e5e5f7;
            opacity: 0.5;
            // background-image: linear-gradient(#444cf7 0.5px, transparent 0.5px), linear-gradient(to right, #444cf7 0.5px, transparent 0.5px);
            background-image: linear-gradient(var(--safi-grid-color, #444444) 1px, transparent 1px), linear-gradient(to right, var(--safi-grid-color, #444444) 1px, transparent 1px);
            background-image: linear-gradient(var(--safi-grid-color, #444444) calc(1px / var(--safi-zoom)), transparent calc(1px / var(--safi-zoom))), linear-gradient(to right, var(--safi-grid-color, #444444) calc(1px / var(--safi-zoom)), transparent calc(1px / var(--safi-zoom)));
            // background: repeating-linear-gradient(90deg, #4f46e4 0, #4f46e4 5%, transparent 0, transparent 50%), repeating-linear-gradient(180deg, #4f46e4 0, #4f46e4 5%, transparent 0, transparent 50%);
            background-size: 10px 10px;
            background-size: inherit;
            // background-size: attr(data-safi-grid);
            opacity: 0.1; // background-size: 1em 1em;
            opacity: var(--safi-grid-opacity, 0.1); // background-size: 1em 1em;
            // background-color: #ffffff;

            z-index: 99999;
            pointer-events: none !important;
            // background: linear-gradient(0deg, transparent 45%, #4f46e4 45%, #4f46e4 55%, transparent 55%, transparent 20%, #4f46e4 20%, #4f46e4 30%, transparent 30%), linear-gradient(90deg, transparent 45%, #4f46e4 45%, #4f46e4 55%, transparent 55%, transparent 20%, #4f46e4 20%, #4f46e4 30%, transparent 30%);
        }

        &.--is-cornering {
            .safi-handles {
                border-color: transparent;
                border-image: none;

                [class*=--handle-]:not(.--handle-corner) {
                    display: none;
                }
            }
        }
    }
}

.safi-center-line {
    position: absolute;
    z-index: 100000;
    pointer-events: none !important;
    background-color: var(--safi-grid-color, #444444);
    opacity: 0.067;
    opacity: var(--safi-grid-opacity, 0.1) // mix-blend-mode: soft-light;
}

#safi-center-line-h {
    width: 100%;
    height: calc(2px / var(--safi-zoom));
    top: calc(50% - calc(1px / var(--safi-zoom)));
}

#safi-center-line-v {
    height: 100%;
    width: calc(2px / var(--safi-zoom));
    left: calc(50% - calc(1px / var(--safi-zoom)));
}

.canvas-outer-background {
    background-color: rgb(52 51 51 / 90%);
    position: absolute;
    z-index: 1000;
    pointer-events: none;


    &.--top {
        top: 0;
        left: 0;
        right: 0;
    }


    &.--right {
        right: 0;
    }


    &.--bottom {
        bottom: 0;
        left: 0;
        right: 0;
    }

    &.--left {
        left: 0;
    }
}