:root {
    /* Primary Colors */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    /* Secondary Colors */
    --secondary-50: #fef7ff;
    --secondary-100: #fce7ff;
    --secondary-200: #f8d4fe;
    --secondary-300: #f0abfc;
    --secondary-400: #e879f9;
    --secondary-500: #d946ef;
    --secondary-600: #c026d3;
    --secondary-700: #a21caf;
    --secondary-800: #86198f;
    --secondary-900: #701a75;

    /* Neutral Colors */
    --neutral-50: #fafafa;
    --neutral-100: #f4f4f5;
    --neutral-200: #e4e4e7;
    --neutral-300: #d4d4d8;
    --neutral-400: #a1a1aa;
    --neutral-500: #71717a;
    --neutral-600: #52525b;
    --neutral-700: #3f3f46;
    --neutral-800: #27272a;
    --neutral-900: #18181b;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-accent: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Border Colors */
    --border-light: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-dark: #94a3b8;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Border Radius */
    --radius-sm: 0.125rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    display: flex;
    align-items: center;
    background: var(--bg-accent);
    padding: 0 1.5rem;
    height: 4rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 100;
    gap: 1rem;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
    justify-self: start;
    flex-shrink: 0;
}

.nav-tabs .tab {
    padding: 10px 20px;
    border: none;
    background-color: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 6px;
    margin-right: 8px;
}

/* Floating Add Button with Hover-Expand Effect */
.floating-add-btn {
    position: fixed;
    top: calc(4rem + 1.5rem);
    left: 1.5rem;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon when collapsed */
    
    width: 3rem; /* Initial width (circular) */
    height: 3rem; /* Initial height (circular) */
    padding: 0;
    gap: 0;

    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: 50%; /* Make it a circle */
    
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* Important: hides the text until hover */
}

.floating-style-btn {
    position: fixed;
    top: calc(4rem + 1.5rem);
    right: 1.5rem;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center; /* Center icon when collapsed */
    
    width: 3rem; /* Initial width (circular) */
    height: 3rem; /* Initial height (circular) */
    padding: 0;
    gap: 0;

    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: 50%; /* Make it a circle */
    
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden; /* Important: hides the text until hover */
}
.floating-add-btn i,
.floating-style-btn i {
    font-size: 1.2rem;
    flex-shrink: 0; /* Prevent icon from shrinking */
    transition: transform 0.3s ease-in-out;
}

.floating-add-btn span ,
.floating-style-btn span {
    width: 0;
    opacity: 0;
    white-space: nowrap;
    font-size: 0.9rem;
    font-weight: 500;
    transition: width 0.2s 0.1s ease-out, opacity 0.2s 0.1s ease-out;
}

.floating-add-btn:hover,
.floating-style-btn:hover {
    width: 9.5rem; /* Expanded width */
    border-radius: var(--radius-full); /* Pill shape */
    justify-content: flex-start; /* Align content to the left */
    padding: 0 1rem; /* Add padding for expanded state */
    gap: 0.6rem; /* Gap between icon and text */

    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: var(--primary-600);
}

.floating-add-btn:hover i, 
.floating-style-btn:hover i {
    transform: rotate(90deg);
}

.floating-add-btn:hover span,
.floating-style-btn:hover span {
    width: auto; /* Let the text take its space */
    opacity: 1;
}

.floating-add-btn:active ,
.floating-style-btn:active{
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Hide button when sidebar is open */
/* body.sidebar-open .floating-style-btn  */
body.sidebar-open .floating-add-btn{
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.nav-tabs .tab:last-child {
    margin-right: 0;
}

.nav-tabs .tab.active,
.nav-tabs .tab:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-actions {
    display: flex;
    align-items: center;
    margin-left: auto; /* Pushes actions to the right */
}

.preview-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-inverse);
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-full);
    transition: all 0.3s ease;
    margin-left: auto; /* Push to the far right */
}

.preview-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.preview-toggle input[type="checkbox"] {
    width: 2.5rem;
    height: 1.25rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    appearance: none;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.preview-toggle input[type="checkbox"]:checked {
    background: var(--primary-500);
}

.preview-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1rem;
    height: 1rem;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.preview-toggle input[type="checkbox"]:checked::before {
    transform: translateX(1.25rem);
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* This will now be in the center, to the right of tabs */
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-inverse);
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn i {
    font-size: 0.875rem;
}

.save-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-inverse);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    backdrop-filter: blur(10px);
}

.save-status.saved {
    background: rgba(16, 185, 129, 0.2);
}

.save-status.unsaved {
    background: rgba(245, 158, 11, 0.2);
}

.save-status i {
    font-size: 0.625rem;
}

.text-success {
    color: var(--accent-green);
}

.text-warning {
    color: var(--accent-yellow);
}

