/* RIMS POS Form Layout Styles */

/* Prevent control overlap with consistent spacing */
.form-group {
    margin-bottom: 1.25rem;
    position: relative;
}

/* DevExpress Form Layout spacing */
.dxbl-fl-group {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
}

.dxbl-fl-group-caption {
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
}

.dxbl-fl-item {
    margin-bottom: 1rem;
}

/* Ensure labels don't overlap with inputs */
.dxbl-fl-caption,
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #212529;
}

/* Input field spacing */
.form-control,
.dxbl-txt-editor,
.dxbl-cb-editor,
.dxbl-memo {
    width: 100%;
    margin-bottom: 0.25rem;
}

/* Validation message spacing */
.validation-message,
.field-validation-error {
    display: block;
    margin-top: 0.25rem;
    margin-bottom: 0;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Button group spacing */
.form-buttons,
.button-group {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Radio button and checkbox spacing */
.form-check {
    margin-bottom: 0.5rem;
}

.form-check-inline {
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

.form-check-input {
    margin-right: 0.5rem;
}

/* Textarea minimum height */
textarea.form-control,
.dxbl-memo {
    min-height: 100px;
    resize: vertical;
}

/* Prevent label text overflow */
label,
.dxbl-fl-caption {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

/* Card spacing for forms */
.card-body form {
    padding: 0.5rem;
}

/* Responsive form adjustments */
@media (max-width: 768px) {
    /* Stack form columns on mobile */
    .col-md-6 {
        margin-bottom: 1rem;
    }
    
    /* Full width buttons on mobile */
    .form-buttons,
    .button-group {
        flex-direction: column;
    }
    
    .form-buttons button,
    .button-group button,
    .form-buttons .dxbl-btn,
    .button-group .dxbl-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Reduce padding on mobile */
    .dxbl-fl-group {
        padding: 0.75rem;
    }
}

/* Loading overlay to prevent interaction during form submission */
.form-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.form-loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
}

/* Ensure consistent spacing in nested forms */
.nested-form {
    padding-left: 1rem;
    border-left: 3px solid #dee2e6;
    margin-left: 0.5rem;
}

/* Fix for overlapping DevExpress components */
.dx-overlay-wrapper {
    z-index: 1050 !important;
}

/* Ensure dropdowns don't get cut off */
.dxbl-dropdown-area {
    position: relative;
    z-index: 10;
}

/* Focus styles for accessibility */
.form-control:focus,
.dxbl-txt-editor:focus,
.dxbl-cb-editor:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Error state styling */
.has-error .form-control,
.has-error .dxbl-txt-editor {
    border-color: #dc3545;
}

/* Success state styling */
.has-success .form-control,
.has-success .dxbl-txt-editor {
    border-color: #198754;
}

/* Disabled state styling */
.form-control:disabled,
.dxbl-txt-editor.disabled {
    background-color: #e9ecef;
    opacity: 0.65;
    cursor: not-allowed;
}

/* Ensure consistent height for inline elements */
.form-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row > * {
    flex: 1;
}

/* Fix for date picker positioning */
.dx-calendar-popup {
    z-index: 1060 !important;
}