/* Elseland Studio — Layout & Styles */

.studio-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #12141c;
    color: #ccc;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
}

/* ── Menubar ── */
.studio-menubar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 36px;
    padding: 0 8px;
    background: #1a1e2a;
    border-bottom: 1px solid #2a2e40;
    flex-shrink: 0;
}

.studio-menu-btn {
    padding: 4px 10px;
    font-size: 11px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    color: #aaa;
    cursor: pointer;
    transition: background 0.15s;
}
.studio-menu-btn:hover { background: rgba(255,255,255,0.12); color: #ddd; }

.studio-title-input {
    background: transparent;
    border: 1px solid transparent;
    color: #ddd;
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    width: 160px;
}
.studio-title-input:focus {
    border-color: #6080ff;
    outline: none;
    background: rgba(0,0,0,0.2);
}

.studio-play-btn {
    padding: 5px 16px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(80,180,80,0.2);
    border: 1px solid rgba(80,180,80,0.4);
    border-radius: 6px;
    color: #8fc88f;
    cursor: pointer;
    transition: all 0.15s;
}
.studio-play-btn:hover { background: rgba(80,180,80,0.35); }
.studio-play-btn.playing {
    background: rgba(255,80,80,0.2);
    border-color: rgba(255,80,80,0.4);
    color: #f88;
}
.studio-play-btn.playing:hover { background: rgba(255,80,80,0.35); }

/* ── Main layout ── */
.studio-main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Scene tree (left) ── */
.studio-tree {
    width: 180px;
    min-width: 140px;
    background: #161822;
    border-right: 1px solid #2a2e40;
    overflow-y: auto;
    flex-shrink: 0;
}

.studio-tree-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 10px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid #2a2e40;
}

.studio-tree-add {
    width: 18px;
    height: 18px;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    background: rgba(100,140,255,0.15);
    border: 1px solid rgba(100,140,255,0.3);
    border-radius: 3px;
    color: #6080ff;
    cursor: pointer;
}
.studio-tree-add:hover { background: rgba(100,140,255,0.3); }

