/* Level Editor Overlay Styles */

.level-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
}

.editor-panel {
    position: absolute;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid var(--kirby-ink);
    padding: 0.75rem;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-size: 0.7rem;
}

/* Draggable panels */
.editor-panel.draggable {
    z-index: 100;
}

.editor-panel.draggable .drag-handle {
    cursor: grab;
    background: #333;
    color: #fff;
    padding: 4px 8px;
    margin: -0.75rem -0.75rem 0.5rem -0.75rem;
    font-size: 8px;
    font-weight: bold;
    user-select: none;
    text-align: center;
}

.editor-panel.draggable .drag-handle:hover {
    background: #555;
}

.editor-panel.draggable.is-dragging {
    opacity: 0.8;
    z-index: 1000;
}

.editor-panel.draggable.is-dragging .drag-handle {
    cursor: grabbing;
    background: #007bff;
}

/* Top Left: Main Controls */
.editor-panel.top-left {
    top: 10px;
    left: 10px;
    flex-direction: row;
    gap: 0.5rem;
}

/* Top Center: Sky (Exterior) */
.editor-panel.top-center {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

/* Center: House (Exterior) */
.editor-panel.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

/* Right Side: Trees (Exterior) */
.editor-panel.right-trees {
    top: 25%;
    right: 100px;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

/* Bottom Left: Ambient Sound */
.editor-panel.bottom-left {
    bottom: 10px;
    left: 10px;
}

/* Bottom Right: Placement Tools */
.editor-panel.bottom-right {
    bottom: 10px;
    right: 10px;
    min-width: 300px;
}

/* Interior Panels */
.editor-panel.int-wallpaper {
    top: 100px;
    left: 100px;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.editor-panel.int-sound {
    top: 10px;
    right: 100px;
}

.editor-panel.int-view {
    top: 280px;
    right: 100px;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.editor-panel.int-person {
    top: 50%;
    left: 100px;
    transform: translateY(-50%);
}

.editor-panel.int-flowers {
    bottom: 10px;
    left: 10px;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.editor-panel.int-rug {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    z-index: 250; /* Above paint toolbar (z-index: 200) */
}

/* Labels */
.editor-label {
    font-weight: bold;
    color: var(--kirby-ink);
    white-space: nowrap;
    font-size: 0.7rem;
}

/* Item Gallery */
.item-gallery {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid var(--kirby-ink);
}

.gallery-item {
    cursor: pointer;
    transition: transform 0.1s;
}

.gallery-item:hover {
    transform: scale(1.1);
}

.gallery-box {
    width: 20px;
    height: 20px;
    background: var(--kirby-cream);
    border: 2px solid var(--kirby-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: bold;
}

.gallery-item.active .gallery-box {
    background: var(--kirby-yellow);
    border-color: var(--kirby-ink);
    box-shadow: 0 0 0 2px var(--kirby-blue);
}

/* Preview images in gallery */
.gallery-box.blockie-box,
.gallery-box.sprite-box {
    width: 50px;
    height: 50px;
    padding: 2px;
    background: var(--kirby-cream);
}

.gallery-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Button Overrides */
.editor-panel .nes-btn {
    font-size: 0.65rem;
    padding: 0.4rem 0.8rem;
}

.editor-panel .nes-btn.is-small {
    font-size: 0.6rem;
    padding: 0.3rem 0.6rem;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .editor-panel {
        font-size: 0.6rem;
        padding: 0.5rem;
    }

    .editor-panel.top-left {
        flex-direction: column;
    }

    .editor-panel.bottom-right {
        min-width: 200px;
    }

    .item-gallery {
        grid-template-columns: repeat(6, 1fr);
    }

    .gallery-box {
        width: 18px;
        height: 18px;
        font-size: 0.5rem;
    }
}

/* Paint Toolbar */
#paint-toolbar {
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    min-width: 600px;
}

#paint-toolbar .drag-handle {
    margin-bottom: 0.3rem;
}

.paint-tools-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.paint-tools-group {
    display: flex;
    gap: 0.3rem;
}

.paint-settings-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.paint-actions-group {
    display: flex;
    gap: 0.3rem;
}

.paint-tool-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #333;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.paint-tool-btn:hover {
    background: #e0e0e0;
}

.paint-tool-btn.active {
    background: #4a90d9;
    border-color: #2a70b9;
}

.paint-icon {
    font-size: 16px;
}

.paint-label {
    font-size: 8px;
    font-weight: bold;
    color: #333;
}

.paint-slider {
    width: 80px;
    height: 16px;
    cursor: pointer;
}

.paint-size-display {
    font-size: 10px;
    min-width: 20px;
    text-align: center;
}

.paint-color-input {
    width: 32px;
    height: 24px;
    border: 2px solid #333;
    padding: 0;
    cursor: pointer;
}

/* Paint canvas styling */
#level-editor-paint-canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
