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

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0F172A 0%, #1e1b4b 100%);
    color: #FFFFFF;
    overflow-x: hidden;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: linear-gradient(135deg, #8B5CF6 0%, #06B6D4 100%);
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: titlePop 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes titlePop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    position: relative;
}

/* Control Panel */
.control-panel {
    width: 320px;
    background: rgba(31, 41, 55, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(139, 92, 246, 0.3);
    padding: 1.5rem;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.control-panel.collapsed {
    transform: translateX(-100%);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h2 {
    font-size: 1.4rem;
}

.toggle-panel {
    background: rgba(139, 92, 246, 0.3);
    border: none;
    color: white;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-panel:hover {
    background: rgba(139, 92, 246, 0.5);
    transform: scale(1.1);
}

.control-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #06B6D4;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #D1D5DB;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #8B5CF6, #06B6D4);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.control-hint {
    font-size: 0.75rem;
    color: #9CA3AF;
    margin-top: 0.3rem;
}

.toggle-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toggle-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.toggle-btn.active {
    background: linear-gradient(135deg, #8B5CF6, #06B6D4);
    border-color: transparent;
}

.preset-btn {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid #F59E0B;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.preset-btn:hover {
    background: rgba(245, 158, 11, 0.4);
    transform: translateX(5px);
}

.camera-hints {
    font-size: 0.85rem;
    color: #D1D5DB;
}

.camera-hints p {
    margin-bottom: 0.5rem;
}

/* Viewport Container */
.viewport-container {
    flex: 1;
    position: relative;
    background: #000000;
}

#sceneContainer {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Upload Area */
.upload-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(30, 27, 75, 0.95) 100%);
    border: 3px dashed rgba(139, 92, 246, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.upload-area:hover {
    border-color: rgba(139, 92, 246, 0.8);
    background: linear-gradient(135deg, rgba(15, 23, 42, 1) 0%, rgba(30, 27, 75, 1) 100%);
}

.upload-area.drag-over {
    border-color: #06B6D4;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    transform: scale(1.02);
}

.upload-content {
    text-align: center;
    padding: 2rem;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-hint {
    color: #9CA3AF;
    margin-top: 0.5rem;
}

.sample-gallery {
    margin-top: 2rem;
}

.sample-gallery h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: #06B6D4;
}

.sample-images {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.sample-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.sample-img:hover {
    transform: scale(1.1) rotate(2deg);
    border-color: #8B5CF6;
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

/* Image Preview */
.image-preview {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
    background: rgba(31, 41, 55, 0.9);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.image-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin-bottom: 0.5rem;
}

.change-image-btn {
    width: 100%;
    padding: 0.5rem;
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid #8B5CF6;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.change-image-btn:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.loading-content {
    text-align: center;
}

.loading-voxels {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.voxel-cube {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #8B5CF6, #06B6D4);
    border-radius: 4px;
    animation: voxelBounce 1s ease-in-out infinite;
}

.voxel-cube:nth-child(2) {
    animation-delay: 0.2s;
}

.voxel-cube:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes voxelBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-20px) scale(1.1); }
}

.progress-bar {
    width: 300px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem auto 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #06B6D4);
    width: 0%;
    transition: width 0.3s ease;
}

/* Action Buttons */
.action-buttons {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 30;
}

.primary-btn, .secondary-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    min-width: 180px;
}

.primary-btn {
    background: linear-gradient(135deg, #8B5CF6, #06B6D4);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(139, 92, 246, 0.6);
}

.secondary-btn {
    background: rgba(31, 41, 55, 0.9);
    color: white;
    border: 1px solid rgba(139, 92, 246, 0.3);
    backdrop-filter: blur(10px);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(139, 92, 246, 0.3);
    transform: translateY(-2px);
}

.secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.2rem;
}

/* Footer */
.footer {
    background: rgba(15, 23, 42, 0.8);
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid rgba(139, 92, 246, 0.3);
}

.footer a {
    color: #06B6D4;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #8B5CF6;
}

.tagline {
    font-size: 0.85rem;
    color: #9CA3AF;
    margin-top: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .control-panel {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 50;
        transform: translateX(-100%);
    }
    
    .control-panel.open {
        transform: translateX(0);
    }
    
    .title {
        font-size: 2rem;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .primary-btn, .secondary-btn {
        flex: 1;
        min-width: auto;
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
}

/* Success Message */
.success-message {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10B981, #06B6D4);
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    z-index: 1000;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-100px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}