/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    margin-bottom: 1rem;
    color: #666;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

/* Header */
.header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #667eea;
}

.logo i {
    font-size: 2rem;
}

.logo h1 {
    font-size: 1.5rem;
    margin: 0;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Hero Section */
.hero {
    padding: 4rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}

.hero-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: white;
}

.hero-content p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.demo-collage {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 300px;
    margin: 0 auto;
}

.demo-photo {
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

/* Upload Section */
.upload-section {
    padding: 4rem 0;
    background: white;
}

.upload-area {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-area.dragover {
    border-color: #667eea;
    background: #e8f2ff;
    transform: scale(1.02);
}

.upload-content i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.upload-content h3 {
    margin-bottom: 0.5rem;
}

/* Template Selection */
.template-selection {
    margin-top: 3rem;
    text-align: center;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.template-item {
    cursor: pointer;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: white;
}

.template-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.template-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.template-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin-bottom: 0.5rem;
    height: 60px;
}

.template-preview.vertical {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

.template-preview.custom {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #667eea;
}

.preview-cell {
    background: #e0e0e0;
    border-radius: 4px;
}

.template-item span {
    font-size: 0.9rem;
    color: #666;
}

/* Editor Section */
.editor-section {
    padding: 3rem 0;
    background: #f8f9fa;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.editor-controls {
    display: flex;
    gap: 1rem;
}

/* Quick Template Panel */
.quick-template-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.quick-template-panel h4 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

.quick-template-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.quick-template-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    border: 2px solid #eee;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.quick-template-item:hover {
    border-color: #667eea;
}

.quick-template-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
}

.quick-template-item i {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.quick-template-item span {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.mini-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    width: 24px;
    height: 18px;
    margin-bottom: 0.5rem;
}

.mini-preview.horizontal {
    grid-template-columns: 1fr 1fr 1fr;
    width: 30px;
    height: 12px;
}

.mini-preview.vertical {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    width: 12px;
    height: 24px;
}

.mini-cell {
    background: #667eea;
    border-radius: 1px;
}

/* Editor container removed - using full width layout */

.collage-canvas {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    min-height: 500px;
    position: relative;
    overflow: hidden;
}

.collage-item {
    position: absolute;
    top: 0;
    left: 0;
    cursor: move;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    background-size: cover;
    background-position: center;
    will-change: transform;
    transform-origin: top left;
}

.collage-item:hover {
    border-color: #667eea;
}

.collage-item.selected {
    border-color: #667eea;
    z-index: 10;
}

.collage-item.dragging {
    z-index: 100;
    pointer-events: none;
}

.collage-item.resizing {
    z-index: 100;
}

.resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    cursor: nw-resize;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 20;
}

.collage-item:hover .resize-handle,
.collage-item.selected .resize-handle {
    opacity: 1;
}

.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

/* Editor Sidebar removed - no longer needed */

.settings-panel {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.settings-row {
    display: flex;
    gap: 2rem;
    align-items: end;
    flex-wrap: wrap;
}

.setting-group {
    margin-bottom: 1rem;
    min-width: 150px;
}

.setting-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.setting-group select,
.setting-group input[type="color"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.setting-group input[type="range"] {
    width: 100%;
    margin-right: 1rem;
}



/* Templates Section */
.templates-section {
    padding: 4rem 0;
    background: white;
}

.templates-section h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.templates-section > .container > p {
    text-align: center;
    margin-bottom: 3rem;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.template-card {
    text-align: center;
    padding: 2rem;
    border: 1px solid #eee;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: white;
}

.template-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.template-preview-large {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1rem;
    height: 120px;
}

.template-preview-large.vertical {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr 1fr;
}

/* How to Use Section */
.how-to-section {
    padding: 4rem 0;
    background: #f8f9fa;
}

.how-to-section h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.step {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 1rem;
}

/* Footer */
.footer {
    background: #2c3e50;
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: white;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: #bdc3c7;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #34495e;
    color: #bdc3c7;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-content h2 {
        font-size: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .settings-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .setting-group {
        min-width: auto;
        width: 100%;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .templates-grid {
        grid-template-columns: 1fr;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero-content h2 {
        font-size: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .editor-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .editor-controls {
        justify-content: center;
    }
    
    .quick-template-grid {
        justify-content: center;
    }
    
    .quick-template-item {
        min-width: 70px;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Drag and Drop Styles */
.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.drop-zone {
    border: 2px dashed #667eea;
    background: #f0f4ff;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Canvas area specific scrollbar */
.workspace-canvas::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.workspace-canvas::-webkit-scrollbar-track {
    background: #f5f6fa;
    border-radius: 6px;
}

.workspace-canvas::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 6px;
    border: 2px solid #f5f6fa;
}

.workspace-canvas::-webkit-scrollbar-thumb:hover {
    background: #5a6fd8;
}

.workspace-canvas::-webkit-scrollbar-corner {
    background: #f5f6fa;
}

/* ===============================
   WORKSPACE EDITOR - NEW LAYOUT
   =============================== */

/* Workspace Container */
.workspace-editor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #f5f6fa;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

/* Workspace Header */
.workspace-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 2001;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.workspace-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #667eea;
    font-size: 18px;
}

.workspace-logo i {
    font-size: 24px;
}

.workspace-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.workspace-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #f8f9fa;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.workspace-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.workspace-btn-close {
    background: #dc3545;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
}

.workspace-btn-close:hover {
    background: #c82333;
}

/* Main Workspace Layout */
.workspace-layout {
    display: flex;
    height: 100vh;
    padding-top: 60px; /* Account for fixed header */
    overflow: hidden; /* Prevent layout from scrolling, only canvas should scroll */
}

/* Sidebar (Left on PC, Top on Mobile) */
.workspace-sidebar {
    width: 320px;
    background: white;
    border-right: 1px solid #e1e8ed;
    overflow-y: auto;
    flex-shrink: 0;
}

/* Sidebar Sections */
.sidebar-section {
    border-bottom: 1px solid #f1f3f4;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e8ed;
}

.sidebar-title i {
    color: #667eea;
}

.sidebar-content {
    padding: 20px;
}

/* Control Groups */
.control-group {
    margin-bottom: 20px;
}

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

.control-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-slider {
    flex: 1;
    height: 4px;
    background: #e1e8ed;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.control-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-value {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    min-width: 20px;
    text-align: right;
}

.color-picker {
    width: 100%;
    height: 40px;
    border: 1px solid #e1e8ed;
    border-radius: 6px;
    cursor: pointer;
}

/* Layouts Grid */
.layouts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.layout-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout-item:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.layout-item.active {
    border-color: #667eea;
    background: #f8f9ff;
}

.layout-preview {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    width: 40px;
    height: 30px;
}

.layout-preview.layout-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 2px;
}

.layout-cell {
    background: #d1d9e6;
    border-radius: 2px;
    flex: 1;
}

.layout-preview .layout-cell:first-child {
    background: #667eea;
}

.layout-item span {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

/* Canvas Area */
.workspace-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #f5f6fa;
    overflow: hidden;
    max-height: calc(100vh - 60px); /* Subtract header height for accurate calculation */
}

/* Canvas Toolbar */
.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: white;
    border-bottom: 1px solid #e1e8ed;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.canvas-toolbar-left,
.canvas-toolbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.toolbar-group label {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    min-width: 45px;
}

.size-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    cursor: text;
    transition: all 0.2s ease;
}

.size-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    background: #f8f9ff;
}

.size-input:hover {
    border-color: #aab4d4;
}

/* Width and Height Sliders in Toolbar */
.width-slider,
.height-slider {
    width: 100px;
    height: 4px;
    background: #e1e8ed;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    margin: 0 4px;
}

.width-slider::-webkit-slider-thumb,
.height-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.width-slider::-moz-range-thumb,
.height-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.zoom-slider {
    width: 120px;
    height: 4px;
    background: #e1e8ed;
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.zoom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.zoom-value {
    font-weight: 600;
    color: #667eea;
    min-width: 40px;
    text-align: center;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    background: white;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9ff;
}

.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: auto; /* Enable scrolling when zoomed in */
    position: relative;
}

.canvas-content {
    position: relative;
    background: white;
    border-radius: 0;
    width: 600px;
    height: 600px;
    border: 2px solid #e1e8ed;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: visible; /* Allow photos to extend beyond canvas */
    transform-origin: center center;
    transition: transform 0.2s ease;
}

/* Canvas Resize Handle */
.canvas-resize-handle {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 16px;
    height: 16px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 4px;
    cursor: se-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.canvas-resize-handle i {
    font-size: 8px;
    color: white;
}

.canvas-content:hover .canvas-resize-handle {
    opacity: 1;
}

.canvas-resize-handle:hover {
    background: #5a6fd8;
    transform: scale(1.2);
}

/* Workspace Photo Styles */
.workspace-photo {
    border: 2px solid transparent !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    will-change: transform;
}

.workspace-photo:hover {
    border-color: rgba(102, 126, 234, 0.3) !important;
}

.workspace-photo.selected {
    border-color: #667eea !important;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
}

.workspace-photo.dragging {
    z-index: 1000 !important;
    border-color: #667eea !important;
    transition: none !important;
    pointer-events: none;
}

.workspace-photo.resizing {
    z-index: 1000 !important;
    border-color: #667eea !important;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3) !important;
    transition: none !important;
}

/* Resize Handles for Workspace */
.workspace-photo .resize-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.workspace-photo:hover .resize-handle,
.workspace-photo.selected .resize-handle {
    opacity: 1;
}

.workspace-photo.dragging .resize-handle,
.workspace-photo.resizing .resize-handle {
    opacity: 1;
}

.workspace-photo .resize-handle:hover {
    background: #5a6fd8;
    transform: scale(1.2);
}

/* ===============================
   RESPONSIVE DESIGN
   =============================== */

/* Tablet and Mobile (768px and below) */
@media (max-width: 768px) {
    .workspace-layout {
        flex-direction: column;
    }
    
    .workspace-sidebar {
        width: 100%;
        height: 250px;
        border-right: none;
        border-bottom: 1px solid #e1e8ed;
        overflow-x: auto;
        overflow-y: visible;
    }
    
    .workspace-sidebar {
        display: flex;
        overflow-x: auto;
        overflow-y: visible;
        padding-bottom: 0;
    }
    
    .sidebar-section {
        min-width: 280px;
        border-right: 1px solid #f1f3f4;
        border-bottom: none;
        flex-shrink: 0;
    }
    
    .sidebar-section:last-child {
        border-right: none;
    }
    
    .sidebar-title {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .sidebar-content {
        padding: 16px;
    }
    
    .control-group {
        margin-bottom: 16px;
    }
    
    .layouts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .layout-item {
        padding: 8px;
        gap: 6px;
    }
    
    .layout-preview {
        width: 32px;
        height: 24px;
    }
    
        .canvas-container {
        margin: 0;
        border-radius: 0;
        padding: 0;
        max-width: calc(100% - 32px); /* Account for mobile padding */
    }

    .canvas-content {
        max-width: 400px;
        /* Remove max-height constraint on mobile to allow scrolling */
    }
    
    .workspace-canvas {
        max-height: calc(100vh - 300px); /* Account for header + sidebar height on mobile */
    }
    
    .canvas-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .canvas-toolbar-left,
    .canvas-toolbar-right {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .toolbar-group {
        justify-content: space-between;
        width: 100%;
    }
    
    .zoom-slider {
        width: 100px;
    }
    
    .canvas-container {
        padding: 16px; /* Reduced padding for mobile */
    }
    
    .workspace-header {
        height: 50px;
        padding: 0 16px;
    }
    
    .workspace-layout {
        padding-top: 50px;
        overflow: hidden; /* Prevent layout scrolling on mobile */
    }
    
    .workspace-logo {
        font-size: 16px;
    }
    
    .workspace-logo i {
        font-size: 20px;
    }
    
    .workspace-btn span {
        display: none;
    }
    
    .workspace-btn {
        padding: 8px;
        width: 36px;
        height: 36px;
        justify-content: center;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .workspace-sidebar {
        height: 200px;
    }
    
    .sidebar-section {
        min-width: 250px;
    }
    
    .sidebar-content {
        padding: 12px;
    }
    
    .layouts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    
    .layout-item {
        padding: 6px;
        gap: 4px;
    }
    
    .layout-item span {
        font-size: 10px;
    }
    
        .canvas-container {
        padding: 0;
        max-width: calc(100% - 24px); /* Account for mobile padding */
    }

    .canvas-content {
        max-width: 300px;
        /* Remove max-height constraint on mobile to allow scrolling */
    }
    
    .workspace-canvas {
        max-height: calc(100vh - 250px); /* Account for header + smaller sidebar on mobile */
    }
    
    .canvas-toolbar {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .canvas-toolbar-left,
    .canvas-toolbar-right {
        gap: 8px;
    }
    
    .toolbar-group {
        font-size: 12px;
    }
    
    .size-input {
        width: 60px;
        font-size: 12px;
        padding: 4px 6px;
    }
    
    .zoom-slider {
        width: 80px;
    }
    
    .toolbar-btn {
        width: 28px;
        height: 28px;
    }
    
    .canvas-container {
        padding: 12px; /* Further reduced padding for small mobile */
    }
    
    .workspace-actions {
        gap: 8px;
    }
}