/**
 * V2 App-Specific Styles
 * 
 * Styles for Sleditor V2 components that aren't part of SLUI.
 * This includes the unified editor panel with project sidebar.
 */

/* ========================================
   UNIFIED EDITOR LAYOUT
   ======================================== */

/* Override window content defaults for unified editor */
.sl-window-content:has(.v2-unified-editor) {
    padding: 0;
    overflow: hidden;
}

/* Override window content defaults for unified browser */
.sl-window-content:has(.v2-unified-browser) {
    padding: 0;
    overflow: hidden;
}

.v2-unified-browser {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg-panel, #161b22);
}

/* Browser sidebar reuses project-sidebar styles */
.v2-browser-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-secondary, #161b22);
    border-right: 1px solid var(--border, rgba(255,255,255,0.1));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.v2-browser-sidebar.collapsed {
    width: 32px;
    min-width: 32px;
}

.v2-browser-sidebar.collapsed .v2-sidebar-title,
.v2-browser-sidebar.collapsed .v2-sidebar-section,
.v2-browser-sidebar.collapsed .v2-sidebar-content {
    display: none;
}

.v2-browser-sidebar.collapsed .v2-sidebar-console-toggle span:not(.v2-browser-chat-arrow) {
    display: none;
}

.v2-browser-sidebar.collapsed .v2-sidebar-console-toggle {
    padding: 5px 0;
    justify-content: center;
}

/* Override window content defaults for preview panel */
.sl-window-content:has(.v2-preview) {
    padding: 0;
    overflow: hidden;
}

/* Ensure preview container doesn't scroll - only uniforms section scrolls */
.v2-preview {
    overflow: hidden;
}

/* Uniforms content area - constrained width, scrolling handled by parent expandableContent */
.v2-shader-controls-uniforms-content {
    /* Prevent uniforms from expanding the controls bar */
    max-width: 100%;
    box-sizing: border-box;
}

/* Embedded uniforms section - constrain width */
.v2-uniforms-section-embedded {
    max-width: 100%;
    overflow: hidden;
}

/* Color row should wrap and not expand parent */
.v2-uniforms-color-row {
    max-width: 100%;
}

/* Compact color uniform in embedded mode */
.v2-uniforms-section-embedded .sl-color-uniform {
    flex-shrink: 1;
    min-width: 0;
}

/* Custom scrollbar for uniforms */
.v2-shader-controls-uniforms-content::-webkit-scrollbar {
    width: 6px;
}

.v2-shader-controls-uniforms-content::-webkit-scrollbar-track {
    background: var(--bg-panel, #21262d);
}

.v2-shader-controls-uniforms-content::-webkit-scrollbar-thumb {
    background: var(--border, rgba(255, 255, 255, 0.2));
    border-radius: 3px;
}

.v2-shader-controls-uniforms-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, #8b949e);
}

.v2-unified-editor {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg-panel, #161b22);
}

.v2-unified-main,
.v2-unified-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.v2-tab-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.v2-tab-area .sl-tabpane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.v2-tab-area .sl-tabpane-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.v2-tab-area .sl-tabpane-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.v2-no-tabs {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted, #6e7681);
    font-size: 14px;
    gap: 12px;
}

/* ========================================
   PROJECT SIDEBAR
   ======================================== */

.v2-project-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--bg-secondary, #161b22);
    border-right: 1px solid var(--border, rgba(255,255,255,0.1));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease, min-width 0.2s ease;
}

.v2-project-sidebar.collapsed {
    width: 32px;
    min-width: 32px;
}

.v2-project-sidebar.collapsed .v2-sidebar-title,
.v2-project-sidebar.collapsed .v2-sidebar-section,
.v2-project-sidebar.collapsed .v2-sidebar-content {
    display: none;
}

.v2-project-sidebar.collapsed .v2-sidebar-console-toggle span:not(.v2-sidebar-console-arrow) {
    display: none;
}

.v2-project-sidebar.collapsed .v2-sidebar-console-toggle {
    padding: 5px 0;
    justify-content: center;
}

.v2-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 10px;
    min-height: 36px;
    box-sizing: border-box;
    background: var(--bg-tertiary, #21262d);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    flex-shrink: 0;
}