/* Main layout - restore original flexbox system */
.main-layout {
    display: flex;
    flex: 1;
    gap: 0;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
    height: calc(100vh - 4rem - 4rem - 1rem);
    justify-content: center;
    align-items: stretch;
    background: var(--bg-secondary);
    margin: 0;
}

.main-layout.sidebar-open {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-areas: "sidebar canvas";
    grid-template-rows: 1fr;
    gap: 0;
    justify-content: initial;
    align-items: stretch;
    padding: 0.5rem;
    margin: 0;
    height: calc(100vh - 4rem - 4rem - 1rem);
}

/* Base sidebar styling */
.sidebar {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
    width: 100%;
    margin: 0;
}

/* Remove the accent bar at top */
.sidebar::before {
    display: none;
}

/* Left sidebar - minimal changes for alignment */
.left-sidebar {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--primary-50) 100%);
    width: 380px;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    left: 0;
    top: 0;
    height: calc(100vh - 4rem - 4rem - 1rem);
    z-index: -1;
    overflow: hidden;
    border-right: none;
    visibility: hidden;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 4rem - 4rem - 1rem);
    padding: 0;
    margin: 0;
}

.main-layout.sidebar-open .left-sidebar {
    position: relative;
    transform: translateX(0);
    grid-area: sidebar;
    z-index: 200;
    visibility: visible;
    /* height: calc(100vh - 4rem - 4rem - 1rem); */
    height: 100%;
    max-height: unset;
}

.left-sidebar.sidebar-open {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

/* Content area separation for both panels */
.left-sidebar .library-search,
.right-sidebar .settings-placeholder,
.right-sidebar .field-settings-content {
    border-top: 1px solid var(--border-light);
}

/* Library search section for left sidebar */
.left-sidebar .library-search {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* Right sidebar content areas */
.right-sidebar .settings-placeholder,
.right-sidebar .field-settings-content {
    padding: 1.5rem;
    background: var(--bg-primary);
    flex: 1;
}

.right-sidebar .settings-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
}

.left-sidebar .search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 0 1rem;
    margin: 0;
}

.left-sidebar .search-icon {
    position: absolute;
    left: 2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    z-index: 2;
}

.left-sidebar .search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 2.5rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
    height: 48px;
    box-sizing: border-box;
}

.left-sidebar .search-input:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.left-sidebar .search-input::placeholder {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Library categories for left sidebar */
.left-sidebar .library-categories {
    display: flex;
    flex-direction: row;
    gap: 0.375rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    flex-shrink: 0;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

.left-sidebar .category-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.5rem;
    background: none;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    font-weight: var(--font-medium);
    color: var(--text-secondary);
    text-align: center;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.left-sidebar .category-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.left-sidebar .category-btn.active {
    background: var(--primary-50);
    color: var(--primary-600);
    box-shadow: inset 0 0 0 1px var(--primary-200);
}

.left-sidebar .category-btn i {
    font-size: 0.9375rem;
    width: 1.125rem;
    text-align: center;
    flex-shrink: 0;
}

/* Library fields for left sidebar - fix height and width */
.left-sidebar .library-fields {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    width: 100%;
    box-sizing: border-box;
    min-height: 0;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
    margin: 0;
}

/* Ensure field items take full width */
.left-sidebar .field-type-item {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
}

/* Custom scrollbar for left sidebar fields */
.left-sidebar .library-fields::-webkit-scrollbar {
    width: 8px;
}

.left-sidebar .library-fields::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.left-sidebar .library-fields::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
}

.left-sidebar .library-fields::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
}

/* Right sidebar - align with left sidebar positioning */
.right-sidebar {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--secondary-50) 100%);
    width: 320px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    position: fixed;
    right: 0.5rem;
    top:0;
    height: 100%;
    padding: 0;
    border-left: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    overflow-y: auto;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    
}
.right-theme-sidebar {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--secondary-50) 100%);
    width: 320px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 150;
    position: fixed;
    right: 0.5rem;
    top:0;
    height: 100%;
    padding: 0;
    border-left: 1px solid var(--border-light);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    overflow-y: auto;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    
}

.main-layout.settings-open .right-sidebar {
    transform: translateX(0);
}

/* Restore original canvas container behavior */
.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
    width: 100%;
    z-index: 10;
    max-width: 1200px;
    margin: 0 auto;
    transition: all 0.3s ease;
    position: relative;
    min-height: 0;
}

.main-layout.sidebar-open .canvas-container {
    grid-area: canvas;
    max-width: none;
    margin: 0;
    height: calc(100vh - 50px);
    overflow-y: auto;
}

/* Ensure proper spacing when settings panel is open */
.main-layout.settings-open:not(.sidebar-open) .canvas-container {
    transition: margin-right 0.3s ease;
    margin-right: 320px;
    width: calc(100% - 320px);
}

