.grt-ticket-form-builder-wrap .grt-fb-container {
    display: flex;
    gap: 30px;
    margin-top: 20px;
    align-items: flex-start;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Sidebar Styles */
.grt-fb-sidebar {
    width: 280px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 40px;
    flex-shrink: 0;
}

.grt-fb-sidebar h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 16px;
    color: #23282d;
    border-bottom: 2px solid #f0f0f1;
    padding-bottom: 10px;
}

.grt-fb-field-types .button {
    display: flex;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
    text-align: left;
    padding: 10px 15px;
    height: auto;
    border: 1px solid #e2e4e7;
    background: #fff;
    transition: all 0.2s ease;
    border-radius: 6px;
    color: #50575e;
    font-size: 14px;
}

.grt-fb-field-types .button:hover {
    background: #f0f6fc;
    border-color: #2271b1;
    color: #2271b1;
    transform: translateX(4px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.grt-fb-field-types .button .dashicons {
    margin-right: 12px;
    color: #8c8f94;
    transition: color 0.2s;
}

.grt-fb-field-types .button:hover .dashicons {
    color: #2271b1;
}

.grt-fb-actions {
    margin-top: 25px;
    border-top: 2px solid #f0f0f1;
    padding-top: 20px;
}

#grt-fb-save-btn {
    width: 100%;
    justify-content: center;
    height: 40px;
    font-size: 15px;
}

/* Main Preview Area */
.grt-fb-main {
    flex: 1;
    max-width: 900px;
}

/* Simulate Frontend Container (.grt-ticket-inner) */
.grt-fb-fields-list {
    min-height: 400px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start; /* Ensure items don't stretch vertically */
    gap: 0; /* We handle gaps with margins/padding like frontend if needed, or use justify-content */
    justify-content: space-between; /* Match frontend flex layout */
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    position: relative;
}

.grt-fb-empty-state {
    width: 100%;
    text-align: center;
    padding: 60px 20px;
    color: #a0a5aa;
    border: 2px dashed #dcdcde;
    border-radius: 8px;
    background: #f9f9fa;
}

/* Field Items */
.grt-fb-field-item {
    background: transparent;
    transition: all 0.2s;
    margin-bottom: 20px; /* Match .grt-form-group margin-bottom */
    box-sizing: border-box;
    position: relative;
}

/* Width Classes - Matching Frontend Logic */
.grt-fb-width-100 { width: 100%; }
.grt-fb-width-50 { width: 48%; }
.grt-fb-width-33 { width: 31%; }

/* Visual Preview Styling */
.grt-fb-field-preview {
    position: relative;
    border: 2px solid transparent; /* Reserve space for border */
    padding: 5px;
    border-radius: 8px;
    cursor: grab;
    transition: all 0.2s;
}

.grt-fb-field-preview:active {
    cursor: grabbing;
}

.grt-fb-field-item:hover .grt-fb-field-preview {
    border-color: #dcdcde;
    background: rgba(240, 246, 252, 0.5);
}

.grt-fb-field-item.open .grt-fb-field-preview {
    border-color: #2271b1;
    background: #f0f6fc;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}

/* Header / Actions Overlay */
.grt-fb-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
    font-size: 11px;
    color: #999;
    height: 20px;
}

.grt-fb-field-item:hover .grt-fb-preview-header,
.grt-fb-field-item.open .grt-fb-preview-header {
    opacity: 1;
}

.grt-fb-handle-area {
    display: flex;
    align-items: center;
    gap: 6px;
}

.grt-fb-handle {
    cursor: grab;
    color: #a7aaad;
}

.grt-fb-type-label {
    text-transform: uppercase;
    background: #e5e5e5;
    color: #50575e;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

.grt-fb-actions-area {
    display: flex;
    gap: 5px;
}

.grt-fb-actions-area button {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 3px;
    cursor: pointer;
    color: #50575e;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    min-width: 24px;
}

.grt-fb-actions-area button:hover {
    color: #2271b1;
    border-color: #2271b1;
}

.grt-fb-actions-area button.grt-fb-remove-btn:hover {
    color: #d63638;
    border-color: #d63638;
}

/* Input Preview Styles (Match Frontend Exactly) */
.grt-fb-preview-content {
    /* No padding here, mimic direct form group structure */
}

.grt-fb-preview-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    cursor: pointer; /* To indicate clickable for edit? No, edit is btn */
}

.grt-fb-required-mark {
    color: #e74c3c;
}

.grt-fb-preview-input-el {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    font-size: 14px;
    background: #fff;
    color: #333; 
    pointer-events: none; /* Make it unclickable in preview */
    box-sizing: border-box;
    font-family: inherit;
}

.grt-fb-preview-input-el[disabled] {
    background-color: #fff; /* Keep white to look like live form */
    color: #333;
}

textarea.grt-fb-preview-input-el {
    height: 120px;
    resize: none;
}

/* Settings Panel */
.grt-fb-field-settings {
    display: none;
    background: #fff;
    border: 1px solid #2271b1;
    border-top: none;
    padding: 20px;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 10;
    position: relative;
    margin-top: -2px; /* Overlap border */
}

.grt-fb-field-item.open .grt-fb-field-settings {
    display: block;
}

.grt-fb-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.grt-fb-col {
    flex: 1;
}

.grt-fb-col label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
    color: #23282d;
}

.grt-fb-col input[type="text"],
.grt-fb-col select,
.grt-fb-input-options {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.grt-fb-col input[type="text"]:focus,
.grt-fb-col select:focus,
.grt-fb-input-options:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.grt-fb-settings-footer {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f1;
}

/* System Field Styling */
.grt-fb-field-item.system-field .grt-fb-type-label {
    background: #2271b1;
    color: #fff;
}

.grt-fb-field-item.system-field .grt-fb-lock-btn {
    cursor: not-allowed;
    opacity: 0.6;
    background: #f0f0f1;
    border: none;
}

/* Placeholder for Sortable */
.grt-fb-placeholder {
    background: #f0f6fc;
    border: 2px dashed #2271b1;
    border-radius: 8px;
    opacity: 0.8;
    margin-bottom: 20px;
    box-sizing: border-box;
}
