@import "./../dist/styles.css";

:root {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color-scheme: dark;
}

body {
    margin: 0;
    overflow: hidden;
}

body.resizing #device iframe {
    filter: blur(20px) opacity(.5);
    pointer-events: none !important;
}

.container {
    display: flex;
    height: 100vh;
}

.preview {
    position: relative;
    width: 100px;
    min-width: 100px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;

    &.selector-mode {
        #selector-frame {
            display: block !important;
        }

        #device>iframe {
            pointer-events: none !important;
        }
    }
}

.editor {
    width: 50%;
    min-width: 400px;
    max-width: calc(100% - 100px);

    &,
    * {
        font-family: monospace;
    }
}

.toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.1);
}

#elementSelector {
    margin-right: 10px;
}

.toolbar-btn {
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer !important;
    color: white;
    width: max-content;
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;

    p {
        margin-left: 5px;
    }

    * {
        pointer-events: none !important;
    }

    i {
        font-size: 16px;
    }

    &:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    div {
        width: 20px;
        height: 20px;
        pointer-events: all !important;
        margin-right: -5px;

        &:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        &:active {
            background: white;
            color: black;
        }
    }

    &:active {
        background: white;
        color: black;
    }
}

div.code-editor {
    height: 100%;
}

#device {
    transition: 0.5s cubic-bezier(0.075, 0.82, 0.165, 1);
    position: absolute;
    width: calc(430px / (376 / 480));
    height: calc(797px / (376 / 480));
    left: calc(50% - 215px / (376 / 480));
    top: calc(50% - 398.5px / (376 / 480));
    pointer-events: none;

    &::after {
        content: "";
        position: absolute;
        left: 0px;
        top: 0px;
        width: 100%;
        height: 100%;
        background-image: url(device.svg);
        background-size: 100% 100%;
    }

    iframe,
    #selector-frame {
        position: absolute;
        left: calc(27px / (376 / 480));
        top: calc(25px / (376 / 480));
        width: calc(376px / (376 / 480));
        height: calc(745.8px / (376 / 480));
        z-index: -1;
        pointer-events: all !important;
        border-radius: 50px;
    }

    #selector-frame {
        display: none;
        background-color: transparent;
        overflow: hidden;

        div {
            transition: .25s cubic-bezier(0.075, 0.82, 0.165, 1);
            border-radius: 50px;
            position: absolute;
            left: 0px;
            top: 0%;
            height: 100%;
            width: 100%;
            box-shadow: inset 0px 0px 0px 2px var(--metro-color-violet), 0px 10px 50px 0px var(--metro-color-violet), 0px 0px 0px 100vw rgba(0, 0, 0, 0.5);

            &.alt {
                &::after {
                    top: 75px !important;
                }
            }

            &::after {
                content: var(--selector-text);
                position: fixed;
                left: 50px;
                bottom: 75px;
                width: calc(100% - 100px);
                height: max-content;
                background: rgba(255, 255, 255, 0.1);
                backdrop-filter: blur(20px);
                box-shadow: inset 0px 0px 0px 1px rgba(255, 255, 255, 0.1);
                font-family: monospace;
                font-size: 15px;
            }
        }
    }
}

div.CodeMirror-gutter {
    cursor: col-resize !important;
}

div.context-menu {

    position: fixed;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 4px;
    z-index: 10000000;
}

@keyframes assets-menu-slide-up {
    from {
        transform: translateY(100px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
    }

}

#assets-menu {
    i {
        pointer-events: none;
    }

    transition: .5s cubic-bezier(0.075, 0.82, 0.165, 1);
    position: absolute;
    bottom: 0;
    left: 20px;
    background: #2d2d2d;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-height: max(40vh, 200px);
    width: calc(100% - 40px);
    min-width: 480px;
    box-sizing: border-box;
    animation: assets-menu-slide-up 0.2s;

    .assets-menu-topbar {
        transition: 0.2s;
        padding: 12px;
        border-bottom: 1px solid #444;
        display: flex;
        gap: 8px;
    }

    .assets-menu-button {
        height: 34px;
        padding: 8px 16px;
        background: transparent;
        border: none;
        border-radius: 4px;
        color: white;
        cursor: pointer !important;
        transition: background 0.2s;

        &:hover {
            background: #555;
        }
    }

    .assets-menu-close {
        margin-left: auto;
        background: none;
        border: none;
        color: white;
        cursor: pointer !important;
        padding: 8px;
        border-radius: 4px;
        width: 34px;
        height: 34px;

        &:hover {
            background: #444;
        }
    }

    .assets-menu-view {
        transition: .5s cubic-bezier(0.075, 0.82, 0.165, 1);
        flex: 1;
        padding: 16px;
        overflow-y: auto;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 16px;
        min-height: 40px;
        position: relative;

        p.no-results {
            position: absolute;
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100px;
            color: white;
            text-align: center;
            font-size: 20px;
            margin-top: 20px;
        }
    }

    .assets-menu-item {
        transition: .5s cubic-bezier(0.075, 0.82, 0.165, 1);
        text-align: center;
        color: white;
        font-size: 14px;
        cursor: pointer !important;
        height: max-content;
        overflow: hidden;

        &:hover {
            transform: scale(1.1);
            filter: drop-shadow(0px 5px 10px rgb(0, 0, 0, .3));
        }

        * {
            pointer-events: none !important;
        }

        .assets-menu-item-preview {
            width: 100%;
            aspect-ratio: 1;
            background: #444;
            border-radius: 4px;
            margin-bottom: 8px;
            background-position: center !important;
            background-size: cover !important;
            font-size: 40px !important;
            justify-content: center;
            align-items: center;
            display: flex;
        }
    }

    &::after {
        transition: .5s cubic-bezier(0.075, 0.82, 0.165, 1);
        content: "Drag assets here!";
        position: absolute;
        padding: 30px;
        box-sizing: border-box;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 30px;
        font-weight: 400;
        opacity: 0;
        filter: blur(5px);
        transform: scale(1.1);
        pointer-events: none !important;
    }

    &.dragging {
        &::after {
            opacity: .75;
            filter: blur(0px);
            transform: scale(1);
        }

        .assets-menu-view {
            min-height: 127px;
        }

        .assets-menu-view,
        .assets-menu-topbar {
            filter: blur(10px);
            transform: scale(.95);
        }
    }
}