/* WYSIWYG Form Builder Styles */

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    overflow: hidden;
}

/* Demo container */
.wysiwyg-demo {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Form Builder */
.form-builder {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
}

/* Toolbar */
.form-builder-toolbar {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
}

.toolbar-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-right: 8px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.toolbar-button:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toolbar-button:active {
    transform: translateY(0);
}

.toolbar-button-icon {
    font-size: 18px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(255,255,255,0.3);
    margin: 0 8px;
}

/* Main container */
.form-builder-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Palette Panel */
.palette-panel {
    width: 220px;
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 16px;
    transition: all 0.3s;
}

.palette-panel.hidden {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

.palette-panel h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    margin-bottom: 8px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.palette-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.palette-item-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.palette-item-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Canvas Panel */
.canvas-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.form-title-container {
    padding: 24px 24px 16px 24px;
    border-bottom: 2px solid #f0f0f0;
}

.form-title-input {
    width: 100%;
    font-size: 28px;
    font-weight: 700;
    color: #333;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 0;
    outline: none;
    transition: all 0.2s;
}

.form-title-input:focus {
    border-bottom-color: #667eea;
}

.form-canvas {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.canvas-empty-message {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    font-size: 16px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    background: #fafafa;
}

/* Form Field Preview */
.form-field-preview {
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.form-field-preview:hover {
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15);
}

.form-field-preview.selected {
    border-color: #667eea;
    background: #f8f9ff;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.25);
}

.field-preview-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.field-type-label {
    flex: 1;
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
}

.field-move-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    color: #666;
    transition: all 0.2s;
}

.field-move-btn:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.field-preview-content {
    padding: 8px 0;
}

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

.preview-input {
    padding: 10px 12px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #999;
    font-size: 14px;
}

.preview-input-checkbox {
    padding: 8px;
    background: transparent;
    border: none;
}

.preview-textarea {
    min-height: 80px;
}

/* Property Editor */
.form-builder-properties {
    width: 300px;
    background: #fafafa;
    border-left: 1px solid #e0e0e0;
    overflow-y: auto;
    transition: all 0.3s;
}

.form-builder-properties.hidden {
    width: 0;
    border: none;
    overflow: hidden;
}

.property-editor-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.property-editor-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.property-editor-properties {
    padding: 16px;
}

.property-editor-no-selection {
    padding: 40px 20px;
    text-align: center;
    color: #999;
    font-size: 14px;
}

.property-group {
    margin-bottom: 20px;
}

.property-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.property-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

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

.property-input:disabled {
    background: #f0f0f0;
    color: #999;
}

.property-group-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.property-group-checkbox .property-label {
    margin: 0;
}

.property-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.property-editor-delete-btn {
    width: 100%;
    padding: 10px;
    margin-top: 20px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.property-editor-delete-btn:hover {
    background: #cc0000;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.3);
}

/* Preview Mode */
.form-preview-submit {
    margin-top: 24px;
    padding: 12px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.form-preview-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

/* FormField Component Styles */
.form-field {
    margin-bottom: 20px;
}

.form-field-label-container {
    margin-bottom: 8px;
}

.form-field-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.required-indicator {
    color: #ff4444;
}

.form-field-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-field-input-container input,
.form-field-input-container select,
.form-field-input-container textarea {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-field-input-container input:focus,
.form-field-input-container select:focus,
.form-field-input-container textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-field-validation {
    width: 24px;
    height: 24px;
}

.form-field-error {
    margin-top: 6px;
    font-size: 13px;
    color: #ff4444;
    min-height: 18px;
}

.form-field.has-error input,
.form-field.has-error select,
.form-field.has-error textarea {
    border-color: #ff4444;
}

/* Responsive */
@media (max-width: 1200px) {
    .palette-panel {
        width: 180px;
    }
    
    .form-builder-properties {
        width: 260px;
    }
}

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

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

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

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