.custom-json-form {
    margin-top: 15px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16,30,54,0.04);
}

.rjf-form-group-inner,
.rjf-form-row-controls + .rjf-oneof-group {
    margin-top: 15px;
    box-shadow: 0 0 0 2px rgba(130, 130, 131, 0.2) !important;
}

/* Use logical positioning */
.custom-json-form .rjf-form-row-controls {
    position: absolute;
    top: 2px;
    inset-inline-end: 5px; /* replaces right: 5px */
}

.custom-json-form input[type="number"] {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 15px;
    color: #22223b;
    box-shadow: none;
    transition: border-color 0.2s;
}

.custom-json-form .rjf-add-button {
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 6px;
    margin-inline-end: 6px; /* replaces margin-right */
    transition: background 0.2s;
}

.custom-json-form .rjf-add-button:hover {
    background: #4f46e5;
    color: #fff;
}

/* RTL overrides */
[dir="rtl"] .custom-json-form .rjf-form-row-controls {
    inset-inline-end: auto;
    inset-inline-start: 5px;
}

[dir="rtl"] .custom-json-form .rjf-add-button {
    margin-inline-end: 0;
    margin-inline-start: 6px;
}

/*
=========================================
      DARK MODE STYLES
=========================================
*/

/* --- Main Container/Card --- */
.dark .custom-json-form {
    background: #111827;
    border-color: #374151;
    box-shadow: none;
}

/* --- Array Item Card --- */
.dark .custom-json-form .jsonform-array-item {
    background-color: #374151;
    border-color: #4b5563;
}

/* --- Input Fields --- */
.dark .custom-json-form input[type="number"] {
    background-color: #111827;
    border-color: #4b5563;
    color: #d1d5db;
}

/* --- Input Fields on Focus --- */
.dark .custom-json-form input[type="number"]:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* --- Field Labels --- */
.dark .custom-json-form .jsonform-label {
    color: #d1d5db;
}

/* --- Delete Button --- */
.dark .custom-json-form .jsonform-delete-button {
    background-color: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.dark .custom-json-form .jsonform-delete-button:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: transparent;
}

.dark .rjf-form-group-inner,
.dark .rjf-form-row-controls + .rjf-oneof-group {
    margin-top: 15px;
    box-shadow: 0 0 0 2px rgba(216, 216, 245, 0.2);
}


.custom-json-form .rjf-form-row-inner label {
    min-width: 80px; /* or any width you like */
    flex-shrink: 0;
    text-align: start !important; /* LTR default */
}

[dir="rtl"] .custom-json-form .rjf-form-row-inner label {
    text-align: end;
}

[dir="rtl"] .rjf-form-row-controls + .rjf-form-row-inner{
    padding-right: 0 !important; /* remove padding-right for RTL */
}
.custom-json-form .rjf-form-row-inner .rjf-input-group {
    flex: 1; /* input takes remaining space */
}


/* Flex layout for label + input */
.custom-json-form .rjf-form-row-inner > div {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

[dir="rtl"] .custom-json-form .rjf-form-row-inner > div {
    flex-direction: row;
}

.custom-json-form .rjf-form-row-inner label {
    min-width: 80px;
    flex-shrink: 0;
    text-align: start;
}

[dir="rtl"] .custom-json-form .rjf-form-row-inner label {
    text-align: end;
}

.custom-json-form .rjf-form-row-inner .rjf-input-group {
    flex: 1;
}
