.builder-container {
    padding: 20px;
    max-height: 100vh;
    overflow-y: auto;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    width: calc(100% - 40px);
    height: 2px;
    background: #ddd;
    z-index: 1;
}

.step.active:not(:last-child)::after {
    background: #007bff;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.step.active .step-number {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.step-label {
    font-size: 14px;
    color: #666;
    text-align: center;
}

.step.active .step-label {
    color: #007bff;
    font-weight: 500;
}

/* App Type Selection */
.app-type-selector {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.app-type-selector h3 {
    margin-bottom: 20px;
    color: #333;
}

.radio-label {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-label:hover {
    background: #f0f0f0;
}

.radio-label input[type="radio"] {
    margin-right: 15px;
}

.radio-text {
    display: flex;
    flex-direction: column;
}

.radio-text strong {
    font-size: 16px;
    margin-bottom: 5px;
}

.radio-text small {
    color: #666;
}

/* Dynamic Features Panel */
.dynamic-features-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dynamic-features-panel h4 {
    margin-bottom: 20px;
    color: #333;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.feature-checkbox {
    display: flex;
    align-items: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feature-checkbox:hover {
    background: #f8f9fa;
}

.feature-checkbox input[type="checkbox"] {
    margin-right: 15px;
}

.feature-icon {
    font-size: 24px;
    margin-right: 15px;
}

.feature-text {
    display: flex;
    flex-direction: column;
}

.feature-text strong {
    font-size: 16px;
    margin-bottom: 5px;
}

.feature-text small {
    color: #666;
}

/* Backend Configuration */
.backend-config-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.backend-config-panel h4 {
    margin-bottom: 20px;
    color: #333;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Cost Estimation */
.cost-estimation-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cost-estimation-panel h4 {
    margin-bottom: 20px;
    color: #333;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.cost-item.total {
    border-top: 2px solid #ddd;
    border-bottom: none;
    margin-top: 10px;
    padding-top: 15px;
}

.cost-free {
    color: #28a745;
}

.cost-dynamic, .cost-database {
    color: #007bff;
}

.cost-total {
    color: #dc3545;
    font-size: 18px;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    bottom: 20px;
    z-index: 100;
}

/* Visual Builder Layout */
.builder-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 20px;
    margin-top: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    height: calc(100vh - 400px);
    min-height: 600px;
    max-height: calc(100vh - 200px);
    overflow: hidden;
}

/* Component Library Panel */
.component-library {
    width: 300px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.component-library.collapsed {
    width: 50px;
    padding: 10px;
}

.component-library.collapsed .component-list,
.component-library.collapsed h3 {
    display: none;
}

/* Properties Panel */
.properties-panel {
    width: 300px;
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.properties-panel.collapsed {
    width: 50px;
    padding: 10px;
}

.properties-panel.collapsed .properties-content,
.properties-panel.collapsed h3 {
    display: none;
}

.properties-panel.double-expanded {
    width: 600px;
}

/* Panel Headers */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    min-height: 40px; /* Ensure consistent height when collapsed */
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.panel-controls {
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* Prevent controls from shrinking */
}

/* Expand Buttons */
.expand-btn {
    width: 30px;
    height: 30px;
    background: none;
    border: 1px solid #ddd;
    color: #666;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.expand-btn:hover {
    background: #e9ecef;
    color: #333;
    border-color: #adb5bd;
}

.expand-btn i {
    font-size: 14px;
}

/* Component Controls */
.component-wrapper {
    position: relative;
    margin-bottom: 15px;
}

.component-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: rgba(255, 255, 255, 0.9);
    padding: 3px;
    border-radius: 4px;
}

.component-wrapper:hover .component-controls {
    opacity: 1;
}

.control-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.control-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.control-btn.delete:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

/* Properties Panel */
.properties-panel {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.properties-panel.collapsed {
    width: 50px;
    padding: 10px;
}

.properties-panel.double-expanded {
    width: 600px;
}

.properties-content {
    margin-top: 15px;
}

.properties-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Component Items */
.component-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: move;
    background: #fff;
    transition: all 0.2s ease;
}

.component-item:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.component-icon {
    font-size: 20px;
    margin-right: 10px;
    opacity: 0.7;
}

.component-info {
    flex: 1;
}

.component-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: #212529;
}

.component-description {
    font-size: 12px;
    color: #6c757d;
}

/* Empty Canvas State */
.empty-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .builder-main {
        grid-template-columns: 1fr;
        height: auto;
        gap: 10px;
    }

    .component-library,
    .properties-panel {
        width: 100%;
    }

    .component-library.collapsed,
    .properties-panel.collapsed {
        width: 100%;
        height: 50px;
    }

    .properties-panel.double-expanded {
        width: 100%;
    }

    .canvas-container {
        min-height: 400px;
    }
} 

.component-list {
    overflow-y: auto;
    max-height: calc(100vh - 500px);
    padding-right: 10px;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.pagination-controls.bottom {
    margin-top: 20px;
    box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
}

.pagination-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(.disabled) {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #212529;
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-indicator {
    font-size: 14px;
    color: #495057;
    min-width: 40px;
    text-align: center;
}

/* Component Groups */
.component-group {
    margin-bottom: 15px;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.group-header:hover {
    background: #e9ecef;
}

.group-header i {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.group-toggle {
    color: #adb5bd;
    transition: transform 0.2s ease;
}

.group-header:hover .group-toggle {
    color: #495057;
}

/* Component Items */
.component-item {
    display: flex;
    align-items: center;
    padding: 10px 10px 10px 40px;
    border-bottom: 1px solid #dee2e6;
    cursor: move;
    background: #fff;
    transition: all 0.2s ease;
}

.component-item:last-child {
    border-bottom: none;
}

.component-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
}

.component-icon {
    font-size: 20px;
    margin-right: 10px;
    opacity: 0.7;
}

.component-info {
    flex: 1;
}

.component-name {
    font-weight: 500;
    margin-bottom: 2px;
    color: #212529;
}

.component-description {
    font-size: 12px;
    color: #6c757d;
} 

/* Scrollbar Styling */
.component-list::-webkit-scrollbar {
    width: 6px;
}

.component-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.component-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.component-list::-webkit-scrollbar-thumb:hover {
    background: #aaa;
} 

/* Component Display Styles */
.component {
    border: 1px solid #ddd;
    padding: 10px;
    margin: 5px;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.component:hover {
    border-color: #007bff;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}

.component.selected {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.component-header {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
    font-weight: 500;
}

.component-content {
    min-height: 20px;
}

/* Canvas Styles */
.canvas {
    background: #f8f9fa;
    min-height: 400px;
    max-height: calc(100vh - 200px);
    padding: 20px;
    border-radius: 4px;
    border: 2px dashed #dee2e6;
    transition: all 0.2s ease;
    overflow-y: auto;
    overflow-x: hidden;
}

.canvas.drag-over {
    border-color: #007bff;
    background-color: #f8f9ff;
}

.empty-canvas {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Component Controls */
.component-controls {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.component-wrapper {
    position: relative;
}

.component-wrapper:hover .component-controls {
    opacity: 1;
}

.control-btn {
    background: rgba(255,255,255,0.9);
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.control-btn.delete:hover {
    background: #dc3545;
    border-color: #dc3545;
}

/* Properties Panel */
.properties-form {
    padding: 15px;
}

.properties-form .form-group {
    margin-bottom: 15px;
}

.properties-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.properties-form input,
.properties-form textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.properties-form textarea {
    min-height: 80px;
    resize: vertical;
}

/* Apply Button Styling */
.properties-form .btn {
    width: 100%;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.properties-form .btn-primary {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.properties-form .btn-primary:hover {
    background: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.properties-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0,123,255,0.3);
}

/* Warning button for unsaved changes */
.properties-form .btn-warning {
    background: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.properties-form .btn-warning:hover {
    background: #e0a800;
    border-color: #d39e00;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255,193,7,0.3);
}

.properties-form .btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(255,193,7,0.3);
}

/* Warning text styling */
.text-warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 8px 12px;
    margin-top: 10px;
    font-size: 12px;
}

/* Step Indicator */
.step-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.step.active {
    opacity: 1;
}

.step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #6c757d;
}

.step.active .step-number {
    background: #007bff;
    color: white;
}

.step-label {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

.step.active .step-label {
    color: #007bff;
    font-weight: 500;
} 

/* Component Grid Layout */
.component-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 4px;
    padding: 4px;
    background: #f8f9fa;
}

/* Responsive Grid */
@media (max-width: 768px) {
    .component-grid {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        gap: 3px;
        padding: 3px;
    }
}

@media (min-width: 1200px) {
    .component-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 1px;
        padding: 0;
    }
}

/* Compact Component Items */
.component-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #dee2e6;
    border-radius: 1px;
    cursor: move;
    background: #fff;
    transition: all 0.2s ease;
    min-height: 45px;
    max-height: 45px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.component-item:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.component-icon {
    font-size: 20px;
    margin-bottom: 1px;
    opacity: 0.8;
    flex-shrink: 0;
    line-height: 0.2;
}

.component-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.component-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 0px;
    color: #212529;
    line-height: 1.0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
}

.component-description {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    display: block;
} 

/* Canvas Grid Layout */
.canvas-grid {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    /* Remove overflow: hidden to ensure drop zone works */
}

/* Grid Zones */
.grid-zone {
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    padding: 10px;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.5);
    position: relative;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-zone:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
}

.grid-zone.drag-over {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    transform: scale(1.02);
}

.zone-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    text-align: center;
    padding: 20px;
}

.zone-icon {
    font-size: 24px;
    margin-bottom: 8px;
    color: #adb5bd;
}

.zone-label {
    font-size: 12px;
    font-weight: 500;
    color: #6c757d;
}

/* Canvas Items in Grid Zones */
.grid-zone .canvas-item {
    position: absolute;
    min-width: 150px;
    min-height: 80px;
    pointer-events: auto;
    z-index: 10;
}

.grid-zone .canvas-item:hover {
    z-index: 20;
}

.grid-zone .canvas-item.selected {
    z-index: 30;
}

/* Canvas Item Styles */
.canvas-item {
    position: absolute;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: move;
    user-select: none;
    transition: all 0.2s ease;
    min-width: 150px;
    min-height: 80px;
    z-index: 10;
    /* Ensure canvas items can receive pointer events */
    pointer-events: auto;
}

.canvas-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #adb5bd;
}

.canvas-item.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
    z-index: 20;
}

.canvas-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: 4px 4px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: #495057;
}

.canvas-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.canvas-item-controls {
    display: flex;
    gap: 4px;
}

.canvas-item-controls .btn {
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1;
}

.canvas-item-content {
    padding: 12px;
    overflow: auto;
    max-height: calc(100% - 40px);
}

.canvas-item-content img {
    max-width: 100%;
    height: auto;
}

/* Resize Handles */
.resize-handles {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.resize-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #007bff;
    border: 2px solid white;
    border-radius: 50%;
    pointer-events: all;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.resize-handle:hover {
    background: #0056b3;
    transform: scale(1.3);
    box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

.resize-handle:active {
    background: #004085;
    transform: scale(1.1);
}

/* Corner handles */
.resize-handle-nw { top: -6px; left: -6px; cursor: nw-resize; }
.resize-handle-ne { top: -6px; right: -6px; cursor: ne-resize; }
.resize-handle-sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.resize-handle-se { bottom: -6px; right: -6px; cursor: se-resize; }

/* Edge handles */
.resize-handle-n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.resize-handle-s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.resize-handle-w { left: -6px; top: 50%; transform: translateY(-50%); cursor: w-resize; }
.resize-handle-e { right: -6px; top: 50%; transform: translateY(-50%); cursor: e-resize; }

/* Ensure resize handles are always on top when component is selected */
.canvas-item.selected .resize-handles {
    z-index: 15;
}

/* Prevent text selection during resize */
.canvas-item.resizing {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Canvas Controls */
.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 30;
    background: rgba(255,255,255,0.9);
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.canvas-controls .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    transition: all 0.2s ease;
    /* Remove overflow: hidden to ensure drop zone works */
    /* Ensure drop zone accepts events */
    pointer-events: auto;
    cursor: default;
}

.canvas-container.drag-over {
    border-color: #007bff;
    background-color: #f8f9ff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Ensure canvas grid doesn't interfere with drop zone */
.canvas-grid {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: transparent;
    /* Remove overflow: hidden to ensure drop zone works */
    /* Allow events to pass through to container but enable them for canvas items */
    pointer-events: auto;
}

/* Empty Canvas State */
.empty-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* JavaScript Interop Styles */
.canvas-item.dragging {
    opacity: 0.8;
    z-index: 1000;
}

.canvas-item.resizing {
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .canvas-item {
        min-width: 150px;
        min-height: 80px;
    }
    
    .canvas-item-header {
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .canvas-item-content {
        padding: 8px;
    }
    
    .resize-handle {
        width: 6px;
        height: 6px;
    }
    
    .canvas-controls {
        top: 5px;
        right: 5px;
        padding: 6px;
    }
    
    .canvas-controls .btn {
        padding: 3px 6px;
        font-size: 11px;
    }
} 

/* Canvas Single Area Mode */
.canvas-single-area {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 600px;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    pointer-events: auto;
    cursor: default;
}

.canvas-single-area.drag-over {
    border-color: #007bff;
    background-color: #f8f9ff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Canvas Mode Toggle */
.canvas-mode-toggle {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.canvas-mode-toggle .btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* Grid Controls - only show when in grid mode */
.grid-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
} 

/* Canvas Hybrid Mode */
.canvas-hybrid {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
}

.hybrid-grid-area,
.hybrid-free-area {
    flex: 1;
    min-height: 300px;
}

.hybrid-section-title {
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    color: #495057;
    border-left: 3px solid #007bff;
}

.hybrid-grid-area .canvas-grid {
    height: 300px;
    min-height: 300px;
}

.hybrid-free-area .canvas-single-area {
    height: 300px;
    min-height: 300px;
}

/* Canvas Mode Selector */
.canvas-mode-selector {
    display: flex;
    align-items: center;
    margin-left: 10px;
}

.canvas-mode-selector .btn-group {
    display: flex;
    gap: 1px;
}

.canvas-mode-selector .btn {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 0;
}

.canvas-mode-selector .btn:first-child {
    border-radius: 4px 0 0 4px;
}

.canvas-mode-selector .btn:last-child {
    border-radius: 0 4px 4px 0;
}

/* Zone Template Selector */
.zone-template-selector {
    margin-left: 10px;
}

.zone-template-selector .form-select {
    font-size: 11px;
    padding: 4px 8px;
    height: auto;
    min-width: 120px;
}

/* Enhanced Canvas Controls */
.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 30;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.canvas-controls.collapsed {
    width: 40px;
    height: 40px;
}

.canvas-controls.expanded {
    width: auto;
    min-width: 200px;
    max-width: calc(100% - 20px);
}

.controls-toggle {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.95);
    color: #6c757d;
    z-index: 31;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.controls-toggle:hover {
    background: rgba(255,255,255,1);
    color: #495057;
    transform: scale(1.05);
}

.controls-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 1;
    transition: all 0.3s ease;
}

.canvas-controls.collapsed .controls-content {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.controls-section {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.canvas-controls .btn {
    padding: 4px 8px;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Canvas Mode Selector */
.canvas-mode-selector {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.canvas-mode-selector .btn-group {
    display: flex;
    gap: 1px;
}

.canvas-mode-selector .btn {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 0;
    flex-shrink: 0;
}

.canvas-mode-selector .btn:first-child {
    border-radius: 4px 0 0 4px;
}

.canvas-mode-selector .btn:last-child {
    border-radius: 0 4px 4px 0;
}

/* Zone Template Selector */
.zone-template-selector {
    flex-shrink: 0;
}

.zone-template-selector .form-select {
    font-size: 11px;
    padding: 4px 8px;
    height: auto;
    min-width: 120px;
    max-width: 150px;
}

/* Grid Controls */
.grid-controls {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.grid-controls .btn {
    font-size: 10px;
    padding: 4px 6px;
    min-width: 40px;
}

/* Responsive design for canvas controls */
@media (max-width: 1200px) {
    .canvas-controls.expanded {
        flex-direction: column;
        gap: 5px;
        max-width: 200px;
    }
    
    .canvas-mode-selector,
    .zone-template-selector,
    .grid-controls {
        margin-left: 0;
        margin-top: 5px;
    }
}

@media (max-width: 768px) {
    .canvas-controls {
        position: relative;
        top: auto;
        right: auto;
        margin: 10px;
        max-width: none;
        width: calc(100% - 20px);
    }
    
    .canvas-controls.collapsed {
        width: 40px;
        height: 40px;
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    .canvas-controls .btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Zone Template Specific Styles */
.zone-template-header .grid-zone:nth-child(1) {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.zone-template-header .grid-zone:nth-child(2) {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.zone-template-header .grid-zone:nth-child(3) {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.zone-template-landing .grid-zone:nth-child(1) {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

.zone-template-landing .grid-zone:nth-child(2) {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.zone-template-landing .grid-zone:nth-child(3) {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.zone-template-landing .grid-zone:nth-child(4) {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.zone-template-dashboard .grid-zone:nth-child(1) {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.zone-template-dashboard .grid-zone:nth-child(2) {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.zone-template-dashboard .grid-zone:nth-child(3) {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.zone-template-blog .grid-zone:nth-child(1) {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

.zone-template-blog .grid-zone:nth-child(2) {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.zone-template-blog .grid-zone:nth-child(3) {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.zone-template-ecommerce .grid-zone:nth-child(1) {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
}

.zone-template-ecommerce .grid-zone:nth-child(2) {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
}

.zone-template-ecommerce .grid-zone:nth-child(3) {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
}

.zone-template-ecommerce .grid-zone:nth-child(4) {
    background: rgba(108, 117, 125, 0.1);
    border-color: #6c757d;
}

.zone-template-ecommerce .grid-zone:nth-child(5) {
    background: rgba(23, 162, 184, 0.1);
    border-color: #17a2b8;
}

.zone-template-ecommerce .grid-zone:nth-child(6) {
    background: rgba(111, 66, 193, 0.1);
    border-color: #6f42c1;
} 

/* Preview Page Styles */
.preview-container {
    min-height: 100vh;
    background: #f8f9fa;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.preview-header {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-title {
    margin: 0;
    color: #333;
    font-size: 2rem;
    font-weight: 600;
}

.preview-description {
    margin: 10px 0 0 0;
    color: #6c757d;
    font-size: 1.1rem;
}

.preview-content {
    padding: 40px 0;
    min-height: calc(100vh - 120px);
    position: relative;
}

.preview-components {
    position: relative;
    min-height: 600px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 0 auto;
    max-width: 1200px;
    overflow: hidden;
}

.preview-component {
    position: absolute;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.2s ease;
}

.preview-component:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.component-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.component-content {
    flex: 1;
    padding: 15px;
    overflow: auto;
    word-wrap: break-word;
}

.component-content img {
    max-width: 100%;
    height: auto;
}

.component-content h1,
.component-content h2,
.component-content h3,
.component-content h4,
.component-content h5,
.component-content h6 {
    margin-top: 0;
    margin-bottom: 10px;
}

.component-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.component-content button {
    margin: 5px;
}

.component-content form {
    margin: 10px 0;
}

.component-content input,
.component-content textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.empty-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin: 0 auto;
    max-width: 600px;
}

/* Responsive Design for Preview */
@media (max-width: 768px) {
    .preview-header {
        padding: 15px 0;
    }
    
    .preview-title {
        font-size: 1.5rem;
    }
    
    .preview-description {
        font-size: 1rem;
    }
    
    .preview-content {
        padding: 20px 0;
    }
    
    .preview-components {
        margin: 0 10px;
        min-height: 400px;
    }
    
    .preview-component {
        position: relative !important;
        left: auto !important;
        top: auto !important;
        width: 100% !important;
        height: auto !important;
        margin-bottom: 15px;
    }
}

/* Component-specific styles for preview */
.component-content .hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
    border-radius: 8px;
}

.component-content .hero h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.component-content .hero p {
    color: rgba(255,255,255,0.9);
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.component-content .card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.component-content .card h3 {
    color: #333;
    margin-bottom: 15px;
}

.component-content .gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
}

.component-content .gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 6px;
}

.component-content .testimonial {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.component-content .testimonial p {
    font-style: italic;
    margin-bottom: 10px;
}

.component-content .testimonial cite {
    color: #6c757d;
    font-weight: 500;
}

.component-content .social-icons {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 20px;
}

.component-content .social-icons a {
    font-size: 24px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.component-content .social-icons a:hover {
    transform: scale(1.2);
}

.component-content nav {
    background: #333;
    padding: 15px;
    border-radius: 6px;
}

.component-content nav a {
    color: white;
    text-decoration: none;
    margin-right: 20px;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.component-content nav a:hover {
    background: rgba(255,255,255,0.1);
}

.component-content footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: 6px;
}

.component-content footer p {
    margin: 0;
    color: rgba(255,255,255,0.8);
}

/* Canvas Loading Overlay */
.canvas-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 8px;
}

.loading-spinner {
    text-align: center;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
}

.loading-text {
    margin-top: 10px;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
}

/* Ensure canvas container has relative positioning for overlay */
.canvas-container {
    position: relative;
} 