.main-layout.settings-open .form-canvas {
    max-width: 650px;
    margin: 0 auto;
    transition: max-width 0.3s ease;
}

/* Form canvas - contain fields within boundaries while allowing vertical growth */
.form-canvas {
    position: relative;
    background: var(--bg-primary);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0;
    padding: 1.5rem;
    min-height: 400px;
    overflow-x: hidden;
    overflow-y: visible;
    margin: 1rem auto;
    height: auto;
    transition: max-width 0.3s ease;
    width: 100%;
    max-width: 800px;
    box-sizing: border-box;
}

.main-layout.sidebar-open .form-canvas {
    max-width: calc(100% - 2rem);
}

/* When settings panel is open, reduce canvas width */
.main-layout.settings-open:not(.sidebar-open) .form-canvas {
    max-width: 600px;
}

/* When both sidebar and settings are open, adjust the canvas container */
.main-layout.sidebar-open.settings-open .canvas-container {
    grid-area: canvas;
    max-width: none;
    margin: 0;
    margin-right: 320px; /* Make room for the right panel */
    width: calc(100% - 320px);
    transition: all 0.3s ease;
}

/* Adjust form canvas when both panels are open */
.main-layout.sidebar-open.settings-open .form-canvas {
    max-width: 500px; /* Smaller max-width when both panels are open */
    margin: 1rem auto;
    transition: max-width 0.3s ease;
}

/* Unified sidebar header styling for both panels - clean and simple */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    min-height: 52px;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
}

/* Remove the gradient overlay */
.sidebar-header::before {
    display: none;
}

/* Header content positioning */
.sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    position: relative;
    z-index: 2;
    color: var(--text-primary);
    text-shadow: none;
}

/* Close button styling for both panels - simple and clean */
.close-library-btn,
.close-settings-btn {
    background: #fff !important;
    border: 1.5px solid var(--primary-400) !important;
    color: var(--primary-600) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-full);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    position: relative;
    z-index: 10;
}

.close-library-btn:hover,
.close-settings-btn:hover {
    background: var(--primary-500) !important;
    color: #fff !important;
    border-color: var(--primary-700) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.close-library-btn .close-icon,
.close-settings-btn .close-icon {
    font-size: 1.5rem;
    font-weight: 700;
    color: inherit;
    line-height: 1;
    pointer-events: none;
}

/* Left panel specific header adjustments */
.left-sidebar .sidebar-header {
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    margin: 0;
    padding-top: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
}

.left-sidebar.sidebar-open .sidebar-header {
    border-top-right-radius: 0;
}

/* Right panel specific header adjustments */
.right-sidebar .sidebar-header {
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    width: 100%;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
}

/* Remove the elegant separator */
.sidebar-header::after {
    display: none;
}

/* Form field styles - proper containment and layout */
.form-field {
    display: block;
    width: 100%;
    max-width: 100%;
    background: white; /* Keep field background white for contrast */
    border: 1px solid transparent; /* Completely transparent border */
    border-radius: 8px;
    margin-bottom: 1.5rem;
    padding: 0;
    position: relative;
    overflow-x: hidden;
    overflow-y: visible;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: none; /* Remove default shadow */
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Only show subtle styling on hover */
.form-field:hover {
    border-color: transparent; /* Keep border transparent on hover */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle shadow on hover */
}

/* Show border and enhanced styling only when selected */
.form-field.selected {
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Enhanced field header layout */
.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    background-color: transparent; /* Make header background transparent */
    padding: 8px 12px;
    border-bottom: none; /* Remove the horizontal line */
    min-height: 40px;
    padding-left: 0px;
}

/* Special styling for layout elements without labels */
.field-header.no-label {
    padding: 4px 12px;
    min-height: 24px;
    justify-content: flex-end;
    margin-bottom: 0;
}

.field-header .field-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 24px;
    margin: 0;
    padding: 0;
    flex: 1;
    min-width: 0; /* Allows text to truncate if needed */
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Required field indicator */
.field-header .field-label .required {
    color: #dc2626;
    margin-left: 2px;
    font-weight: 700;
}

/* Position field controls in the right area of the header */
.field-header .field-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 1;
    flex-shrink: 0;
    margin-left: auto;
    padding: 2px 4px;
    background: transparent; /* Make controls background transparent */
    border-radius: 4px;
    border: none; /* Remove border from controls */
}

/* Show controls on field hover or selection */
.form-field .field-controls {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.form-field:hover .field-controls,
.form-field.selected .field-controls {
    opacity: 1;
}

/* Improved field action buttons */
.field-action {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    color: #666;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    position: relative;
}

.field-action:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1);
}

.field-action.edit-field:hover {
    color: #4285f4;
    background: rgba(66, 133, 244, 0.15);
}

.field-action.delete-field:hover {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.15);
}

