/* ========================================
   DeltaGame Level Editor Styles
======================================== */

/* ========================================
   Editor Layout
======================================== */
#editor-screen {
    z-index: 40;
    display: flex;
    flex-direction: column;
}

#editor-screen.hidden {
    display: none;
}

.editor-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #1a1a2e;
}

/* ========================================
   Top Menu Bar
======================================== */
.editor-menubar {
    display: flex;
    align-items: center;
    height: 36px;
    background: linear-gradient(180deg, #2d2d44 0%, #1f1f33 100%);
    border-bottom: 2px solid #0f0f1a;
    padding: 0 8px;
    gap: 4px;
    z-index: 100;
}

.menu-item {
    position: relative;
    font-family: var(--pixel-font);
    font-size: 10px;
    color: #c8c8d8;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: #2d2d44;
    border: 2px solid #0f0f1a;
    border-radius: 4px;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 200;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.dropdown-item {
    font-family: var(--pixel-font);
    font-size: 9px;
    color: #c8c8d8;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.dropdown-item:hover {
    background: #4a4a6a;
    color: #fff;
}

.dropdown-item:first-child {
    border-radius: 2px 2px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 2px 2px;
}

/* ========================================
   Main Editor Area
======================================== */
.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========================================
   Workspace Panel (Left)
======================================== */
.workspace-panel {
    width: 200px;
    min-width: 200px;
    background: #16162a;
    border-right: 2px solid #0f0f1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #1f1f38;
    border-bottom: 1px solid #0f0f1a;
}

.panel-title {
    font-family: var(--pixel-font);
    font-size: 10px;
    color: #a8a8c0;
}

.panel-add-btn {
    width: 20px;
    height: 20px;
    background: #3a3a5a;
    border: none;
    border-radius: 4px;
    color: #88ff88;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.panel-add-btn:hover {
    background: #4a4a7a;
}

.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 4px;
    background: #22223a;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.room-item:hover {
    background: #2a2a4a;
}

.room-item.active {
    background: #3a3a6a;
    border-left: 3px solid #ffaa00;
}

.room-name {
    font-family: var(--pixel-font);
    font-size: 9px;
    color: #c8c8d8;
}

.room-add-obj-btn {
    width: 18px;
    height: 18px;
    background: transparent;
    border: 1px solid #5a5a7a;
    border-radius: 3px;
    color: #88aaff;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.15s;
}

.room-add-obj-btn:hover {
    opacity: 1;
    background: #3a3a5a;
}

/* ========================================
   Object Picker Modal
======================================== */
.object-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 500;
}

.object-picker-modal.visible {
    display: flex;
}

.object-picker {
    width: 600px;
    max-height: 80vh;
    background: #1f1f38;
    border: 2px solid #3a3a5a;
    border-radius: 8px;
    overflow: hidden;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #2a2a48;
    border-bottom: 2px solid #0f0f1a;
}

.picker-title {
    font-family: var(--pixel-font);
    font-size: 12px;
    color: #fff;
}

.picker-close {
    width: 24px;
    height: 24px;
    background: #5a3a3a;
    border: none;
    border-radius: 4px;
    color: #ff8888;
    font-size: 14px;
    cursor: pointer;
}

.picker-close:hover {
    background: #7a4a4a;
}

.picker-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #1a1a30;
    border-bottom: 1px solid #0f0f1a;
}

.category-btn {
    font-family: var(--pixel-font);
    font-size: 8px;
    padding: 8px 12px;
    background: #2a2a4a;
    border: none;
    border-radius: 4px;
    color: #a8a8c0;
    cursor: pointer;
    transition: all 0.15s;
}

.category-btn:hover,
.category-btn.active {
    background: #4a4a7a;
    color: #fff;
}

.picker-objects {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.picker-object {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    background: #2a2a4a;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.picker-object:hover {
    background: #3a3a5a;
    border-color: #5a5a8a;
}

.picker-object.selected {
    background: #3a4a6a;
    border-color: #ffaa00;
}

.picker-object img {
    width: 32px;
    height: 32px;
    image-rendering: pixelated;
    margin-bottom: 6px;
}

.picker-object span {
    font-family: var(--pixel-font);
    font-size: 6px;
    color: #a8a8c0;
    text-align: center;
}

/* ========================================
   Canvas Area (Center)
======================================== */
.canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #0a0a18;
}

#editor-canvas {
    position: absolute;
    top: 0;
    left: 0;
    image-rendering: pixelated;
}

/* Cursor modes */
.canvas-container.mode-place {
    cursor: url('../Place.png') 8 8, crosshair;
}

.canvas-container.mode-delete {
    cursor: url('../Delete.png') 8 8, not-allowed;
}

.canvas-container.mode-pan {
    cursor: grab;
}

.canvas-container.mode-panning {
    cursor: grabbing;
}

/* ========================================
   Properties Panel (Right)
======================================== */
.properties-panel {
    width: 240px;
    min-width: 240px;
    background: #16162a;
    border-left: 2px solid #0f0f1a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.properties-content {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.property-empty {
    font-family: var(--pixel-font);
    font-size: 8px;
    color: #5a5a7a;
    text-align: center;
    padding: 20px;
}

.property-section {
    margin-bottom: 16px;
}

