@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Inter:wght@300;400;600;700&family=Fira+Code:wght@300;400&display=swap');

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

body {
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
    font-family: 'Inter', sans-serif;
    color: #ffffff;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100vh;
}

.canvas-container {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 20%, #16213e 100%);
}

#scene-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#camera {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 160px;
    height: 120px;
    border-radius: 12px;
    border: 2px solid #00ff88;
    opacity: 0.9;
    z-index: 100;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

#output_canvas {
    display: none;
}

/* Performance Dashboard */
#performance-dashboard {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(0, 255, 136, 0.3);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Fira Code', monospace;
    font-size: 11px;
}

.metric .label {
    color: #cccccc;
}

.metric .value {
    color: #00ff88;
    font-weight: 600;
}

#status-indicator {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-size: 24px;
    z-index: 100;
    text-shadow: 0 0 10px currentColor;
}

.status-good { color: #00ff88; }
.status-warning { color: #ffaa00; }
.status-error { color: #ff0044; }

/* Camera Controls */
#camera-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.cam-btn {
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'Fira Code', monospace;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.cam-btn:hover {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

.cam-btn.active {
    background: #00ff88;
    color: #000000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* Recording Indicator */
#recording-indicator {
    position: absolute;
    top: 50px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 0, 0, 0.9);
    padding: 8px 12px;
    border-radius: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    font-weight: 600;
    z-index: 100;
}

.pulse {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.hidden {
    display: none !important;
}

/* Enhanced Control Panel */
.control-panel {
    width: 400px;
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(30px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #00ff88 transparent;
}

.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: transparent;
}

.control-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(to bottom, #00ff88, #0088aa);
    border-radius: 4px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, #00ff88, #0088aa, #aa00ff) 1;
    padding-bottom: 15px;
    position: relative;
}

.panel-header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 26px;
    font-weight: 900;
    background: linear-gradient(45deg, #00ff88, #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

.version-badge {
    position: absolute;
    top: -5px;
    right: 120px;
    background: linear-gradient(45deg, #ff0066, #aa00ff);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
}

.header-controls {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid #00ff88;
    color: #00ff88;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover {
    background: rgba(0, 255, 136, 0.4);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.action-btn:hover::before {
    left: 100%;
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: #cccccc;
    padding: 8px 6px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.tab-btn.active {
    background: linear-gradient(45deg, #00ff88, #00aaff);
    color: #000000;
    box-shadow: 0 2px 10px rgba(0, 255, 136, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Enhanced Control Sections */
.control-section {
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    overflow: hidden;
    backdrop-filter: blur(5px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    font-weight: 600;
    background: rgba(0, 255, 136, 0.1);
    transition: all 0.3s ease;
    user-select: none;
}

.section-header:hover {
    background: rgba(0, 255, 136, 0.2);
}

.section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    padding: 0 15px;
}

.control-section.active .section-content {
    max-height: 800px;
    padding: 15px;
}

.arrow {
    color: #00ff88;
    font-size: 14px;
    transition: transform 0.3s ease;
}

/* Particle Group Toggles */
.particle-groups {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.group-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.3s ease;
}

.group-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.group-toggle.active {
    background: linear-gradient(45deg, #00ff88, #00aaff);
    color: #000000;
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Advanced Controls */
.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

/* Enhanced Range Sliders */
.control-group input[type="range"] {
    width: 70%;
    height: 8px;
    background: linear-gradient(to right, rgba(255, 255, 255, 0.2), rgba(0, 255, 136, 0.3));
    border-radius: 4px;
    outline: none;
    margin-right: 10px;
    cursor: pointer;
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00ff88, #00aaff);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.8);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #00ff88, #00aaff);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.control-group .value {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #00ff88;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    min-width: 50px;
    text-align: center;
    border: 1px solid rgba(0, 255, 136, 0.3);
}

/* Button Rows */
.button-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mini-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 0;
}

.mini-btn:hover {
    background: rgba(0, 255, 136, 0.3);
    border-color: #00ff88;
}

/* Toggle Switches */
.toggle-switch {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin-right: 12px;
    transition: all 0.3s ease;
}

.slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked + .slider {
    background: linear-gradient(45deg, #00ff88, #00aaff);
}

.toggle-switch input:checked + .slider::before {
    transform: translateX(20px);
}

.toggle-switch .label {
    font-size: 13px;
    color: #e0e0e0;
}

/* Behavior Toggles */
.behavior-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

/* Season Selector */
.season-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.season-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.season-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.season-btn.active {
    background: linear-gradient(45deg, #00ff88, #00aaff);
    color: #000000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Weather Controls */
.weather-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wind-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wind-controls select {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
}

/* TSL Shader Workshop */
.shader-templates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.template-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.template-card:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    transform: translateY(-2px);
}

.template-name {
    font-weight: 600;
    color: #00ff88;
    margin-bottom: 4px;
    font-size: 12px;
}

.template-desc {
    font-size: 10px;
    color: #cccccc;
    line-height: 1.3;
}

/* Performance Meters */
.performance-meters {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.meter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.meter span:first-child {
    min-width: 70px;
    color: #cccccc;
}

.meter-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
}

.meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff88, #ffaa00, #ff4444);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.meter span:last-child {
    color: #00ff88;
    font-family: 'Fira Code', monospace;
}

/* Gesture Status */
.gesture-status {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

.detected-gesture {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gesture-name {
    font-weight: 600;
    color: #00ff88;
    min-width: 80px;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4444, #ffaa00, #00ff88);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.confidence {
    font-family: 'Fira Code', monospace;
    font-size: 12px;
    color: #00ff88;
    min-width: 35px;
}

/* AI Controls */
.ai-controls {
    display: flex;
    gap: 8px;
}

.ai-controls .mini-btn {
    background: linear-gradient(45deg, #aa00ff, #ff0066);
    border-color: #aa00ff;
}

.ai-controls .mini-btn:hover {
    box-shadow: 0 0 15px rgba(170, 0, 255, 0.5);
}

/* Quality Presets */
.quality-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 15px;
}

.preset-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    padding: 10px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    text-align: center;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preset-btn.active {
    background: linear-gradient(45deg, #00ff88, #00aaff);
    color: #000000;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.3);
}

/* Monitoring Grid */
.monitoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.monitor-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}

.monitor-label {
    font-size: 10px;
    color: #cccccc;
    margin-bottom: 4px;
}

.monitor-value {
    font-size: 12px;
    color: #00ff88;
    font-weight: 600;
    font-family: 'Fira Code', monospace;
}

.monitor-target {
    font-size: 9px;
    color: #888888;
    margin-top: 2px;
}

/* Feature Buttons */
.feature-btn {
    width: 100%;
    background: linear-gradient(45deg, #ff0066, #aa00ff);
    border: none;
    color: #ffffff;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 5px 25px rgba(255, 0, 102, 0.4);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(10, 10, 20, 0.95);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0;
    max-width: 90%;
    max-height: 90%;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(45deg, #00ff88, #00aaff);
    color: #000000;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-family: 'Orbitron', monospace;
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #000000;
}

.modal-body {
    padding: 20px;
}

/* Node Editor */
#node-editor-canvas {
    display: flex;
    gap: 20px;
    min-height: 500px;
}

.node-palette {
    width: 200px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.node-category {
    font-size: 12px;
    font-weight: 600;
    color: #00ff88;
    margin: 15px 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.node-category:first-child {
    margin-top: 0;
}

.draggable-node {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
    cursor: grab;
    font-size: 11px;
    transition: all 0.3s ease;
}

.draggable-node:hover {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
}

.node-workspace {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

#node-canvas {
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .control-panel {
        width: 350px;
    }
    
    #performance-dashboard {
        font-size: 10px;
    }
}

@media (max-width: 768px) {
    #app {
        flex-direction: column;
    }
    
    .control-panel {
        width: 100%;
        height: 50vh;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .canvas-container {
        height: 50vh;
    }
    
    #camera {
        width: 100px;
        height: 75px;
    }
    
    #performance-dashboard {
        top: 5px;
        right: 5px;
        padding: 8px;
        font-size: 9px;
    }
    
    .tab-navigation {
        flex-wrap: wrap;
    }
    
    .tab-btn {
        font-size: 10px;
        padding: 6px 4px;
    }
    
    .particle-groups,
    .season-selector,
    .shader-templates,
    .quality-presets {
        grid-template-columns: 1fr;
    }
    
    .monitoring-grid {
        grid-template-columns: 1fr;
    }
    
    #camera-controls {
        bottom: 10px;
        right: 10px;
        flex-wrap: wrap;
    }
    
    .cam-btn {
        font-size: 10px;
        padding: 6px 8px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Glow effects */
@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 25px rgba(0, 255, 136, 0.7), 0 0 35px rgba(0, 255, 136, 0.4); }
}

.action-btn:active,
.feature-btn:active {
    animation: glow 0.6s ease-in-out;
}

/* Enhanced visual effects */
.control-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.02), rgba(0, 170, 255, 0.02), rgba(170, 0, 255, 0.02));
    pointer-events: none;
    z-index: -1;
}

/* Particle trail effects for buttons */
.action-btn, .feature-btn {
    position: relative;
    overflow: hidden;
}

.action-btn::after, .feature-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.4), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
    border-radius: 50%;
    pointer-events: none;
}

.action-btn:hover::after, .feature-btn:hover::after {
    width: 100px;
    height: 100px;
}