        /* Layout fixes for resize tool */
        .editor-layout {
            display: grid;
            grid-template-columns: 1fr 300px;
            gap: 1.5rem;
            margin-top: 1rem;
        }
        
        @media (max-width: 768px) {
            .editor-layout {
                grid-template-columns: 1fr !important;
                gap: 1.5rem !important;
            }
            
            .controls-panel {
                order: 2;
                margin-top: 1rem;
            }
            
            .editor-main {
                order: 1;
            }
        }
        
        /* New styles for single box design */
        .editor-preview.drag-drop {
            cursor: pointer;
            border: 2px dashed #cbd5e0;
            transition: border-color 0.2s, background-color 0.2s;
            position: relative;
            min-height: 400px;
            max-width: 100%;
            overflow: hidden;
            background-color: #f8fafc; /* Light background for empty state */
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 0.5rem;
        }
        
        .editor-preview.drag-drop:hover {
            border-color: #4299e1;
            background-color: #f7fafc;
        }
        
        .editor-preview.drag-drop.dragover {
            border-color: #4299e1;
            background-color: #ebf8ff;
            border-style: solid;
        }
        
        /* When image is loaded */
        .editor-preview.drag-drop.has-image {
            background-color: #ffffff;
            border: 1px solid #e2e8f0;
        }
        
        .upload-instructions {
            text-align: center;
            padding: 2rem;
            color: #718096;
        }
        
        .upload-instructions h3 {
            color: #2d3748;
            margin-bottom: 0.5rem;
            font-size: 1.25rem;
        }
        
        .upload-instructions p {
            margin-bottom: 0.25rem;
            font-size: 0.875rem;
        }
        
        .upload-icon-large {
            font-size: 3rem;
            margin-bottom: 1rem;
            display: block;
        }
        
        .upload-button-container {
            display: flex;
            justify-content: center;
            margin-bottom: 1.5rem;
        }
        
        .tool-btn {
            padding: 0.5rem 1rem;
            background-color: #edf2f7;
            border: 1px solid #e2e8f0;
            border-radius: 0.375rem;
            cursor: pointer;
            font-size: 0.875rem;
            color: #4a5568;
            transition: background-color 0.2s;
        }
        
        .tool-btn.active {
            background-color: #4299e1;
            color: white;
            border-color: #4299e1;
        }
        
        .tool-btn:hover {
            background-color: #e2e8f0;
        }
        
        .dimension-controls {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
            margin-bottom: 0.5rem;
        }
        
        .dimension-input {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        
        .dimension-input input {
            flex: 1;
            padding: 0.5rem;
            border: 1px solid #e2e8f0;
            border-radius: 0.375rem;
            font-size: 0.875rem;
        }
        
        .checkbox-group {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }
        
        .aspect-ratio-buttons {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.4rem;
        }
        
        .ratio-btn {
            padding: 0.4rem;
            font-size: 0.8rem;
            background-color: #edf2f7;
            color: #4a5568;
            border: 1px solid #e2e8f0;
            border-radius: 0.25rem;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        
        .ratio-btn:hover {
            background-color: #e2e8f0;
        }
        
        .action-buttons {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
            margin-top: 1rem;
        }
        
        /* Ensure image fits properly */
        #imagePreview {
            display: none;
            max-width: 100%;
            max-height: 70vh;
            width: auto;
            height: auto;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
        }
        
        /* Loading spinner */
        .loading {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(255,255,255,0.9);
            z-index: 1000;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        
        .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e2e8f0;
            border-top: 4px solid #4299e1;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        /* Advanced quality controls */
        .advanced-quality {
            margin-top: 1rem;
            padding: 1rem;
            background: #f7fafc;
            border-radius: 0.375rem;
            border: 1px solid #e2e8f0;
        }
        
        .advanced-quality h4 {
            margin-bottom: 0.5rem;
            font-size: 0.875rem;
            color: #4a5568;
        }
        
        .quality-options {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 0.5rem;
        }
        
        .quality-option {
            padding: 0.5rem;
            border: 1px solid #e2e8f0;
            border-radius: 0.25rem;
            cursor: pointer;
            text-align: center;
            font-size: 0.75rem;
            background: white;
            transition: all 0.2s;
        }
        
        .quality-option:hover {
            border-color: #4299e1;
            background: #ebf8ff;
        }
        
        .quality-option.active {
            border-color: #4299e1;
            background: #4299e1;
            color: white;
        }
        
        /* ========== FIX IMAGE PREVIEW CONTAINER ========== */
.editor-preview.drag-drop {
    height: 700px !important;
    min-height: 700px !important;
    max-height: 700px !important;
    overflow: hidden !important;
}

/* Make image preview responsive but contained within the box */
#imagePreview {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* This prevents cutting */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Keep upload instructions centered when no image */
.upload-instructions {
    position: relative;
    z-index: 2;
}

@media (max-width: 768px) {
    .editor-preview.drag-drop {
        height: 300px !important;
        min-height: 300px !important;
        max-height: 300px !important;
    }
}
