:root {
    --primary: #50dcff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none; /* Crucial for a drawing app so double clicks don't highlight UI */
}

body {
    background-color: #050a12;
    color: white;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app-root {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Let clicks pass through empty spaces! */
    z-index: 1000;
}

.glass-panel {
    pointer-events: auto; /* Catch clicks on UI */
}

/* 
 * The Multi-Layer Canvas Container 
 * We position this to span the entire screen behind the glass UI
 */
#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    overflow: hidden;
    cursor: crosshair;
    z-index: 10;
}

/* 
 * Each drawing layer will be an absolutely positioned canvas element
 * spanning the entire container width/height naturally
 */
.drawing-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* 
 * We use an invisible top-level overlay canvas specifically 
 * for capturing high-speed Pointer Events and drawing the selection box
 */
#interaction-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
}

/* --- Glassmorphism UI Panels --- */
.glass-panel {
    position: absolute;
    background: rgba(20, 25, 35, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(80, 220, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10000;
}

/* 1. Tool Palette (Left side) */
#tool-palette {
    top: 60px;
    left: 15px;
    width: 50px;
    padding: 10px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 8px;
}

.tool-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 4px;
    box-sizing: border-box;
    display: inline-flex;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.tool-btn.active {
    background: var(--primary);
    color: #050a12;
    box-shadow: 0 0 10px rgba(80, 220, 255, 0.5);
}

/* 2. Top Bar (Color & Properties) */
#top-bar {
    top: 10px;
    left: 15px;
    right: 15px;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: #50dcff; transform: scale(1.2); }

#brush-size-slider {
    width: 120px;
    accent-color: #50dcff;
}

/* 3. Layers Panel (Right side) */
#layers-panel {
    top: 60px;
    right: 15px;
    width: 215px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 12px 15px;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.new-layer-btn {
    background: rgba(80, 220, 255, 0.2);
    border: 1px solid rgba(80, 220, 255, 0.5);
    color: #50dcff;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
}
.new-layer-btn:hover { background: rgba(80, 220, 255, 0.4); }

#layers-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.layer-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.1s;
}

.layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.layer-item.active {
    background: rgba(80, 220, 255, 0.15);
    border-color: rgba(80, 220, 255, 0.5);
}

.layer-vis-btn {
    margin-right: 10px;
    cursor: pointer;
    font-size: 14px;
    width: 20px;
    text-align: center;
}
.layer-name {
    flex: 1;
    font-size: 13px;
}

.layer-op {
    font-size: 11px;
    color: #aaa;
}