.v2-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #8b949e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex: 1;
}

.v2-new-shader-btn {
    background: var(--accent, #58a6ff);
    color: var(--bg-primary, #0d1117);
    border: none;
    border-radius: 3px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.v2-new-shader-btn:hover {
    filter: brightness(1.15);
}

.v2-shader-type-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    box-sizing: border-box;
    padding: 4px 12px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted, #8b949e);
    background: var(--bg-tertiary, #21262d);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.v2-project-sidebar.collapsed .v2-new-shader-btn,
.v2-project-sidebar.collapsed .v2-shader-type-badge {
    display: none;
}

.v2-dropdown-hint {
    font-size: 9px;
    color: var(--text-muted, #6e7681);
    margin-left: 8px;
    font-style: italic;
}

.v2-sidebar-collapse {
    background: none;
    border: none;
    color: var(--text-muted, #8b949e);
    font-size: 10px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.v2-sidebar-collapse:hover {
    background: var(--bg-hover, rgba(255,255,255,0.1));
    color: var(--text-primary, #c9d1d9);
}

.v2-sidebar-sections {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ========================================
   SIDEBAR SECTIONS
   ======================================== */

.v2-sidebar-section {
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.05));
}

.v2-sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary, #161b22);
    cursor: pointer;
    user-select: none;
}

.v2-sidebar-section-header:hover {
    background: var(--bg-tertiary, #21262d);
}

.v2-section-expand {
    background: none;
    border: none;
    color: var(--text-muted, #8b949e);
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    width: 16px;
    text-align: center;
}

.v2-section-icon {
    width: 16px;
    text-align: center;
    margin-right: 4px;
}

.v2-section-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary, #8b949e);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.v2-sidebar-items {
    padding: 4px 0;
}

/* ========================================
   ADD BUTTON & DROPDOWN
   ======================================== */

.v2-add-button-container {
    position: relative;
    margin-left: auto;
}

.v2-add-button {
    background: none;
    border: none;
    color: var(--text-muted, #8b949e);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.v2-add-button:hover {
    background: var(--accent, #58a6ff);
    color: white;
}

.v2-add-dropdown {
    position: fixed;
    background: var(--bg-secondary, #161b22);
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 6px;
    padding: 4px 0;
    min-width: 140px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
}

.v2-add-dropdown.visible {
    display: block;
}

.v2-add-dropdown .v2-dropdown-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.v2-add-dropdown .v2-dropdown-item:hover:not(:disabled) {
    background: var(--bg-tertiary, #21262d);
}

.v2-add-dropdown .v2-dropdown-item:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.v2-dropdown-icon {
    font-size: 14px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.v2-dropdown-icon img {
    display: block;
}

/* SVG code-type icons — uniform height, auto width, thin dark glow for light bg */
.v2-svg-icon {
    height: 22px;
    width: auto;
    vertical-align: middle;
    filter: drop-shadow(0 0 0.5px rgba(0,0,0,0.5)) drop-shadow(0 0 1px rgba(0,0,0,0.25));
}

.v2-dropdown-label {
    font-size: 12px;
    color: var(--text-primary, #c9d1d9);
}

/* ========================================
   SIDEBAR ITEMS
   ======================================== */

.v2-sidebar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 24px;
    cursor: pointer;
    transition: background 0.15s;
    user-select: none;
}

.v2-sidebar-item:hover {
    background: var(--bg-tertiary, #21262d);
}

.v2-sidebar-item.has-tab {
    background: rgba(88, 166, 255, 0.05);
}

.v2-sidebar-item.has-tab::before {
    content: '●';
    position: absolute;
    left: 8px;
    font-size: 6px;
    color: var(--accent, #58a6ff);
}

.v2-sidebar-item.active {
    background: rgba(88, 166, 255, 0.15);
    border-left: 2px solid var(--accent, #58a6ff);
    padding-left: 22px;
}

.v2-item-icon {
    font-size: 14px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.v2-item-icon img {
    display: block;
}

.v2-item-label {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary, #c9d1d9);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-item-channel {
    font-size: 9px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 2px 4px;
    border-radius: 3px;
}

.v2-item-lock {
    font-size: 10px;
    opacity: 0.5;
}

/* ========================================
   DOCS SIDEBAR (Browser Panel)
   ======================================== */

.v2-docs-guide-header {
    position: relative;
}

.v2-docs-guide-header .v2-item-label {
    font-weight: 600;
    color: var(--text-secondary, #8b949e);
}

.v2-docs-guide-header.active .v2-item-label {
    color: var(--text-primary, #c9d1d9);
}

.v2-docs-section-item {
    position: relative;
}

.v2-docs-section-item .v2-item-label {
    color: var(--text-secondary, #8b949e);
}

.v2-docs-section-item:hover .v2-item-label {
    color: var(--text-primary, #c9d1d9);
}

.v2-docs-section-item.active {
    background: rgba(88, 166, 255, 0.12);
    border-left: 2px solid var(--accent, #58a6ff);
}

.v2-docs-section-item.active .v2-item-label {
    color: var(--text-primary, #c9d1d9);
}

/* ========================================
   CONTEXT MENU
   ======================================== */

.v2-context-menu {
    position: fixed;
    background: var(--bg-secondary, #161b22);
    border: 1px solid var(--border, rgba(255,255,255,0.15));
    border-radius: 6px;
    padding: 4px 0;
    min-width: 120px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 10000;
}

.v2-context-menu button {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    text-align: left;
    font-size: 12px;
    color: var(--text-primary, #c9d1d9);
    cursor: pointer;
    transition: background 0.15s;
}

.v2-context-menu button:hover {
    background: var(--bg-tertiary, #21262d);
}

.v2-context-menu button.danger {
    color: var(--console-error, #f85149);
}

.v2-context-menu button.danger:hover {
    background: rgba(248, 81, 73, 0.1);
}

/* ========================================
   UNIFIED TAB AREA (uses SLUI TabPane)
   ======================================== */

.v2-unified-tab-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.v2-unified-tab-area .sl-tabpane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v2-unified-tab-area .sl-tabpane-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.v2-no-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted, #6e7681);
    font-size: 14px;
}

/* ========================================
   CODE CONTENT (MONACO)
   ======================================== */

.v2-code-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.v2-editor-host {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.v2-editor-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    background: var(--bg-tertiary, #21262d);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    flex-shrink: 0;
}

.v2-auto-compile {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
}

.v2-compile-status {
    font-size: 11px;
    color: var(--text-muted, #8b949e);
}

.v2-editor-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

.v2-editor-statusbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 10px;
    height: 24px;
    box-sizing: border-box;
    background: var(--bg-tertiary, #21262d);
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
    font-size: 11px;
    color: var(--text-muted, #8b949e);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    flex-shrink: 0;
}

.v2-line-info {
    min-width: 100px;
}

.v2-font-size-control {
    display: flex;
    align-items: center;
    gap: 4px;
}

.v2-font-small {
    font-size: 9px;
    opacity: 0.7;
}

.v2-font-large {
    font-size: 13px;
    opacity: 0.7;
}

.v2-font-size-control input[type="range"] {
    width: 50px;
    height: 4px;
    cursor: pointer;
    accent-color: var(--accent, #58a6ff);
}

.v2-separator {
    color: var(--border, rgba(255,255,255,0.1));
    margin: 0 4px;
}

.v2-error {
    padding: 20px;
    color: var(--console-error, #f85149);
}

/* ========================================
   MEDIA CONTENT
   ======================================== */

.v2-media-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.v2-media-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #161b22);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
}

.v2-media-icon {
    font-size: 24px;
}

.v2-media-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #c9d1d9);
}

.v2-media-channel {
    font-size: 11px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: auto;
}

.v2-media-preview {
    aspect-ratio: 16/9;
    max-height: 200px;
    margin: 16px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.v2-media-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.v2-media-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted, #6e7681);
}

.v2-empty-icon {
    font-size: 48px;
    opacity: 0.3;
}

.v2-media-selector {
    flex: 1;
    padding: 16px;
    overflow: auto;
}

.v2-selector-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-muted, #6e7681);
    font-size: 12px;
    height: 100%;
}

/* ========================================
   TEXTURE SELECTOR
   ======================================== */

.v2-texture-selector {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.v2-texture-preview-section {
    padding: 12px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    background: var(--bg-secondary, #161b22);
    flex-shrink: 0;
    display: flex;
    gap: 16px;
}

.v2-texture-thumbnail {
    width: 100px;
    height: 100px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 32px;
    flex-shrink: 0;
    overflow: hidden;
}

.v2-texture-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v2-texture-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.v2-texture-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary, #c9d1d9);
}

.v2-texture-channel-badge {
    font-size: 10px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 2px 6px;
    border-radius: 3px;
}

.v2-filter-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted, #6e7681);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.v2-advanced-btn {
    padding: 2px 6px;
    font-size: 9px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: not-allowed;
    opacity: 0.4;
}

.v2-filter-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 11px;
}

.v2-filter-row {
    display: flex;
    gap: 12px;
}

.v2-filter-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary, #8b949e);
}

.v2-filter-row input[type="checkbox"] {
    width: 14px;
    height: 14px;
}

.v2-filter-select-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #8b949e);
}

.v2-filter-select-row span {
    min-width: 50px;
}

.v2-filter-select-row select {
    flex: 1;
}

.v2-media-tabs-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

/* Catalog Tab */
.v2-catalog-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.v2-texture-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.v2-gallery-loading,
.v2-gallery-empty,
.v2-gallery-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    color: var(--text-muted, #6e7681);
}

.v2-gallery-error {
    color: var(--console-error, #f85149);
}

.v2-texture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
}

.v2-texture-card {
    aspect-ratio: 1;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary, #21262d);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    position: relative;
}

.v2-texture-card:hover {
    border-color: var(--accent, #58a6ff);
    transform: scale(1.05);
}

.v2-texture-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v2-texture-card-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 24px;
    opacity: 0.3;
}

.v2-texture-card-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    padding: 4px 6px;
    font-size: 9px;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v2-texture-card:hover .v2-texture-card-name {
    opacity: 1;
}

/* Import Tab */
.v2-import-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 12px;
    gap: 12px;
}

.v2-url-import-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.v2-url-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.v2-url-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted, #6e7681);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.v2-url-input-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.v2-url-prefix {
    font-size: 10px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    white-space: nowrap;
}

.v2-url-input {
    flex: 1;
    background: var(--bg-secondary, #161b22);
    color: var(--text-primary, #c9d1d9);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    border-radius: 4px;
    padding: 6px 8px;
    font-size: 11px;
    font-family: var(--font-code, 'JetBrains Mono', monospace);
}

.v2-url-input:focus {
    outline: none;
    border-color: var(--accent, #58a6ff);
}

/* ========================================
   INPUT CONTENT
   ======================================== */

.v2-input-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.v2-input-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #161b22);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
}

.v2-input-icon {
    font-size: 24px;
}

.v2-input-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #c9d1d9);
}

.v2-input-channel {
    font-size: 11px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: auto;
}

.v2-input-body {
    flex: 1;
    padding: 16px;
    overflow: auto;
}

.v2-input-placeholder {
    text-align: center;
    padding: 40px;
    color: var(--text-muted, #6e7681);
    font-size: 12px;
}

/* ========================================
   INPUT STATUS
   ======================================== */

.v2-input-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #161b22);
    border-radius: 6px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    margin-bottom: 16px;
}

.v2-status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted, #6e7681);
}

.v2-input-status.active .v2-status-indicator {
    background: var(--console-success, #3fb950);
    box-shadow: 0 0 8px var(--console-success, #3fb950);
}

.v2-status-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #c9d1d9);
}

/* ========================================
   INPUT TOGGLE
   ======================================== */

.v2-input-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary, #161b22);
    border-radius: 6px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    margin-bottom: 16px;
}

.v2-input-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent, #58a6ff);
}

.v2-input-toggle label {
    font-size: 13px;
    color: var(--text-primary, #c9d1d9);
    cursor: pointer;
}

/* ========================================
   UNIFORM INFO
   ======================================== */

.v2-uniform-info {
    padding: 12px 16px;
    background: var(--bg-secondary, #161b22);
    border-radius: 6px;
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    margin-bottom: 16px;
}

.v2-uniform-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted, #6e7681);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.v2-uniform-row {
    display: flex;
    gap: 8px;
    margin: 6px 0;
    font-size: 12px;
}

.v2-uniform-row code {
    color: var(--console-info, #58a6ff);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
}

/* ========================================
   CODE EXAMPLE
   ======================================== */

.v2-code-example {
    padding: 12px 16px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    font-size: 11px;
    color: var(--text-secondary, #8b949e);
    white-space: pre;
    overflow-x: auto;
    margin: 0;
}

/* ========================================
   WEBCAM & MIC SPECIFIC
   ======================================== */

.v2-webcam-preview {
    aspect-ratio: 16/9;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #6e7681);
    font-size: 12px;
    margin-bottom: 16px;
}

.v2-audio-meter {
    height: 24px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 16px;
}

.v2-meter-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, 
        var(--console-success, #3fb950), 
        #f0883e, 
        var(--console-error, #f85149)
    );
    transition: width 0.1s;
}

/* ========================================
   ERROR LINE DECORATION
   ======================================== */

.v2-error-line {
    background: rgba(248, 81, 73, 0.15) !important;
}

/* ========================================
   SIDEBAR SPECIAL LINKS
   ======================================== */

.v2-sidebar-special-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin: 8px;
    cursor: pointer;
    background: var(--bg-tertiary, #21262d);
    border: 1px solid var(--border-primary, #30363d);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-secondary, #8b949e);
    transition: all 0.15s ease;
}

.v2-sidebar-special-link:hover {
    background: var(--bg-hover, #30363d);
    color: var(--text-primary, #c9d1d9);
    border-color: var(--accent-color, #58a6ff);
}

.v2-special-link-icon {
    font-size: 14px;
}

.v2-special-link-label {
    font-weight: 500;
}

/* ========================================
   CHANNEL MATRIX
   ======================================== */

.v2-channel-matrix-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: auto;
    padding: 10px;
    gap: 10px;
}

.v2-matrix-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.v2-matrix-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #c9d1d9);
}

.v2-matrix-icon {
    font-size: 20px;
}

.v2-matrix-subtitle {
    font-size: 11px;
    color: var(--text-muted, #6e7681);
}

.v2-matrix-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-muted, #6e7681);
    font-size: 13px;
    background: var(--bg-secondary, #161b22);
    border-radius: 8px;
    border: 1px dashed var(--border-primary, #30363d);
}

.v2-matrix-grid {
    display: grid;
    gap: 1px;
    background: var(--border-primary, #30363d);
    border: 1px solid var(--border-primary, #30363d);
    border-radius: 8px;
    overflow: auto;
    max-height: 400px;
}

.v2-matrix-cell {
    background: var(--bg-panel, #161b22);
    padding: 4px 6px;
    min-width: 70px;
    font-size: 10px;
}

.v2-matrix-corner {
    background: var(--bg-secondary, #161b22);
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-matrix-arrow {
    font-size: 9px;
    color: var(--text-muted, #6e7681);
    text-align: center;
    line-height: 1.3;
}

.v2-matrix-header-cell {
    background: var(--bg-secondary, #161b22);
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    color: var(--text-primary, #c9d1d9);
    padding: 10px 8px;
}

.v2-matrix-receiver-label {
    display: block;
}

.v2-matrix-source-cell {
    background: var(--bg-secondary, #161b22);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.v2-matrix-source-channel {
    background: var(--accent-color, #58a6ff);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    font-family: monospace;
}

.v2-matrix-source-label {
    color: var(--text-primary, #c9d1d9);
    font-weight: 500;
}

.v2-matrix-data-cell {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 10px;
}

.v2-matrix-default-row {
    display: flex;
    align-items: center;
}

.v2-matrix-default-label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary, #8b949e);
    font-size: 11px;
}

.v2-matrix-default-label input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.v2-matrix-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border-primary, #30363d);
}

.v2-matrix-option-row {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary, #8b949e);
}

.v2-matrix-option-row span {
    min-width: 40px;
    font-size: 10px;
}

.v2-matrix-option-row label {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.v2-matrix-select {
    flex: 1;
    padding: 2px 4px;
    font-size: 10px;
    background: var(--bg-tertiary, #21262d);
    color: var(--text-primary, #c9d1d9);
    border: 1px solid var(--border-primary, #30363d);
    border-radius: 4px;
    cursor: pointer;
}

.v2-matrix-select:focus {
    outline: none;
    border-color: var(--accent-color, #58a6ff);
}

.v2-matrix-legend {
    background: var(--bg-secondary, #161b22);
    border: 1px solid var(--border-primary, #30363d);
    border-radius: 6px;
    padding: 12px;
    font-size: 11px;
    color: var(--text-muted, #6e7681);
}

.v2-matrix-legend-title {
    font-weight: 600;
    color: var(--text-secondary, #8b949e);
    margin-bottom: 8px;
}

.v2-matrix-legend-item {
    margin-top: 4px;
}

.v2-matrix-legend-item strong {
    color: var(--text-secondary, #8b949e);
}

.v2-matrix-legend-note {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-primary, #30363d);
    font-style: italic;
    color: var(--text-muted, #6e7681);
}

/* ========================================
   VIDEO SELECTOR
   ======================================== */

.v2-video-selector {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.v2-video-preview-section {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary, #161b22);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
}

.v2-video-preview {
    width: 200px;
    height: 112px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.v2-video-preview video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.v2-video-empty {
    font-size: 48px;
    opacity: 0.3;
}

.v2-video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.v2-video-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #c9d1d9);
}

.v2-video-channel-badge {
    font-size: 11px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 4px 8px;
    border-radius: 4px;
}

.v2-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.v2-video-card {
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-tertiary, #21262d);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
}

.v2-video-card:hover {
    border-color: var(--accent, #58a6ff);
    transform: scale(1.02);
}

.v2-video-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-panel, #161b22);
}

.v2-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v2-video-card-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 32px;
    opacity: 0.3;
}

.v2-video-duration {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-family: var(--font-code, 'JetBrains Mono', monospace);
}

.v2-video-card-name {
    padding: 8px;
    font-size: 12px;
    color: var(--text-primary, #c9d1d9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.v2-video-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ========================================
   AUDIO SELECTOR
   ======================================== */

.v2-audio-selector {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.v2-audio-preview-section {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: var(--bg-secondary, #161b22);
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
}

.v2-audio-preview {
    width: 150px;
    height: 80px;
    background: var(--bg-tertiary, #21262d);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.v2-audio-visualizer {
    width: 100%;
    height: 100%;
    background: #141418;
}

.v2-audio-empty {
    font-size: 32px;
    opacity: 0.3;
}

.v2-audio-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.v2-audio-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #c9d1d9);
}

.v2-audio-channel-badge {
    font-size: 11px;
    color: var(--text-muted, #6e7681);
    font-family: var(--font-code, 'JetBrains Mono', monospace);
    background: var(--bg-tertiary, #21262d);
    padding: 4px 8px;
    border-radius: 4px;
}

.v2-audio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.v2-audio-card {
    border-radius: 6px;
    padding: 12px;
    background: var(--bg-tertiary, #21262d);
    border: 1px solid var(--border, rgba(255,255,255,0.1));
    cursor: pointer;
    transition: border-color 0.15s, transform 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.v2-audio-card:hover {
    border-color: var(--accent, #58a6ff);
    transform: scale(1.02);
}

.v2-audio-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.v2-audio-card-name {
    font-size: 11px;
    color: var(--text-primary, #c9d1d9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.v2-audio-duration {
    font-size: 10px;
    color: var(--text-muted, #6e7681);
    margin-top: 4px;
}

.v2-audio-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

/* ========================================
   SHADER CONTROLS - UNIFORMS SECTION
   ======================================== */

.v2-shader-controls-uniforms-header:hover {
    background: var(--bg-secondary, rgba(255,255,255,0.03));
}

.v2-shader-controls-uniforms-header:hover span {
    color: var(--text-primary, #c9d1d9);
}

.v2-uniforms-toggle-icon {
    font-size: 8px;
    transition: transform 0.15s;
}

/* Compact uniform controls in shader controls */
.v2-uniforms-section-embedded .sl-uniform-slider {
    margin-bottom: 2px;
}

.v2-uniforms-section-embedded .sl-vector-slider-stack {
    margin-bottom: 4px;
}

.v2-uniforms-section-embedded .sl-color-uniform {
    gap: 4px;
}