/* Drag handle improvements */
.field-handle {
    position: relative;
    padding: 4px;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
    color: #666;
    background: transparent;
    user-select: none;
    width: 20px;
    height: 20px;
}

.field-handle:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: scale(1.1);
}

.field-handle:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* Drag grip - smaller and more refined */
.drag-grip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    width: 6px;
    height: 6px;
    pointer-events: none;
}

.grip-dot {
    width: 1px;
    height: 1px;
    background: currentColor;
    border-radius: 50%;
    pointer-events: none;
}

/* Field content area - ensure proper containment */
.field-content {
    padding: 0 12px 12px 12px; /* Remove top padding to eliminate gap */
    background: transparent; /* Make content background transparent */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    word-wrap: break-word;
}

/* Special content styling for layout elements */
.form-field[data-field-type="heading"] .field-content,
.form-field[data-field-type="paragraph"] .field-content,
.form-field[data-field-type="divider"] .field-content {
    padding: 0 12px 8px 12px;
}

/* Ensure headings have proper styling inside the canvas */
.form-field[data-field-type="heading"] h1,
.form-field[data-field-type="heading"] h2,
.form-field[data-field-type="heading"] h3,
.form-field[data-field-type="heading"] h4,
.form-field[data-field-type="heading"] h5,
.form-field[data-field-type="heading"] h6 {
    margin: 0;
    padding: 0;
    line-height: 1.2;
}

.form-field[data-field-type="heading"] h1 { font-size: 2rem; font-weight: 700; }
.form-field[data-field-type="heading"] h2 { font-size: 1.5rem; font-weight: 600; }
.form-field[data-field-type="heading"] h3 { font-size: 1.25rem; font-weight: 600; }
.form-field[data-field-type="heading"] h4 { font-size: 1.125rem; font-weight: 500; }
.form-field[data-field-type="heading"] h5 { font-size: 1rem; font-weight: 500; }
.form-field[data-field-type="heading"] h6 { font-size: 0.875rem; font-weight: 500; }

/* Subheading styles */
.form-field[data-field-type="heading"] .heading-subtitle {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.4;
}

/* Subheading input styling */
#field-subheading:disabled {
    background-color: #f3f4f6;
    color: #9ca3af;
    cursor: not-allowed;
}

/* Dual Column Layout Styling */
.dual-column-wrapper {
    display: flex;
    width: 100%;
}

.column-left,
.column-right {
    flex: 1;
    min-width: 0;
}

.column-drop-zone {
    min-height: 80px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.column-drop-zone:hover {
    border-color: #4285f4;
    background: #f8f9fa;
}

.column-drop-zone.drag-over {
    border-color: #4285f4;
    background: #e8f0fe;
    transform: scale(1.02);
}

.drop-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.drop-placeholder i {
    font-size: 1.5rem;
    color: #9ca3af;
}

/* Ensure fields inside columns are properly contained */
.column-left .form-field,
.column-right .form-field {
    margin: 0;
    width: 100%;
    border: none !important;
    box-shadow: none !important;
}

.column-left .field-content,
.column-right .field-content {
    width: 100%;
}

/* Remove unwanted borders from fields inside dual-column layout */
.dual-column-wrapper .form-field {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

.dual-column-wrapper .field-header {
    border-bottom: none !important;
    background: transparent !important;
    padding: 4px 0 !important;
}

.dual-column-wrapper .field-content {
    padding: 0 !important;
    background: transparent !important;
}

/* Remove any borders from input fields inside dual-column */
.dual-column-wrapper .field-input {
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
}

.dual-column-wrapper .field-input:focus {
    border-color: #4285f4 !important;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1) !important;
}

/* Ensure no unwanted borders on any elements inside dual-column */
.dual-column-wrapper * {
    border-top: none !important;
    border-bottom: none !important;
}

.dual-column-wrapper .field-input,
.dual-column-wrapper .field-label,
.dual-column-wrapper .field-controls {
    border-top: none !important;
    border-bottom: none !important;
}

/* Ensure nested fields have proper styling and controls */
.dual-column-wrapper .form-field {
    position: relative;
    margin: 0;
    padding: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
}

.dual-column-wrapper .form-field:hover {
    border-color: #4285f4;
    box-shadow: 0 2px 4px rgba(66, 133, 244, 0.1);
}

.dual-column-wrapper .form-field .field-controls {
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.dual-column-wrapper .form-field:hover .field-controls {
    opacity: 1;
}

.dual-column-wrapper .form-field .field-header {
    padding: 4px 0;
    margin-bottom: 8px;
}

.dual-column-wrapper .form-field .field-content {
    padding: 0;
}

/* Remove any red borders that might be appearing */
.dual-column-wrapper .form-field,
.dual-column-wrapper .field-header,
.dual-column-wrapper .field-content,
.dual-column-wrapper .field-controls,
.dual-column-wrapper .field-actions {
    border-color: transparent !important;
    outline: none !important;
}

/* Comprehensive fix for any unwanted borders in dual-column */
.dual-column-wrapper .form-field {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    outline: none !important;
}

.dual-column-wrapper .form-field::before,
.dual-column-wrapper .form-field::after {
    display: none !important;
    content: none !important;
}

.dual-column-wrapper .field-header::before,
.dual-column-wrapper .field-header::after {
    display: none !important;
    content: none !important;
}

.dual-column-wrapper .field-content::before,
.dual-column-wrapper .field-content::after {
    display: none !important;
    content: none !important;
}

/* Ensure no borders on any pseudo-elements */
.dual-column-wrapper *::before,
.dual-column-wrapper *::after {
    border: none !important;
    border-color: transparent !important;
}

/* Responsive design for dual columns */
@media (max-width: 768px) {
    .dual-column-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .column-left,
    .column-right {
        flex: none;
        width: 100%;
    }
}

/* Enhanced styling for dual column field */
.form-field[data-field-type="dualColumn"] {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 0.15rem 1rem 1rem 1rem; /* Even less top padding */
    background: #fafafa;
}

.form-field[data-field-type="dualColumn"]:hover {
    border-color: #4285f4;
    background: #f8f9fa;
}

.form-field[data-field-type="dualColumn"] .field-header {
    margin-bottom: 0.15rem; /* Even less bottom margin */
    padding-top: 0;
    padding-bottom: 0.05rem; /* Minimal bottom padding */
    border-bottom: none !important;
}

.form-field[data-field-type="dualColumn"] .field-content {
    margin-top: 0;
    padding-top: 0;
}

/* Field input styling - ensure proper containment */
.field-input {
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: #374151;
    background: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    word-wrap: break-word;
}

.field-input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.field-input::placeholder {
    color: #9ca3af;
}

/* Textarea specific styling - ensure proper containment */
.textarea-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.textarea-wrapper textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    resize: vertical;
    overflow-x: hidden;
    word-wrap: break-word;
}

.textarea-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 12px;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 4px;
    border-radius: 3px;
    pointer-events: none;
}

/* Select wrapper styling - ensure proper containment */
.select-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.select-wrapper select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #666;
    pointer-events: none;
}

