/**
 * Form Builder Styles
 */

/* Main Container */
.form-builder-wrapper {
    width: 100%;
}

.fb-main-container {
    display: flex;
    gap: 20px;
    min-height: 400px;
    direction: rtl;
}

/* Fields Area */
.fb-fields-area {
    flex: 1;
    border: 2px dashed #0A6FC2;
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
}

.fb-fields-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* Field Item */
.fb-field-item {
    display: flex;
    align-items: end;
    gap: 15px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 16px 20px;
    transition: box-shadow 0.2s, border-color 0.2s;
    flex-direction: row-reverse;
    justify-content: space-between;
    margin-bottom: 12px;
}c

.fb-field-item:last-child {
    margin-bottom: 0;
}

.fb-field-item:only-child {
    border-radius: 12px;
    border-bottom: 1px solid #e8e8e8;
}

.fb-field-item:hover {
    background: #fafcff;
}

/* Field Actions */
.fb-field-actions {
    display: flex;
    flex-direction: row-reverse;
    gap: 8px;
    flex-shrink: 0;
    margin-bottom: 6px;
}

.fb-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.fb-btn svg {
    width: 16px;
    height: 16px;
}

.fb-btn-delete {
    background: #ffeaea;
    color: #e74c3c;
}

.fb-btn-edit {
    background: #1FC16B1A;
    color: #1A9F58;
}

.fb-btn-add {
    background: #0A6FC2;
    color: #fff;
}

/* Field Content */
.fb-field-content {
    flex: 1;
    cursor: move;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.fb-field-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    justify-content: flex-start;
    flex-direction: row;
}

.fb-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-field-icon svg {
    width: 18px;
    height: 18px;
}

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

.fb-required {
    color: #e74c3c;
    margin-right: 4px;
}

.fb-field-preview {
    width: 100%;
}

.fb-field-preview .form-control,
.fb-field-preview .form-select {
    background: #f8f9fa;
    border-radius: 1rem;
    border: solid 1px #f6f8f9;
    box-shadow: none !important;
    outline: none !important;
    padding: 0.75rem;
    font-size: 1rem;
    color: #999;
    text-align: right;
}

.fb-field-preview .form-control:disabled,
.fb-field-preview .form-select:disabled {
    background: transparent;
    cursor: default;
}

.fb-heading-preview {
    margin: 0;
    font-size: 20px;
    color: #333;
    font-weight: 700;
}

.fb-paragraph-preview {
    margin: 0;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

.fb-options-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.fb-options-preview .form-check {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fb-options-preview .form-check-input {
    margin: 0;
}

.fb-options-preview .form-check-label {
    font-size: 13px;
    color: #555;
}

.input-icon-box {
    position: relative;
}

.input-icon-box svg {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.input-icon-box .form-control {
    padding-left: 55px;
}

/* Sidebar */
.fb-sidebar {
    width: 220px;
    flex-shrink: 0;
}

.fb-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    border-radius: 12px;
    padding: 24px 16px;
    box-shadow: 0px 3px 25px 0px #0A6FC214;
}

.fb-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #0B2746;
    font-weight: 700;
    box-shadow: 0px 3px 25px 0px #0A6FC214;

}

.fb-sidebar-item:hover {
    background: #e8f4fc;
    box-shadow: none;
}

.fb-sidebar-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.fb-sidebar-icon svg {
    width: 16px;
    height: 16px;
}

.fb-sidebar-label {
    white-space: nowrap;
}

/* Add Dropdown */
.fb-add-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    min-width: 200px;
    padding: 10px;
    margin-top: 5px;
}

.fb-add-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #0A6FC2;
    font-weight: 500;
    border-radius: 8px;
    transition: background 0.2s;
}

.fb-add-dropdown-item:hover {
    background: #e8f4fc;
}

/* Sortable Placeholder */
.fb-sortable-placeholder {
    height: 60px;
    background: #e8f4fc;
    border: 2px dashed #0A6FC2;
    border-radius: 8px;
}

.ui-sortable-helper {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-radius: 12px !important;
}

/* RTL Styles */
/* Add RTL direction to the form builder */
body {
    direction: rtl;
}

/* Adjust text alignment for RTL */
.form-builder {
    text-align: right;
}

/* Ensure proper alignment for buttons and inputs */
.form-builder .form-group {
    display: flex;
    flex-direction: row-reverse;
}

.form-builder .form-group label {
    margin-left: auto;
    margin-right: 0;
}

.form-builder .form-group input,
.form-builder .form-group select,
.form-builder .form-group textarea {
    text-align: right;
}

.form-builder .form-group .form-control {
    text-align: right;
}

/* Adjust icons alignment */
.form-builder .form-group .icon {
    margin-left: auto;
    margin-right: 0;
}

/* Add styles for the form to match the provided design */
.form-builder-box .form-container {
    border: 1px dashed #0A6FC2;
    padding: 20px;
    border-radius: 10px;
    background-color: #f9f9f9;
}

.form-builder-box .form-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #0A6FC2;
    display: flex;
    align-items: center;
}

.form-builder-box .form-title svg {
    margin-left: 10px;
}

.form-builder-box .form-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
}

.form-builder-box .form-group .actions {
    display: flex;
    gap: 10px;
}

.form-builder-box .form-group .actions button {
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.form-builder-box .form-group .actions .btn-delete {
    background-color: #f8d7da;
    color: #721c24;
}

.form-builder-box .form-group .actions .btn-edit {
    background-color: #d4edda;
    color: #155724;
}

.form-builder-box .form-group .actions .btn-add {
    background-color: #cce5ff;
    color: #004085;
}

.form-builder-box .form-group input,
.form-builder-box .form-group select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.form-builder-box .form-sidebar {
    border: 1px dashed #0A6FC2;
    padding: 15px;
    border-radius: 10px;
    background-color: #f9f9f9;
    float: right;
    width: 250px; /* Adjust based on your layout */
}

.form-builder-box .form-sidebar ul {
    list-style: none;
    padding: 0;
}

.form-builder-box .form-sidebar ul li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff;
    cursor: pointer;
}

.form-builder-box .form-sidebar ul li svg {
    margin-left: auto;
}

.form-builder-box .main-content {
    margin-right: 250px; /* Adjust based on sidebar width */
}

/* Responsive */
@media (max-width: 768px) {
    .fb-main-container {
        flex-direction: column-reverse;
    }

    .fb-sidebar {
        width: 100%;
    }

    .fb-sidebar-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .fb-sidebar-item {
        flex: 0 0 auto;
    }

    .fb-field-content {
        align-items: stretch;
    }

    .fb-field-preview {
        max-width: 100%;
    }
}
