﻿/* CANVAS */
#canvas-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    cursor: default;
    touch-action: none;
    /* Prevent browser zooming/scrolling */
}

#canvas-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 5000px;
    height: 5000px;
    background-image: linear-gradient(var(--grid-color) 1px, transparent 1px), linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 40px 40px;
    transform-origin: 0 0;
}

#drawing-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
}

#interaction-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    cursor: crosshair;
}

.drawn-line {
    pointer-events: stroke;
    cursor: pointer;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: filter 0.2s;
}

.drawn-line.dynamic-ink {
    stroke: var(--ink-color);
}

.drawn-line:hover {
    filter: drop-shadow(0 0 2px var(--accent-color));
}

/* Selection Gizmo */
#selection-gizmo {
    position: absolute;
    pointer-events: none;
    display: none;
    border: 1px solid var(--accent-color);
    z-index: 10001;
}

.gizmo-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 1px solid var(--accent-color);
    pointer-events: auto;
}

.handle-tl {
    top: -6px;
    left: -6px;
    cursor: nwse-resize;
}

.handle-tr {
    top: -6px;
    right: -6px;
    cursor: nesw-resize;
}

.handle-bl {
    bottom: -6px;
    left: -6px;
    cursor: nesw-resize;
}

.handle-br {
    bottom: -6px;
    right: -6px;
    cursor: nwse-resize;
}

.handle-rot {
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-color);
    cursor: grab;
}

#selection-box {
    position: absolute;
    border: 1px dashed var(--accent-color);
    background: rgba(0, 122, 204, 0.1);
    display: none;
    pointer-events: none;
    z-index: 10002;
    transform-origin: 0 0;
}

.selected-line {
    filter: drop-shadow(0 0 4px var(--accent-color)) !important;
    stroke-width: calc(var(--original-width, 2) * 1.5) !important;
}

#eraser-cursor {
    position: fixed;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255, 0, 0, 0.5);
    background: rgba(255, 0, 0, 0.1);
    border-radius: 50%;
    pointer-events: none;
    z-index: 20000;
    transform: translate(-50%, -50%);
    display: none;
}