/* Radio and checkbox group styling */
.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-group.horizontal,
.checkbox-group.horizontal {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
}

.radio-option,
.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 0;
}

.radio-input,
.checkbox-input {
    margin: 0;
    width: 16px;
    height: 16px;
}

.radio-label,
.checkbox-label {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
    cursor: pointer;
}

/* Date wrapper styling */
.date-wrapper {
    position: relative;
}

/* File upload field styling */
.file-upload-field {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #fafafa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.file-upload-field:hover {
    border-color: #4285f4;
    background: #f8f9fa;
}

.file-upload-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.file-upload-icon {
    font-size: 2rem;
    color: #9ca3af;
}

.file-upload-icon i {
    color: #4285f4;
}

.file-upload-button {
    background: #4285f4;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.file-upload-button:hover {
    background: #3367d6;
}

.file-upload-button i {
    font-size: 0.875rem;
}

/* Rating field styling */
.rating-field {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 0.25rem;
    padding: 0.5rem 0;
}

.rating-field input[type="radio"] {
    display: none;
}

.rating-field label {
    cursor: pointer;
    color: #d1d5db;
    font-size: 1.5rem;
    transition: color 0.2s ease;
}

.rating-field label:hover,
.rating-field label:hover ~ label,
.rating-field input[type="radio"]:checked ~ label {
    color: #fbbf24;
}

/* Range slider styling */
.form-field input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #4285f4 0%, #4285f4 50%, #d1d5db 50%, #d1d5db 100%);
    outline: none;
    -webkit-appearance: none;
    margin: 1rem 0;
}

.form-field input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4285f4;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.form-field input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4285f4;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.range-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.range-values span:nth-child(2) {
    font-weight: 600;
    color: #4285f4;
}

/* Empty canvas styling */
.canvas-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #9ca3af;
    font-size: 16px;
    text-align: center;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    margin: 20px 0;
}

/* Form Canvas specific styling */
.form-canvas {
    min-height: 400px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.form-canvas:empty::before {
    content: 'Drag fields here to build your form';
    display: block;
    text-align: center;
    color: #9ca3af;
    font-size: 16px;
    padding: 60px 20px;
    border: 2px dashed #e5e7eb;
    border-radius: 8px;
    margin: 20px 0;
}

/* Reorder instruction tooltip */
.reorder-instruction {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.reorder-instruction::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.75);
}

/* Enhanced scrollbar for canvas container */
.canvas-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) var(--bg-secondary);
}

.canvas-container::-webkit-scrollbar {
    width: 12px;
}

.canvas-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
}