.studio-tree-item {
    padding: 4px 8px 4px 14px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-left: 2px solid transparent;
    transition: background 0.1s;
}
.studio-tree-item:hover { background: rgba(255,255,255,0.04); color: #bbb; }
.studio-tree-item.active {
    background: rgba(100,140,255,0.1);
    border-left-color: #6080ff;
    color: #ddd;
}

/* ── Viewport (center) ── */
.studio-viewport {
    flex: 1;
    min-width: 300px;
    position: relative;
    background: #111;
}

/* ── Right column ── */
.studio-right {
    width: 280px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #2a2e40;
    flex-shrink: 0;
}

/* ── Inspector (top-right) ── */
.studio-inspector {
    flex: 0 0 auto;
    max-height: 45%;
    overflow-y: auto;
    padding: 6px;
    border-bottom: 1px solid #2a2e40;
    background: #161822;
}

/* ── Code panel (bottom-right) ── */
.studio-code {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #0d1117;
}

.studio-code-tabs {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #2a2e40;
    background: #161822;
    padding: 0 4px;
}

.studio-code-tab {
    padding: 5px 12px;
    font-size: 10px;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.studio-code-tab.active { color: #a0c0ff; border-bottom-color: #6080ff; background: rgba(100,140,255,0.05); }
.studio-code-tab:hover { color: #aaa; }

.studio-code-editor {
    flex: 1;
    width: 100%;
    padding: 8px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    line-height: 1.5;
    tab-size: 2;
    background: #0d1117;
    color: #c9d1d9;
    border: none;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

.studio-api-hint {
    padding: 6px 8px;
    font-size: 9px;
    color: #556;
    background: rgba(0,0,0,0.3);
    border-top: 1px solid #1a1e28;
    line-height: 1.5;
    flex-shrink: 0;
}
.studio-api-hint b { color: #6080ff; }
.studio-api-hint span { color: #4a5568; }

/* ── Console (bottom) ── */
.studio-console {
    height: 100px;
    min-height: 60px;
    border-top: 1px solid #2a2e40;
    background: #0d1117;
    flex-shrink: 0;
}

.studio-console-header {
    padding: 3px 8px;
    font-size: 10px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid #1a1e28;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.studio-console-clear {
    width: 16px;
    height: 16px;
    font-size: 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.studio-console-clear:hover { background: rgba(255,80,80,0.15); color: #f88; border-color: rgba(255,80,80,0.3); }

.studio-console-logs {
    height: calc(100% - 22px);
    overflow-y: auto;
    padding: 4px 8px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Inspector sections ── */
.studio-insp-section {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    font-size: 10px;
    font-weight: 600;
    color: #8090b0;
    cursor: pointer;
    user-select: none;
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
    margin: 4px 0 2px;
    transition: background 0.1s;
}
.studio-insp-section:hover { background: rgba(96,128,255,0.08); }
.studio-insp-arrow {
    font-size: 8px;
    color: #556;
    width: 10px;
    text-align: center;
}
.studio-insp-body {
    padding: 2px 0 4px;
}

/* ── Shared components ── */
.studio-hint {
    padding: 16px;
    text-align: center;
    color: #556;
    font-size: 11px;
}

.studio-prop-row {
    padding: 3px 0;
}

.studio-prop-label {
    font-size: 10px;
    color: #888;
    margin-bottom: 2px;
}

.studio-input, .studio-select {
    width: 100%;
    padding: 3px 6px;
    font-size: 11px;
    background: rgba(0,0,0,0.3);
    border: 1px solid #2a2e40;
    border-radius: 3px;
    color: #ccc;
    box-sizing: border-box;
}
.studio-input:focus, .studio-select:focus {
    border-color: #6080ff;
    outline: none;
}

.studio-input-sm {
    padding: 2px 6px;
    font-size: 11px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #ddd;
}
.studio-input-sm:focus { border-color: #6080ff; outline: none; background: rgba(0,0,0,0.2); }

.studio-btn {
    padding: 5px 12px;
    font-size: 11px;
    background: rgba(100,140,255,0.15);
    border: 1px solid rgba(100,140,255,0.3);
    border-radius: 4px;
    color: #8090cc;
    cursor: pointer;
}
.studio-btn:hover { background: rgba(100,140,255,0.25); }

.studio-btn-danger {
    background: rgba(255,80,80,0.15);
    border-color: rgba(255,80,80,0.3);
    color: #f88;
}
.studio-btn-danger:hover { background: rgba(255,80,80,0.25); }

.studio-btn-sm {
    padding: 3px 8px;
    font-size: 10px;
    background: rgba(100,140,255,0.1);
    border: 1px solid rgba(100,140,255,0.2);
    border-radius: 4px;
    color: #7090bb;
    cursor: pointer;
}
.studio-btn-sm:hover { background: rgba(100,140,255,0.2); }

.studio-tag {
    font-size: 9px;
    padding: 2px 7px;
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: #666;
}
.studio-tag:hover { background: rgba(255,255,255,0.1); }
.studio-tag.active {
    background: rgba(100,180,100,0.2);
    border-color: rgba(100,180,100,0.4);
    color: #8fc88f;
}

/* ── Tree item layout ── */
.studio-tree-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.studio-tree-eye {
    font-size: 8px;
    width: 14px;
    text-align: center;
    color: #555;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.4;
    transition: opacity 0.15s;
}
.studio-tree-item:hover .studio-tree-eye { opacity: 1; }
.studio-tree-eye.off { color: #444; opacity: 0.2; }
.studio-tree-eye:hover { color: #8af !important; opacity: 1 !important; }
.studio-tree-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Viewport toolbar ── */
.studio-vp-toolbar {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    background: rgba(22, 24, 34, 0.85);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    backdrop-filter: blur(8px);
}
.studio-vp-group {
    display: flex;
    gap: 2px;
}
.studio-vp-btn {
    width: 28px;
    height: 26px;
    font-size: 13px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.studio-vp-btn:hover { background: rgba(255,255,255,0.08); color: #bbb; }
.studio-vp-btn.active {
    background: rgba(96,128,255,0.2);
    border-color: rgba(96,128,255,0.4);
    color: #8ab4ff;
}
.studio-vp-sep {
    width: 1px;
    height: 18px;
    background: rgba(255,255,255,0.1);
    margin: 0 2px;
}

/* ── Resizer handles ── */
.studio-resizer-v {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
}
.studio-resizer-v:hover,
.studio-resizer-v:active { background: rgba(96,128,255,0.4); }

.studio-resizer-h {
    height: 4px;
    cursor: row-resize;
    background: transparent;
    flex-shrink: 0;
    transition: background 0.15s;
}
.studio-resizer-h:hover,
.studio-resizer-h:active { background: rgba(96,128,255,0.4); }

/* ── Scrollbar ── */
.studio-tree::-webkit-scrollbar,
.studio-inspector::-webkit-scrollbar,
.studio-console-logs::-webkit-scrollbar {
    width: 5px;
}
.studio-tree::-webkit-scrollbar-thumb,
.studio-inspector::-webkit-scrollbar-thumb,
.studio-console-logs::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}
