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

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    overflow: hidden;
}

#app {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Step Indicator */
#step-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.step {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #aaa;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
}

.step.active {
    color: #7B68EE;
}

.step.completed {
    color: #28a745;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.3s;
}

.step.active .step-number {
    background: #7B68EE;
    color: white;
}

.step.completed .step-number {
    background: #28a745;
    color: white;
}

.step-line {
    width: 30px;
    height: 2px;
    background: #ddd;
}

.step-label {
    display: none;
}

@media (min-width: 600px) {
    .step-label {
        display: inline;
    }
}

/* Panels */
.panel {
    display: none;
    width: 100%;
    height: 100%;
}

.panel.active {
    display: flex;
}

/* Upload Panel */
#upload-panel {
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.panel-content {
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.panel-content h1 {
    font-size: 2.5rem;
    color: #7B68EE;
    margin-bottom: 8px;
}

.panel-content .subtitle {
    color: #666;
    margin-bottom: 30px;
}

#drop-zone {
    border: 3px dashed #7B68EE;
    border-radius: 16px;
    padding: 50px 30px;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(123, 104, 238, 0.05);
    margin-bottom: 20px;
}

#drop-zone:hover,
#drop-zone.dragover {
    background: rgba(123, 104, 238, 0.15);
    border-color: #5a4fcf;
}

.drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drop-icon {
    font-size: 3rem;
}

.drop-hint {
    font-size: 0.8rem;
    color: #999;
}

#image-preview {
    position: relative;
    margin-bottom: 20px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

#image-preview img {
    max-width: 100%;
    max-height: 300px;
    display: block;
}

#remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
}

.primary-btn {
    background: linear-gradient(135deg, #7B68EE 0%, #9B8AFF 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(123, 104, 238, 0.4);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(123, 104, 238, 0.5);
}

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

/* Editor Panel */
#editor-panel {
    position: relative;
}

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

#scene-container canvas {
    display: block;
}

/* Furniture Palette */
#furniture-palette {
    position: absolute;
    top: 90px;
    left: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 180px;
    z-index: 100;
}

#furniture-palette h3 {
    font-size: 0.85rem;
    color: #7B68EE;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.furniture-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.furniture-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.furniture-btn:hover {
    border-color: #7B68EE;
    background: rgba(123, 104, 238, 0.1);
    transform: scale(1.1);
}

/* Control Bar */
#control-bar {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 15px;
    align-items: center;
    z-index: 100;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 90%;
}

.control-group {
    display: flex;
    gap: 5px;
    align-items: center;
}

.control-btn {
    background: #f5f5f5;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: #7B68EE;
    color: white;
}

.control-btn.danger:hover {
    background: #FF6B6B;
}

#view-toggle {
    width: auto;
    border-radius: 20px;
    padding: 0 15px;
    gap: 5px;
}

.view-label {
    font-size: 0.75rem;
    font-weight: 500;
}

.color-picker-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.color-picker-label input[type="color"] {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    overflow: hidden;
}

/* Reference Overlay */
#reference-overlay {
    position: absolute;
    top: 90px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    z-index: 100;
    transition: all 0.3s;
}

#reference-overlay.collapsed {
    width: 45px;
    height: 45px;
}

#reference-overlay.collapsed #reference-img {
    display: none;
}

#toggle-reference {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 35px;
    height: 35px;
    background: #7B68EE;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    z-index: 1;
}

#reference-img {
    width: 200px;
    max-height: 150px;
    object-fit: cover;
    margin-top: 45px;
    display: block;
}

/* Object Controls */
#object-controls {
    position: absolute;
    top: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(123, 104, 238, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 10px 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 150;
    color: white;
}

.selected-label {
    font-size: 0.85rem;
    font-weight: 500;
}

#object-controls .control-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

#object-controls .control-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

#object-controls .color-picker-label input {
    border: 2px solid white;
}

/* Room Presets */
#room-presets {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 100;
    font-size: 0.8rem;
    color: #666;
}

.preset-btn {
    background: white;
    border: 2px solid #7B68EE;
    color: #7B68EE;
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: #7B68EE;
    color: white;
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e0e0e0;
    border-top-color: #7B68EE;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-text {
    color: #7B68EE;
    font-weight: 500;
}

/* Instructions Overlay */
#instructions-overlay {
    position: absolute;
    bottom: 180px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(123, 104, 238, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 15px 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: 90%;
}

#instructions-overlay.hidden {
    display: none;
}

.instructions-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.instructions-content p {
    color: white;
    font-size: 0.8rem;
    text-align: center;
}

#dismiss-instructions {
    padding: 6px 16px;
    border: 2px solid white;
    background: transparent;
    border-radius: 20px;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#dismiss-instructions:hover {
    background: white;
    color: #7B68EE;
}

/* Footer */
#footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 15px 20px;
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0) 100%);
    text-align: center;
}

#footer p {
    font-size: 0.8rem;
    color: #666;
}

#footer a {
    color: #7B68EE;
    text-decoration: none;
    font-weight: 600;
}

#footer a:hover {
    text-decoration: underline;
}

#footer .tagline {
    font-style: italic;
    font-size: 0.75rem;
    color: #888;
    margin-top: 3px;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #step-indicator {
        padding: 8px 16px;
        gap: 5px;
    }
    
    .step-number {
        width: 20px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .step-line {
        width: 15px;
    }
    
    .panel-content h1 {
        font-size: 1.8rem;
    }
    
    #furniture-palette {
        top: auto;
        bottom: 200px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .furniture-grid {
        grid-template-columns: repeat(10, 1fr);
    }
    
    #control-bar {
        bottom: 70px;
        padding: 8px 15px;
        gap: 8px;
    }
    
    .control-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    #reference-overlay {
        top: 75px;
        right: 10px;
    }
    
    #reference-img {
        width: 120px;
        max-height: 90px;
    }
    
    #object-controls {
        top: 75px;
        padding: 8px 15px;
        gap: 8px;
    }
    
    .selected-label {
        font-size: 0.75rem;
    }
    
    #room-presets {
        bottom: 260px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #instructions-overlay {
        bottom: 270px;
    }
    
    #footer {
        padding: 10px;
    }
    
    #footer p {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .furniture-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    #room-presets span {
        display: none;
    }
    
    .view-label {
        display: none;
    }
}