/* Shared form styling: one look for labels, inputs, selects and actions across the EMR */

/* Labels: readable weight, muted colour, required mark stays red but light */
.form-group label,
.form-group .control-label { display: inline-block; font-size: .8125rem; font-weight: 600; line-height: 1.3; color: #495057; margin-bottom: .35rem; }
.form-group label .text-danger { font-weight: 600; margin-left: 1px; }
.form-group label small { font-weight: 400; }
.form-group { margin-bottom: 1rem; }

/* Inputs and selects */
.content-wrapper .form-control,
.modal .form-control { font-size: .875rem; color: #212529; background-color: #fff; border: 1px solid #dfe3e8; border-radius: 6px; padding: .5rem .75rem; min-height: 38px; box-shadow: none; transition: border-color .15s, box-shadow .15s; }
.content-wrapper select.form-control:not([size]):not([multiple]),
.modal select.form-control:not([size]):not([multiple]) { height: 38px; padding-top: .375rem; padding-bottom: .375rem; }
.content-wrapper textarea.form-control,
.modal textarea.form-control { min-height: 76px; line-height: 1.45; }
.content-wrapper .form-control::placeholder,
.modal .form-control::placeholder { color: #adb5bd; }
.content-wrapper .form-control:focus,
.modal .form-control:focus { border-color: #f19a9d; box-shadow: 0 0 0 3px rgba(237, 28, 35, .12); outline: none; }
.content-wrapper .form-control:disabled,
.modal .form-control:disabled { background-color: #f6f7f9; color: #6c757d; }

/* Validation */
.content-wrapper .form-control.is-invalid,
.modal .form-control.is-invalid { border-color: #e55353; }
.content-wrapper .form-control.is-invalid:focus,
.modal .form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(229, 83, 83, .15); }
.invalid-feedback { font-size: .75rem; }

/* File inputs */
.content-wrapper input[type="file"].form-control,
.modal input[type="file"].form-control { padding: .3rem .4rem; height: auto; line-height: 1.6; cursor: pointer; }
.content-wrapper input[type="file"]::file-selector-button,
.modal input[type="file"]::file-selector-button { font-size: .8125rem; font-weight: 600; color: #495057; background: #f1f3f5; border: 1px solid #dfe3e8; border-radius: 4px; padding: .25rem .75rem; margin-right: .6rem; cursor: pointer; }
.content-wrapper input[type="file"]::file-selector-button:hover,
.modal input[type="file"]::file-selector-button:hover { background: #e9ecef; }

/* Input groups (date pickers etc.) */
.content-wrapper .input-group .input-group-text,
.modal .input-group .input-group-text { background: #f6f7f9; border: 1px solid #dfe3e8; color: #6c757d; height: 100%; }
.content-wrapper .input-group > .form-control:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.content-wrapper .input-group-append .input-group-text { border-top-left-radius: 0; border-bottom-left-radius: 0; border-top-right-radius: 6px; border-bottom-right-radius: 6px; }
.content-wrapper .input-group-append.border-left { border-left: 0 !important; }

/* select2, matched to the inputs */
.content-wrapper .select2-container,
.modal .select2-container { max-width: 100%; }
.content-wrapper .select2-container--default .select2-selection--single,
.content-wrapper .select2-container--default .select2-selection--multiple,
.modal .select2-container--default .select2-selection--single,
.modal .select2-container--default .select2-selection--multiple { border: 1px solid #dfe3e8; border-radius: 6px; min-height: 38px; background: #fff; }
.content-wrapper .select2-container--default .select2-selection--single,
.modal .select2-container--default .select2-selection--single { height: 38px; }
.content-wrapper .select2-container--default .select2-selection--single .select2-selection__rendered,
.modal .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; font-size: .875rem; padding-left: .75rem; color: #212529; }
.content-wrapper .select2-container--default .select2-selection--single .select2-selection__arrow,
.modal .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }
.content-wrapper .select2-container--default .select2-selection--multiple .select2-selection__rendered,
.modal .select2-container--default .select2-selection--multiple .select2-selection__rendered { padding: 3px 6px; }
.content-wrapper .select2-container--default .select2-selection--multiple .select2-selection__choice,
.modal .select2-container--default .select2-selection--multiple .select2-selection__choice { font-size: .8125rem; color: #495057; background: #f1f3f5; border: 1px solid #dfe3e8; border-radius: 999px; padding: 1px 8px; margin-top: 3px; }
.content-wrapper .select2-container--default .select2-search--inline .select2-search__field,
.modal .select2-container--default .select2-search--inline .select2-search__field { font-size: .875rem; margin-top: 5px; }
.content-wrapper .select2-container--default.select2-container--focus .select2-selection--multiple,
.content-wrapper .select2-container--default.select2-container--open .select2-selection,
.modal .select2-container--default.select2-container--focus .select2-selection--multiple,
.modal .select2-container--default.select2-container--open .select2-selection { border-color: #f19a9d; box-shadow: 0 0 0 3px rgba(237, 28, 35, .12); }

/* Checkboxes and radios sitting in forms */
.content-wrapper form .checkbox label { font-size: .875rem; font-weight: 500; color: #212529; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.content-wrapper form .checkbox input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: #ed1c23; }

/* Sections: group related fields under a small heading */
/* The theme forces .row to display:block with floated columns, so sections must contain and clear floats */
.form-section { display: flow-root; margin-bottom: 1.25rem; }
.form-section ~ .form-section { padding-top: 1.25rem; border-top: 1px solid #eef0f3; }
.form-section__title { clear: both; display: flex; align-items: center; gap: .5rem; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6c757d; margin: 0 0 .9rem; }
.form-section__title .fa,
.form-section__title .mdi { color: #ed1c23; font-size: .875rem; }
/* Same heading used as a full-width row inside an existing .row grid */
.form-section-row { padding-top: 1.1rem; margin-top: .25rem; border-top: 1px solid #eef0f3; }
.form-section-row:first-child { padding-top: 0; margin-top: 0; border-top: 0; }
.form-section__hint { font-size: .8125rem; color: #6c757d; margin: -.5rem 0 .9rem; }

/* Help text under or beside a label */
.form-hint { display: block; font-size: .75rem; font-weight: 400; color: #6c757d; margin-top: .25rem; }

/* Form header and action footer */
.form-head { clear: both; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding-bottom: 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid #eef0f3; }
.form-head h3, .form-head h4 { font-size: 1.125rem; font-weight: 700; margin: 0; }
.form-head p { font-size: .8125rem; color: #6c757d; margin: .2rem 0 0; }
.form-actions { clear: both; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .75rem; padding-top: 1rem; margin-top: .5rem; border-top: 1px solid #eef0f3; }
.form-actions .btn { min-width: 120px; margin: 0; }
.form-actions__aside { margin-right: auto; }
@media (max-width: 575px) { .form-actions .btn { flex: 1 1 auto; } }

/* Profile photo card used on patient forms */
.form-avatar { text-align: center; }
.card-body.form-avatar { padding: 1.25rem 1rem; }
.form-avatar img { width: 120px; height: 120px; object-fit: cover; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px #e3e6ea; margin-bottom: 1rem; }
.form-avatar__placeholder { width: 120px; height: 120px; margin: 0 auto 1rem; border-radius: 50%; background: #f1f3f5; box-shadow: 0 0 0 1px #e3e6ea; display: flex; align-items: center; justify-content: center; color: #adb5bd; font-size: 64px; }
.form-avatar .form-group { text-align: left; margin-bottom: 0; }
.form-avatar input[type="file"].form-control { font-size: .75rem; }
.form-avatar input[type="file"]::file-selector-button { display: block; width: 100%; margin: 0 0 .35rem; }

/* Leave compact controls alone: filter bar, DataTables, small inputs */
.content-wrapper .filter-bar .form-control,
.content-wrapper .dataTables_wrapper .form-control,
.content-wrapper .form-control-sm { min-height: 0; }
.content-wrapper .filter-bar__grid .form-control { padding: .375rem .75rem; }
.content-wrapper .filter-bar__search .form-control { padding: .25rem .6rem .25rem 1.9rem; border-radius: 4px; }
.content-wrapper .dataTables_wrapper .dataTables_length select.form-control { height: 30px; padding: 0 .4rem; }
.content-wrapper .filter-bar .select2-container--default .select2-selection--single { min-height: 0; }
.content-wrapper .filter-bar .select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 34px; }
.content-wrapper .filter-bar .select2-container--default .select2-selection--single .select2-selection__arrow { height: 34px; }
.content-wrapper .filter-bar .form-group label { display: block; font-size: .75rem; color: #6c757d; margin-bottom: .25rem; }