.canvas-container::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-md);
    transition: background 0.2s ease;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.canvas-container::-webkit-scrollbar-thumb:hover {
    background: var(--border-dark);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Remove redundant sidebar open settings */
.main-layout.sidebar-open.settings-open .form-canvas {
    max-width: calc(100% - 2rem);
    margin: 1rem auto;
}

.settings-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 2rem 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 250px;
}

.settings-placeholder h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 600;
}

.app-footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 10;
    padding: 0.5rem 0;
}

@media (max-width: 1200px) {
    .main-layout.sidebar-open {
        grid-template-columns: 320px 1fr;
    }
    
    .left-sidebar {
        width: 320px;
    }
    
    .form-canvas {
        max-width: 700px;
    }
}

@media (max-width: 900px) {
    .main-layout.sidebar-open {
        display: flex;
        position: relative;
    }
    
    .left-sidebar {
        position: fixed;
        z-index: 400;
        width: 280px;
        box-shadow: var(--shadow-xl);
    }
    
    .right-sidebar {
        width: 300px;
    }
    
    .form-canvas {
        max-width: 600px;
    }
    
    .form-field {
        margin-bottom: 1.25rem;
    }
}

@media (max-width: 600px) {
    .main-layout {
        padding: 0.25rem;
    }
    
    .left-sidebar {
        width: calc(100vw - 1rem);
        left: 0.5rem;
        right: 0.5rem;
    }
    
    .right-sidebar {
        width: calc(100vw - 1rem);
        right: 0.5rem;
    }
    
    .form-canvas {
        max-width: calc(100% - 1rem);
        padding: 1rem;
    }
    
    .form-field {
        margin-bottom: 1rem;
        font-size: 0.9rem;
    }
    
    .floating-add-btn {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        padding: 0.75rem 1rem;
        font-size: 0.75rem;
    }
}

/* Site Footer */
.site-footer {
    background-color: #24243e;
    color: rgba(255, 255, 255, 0.8);
    padding: 15px 30px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 10;
    border-top: 3px solid #0ea5e9;
    flex-shrink: 0;
}

.footer-container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.copyright {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: white;
    text-decoration: underline;
}

.social-link {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-left: 5px;
    transition: color 0.2s ease;
}

.social-link:hover {
    color: white;
}

@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .copyright, .footer-links {
        justify-content: center;
    }
}

/* Field Settings Styles */
.field-settings-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    padding: 1.5rem;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Custom width input styling */
.custom-width-input {
    display: none;
    margin-top: 0.75rem;
}

.custom-width-input.show {
    display: block;
}

.custom-width-input .form-control {
    margin-bottom: 0.375rem;
}

.custom-width-input .form-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Form check styles */
.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.form-check-input {
    width: 1rem;
    height: 1rem;
}

.form-check-label {
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Device Preview Controls */
.device-preview-controls {
    display: none; /* Hidden by default */
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    margin: 0 auto; /* Center horizontally */
}

body.preview-mode .device-preview-controls {
    display: flex; /* Visible in preview mode */
}

.device-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-inverse);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
}

.device-btn i {
    font-size: 0.9rem;
}

.device-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.device-btn.active {
    color: var(--text-inverse);
    background-color: rgba(255, 255, 255, 0.3);
}

/* Canvas size adjustments for device preview */
body.preview-mode .form-canvas.device-desktop {
    width: 100%;
    max-width: 1200px; /* Increased for a better desktop view */
}

body.preview-mode .form-canvas.device-tablet {
    max-width: 768px;
    width: 768px;
}

body.preview-mode .form-canvas.device-mobile {
    max-width: 375px;
    width: 375px;
}

/* Preview Mode Styles */
body.preview-mode .app-header {
    background: var(--primary-700);
}

body.preview-mode .form-canvas {
    box-shadow: var(--shadow-lg);
    margin: 0 auto;
}

.form-canvas.preview-mode {
    background: var(--bg-primary);
    border: none;
}

.form-canvas.preview-mode .form-field {
    pointer-events: none;
    cursor: default;
}

/* Disable form interactions in preview mode */
.form-canvas.preview-mode input,
.form-canvas.preview-mode textarea,
.form-canvas.preview-mode select,
.form-canvas.preview-mode button {
    pointer-events: none !important;
    cursor: not-allowed !important;
    user-select: none !important;
}

.form-canvas.preview-mode .field-controls {
    display: none;
}

/* Hide certain elements in preview mode */
body.preview-mode .left-sidebar,
body.preview-mode .right-sidebar {
    display: none;
}

/* Adjust layout in preview mode */
body.preview-mode .main-layout {
    grid-template-columns: 1fr;
}

body.preview-mode .canvas-container {
    padding: 2rem;
    justify-content: center;
}

