/* index.css - styles for index.html and generally main parts of the app
   For shared styles (such as color definitions) check out base.css. */

/* Main container layout */

body {
    width: 100vw;
    height: 100vh;
}

main {
    width: 100%;
    height: 100%;
    position: relative;

    &>.fullscreen {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
    }

    &>.panels {
        box-sizing: border-box;
        padding: 16px;

        display: grid;
        grid-template-columns: [left] 1fr [right] 384px;

        /* Pass all events through. Children may receive events as normal. */
        pointer-events: none;

        &>* {
            pointer-events: all;
        }

        &>rkgk-brush-editor {
            grid-column: right / right;
            height: fit-content;
            max-height: 100%;
            overflow: auto;
        }
    }

    &>rkgk-canvas-renderer {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
    }

    &>rkgk-reticle-renderer {
        width: 100%;
        height: 100%;
        position: absolute;
        left: 0;
        top: 0;
        overflow: hidden;
    }

    &>rkgk-brush-editor {
        width: 384px;
    }

    &>#js-loading {
        background-color: var(--color-panel-background);

        display: flex;
        align-items: center;
        justify-content: center;
    }
}


/* Canvas renderer */

rkgk-canvas-renderer {
    display: block;

    &>canvas {
        display: block;
    }
}

/* Reticle renderer */

rkgk-reticle-renderer {
    display: block;

    pointer-events: none;

    &>.reticles {
        position: relative;
    }
}

rkgk-reticle-cursor {
    --color: black; /* Overridden by JavaScript to set a per-user color. */

    position: absolute;
    display: block;

    &>.container {
        &>.arrow {
            width: 24px;
            height: 24px;
            background-color: var(--color);
            clip-path: path("M 0,0 L 13,13 L 6,13 L 0,19 Z");
        }

        &>.nickname {
            position: absolute;
            top: 20px;
            left: 8px;

            color: white;
            background-color: var(--color);
            padding: 1px 6px;
            border-radius: 9999px;
            text-align: center;
            font-weight: bold;
        }
    }
}

/* Brush editor */

rkgk-brush-editor {
    padding: 12px;
    
    &>.text-area {
        display: block;
        width: 100%;
        margin: 0;
        resize: none;
        white-space: pre-wrap;
        border: none;
        overflow: hidden;
        box-sizing: border-box;
    }

    &>.errors:empty, &>.error-header:empty {
        display: none;
    }

    &>.error-header {
        margin-top: 1em;
        margin-bottom: 0;
        font-size: 1rem;
        color: var(--color-error);
    }

    &>.errors {
        margin: 0;
        color: var(--color-error);
        white-space: pre-wrap;
    }
}

/* Welcome screen */

rkgk-welcome {
    &>dialog {
        h3 {
            margin: 0.5rem 0;
            font-size: 2rem;
            font-weight: bold;
        }
    }
}

/* Connection status dialogs */

rkgk-connection-status {
    &>dialog[name='logging-in-dialog'][open], &>dialog[name='disconnected-dialog'][open] {
        border: none;
        outline: none;
        background: none;

        display: flex;
        gap: 8px;
        align-items: center;
    }

    &>dialog[name='error-dialog'][open] {
        & textarea[name='error-text'] {
            box-sizing: border-box;
            width: 100%;
            resize: none;
            border: 1px solid var(--color-panel-border);
            padding: 4px;
        }
    }
}

/* Menu bar */

.menu-bar {
    --border-radius: 4px;
    
    display: flex;
    align-items: center;
    box-sizing: border-box;

    width: fit-content;
    height: 24px;
    border-radius: var(--border-radius);

    &>a {
        display: block;
        
        color: var(--color-text);
        padding: 4px 8px;
        text-decoration: none;

        line-height: 1;

        &:hover {
            background-color: var(--color-shaded-background);
        }

        &.icon {
            padding: 4px 4px;
        }

        &:first-child {
            border-top-left-radius: var(--border-radius);
            border-bottom-left-radius: var(--border-radius);
        }

        &:last-child {
            border-top-right-radius: var(--border-radius);
            border-bottom-right-radius: var(--border-radius);
        }
    }

    &>hr {
        height: 100%;
        margin: 0;
        border: none;
        border-right: 1px solid var(--color-panel-border);
    }
}

