:root {
    /* Roblox Studio Dark Theme */
    --bg-studio: #2d2d2d;
    --bg-sidebar: #222222;
    --bg-editor: #1b1b1b;
    --bg-header: #3e3e3e;
    --bg-input: #1a1a1a;
    --border: #161616;
    --accent: #00a2ff;
    --accent-hover: #0081cc;
    
    --text: #cccccc;
    --text-bright: #ffffff;
    --text-dim: #858585;
    
    --sidebar-width: 280px;
    --inspector-width: 320px;
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    user-select: none;
}

body {
    background: var(--bg-studio);
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Ribbon / Toolbar */
.ribbon {
    height: 90px;
    background: var(--bg-studio);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    padding: 0 10px;
    gap: 0;
}

.ribbon-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 15px;
    border-right: 1px solid var(--border);
    min-width: 80px;
}

.ribbon-group:last-child { border-right: none; }

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
    width: 100%;
}

.tool-btn:hover { background: var(--bg-header); }
.tool-btn.active { background: var(--bg-header); box-shadow: inset 0 0 0 1px var(--accent); }
.tool-btn svg { width: 20px; height: 20px; color: var(--text-bright); }
.tool-btn span { font-size: 11px; font-weight: 500; color: var(--text-bright); }

.ribbon-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    margin-top: 8px;
    text-transform: uppercase;
}

/* Main Workspace */
.workspace {
    flex: 1;
    display: flex;
    min-height: 0;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar.inspector-panel {
    width: var(--inspector-width);
    border-right: none;
    border-left: 1px solid var(--border);
}

.section-header {
    height: 28px;
    background: #333;
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-bright);
    border-bottom: 1px solid var(--border);
}

.main-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-editor);
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background-image: radial-gradient(#333 1px, transparent 1px);
    background-size: 20px 20px;
    padding: 100px;
}

.viewport {
    background: #000; 
    width: 800px;
    height: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
    outline: 1px solid #444;
}

/* Explorer */
.explorer {
    flex: 1;
    overflow-y: auto;
}

.explorer-item {
    display: flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    gap: 8px;
}

.explorer-item:hover { background: #333; }
.explorer-item.selected { background: var(--accent); color: #fff; }

/* Inspector / Properties */
.properties {
    flex: 1;
    overflow-y: auto;
}

.prop-category {
    background: #2a2a2a;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
}

.prop-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    border-bottom: 1px solid var(--border);
    min-height: 28px;
}

.prop-label {
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text);
    border-right: 1px solid var(--border);
    display: flex;
    align-items: center;
    background: #222;
}

.prop-value {
    padding: 0 8px;
    display: flex;
    align-items: center;
    background: #1a1a1a;
}

.prop-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 12px;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
}

/* Context Menu */
.context-menu {
    position: fixed;
    background: #252525;
    border: 1px solid #444;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    padding: 4px 0;
    z-index: 1000;
    min-width: 180px;
    border-radius: 4px;
}

.menu-item {
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.menu-item:hover { background: var(--accent); color: #fff; }

/* Resize Handles */
.handle {
    width: 8px;
    height: 8px;
    background: #fff;
    border: 2px solid var(--accent);
    position: absolute;
    z-index: 100;
    border-radius: 50%;
}

/* Animations */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px) rotate(-1deg); }
    50% { transform: translateX(5px) rotate(1deg); }
    75% { transform: translateX(-5px) rotate(-1deg); }
    100% { transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.anim-pulse.play-mode:hover {
    animation: pulse 1s infinite ease-in-out;
}

.shake-active {
    animation: shake 0.4s ease-in-out;
}

.handle-nw { top: -5px; left: -5px; cursor: nw-resize; }
.handle-ne { top: -5px; right: -5px; cursor: ne-resize; }
.handle-sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.handle-se { bottom: -5px; right: -5px; cursor: se-resize; }

/* Output Drawer */
.output-drawer {
    height: 240px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.status-bar {
    height: 24px;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-weight: 600;
}

/* Canvas Element Selection */
.canvas-element.selected::after {
    content: '';
    position: absolute;
    inset: -2px;
    border: 2px solid var(--accent);
    pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #333; border: 3px solid #1a1a1a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

.hidden { display: none !important; }