/* Insertion Indicator - Stable Version */
.insertion-indicator {
    display: block !important;
    position: relative;
    left: 0;
    right: 0;
    width: 100% !important;
    height: 6px !important;
    min-height: 6px !important;
    margin: 8px 0 !important;
    pointer-events: none;
    z-index: 1000;
    background: linear-gradient(90deg, #3b82f6, #60a5fa, #3b82f6) !important;
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.7);
    opacity: 1 !important;
    transform: scaleY(1) !important;
}

/* Stable indicator without animation to prevent flickering */
.insertion-indicator.stable-indicator {
    animation: none !important;
    background: #3b82f6 !important;
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.6) !important;
    transition: none !important;
    }

/* Ensure only one indicator is visible - hide all but the last one */
.insertion-indicator:not(:last-of-type) {
    display: none !important;
}

/* Simplified pulse animation for non-stable indicators only */
@keyframes insertionPulse {
    0%, 100% { 
        opacity: 0.8; 
        box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
    }
    50% { 
        opacity: 1; 
        box-shadow: 0 0 16px rgba(59, 130, 246, 0.8);
    }
}

/* Only apply animation to non-stable indicators */
.insertion-indicator:not(.stable-indicator) {
    animation: insertionPulse 1.2s infinite ease-in-out;
}

/* Remove the complex indicator children - keep it simple */
.insertion-indicator * {
    display: none !important;
}

/* Reorder Instruction Tooltip */
.reorder-instruction {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.reorder-instruction::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.75);
}

/* Form Button Styles */
.form-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: inherit;
    min-width: 120px; /* Minimum width for auto buttons */
    max-width: 100%; /* Ensure button doesn't overflow container */
    box-sizing: border-box;
}

/* Button wrapper and alignment */
.button-wrapper {
    display: block;
    margin: 1rem 0;
    box-sizing: border-box;
    width: 100%; /* Ensure wrapper takes full width for proper alignment */
}

/* Auto width button */
.button-wrapper:not(.w-full) .form-button:not(.w-full) {
    display: inline-block;
    width: auto;
    min-width: 120px;
}

/* Full width button */
.button-wrapper.w-full {
    width: 100%;
    box-sizing: border-box;
}

.button-wrapper.w-full .form-button.w-full {
    display: block;
    width: 100%;
}

/* Custom width button */
.button-wrapper[style*="width"] {
    box-sizing: border-box;
}

.button-wrapper[style*="width"] .form-button {
    width: 100%;
}

/* Form Button Base Styles */
.form-button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: center;
    display: inline-block; /* Ensure button behaves as inline block */
}

/* Alignment styles - removed old text-align rules in favor of flex alignment */

/* Button Style Variants */
.form-button.btn-primary {
    background: var(--primary-500);
    color: white;
}

.form-button.btn-primary:hover {
    background: var(--primary-600);
}

.form-button.btn-secondary {
    background: var(--secondary-500);
    color: white;
}

.form-button.btn-secondary:hover {
    background: var(--secondary-600);
}

/* File Upload Field Styles */
.file-upload-wrapper {
    position: relative;
    width: 100%;
}

.file-input-hidden {
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    position: absolute;
    z-index: -1;
}

.file-upload-label {
    display: block;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: var(--bg-secondary);
}

.file-upload-label:hover {
    border-color: var(--primary-400);
    background-color: var(--primary-50);
}

.file-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.file-upload-icon i {
    font-size: 2.5rem;
    color: var(--primary-500);
}

.file-upload-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

.file-upload-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    background-color: var(--primary-500);
    color: white;
    font-weight: 500;
}

.file-upload-button:hover {
    background-color: var(--primary-600);
}

/* Rating Field Styles */
.rating-wrapper {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end; /* Aligns stars to the left */
    gap: 0.25rem;
}

.rating-star-input {
    display: none;
}

.rating-star-label {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--neutral-300);
    transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
}

.rating-star-label:hover {
    transform: scale(1.1);
}

.rating-star-input:checked ~ .rating-star-label,
.rating-wrapper:hover .rating-star-label:hover,
.rating-wrapper:hover .rating-star-label:hover ~ .rating-star-label {
    color: var(--rating-color, var(--primary-400));
}

/* Rating Sizes */
.rating-wrapper.rating-sm .rating-star-label {
    font-size: 1.2rem;
}
.rating-wrapper.rating-md .rating-star-label {
    font-size: 1.5rem;
}
.rating-wrapper.rating-lg .rating-star-label {
    font-size: 2rem;
}


/* Field Header Styles */
.field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    background-color: transparent; /* Make header background transparent */
    padding: 8px 12px;
    border-bottom: none; /* Remove the horizontal line */
    min-height: 40px;
    padding-left: 0px;
}

/* Label styling */
.form-field .field-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    line-height: 24px;
    margin: 0;
    padding: 0;
    display: inline-block;
    flex-grow: 1;
}

