/* Unified Workspace Styles */
/* TouchDesigner-style layout with integrated panels */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: #161616;
    height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    color: #fff;
}

/* Menu Bar */
.workspace-menu-bar {
    height: 40px;
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    padding: 0 12px;
    flex-shrink: 0;
    z-index: 1000;
}

.menu-bar-section {
    display: flex;
    gap: 8px;
}

.menu-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    user-select: none;
}

.menu-item:hover {
    background: #2a2a2a;
    color: #fff;
}

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

/* Panel Base Styles */
.workspace-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #1e1e1e;
}

.workspace-panel-left {
    width: 280px;
    min-width: 200px;
    max-width: 400px;
    border-right: 1px solid #333;
}

.workspace-panel-center {
    flex: 1;
    min-width: 0;
    background: #161616;
}

.workspace-panel-right {
    width: 320px;
    min-width: 200px;
    max-width: 800px;
    border-left: 1px solid #333;
}

/* Resize Handles */
.workspace-resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: transparent;
    cursor: col-resize;
    z-index: 100;
    transition: background 0.2s;
}

.workspace-resize-handle:hover {
    background: #4a9eff;
}

.workspace-resize-handle-right {
    right: -2px;
}

.workspace-resize-handle-left {
    left: -2px;
}

.workspace-resize-handle.resizing {
    background: #4a9eff;
}

/* Panel Containers */
.operator-library-panel {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.canvas-workspace {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.parameters-panel-container,
.viewport-panel-container {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.parameters-panel,
.viewport-panel {
    width: 100%;
    height: 100%;
    overflow: hidden;
}


/* Panel Toggle Button */
.panel-toggle-button {
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: color 0.2s;
    padding: 0;
    margin-left: 4px;
}

.panel-toggle-button:hover {
    color: #fff;
}

.panel-toggle-button.active {
    color: #4a9eff;
}

/* Responsive Adjustments */
@media (max-width: 1280px) {
    .workspace-panel-left {
        min-width: 200px;
    }
    
    .workspace-panel-right {
        min-width: 200px;
    }
}

/* Mobile Overlay Message */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #161616 0%, #1a2a1a 100%);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

.mobile-overlay-content {
    max-width: 400px;
}

.mobile-overlay h2 {
    color: #7FFF00;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(127, 255, 0, 0.4);
}

.mobile-overlay p {
    color: #ccc;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.mobile-overlay-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 10px rgba(127, 255, 0, 0.3));
}

.mobile-overlay a {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: #7FFF00;
    color: #000;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(127, 255, 0, 0.4);
}

.mobile-overlay a:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(127, 255, 0, 0.6);
}

/* Loading State */
.workspace-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

/* Matrix View Panel Styles */
.matrix-view-header {
    padding: 12px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
}

.matrix-view-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

.matrix-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.matrix-play-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.matrix-play-btn:hover {
    background: #3a3a3a;
}

.matrix-frame-display {
    font-size: 12px;
    color: #ccc;
    min-width: 100px;
    text-align: right;
}

.matrix-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
    cursor: pointer;
}

.matrix-controls input[type="checkbox"] {
    cursor: pointer;
}

.matrix-grid-container {
    flex: 1;
    overflow: auto;
    padding: 12px;
    display: grid;
    gap: 8px;
    background: #161616;
}

.matrix-panel {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.matrix-panel.no-signal {
    opacity: 0.5;
    border-color: #222;
}

.matrix-panel canvas {
    width: 100%;
    height: calc(100% - 40px);
    display: block;
    background: #0a0a0a;
}

.matrix-panel-label {
    padding: 4px 8px;
    font-size: 11px;
    color: #ccc;
    background: #222;
    border-top: 1px solid #333;
    text-align: center;
    font-weight: 500;
}

.matrix-panel-timeline {
    height: 20px;
    background: #222;
    border-top: 1px solid #333;
    position: relative;
}

/* Grid layout - adjust based on grid_rows and grid_cols */
.matrix-grid-container[data-rows="5"][data-cols="6"] {
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(5, 1fr);
}

.matrix-grid-container[data-rows="4"][data-cols="5"] {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(4, 1fr);
}

.matrix-grid-container[data-rows="3"][data-cols="4"] {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
}

