/* Viewport Emulator Panel — sidebar + tabbed layout */

/* Preview layer: flex row with preview area + sidebar */
#viewport-emulator-preview-layer {
    position: fixed;
    inset: 0;
    z-index: 99996;
    background: #111111;
    display: flex;
    flex-direction: row;
}

/* Preview area fills remaining space next to sidebar */
#ve-preview-area {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Panel: right sidebar, full height, flex column */
#viewport-emulator-panel {
    width: 320px;
    flex-shrink: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(30, 30, 30, 0.98);
    border-left: 1px solid #3e3e42;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    color: #d4d4d4;
    pointer-events: auto;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

/* Panel header: always visible, scene selector + close */
#ve-panel-header {
    padding: 10px 14px 8px;
    border-bottom: 1px solid #3e3e42;
    flex-shrink: 0;
}

#ve-panel-header .ve-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

#ve-panel-header .ve-header-title {
    font-size: 12px;
    font-weight: 600;
    color: #e0e0e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#ve-panel-header .ve-close-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #888;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 4px;
}

#ve-panel-header .ve-close-btn:hover {
    background: #3e3e42;
    color: #d4d4d4;
}

/* Tab bar */
#ve-tab-bar {
    display: flex;
    flex-shrink: 0;
    border-bottom: 1px solid #3e3e42;
    background: rgba(25, 25, 25, 0.6);
}

#ve-tab-bar button {
    flex: 1;
    padding: 7px 4px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

#ve-tab-bar button:hover {
    color: #bbb;
}

#ve-tab-bar button.active {
    color: #d4d4d4;
    border-bottom-color: #007acc;
}

/* Tab content area: scrollable, fills remaining height */
#ve-tab-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Tab panels */
#ve-tab-content .ve-tab-panel {
    padding: 10px 14px;
}

/* Terminal tab: fill all vertical space */
#ve-tab-content .ve-tab-panel[data-tab-panel="terminal"] {
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Labels */
#viewport-emulator-panel .ve-label {
    margin-bottom: 4px;
    color: #cccccc;
    font-size: 11px;
    font-weight: 500;
}

/* Section headings */
#viewport-emulator-panel .ve-heading {
    margin-top: 14px;
    margin-bottom: 6px;
    color: #e0e0e0;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #3e3e42;
    padding-bottom: 4px;
}

/* First heading in a tab panel — no top margin */
#ve-tab-content .ve-tab-panel > .ve-heading:first-child {
    margin-top: 0;
}

/* Selects */
#viewport-emulator-panel select {
    width: 100%;
    margin-bottom: 8px;
    background: #1a1a1a;
    color: #d4d4d4;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    font-family: inherit;
}

#viewport-emulator-panel select:focus {
    outline: none;
    border-color: #007acc;
}

/* Inputs (number, text) */
#viewport-emulator-panel input[type="number"],
#viewport-emulator-panel input[type="text"] {
    background: #1a1a1a;
    color: #d4d4d4;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    padding: 5px 8px;
    font-size: 12px;
    font-family: 'Consolas', 'Courier New', monospace;
}

#viewport-emulator-panel input[type="number"]:focus,
#viewport-emulator-panel input[type="text"]:focus {
    outline: none;
    border-color: #007acc;
}

/* Radio buttons and checkboxes */
#viewport-emulator-panel input[type="radio"],
#viewport-emulator-panel input[type="checkbox"] {
    accent-color: #007acc;
}

#viewport-emulator-panel label {
    cursor: pointer;
    font-size: 12px;
}

/* Buttons */
#viewport-emulator-panel .ve-btn {
    padding: 5px 10px;
    background: #2d2d30;
    color: #d4d4d4;
    border: 1px solid #3e3e42;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    transition: background 0.15s, border-color 0.15s;
}

#viewport-emulator-panel .ve-btn:hover {
    background: #3e3e42;
    border-color: #505054;
}

#viewport-emulator-panel .ve-btn-primary {
    background: #007acc;
    border-color: #007acc;
    color: #ffffff;
}

#viewport-emulator-panel .ve-btn-primary:hover {
    background: #0098ff;
    border-color: #0098ff;
}

/* Diagnostics readout */
#ve-diagnostics {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 11px;
    font-family: 'Consolas', 'Courier New', monospace;
    user-select: text;
    background: #1a1a1a;
    border: 1px solid #2d2d30;
    border-radius: 4px;
    padding: 8px 10px;
    color: #9cdcfe;
}

/* Fit test result */
#ve-fit-test-result {
    margin-bottom: 8px;
    line-height: 1.5;
    font-size: 11px;
    user-select: text;
}

/* Custom dimension row */
#ve-custom-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

#ve-custom-row input {
    width: 70px;
}

/* DPR custom row */
#ve-dpr-custom-row input {
    width: 80px;
}

/* Grid options row */
.ve-grid-options {
    margin-bottom: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.ve-grid-options select {
    width: auto;
    margin-bottom: 0;
}

/* Scrollbar for tab content */
#ve-tab-content::-webkit-scrollbar {
    width: 6px;
}

#ve-tab-content::-webkit-scrollbar-track {
    background: transparent;
}

#ve-tab-content::-webkit-scrollbar-thumb {
    background: #3e3e42;
    border-radius: 3px;
}

/* ─── CLI Section (Terminal tab) ─── */

.ve-cli-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ve-cli-section .ve-heading {
    padding: 10px 14px 4px;
    margin: 0;
    flex-shrink: 0;
}

.ve-cli-section .cli-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    background: #1a1a1a;
    border-top: 1px solid #2d2d30;
    overflow: hidden;
}

.ve-cli-section .cli-terminal {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    min-height: 80px;
}

.ve-cli-section .cli-input-container {
    border-top: 1px solid #2d2d30;
    padding: 4px 6px;
    flex-shrink: 0;
}

.ve-cli-section .cli-input {
    width: 100%;
    background: #1a1a1a;
    border: none;
    color: #d4d4d4;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 11px;
    outline: none;
    padding: 4px 2px;
}

/* ─── Scene Inspector Section (Inspector tab) ─── */

.ve-scene-inspector {
    /* No border-top needed — already in its own tab */
}

.ve-scene-inspector .ve-scene-details {
    background: #1a1a1a;
    border: 1px solid #2d2d30;
    border-radius: 4px;
    padding: 8px 10px;
    margin-top: 6px;
    font-size: 11px;
}

.ve-scene-inspector .ve-scene-field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
}

.ve-scene-inspector .ve-scene-field label {
    min-width: 100px;
    color: #9cdcfe;
    font-size: 11px;
}

.ve-scene-inspector .ve-scene-field input[type="text"],
.ve-scene-inspector .ve-scene-field input[type="number"] {
    flex: 1;
    min-width: 0;
}

.ve-scene-inspector .ve-scene-field input[type="checkbox"] {
    margin: 0;
}

.ve-scene-inspector .ve-scene-field input[type="color"] {
    width: 32px;
    height: 24px;
    padding: 0;
    border: 1px solid #3e3e42;
    background: transparent;
    cursor: pointer;
}

.ve-scene-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    margin-bottom: 6px;
}

.ve-scene-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ve-scene-status-dot.active {
    background: #4caf50;
}

.ve-scene-status-dot.inactive {
    background: #666;
}
