/* CRTscape Creator Pro - Enhanced Retro 3D Environment Builder Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    font-size: 11px;
    background: #008080;
    overflow: hidden;
}

.desktop-background {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #008080 0%, #004040 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Enhanced Windows Dialog */
.window-frame {
    width: 95vw;
    max-width: 1200px;
    height: 90vh;
    max-height: 800px;
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.title-bar {
    background: linear-gradient(90deg, #0000FF 0%, #000080 100%);
    color: white;
    padding: 2px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 11px;
}

.title-text {
    margin-left: 4px;
}

.window-controls {
    display: flex;
    gap: 1px;
}

.control-btn {
    width: 16px;
    height: 14px;
    background: #C0C0C0;
    border: 1px outset #C0C0C0;
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:active {
    border: 1px inset #C0C0C0;
}

/* Enhanced Tab Navigation */
.tab-strip {
    display: flex;
    background: #C0C0C0;
    border-bottom: 1px solid #808080;
    padding-left: 8px;
    overflow-x: auto;
}

.tab {
    padding: 6px 16px 4px 16px;
    border: 1px solid #808080;
    border-bottom: none;
    background: #C0C0C0;
    cursor: pointer;
    margin-right: 2px;
    position: relative;
    top: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab.active {
    background: #C0C0C0;
    border-top: 1px solid #FFFFFF;
    border-left: 1px solid #FFFFFF;
    border-right: 1px solid #808080;
    z-index: 1;
}

.window-content {
    flex: 1;
    background: #C0C0C0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tab-content-container {
    flex: 1;
    position: relative;
    overflow: auto;
}

.tab-content {
    display: none;
    height: 100%;
}

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

.main-content {
    display: flex;
    gap: 20px;
    height: 100%;
}

/* Enhanced CRT Monitor */
.monitor-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crt-monitor {
    position: relative;
}

.monitor-bezel {
    background: linear-gradient(135deg, #2A2A2A 0%, #1A1A1A 50%, #0A0A0A 100%);
    padding: 20px;
    border-radius: 15px;
    box-shadow: inset 2px 2px 8px rgba(255,255,255,0.1),
                inset -2px -2px 8px rgba(0,0,0,0.8),
                4px 4px 16px rgba(0,0,0,0.5);
}

.screen-area {
    width: 320px;
    height: 240px;
    background: #000;
    border: 2px inset #333;
    position: relative;
    overflow: hidden;
    border-radius: 3px;
}

#scene-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000508;
}

#scene-container canvas {
    width: 100% !important;
    height: 100% !important;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0,0,0,0.3) 1px,
        rgba(0,0,0,0.3) 2px
    );
    pointer-events: none;
    z-index: 10;
}

.phosphor-glow {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: radial-gradient(ellipse at center, 
        rgba(0,255,100,0.1) 0%, 
        rgba(0,255,100,0.05) 50%, 
        transparent 70%);
    pointer-events: none;
    border-radius: 8px;
    opacity: 0.1;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.loading-text {
    color: #00FF00;
    font-family: monospace;
    font-size: 12px;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #00FF00;
}

.progress-bar {
    width: 200px;
    height: 10px;
    border: 1px solid #00FF00;
    background: #000;
}

.progress-fill {
    height: 100%;
    background: #00FF00;
    width: 0%;
    animation: progress 2s linear infinite;
}

@keyframes progress {
    0% { width: 0%; }
    100% { width: 100%; }
}

.monitor-label {
    text-align: center;
    color: #AAA;
    font-size: 8px;
    margin-top: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* Enhanced Controls Area */
.controls-area {
    width: 320px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    max-height: 100%;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-weight: bold;
    color: #000;
}

/* Enhanced Texture Gallery */
.texture-gallery {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.texture-thumb {
    width: 32px;
    height: 32px;
    border: 2px outset #C0C0C0;
    cursor: pointer;
    background-size: cover;
    background-position: center;
}

.texture-thumb[data-texture="brick"] {
    background: repeating-linear-gradient(45deg, #8B4513, #8B4513 2px, #A0522D 2px, #A0522D 4px);
}

.texture-thumb[data-texture="marble"] {
    background: linear-gradient(135deg, #F5F5DC 0%, #E6E6FA 50%, #F5F5DC 100%);
}

.texture-thumb[data-texture="circuit"] {
    background: radial-gradient(circle, #00FF00 1px, #000 1px, #000 3px, #00FF00 3px);
    background-size: 8px 8px;
}

.texture-thumb[data-texture="metal"] {
    background: linear-gradient(90deg, #708090 0%, #C0C0C0 50%, #708090 100%);
}

.texture-thumb[data-texture="neon"] {
    background: linear-gradient(45deg, #00FFFF, #FF00FF);
    box-shadow: 0 0 8px rgba(0,255,255,0.5);
}

.texture-thumb[data-texture="hologram"] {
    background: linear-gradient(90deg, #FF00FF, #00FFFF, #FF00FF);
    animation: hologram 2s infinite;
}

@keyframes hologram {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(180deg); }
}

.texture-thumb.active {
    border: 2px inset #C0C0C0;
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.3);
}

/* Settings Panels */
.settings-panel {
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.settings-panel h3 {
    margin-bottom: 16px;
    color: #000080;
    border-bottom: 1px solid #808080;
    padding-bottom: 4px;
}

.setting-section {
    margin-bottom: 20px;
    padding: 12px;
    border: 1px inset #C0C0C0;
    background: #F0F0F0;
}

.setting-section h4 {
    margin-bottom: 12px;
    color: #000;
    font-size: 11px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.setting-row label {
    font-weight: bold;
    min-width: 120px;
}

/* Enhanced Form Controls */
.retro-dropdown, .retro-input {
    background: #FFFFFF;
    border: 2px inset #C0C0C0;
    padding: 2px 4px;
    font-family: inherit;
    font-size: 11px;
    min-width: 120px;
}

.retro-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 20px;
    background: #C0C0C0;
    border: 2px inset #C0C0C0;
    outline: none;
    min-width: 120px;
}

.retro-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    cursor: pointer;
}

.retro-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    cursor: pointer;
}

.slider-labels, .era-labels {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #666;
    margin-top: 2px;
    min-width: 120px;
}

.spinner-control {
    display: flex;
    align-items: center;
    gap: 2px;
}

.spinner-control input {
    background: #FFFFFF;
    border: 2px inset #C0C0C0;
    padding: 2px 4px;
    font-family: inherit;
    font-size: 11px;
    width: 60px;
    text-align: right;
}

.spinner-buttons {
    display: flex;
    flex-direction: column;
}

.spinner-up, .spinner-down {
    width: 16px;
    height: 10px;
    background: #C0C0C0;
    border: 1px outset #C0C0C0;
    font-size: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.spinner-up:active, .spinner-down:active {
    border: 1px inset #C0C0C0;
}

/* Radio Groups */
.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: normal;
    min-width: auto;
}

/* Enhanced Checkboxes */
.checkboxes, .checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 13px;
    height: 13px;
    background: #FFFFFF;
    border: 2px inset #C0C0C0;
    position: relative;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: -3px;
    left: 1px;
    font-size: 11px;
    color: #000;
    font-weight: bold;
}

/* Social Panel */
.social-panel {
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.social-section {
    margin-bottom: 24px;
    padding: 16px;
    border: 2px inset #C0C0C0;
    background: #F0F0F0;
}

.social-section h3 {
    margin-bottom: 12px;
    color: #000080;
    border-bottom: 1px solid #808080;
    padding-bottom: 4px;
}

.share-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.url-display input {
    flex: 1;
    min-width: 0;
}

.qr-placeholder {
    width: 100px;
    height: 100px;
    border: 2px inset #C0C0C0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    font-size: 10px;
    color: #666;
}

.social-buttons, .collab-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gallery-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.filter-row select, .filter-row input {
    flex: 1;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.gallery-item {
    border: 2px outset #C0C0C0;
    padding: 8px;
    background: #F8F8F8;
}

.gallery-thumb {
    width: 100%;
    height: 60px;
    background: linear-gradient(45deg, #333, #666);
    border: 1px inset #C0C0C0;
    margin-bottom: 8px;
}

.gallery-info {
    font-size: 10px;
}

.gallery-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.gallery-author {
    color: #666;
    margin-bottom: 4px;
}

.gallery-stats {
    color: #000080;
    margin-bottom: 6px;
}

.gallery-actions {
    display: flex;
    gap: 4px;
}

/* Enhanced Buttons */
.button-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #808080;
    margin-top: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.action-buttons, .dialog-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.button-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.retro-button {
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    padding: 4px 16px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    min-width: 75px;
    white-space: nowrap;
}

.retro-button:disabled {
    color: #808080;
    cursor: not-allowed;
}

.retro-button:not(:disabled):active {
    border: 2px inset #C0C0C0;
}

.retro-button.primary {
    background: #0000FF;
    color: white;
    border-color: #0000FF;
}

.retro-button.small {
    padding: 3px 8px;
    min-width: auto;
    font-size: 10px;
}

.retro-button.tiny {
    padding: 2px 6px;
    min-width: auto;
    font-size: 9px;
}

.retro-button.social {
    min-width: 120px;
}

.retro-button.twitter {
    background: #1DA1F2;
    color: white;
    border-color: #1DA1F2;
}

.retro-button.discord {
    background: #7289DA;
    color: white;
    border-color: #7289DA;
}

/* Enhanced Modal Dialog */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    width: 500px;
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    box-shadow: 4px 4px 8px rgba(0,0,0,0.5);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-dialog.large {
    width: 700px;
}

.modal-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.advanced-tabs {
    display: flex;
    margin-bottom: 16px;
    border-bottom: 1px solid #808080;
}

.advanced-tabs .tab {
    padding: 8px 16px;
    border: 1px solid #808080;
    border-bottom: none;
    background: #E0E0E0;
    cursor: pointer;
}

.advanced-tabs .tab.active {
    background: #C0C0C0;
    border-top: 1px solid #FFFFFF;
    border-left: 1px solid #FFFFFF;
    border-right: 1px solid #808080;
}

.tab-content-area {
    min-height: 200px;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #808080;
}

/* Export Panel */
.export-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 200px;
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
    padding: 12px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.panel-header {
    font-weight: bold;
    margin-bottom: 8px;
    font-size: 11px;
    color: #000080;
    border-bottom: 1px solid #808080;
    padding-bottom: 4px;
}

.export-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Notification System */
.notification-area {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 300px;
    z-index: 2000;
}

.notification {
    background: #FFFFCC;
    border: 2px outset #C0C0C0;
    padding: 8px 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.notification.success {
    background: #CCFFCC;
    border-color: #00AA00;
}

.notification.error {
    background: #FFCCCC;
    border-color: #AA0000;
}

.notification.info {
    background: #CCE5FF;
    border-color: #0066CC;
}

.notification button {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    padding: 0 4px;
}

/* Animation enhancements */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

/* Loading animation for progress bar */
@keyframes loading {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

.progress-fill {
    animation: loading 3s ease-in-out infinite;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .window-frame {
        width: 98vw;
        height: 95vh;
    }
    
    .main-content {
        flex-direction: column;
    }
    
    .controls-area {
        width: 100%;
        max-height: 300px;
    }
    
    .screen-area {
        width: 280px;
        height: 210px;
    }
    
    .export-panel {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        margin-top: 12px;
    }
}

@media (max-width: 768px) {
    .desktop-background {
        padding: 5px;
    }
    
    .window-frame {
        width: 100%;
        height: 100%;
    }
    
    .screen-area {
        width: 240px;
        height: 180px;
    }
    
    .controls-area {
        width: 100%;
    }
    
    .button-area {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-buttons, .dialog-buttons {
        justify-content: center;
    }
    
    .modal-dialog {
        width: 95%;
        margin: 10px;
    }
    
    .gallery-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .social-buttons, .collab-buttons {
        flex-direction: column;
    }
    
    .notification-area {
        right: 10px;
        left: 10px;
        width: auto;
    }
}

@media (max-width: 480px) {
    .tab-strip {
        font-size: 10px;
    }
    
    .tab {
        padding: 4px 8px;
    }
    
    .screen-area {
        width: 200px;
        height: 150px;
    }
    
    .setting-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .setting-row label {
        min-width: auto;
    }
    
    .url-display {
        flex-direction: column;
    }
}

/* Pixel perfect rendering */
* {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Enhanced scrollbars */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

::-webkit-scrollbar-track {
    background: #C0C0C0;
    border: 2px inset #C0C0C0;
}

::-webkit-scrollbar-thumb {
    background: #C0C0C0;
    border: 2px outset #C0C0C0;
}

::-webkit-scrollbar-corner {
    background: #C0C0C0;
}