.property-section-title {
    font-family: var(--pixel-font);
    font-size: 9px;
    color: #8888aa;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #2a2a4a;
}

.property-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.property-label {
    font-family: var(--pixel-font);
    font-size: 8px;
    color: #a8a8c0;
}

.property-input {
    width: 80px;
    padding: 6px 8px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 9px;
}

.property-input:focus {
    outline: none;
    border-color: #ffaa00;
}

.property-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #ffaa00;
}

.property-select {
    width: 120px;
    padding: 6px 8px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 8px;
}

/* ========================================
   Current Tool Indicator
======================================== */
.tool-indicator {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    z-index: 50;
}

.tool-indicator img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.tool-indicator span {
    font-family: var(--pixel-font);
    font-size: 10px;
    color: #c8c8d8;
}

/* ========================================
   Toolbar
======================================== */
.editor-toolbar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(30, 30, 50, 0.9);
    border: 2px solid #3a3a5a;
    border-radius: 8px;
    z-index: 50;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    background: #2a2a4a;
    border: 2px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.toolbar-btn img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
}

.toolbar-btn:hover {
    background: #3a3a5a;
}

.toolbar-btn.active {
    background: #4a4a6a;
    border-color: #ffaa00;
}

/* ========================================
   Room Context Menu
======================================== */
.room-context-menu {
    position: fixed;
    min-width: 120px;
    background: #2a2a48;
    border: 2px solid #3a3a5a;
    border-radius: 6px;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    overflow: hidden;
}

.context-item {
    font-family: var(--pixel-font);
    font-size: 9px;
    color: #c8c8d8;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.1s;
}

.context-item:hover {
    background: #4a4a6a;
    color: #fff;
}

.context-item.context-delete {
    color: #ff8888;
}

.context-item.context-delete:hover {
    background: #5a3a3a;
    color: #ff6666;
}

/* ========================================
   Link Button and Tags
======================================== */
.property-btn {
    padding: 6px 10px;
    font-family: var(--pixel-font);
    font-size: 8px;
    background: #3a5a3a;
    border: none;
    border-radius: 4px;
    color: #88ff88;
    cursor: pointer;
    transition: all 0.15s;
}

.property-btn:hover {
    background: #4a7a4a;
}

.link-btn {
    background: #3a5a6a;
    color: #88ddff;
}

.link-btn:hover {
    background: #4a7a8a;
}

.linked-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
    padding: 8px;
    background: #1a1a30;
    border-radius: 4px;
    min-height: 24px;
}

.linked-tag {
    font-family: var(--pixel-font);
    font-size: 7px;
    padding: 4px 8px;
    background: #3a5a6a;
    border-radius: 3px;
    color: #88ddff;
}

/* ========================================
   Canvas Cursor - Hidden by default
======================================== */
.canvas-container {
    cursor: none;
}

.canvas-container.mode-panning {
    cursor: grabbing;
}

/* ========================================
   Property Note
======================================== */
.property-note {
    font-family: var(--pixel-font);
    font-size: 7px;
    color: #6a6a8a;
    font-style: italic;
    padding: 4px 0;
    margin-bottom: 8px;
}

/* ========================================
   Level Settings Modal
======================================== */
.level-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 600;
}

.level-settings-modal.visible {
    display: flex;
}

.level-settings {
    width: 400px;
    background: #1f1f38;
    border: 2px solid #3a3a5a;
    border-radius: 8px;
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #2a2a48;
    border-bottom: 2px solid #0f0f1a;
}

.settings-title {
    font-family: var(--pixel-font);
    font-size: 12px;
    color: #fff;
}

.settings-close {
    width: 24px;
    height: 24px;
    background: #5a3a3a;
    border: none;
    border-radius: 4px;
    color: #ff8888;
    font-size: 14px;
    cursor: pointer;
}

.settings-close:hover {
    background: #7a4a4a;
}

.settings-content {
    padding: 20px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.settings-label {
    font-family: var(--pixel-font);
    font-size: 10px;
    color: #a8a8c0;
}

.settings-select {
    width: 160px;
    padding: 8px 12px;
    background: #2a2a4a;
    border: 1px solid #3a3a5a;
    border-radius: 4px;
    color: #fff;
    font-family: var(--pixel-font);
    font-size: 10px;
}

.settings-select:focus {
    outline: none;
    border-color: #ffaa00;
}

.settings-note {
    font-family: var(--pixel-font);
    font-size: 8px;
    color: #6a6a8a;
    font-style: italic;
    margin-top: 8px;
}

.settings-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px;
    background: #1a1a30;
    border-top: 1px solid #0f0f1a;
}

.settings-save-btn {
    padding: 10px 24px;
    font-family: var(--pixel-font);
    font-size: 10px;
    background: #3a6a3a;
    border: none;
    border-radius: 4px;
    color: #88ff88;
    cursor: pointer;
    transition: all 0.15s;
}

.settings-save-btn:hover {
    background: #4a8a4a;
}

/* ========================================
   Game Screen (Test Mode)
======================================== */
#game-screen {
    z-index: 50;
}

#game-screen.hidden {
    display: none;
}

.game-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

#game-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.game-hint {
    position: absolute;
    top: 16px;
    right: 16px;
    font-family: var(--pixel-font);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}