/* Field controls alignment and improved visibility */
.field-controls {
    position: relative;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 1;
    transition: all 0.2s ease;
    z-index: 10;
    background: transparent;
    border-radius: 6px;
    padding: 2px;
    pointer-events: auto;
    height: 32px;
}

/* Show controls immediately when form field is selected */
.form-field.selected .field-controls {
    opacity: 1;
}

/* Make controls appear faster on hover */
.form-field:hover .field-controls {
    opacity: 1;
    transition-delay: 0s;
}

/* Required field indicator */
.form-field .field-label:after {
    content: attr(data-required);
    color: #dc2626;
    margin-left: 2px;
}

/* Field actions container */
.field-actions {
    display: flex;
    gap: 1px;
    align-items: center;
}

/* Input wrapper styling */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper.has-icon {
    padding-left: 35px;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
    font-size: 14px;
    z-index: 1;
}

/* Remove old form-canvas scrollbar styles - scrolling now handled by canvas-container */

/* Drop zone styling - restore to work with original canvas */
.form-canvas.drag-over {
    border: 2px dashed var(--bg-accent);
    background: linear-gradient(135deg, var(--primary-50), var(--bg-primary));
    transform: scale(1.02);
}

/* Field drop zones for reordering */
.field-drop-zone {
    height: 4px;
    background: transparent;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    margin: 2px 0;
    opacity: 0;
    transform: scaleY(0);
}

.field-drop-zone.drag-over {
    height: 20px;
    background: linear-gradient(90deg, var(--bg-accent), transparent);
    opacity: 1;
    transform: scaleY(1);
    box-shadow: 0 0 10px rgba(var(--bg-accent-rgb), 0.3);
}

/* Ensure both panels have consistent bottom spacing */
.left-sidebar .library-fields,
.right-sidebar .settings-placeholder,
.right-sidebar .field-settings-content {
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
}

.left-sidebar.sidebar-open .library-fields {
    border-bottom-right-radius: 0;
}



.left-sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    padding: 1rem 1.5rem;
    border-top-left-radius: var(--radius-xl);
    border-top-right-radius: var(--radius-xl);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Button Field Specific Styles */
.form-field[data-field-type="button"] {
    padding: 0;
}

.button-wrapper {
    position: relative;
    display: inline-block;
    width: auto;
    max-width: 100%;
    margin: 0 auto;
    text-align: inherit;
    padding: 0
    px;
    box-sizing: border-box;
}

.button-wrapper.w-full {
    display: block;
    width: 100%;
    padding: 0 12px;
}

/* Custom width input styling - removed conflicting rules */

/* Input wrapper with unit styling */
.input-wrapper-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper-with-unit .form-control {
    padding-right: 35px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.input-wrapper-with-unit .input-unit {
    position: absolute;
    right: 10px;
    color: #9ca3af;
    font-size: 14px;
    pointer-events: none;
    z-index: 1;
}

/* Field content wrapper */
.field-content {
    width: 100%;
    box-sizing: border-box;
}

/* ===========================
   IMPORT FORM FUNCTIONALITY
   =========================== */

/* Import loading overlay */
.import-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.loading-content i {
    font-size: 24px;
    color: var(--primary-500);
    margin-bottom: 15px;
    display: block;
}

.loading-content p {
    margin: 0;
    color: var(--text-primary);
    font-weight: 500;
}

/* Import notifications */
.import-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 400px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.import-notification.show {
    transform: translateX(0);
}

.import-notification.success {
    border-left: 4px solid #10b981;
}

.import-notification.error {
    border-left: 4px solid #ef4444;
}

.import-notification.info {
    border-left: 4px solid var(--primary-500);
}

.notification-content {
    display: flex;
    align-items: center;
    padding: 16px;
    gap: 12px;
}

.notification-content i {
    font-size: 18px;
}

.import-notification.success .notification-content i {
    color: #10b981;
}

.import-notification.error .notification-content i {
    color: #ef4444;
}

.import-notification.info .notification-content i {
    color: var(--primary-500);
}

.notification-content span {
    flex: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.notification-close:hover {
    color: var(--text-primary);
}

/* Import tab styling */
.tab[data-action="import"] {
    position: relative;
}

.tab[data-action="import"]:before {
    content: "📄 ";
    margin-right: 4px;
}

.tab[data-action="import"]:hover {
    background-color: var(--primary-50);
    color: var(--primary-700);
}

.tab[data-action="import"].active {
    background-color: var(--primary-500);
    color: white;
}

/* File input styling (hidden) */
#importFileInput {
    display: none !important;
}

/* Responsive adjustments for import notifications */
@media (max-width: 768px) {
    .import-notification {
        right: 10px;
        left: 10px;
        max-width: none;
        transform: translateY(-100%);
    }
    
    .import-notification.show {
        transform: translateY(0);
    }
}

 