﻿:root {
    --editor-bg: var(--ui-bg);
    --editor-text: var(--ui-text);
    --editor-top-bg: var(--ui-surface-2);
    --editor-panel-bg: var(--ui-surface-2);
    --editor-surface-bg: var(--ui-surface-1);
    --editor-border-soft: var(--ui-border);
    --editor-border-strong: var(--ui-border);
    --editor-grid-line: var(--ui-grid-line);
    --editor-grid-radial-a: var(--ui-grid-line);
    --editor-grid-radial-b: var(--ui-grid-line);
    --editor-anchor-bg: var(--ui-surface-1);
    --editor-toggle-accent: var(--ui-accent);
}

.editor-wrapper {
    height: 100%;
    width: 100%;
    background: var(--editor-bg);
    color: var(--editor-text);
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 0;
}

.editor-top-row {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--editor-border-soft);
    background: var(--editor-top-bg);
    min-height: 3.25rem;
    flex-wrap: wrap;
}

.editor-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    user-select: none;
}

.editor-toggle input {
    accent-color: var(--editor-toggle-accent);
}

.editor-main {
    display: grid;
    grid-template-columns: minmax(300px, auto) minmax(300px, auto) 1fr minmax(500px, auto);
    gap: 0.75rem;
    padding: 0.75rem;
    min-height: 0;
    overflow: hidden;
    height: 100%;
    width: 100%;
}

.editor-elements-menu,
.editor-properties-menu,
.editor-toolbox {
    background: var(--editor-panel-bg);
    border: 1px solid var(--editor-border-soft);
    border-radius: 0.5rem;
    min-height: 0;
    overflow: auto;
    height: 100%;
    width: 100%;
}

.editor-elements-menu {
    padding: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.editor-properties-menu {
    padding: 0.75rem;
}

.editor-drawing-surface {
    background: var(--editor-surface-bg);
    border: 1px solid var(--editor-border-strong);
    border-radius: 0.5rem;
    min-height: 0;
    overflow: hidden;
    position: relative;
    user-select:none;
}

/* Grid is rendered on the content (anchor) so it pans/zooms with the canvas */
.editor-anchor {
    height: 100%;
    width: 100%;
    min-height: 32rem;
    position: relative;
/*    background: linear-gradient(var(--editor-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--editor-grid-line) 1px, transparent 1px), radial-gradient(circle at 0 0, var(--editor-grid-radial-a), transparent 45%), radial-gradient(circle at 100% 0, var(--editor-grid-radial-b), transparent 40%), var(--editor-anchor-bg);
    background-size: 16px 16px, 16px 16px, auto, auto, auto;
*/    
    background-image: linear-gradient(var(--gl-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--gl-grid-line) 1px, transparent 1px);
    background-size: 16px 16px;
}



/* Only set will-change during active interactions */
.editor-anchor.is-zooming,
.editor-anchor[data-editor-zooming="1"] {
    will-change: transform;
}

/* Draggable demo items */
.drag-item,
[data-editor-draggable="1"] {
    user-select: none;
    position:absolute;
}

.drag-item:active,
[data-editor-draggable="1"]:active {

}

/* Items are positioned absolutely by the editor */
.editor-item,
[data-editor-item="1"] {
    position: absolute;
    left: 0;
    top: 0;
}

/* Selection styles */
.editor-selectable,
[data-editor-selectable="1"] {

}

.editor-selected,
[data-editor-selected="1"] {
    outline: 1px solid #ffd400;
/*cant use will change her like this. It causes z-index layers to behave weird*/
/*    will-change: transform;*/
}
.editor-marqueed,
[data-editor-marqueed="1"] {
    outline: 1px solid cyan;
}
.editor-selected-chief,
[data-editor-chief="1"] {
    outline: 1px solid red;
    z-index: 100;
}

.editor-resize-overlay,
[data-editor-resize-overlay="1"] {
    position: absolute;
    z-index: 101;
    pointer-events: none;
    display: none;
}

.editor-resize-overlay .editor-resize-handle,
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"] {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: orange;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.editor-resize-overlay .editor-resize-handle[data-handle="nw"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="nw"] {
    left: 0%;
    top: 0%;
    cursor: nwse-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="n"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="n"] {
    left: 50%;
    top: 0%;
    cursor: ns-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="ne"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="ne"] {
    left: 100%;
    top: 0%;
    cursor: nesw-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="e"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="e"] {
    left: 100%;
    top: 50%;
    cursor: ew-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="se"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="se"] {
    left: 100%;
    top: 100%;
    cursor: nwse-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="s"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="s"] {
    left: 50%;
    top: 100%;
    cursor: ns-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="sw"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="sw"] {
    left: 0%;
    top: 100%;
    cursor: nesw-resize;
}

.editor-resize-overlay .editor-resize-handle[data-handle="w"],
[data-editor-resize-overlay="1"] [data-editor-resize-handle="1"][data-handle="w"] {
    left: 0%;
    top: 50%;
    cursor: ew-resize;
}

/* Marquee selection rectangle */
.editor-marquee,
[data-editor-marquee-overlay="1"] {
    position: absolute;
    pointer-events: none;
    border: 1px dashed rgba(255, 212, 0, 0.95);
    background: rgba(255, 212, 0, 0.12);
    z-index: 50;
}

/* Snap guide lines */
.editor-snap-line {
    position: absolute;
    pointer-events: none;
    z-index: 60;
    background: rgba(0, 180, 255, 0.9);
}

.editor-snap-line-v {
    top: 0;
    bottom: 0;
    width: 1px;
}

.editor-snap-line-h {
    left: 0;
    right: 0;
    height: 1px;
}

.editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--editor-border-soft);
    background: var(--editor-top-bg);
    min-height: 2.5rem;
}

/* Responsive: stack panels on smaller screens */
@media (max-width: 992px) {
    .editor-main {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }

    .editor-elements-menu {
        order: 1;
        max-height: 12rem;
    }

    .editor-drawing-surface {
        order: 2;
    }

    .editor-properties-menu {
        order: 3;
        max-height: 14rem;
    }
}
