/* Base-2 Canvas - Canvas Styles */

#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Canvas layers stack */
.canvas-stack {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    /* Size set dynamically via JS */
}

/* Background layer - shows grid/paper */
#canvas-background {
    z-index: 1;
}

/* Main content layer */
#canvas-main {
    z-index: 2;
}

/* UI overlay layer - selection, guides, handles */
#canvas-overlay {
    z-index: 3;
    pointer-events: none;
}

/* Interactive layer - captures mouse events */
#canvas-interaction {
    z-index: 4;
    cursor: default;
}

/* Cursor states */
#canvas-interaction.cursor-move {
    cursor: move;
}

#canvas-interaction.cursor-grab {
    cursor: grab;
}

#canvas-interaction.cursor-grabbing {
    cursor: grabbing;
}

#canvas-interaction.cursor-crosshair {
    cursor: crosshair;
}

#canvas-interaction.cursor-text {
    cursor: text;
}

#canvas-interaction.cursor-pointer {
    cursor: pointer;
}

/* Resize cursors */
#canvas-interaction.cursor-nw-resize { cursor: nw-resize; }
#canvas-interaction.cursor-ne-resize { cursor: ne-resize; }
#canvas-interaction.cursor-sw-resize { cursor: sw-resize; }
#canvas-interaction.cursor-se-resize { cursor: se-resize; }
#canvas-interaction.cursor-n-resize { cursor: n-resize; }
#canvas-interaction.cursor-s-resize { cursor: s-resize; }
#canvas-interaction.cursor-e-resize { cursor: e-resize; }
#canvas-interaction.cursor-w-resize { cursor: w-resize; }

/* Canvas document area visualization */
.canvas-document-bounds {
    position: absolute;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 0;
}

/* Grid overlay styles (drawn on canvas but CSS for reference) */
.grid-major {
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 1;
}

.grid-minor {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 0.5;
}

/* Rulers */
.ruler {
    position: absolute;
    background: var(--bg-tertiary);
    z-index: 10;
}

.ruler-horizontal {
    top: 0;
    left: 20px;
    right: 0;
    height: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ruler-vertical {
    top: 20px;
    left: 0;
    bottom: 0;
    width: 20px;
    border-right: 1px solid var(--border-color);
}

.ruler-corner {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    z-index: 11;
}

/* Selection box (marque) */
.selection-marquee {
    position: absolute;
    border: 1px dashed var(--accent-primary);
    background: rgba(74, 158, 255, 0.1);
    pointer-events: none;
    z-index: 100;
}

/* Transform handles */
.transform-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: white;
    border: 1px solid var(--accent-primary);
    border-radius: 1px;
    pointer-events: auto;
}

.transform-handle.corner {
    width: 8px;
    height: 8px;
}

.transform-handle.edge {
    width: 6px;
    height: 6px;
}

.transform-handle.rotation {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: grab;
}

/* Info overlay (coordinates, dimensions while dragging) */
.canvas-info-overlay {
    position: absolute;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 11px;
    font-family: var(--font-mono);
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 200;
}

/* Zoom indicator */
.zoom-indicator {
    position: absolute;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
    color: var(--text-secondary);
    z-index: 50;
}

/* Text Editor Overlay */
.text-editor-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.text-editor-input {
    pointer-events: auto;
    resize: none;
    border: 2px solid var(--accent-primary, #4a9eff);
    border-radius: 2px;
    outline: none;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    padding: 4px 6px;
    box-sizing: border-box;
    overflow: hidden;
    font-family: inherit;
    line-height: inherit;
    min-width: 100px;
    min-height: 30px;
}

.text-editor-input:focus {
    border-color: var(--accent-secondary, #6db3ff);
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.3);
}
