/* Orbit shared control spec — mirrors the Appointment System prototype
   (.field / .field label / .input / .select / .input.mono / .field textarea
    from app.css + app-extra.css). Tokens come from orbit-tokens.css. */

/* Container
   NOTE: .field is an unscoped global selector. It intentionally matches native-input
   wrappers in the data-entry forms (RelatedPersonSection, DemographicsSection,
   InsuranceSection). Do not add this class to elements outside those forms without
   checking for collisions first. */
.field,
.orbit-mud-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

/* Label (prototype .field label) */
.field > label,
.orbit-mud-field > label {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Native controls (prototype .input / .select / .field input) */
.control,
.field > input,
.field > select,
.field > textarea {
    font-family: inherit;
    font-size: 13px;
    color: var(--fg-1);
    width: 100%;
    padding: 0.55rem 0.8rem;
    background: #fff; /* intentional: prototype uses white; revisit when dark-mode token added */
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    outline: none;
    box-sizing: border-box;
    transition: border-color var(--dur-fast) var(--ease-std),
                box-shadow var(--dur-fast) var(--ease-std);
}
.control.mono,
.field > .mono {
    font-family: var(--font-mono);
}
/* Textarea (prototype .field textarea) */
.field > textarea {
    min-height: 80px;
    resize: vertical;
}
.orbit-mud-field textarea.mud-input-slot {
    resize: vertical;
}
.control:focus,
.field > input:focus,
.field > select:focus,
.field > textarea:focus {
    border-color: rgb(var(--primary-rgb));
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.control:read-only,
.control[readonly],
.field > input[readonly] {
    background: var(--bg-surface-3);
    color: var(--fg-2);
    cursor: default;
}
.control:disabled,
.field > input:disabled,
.field > select:disabled,
.field > textarea:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}
.control.is-error,
.control[aria-invalid="true"] {
    border-color: rgb(var(--danger-rgb, 230 83 60));
    box-shadow: 0 0 0 3px rgba(var(--danger-rgb, 230 83 60), 0.10);
}

/* MudBlazor controls — mirror the same spec onto the inner .mud-input box.
   Variant.Text strips filled/outlined chrome. MudTextField also accepts Underline=false;
   MudSelect does not (param is silently swallowed), so we suppress the line via CSS below.
   DOM verified against MudBlazor 9.5.0: .mud-input is display:inline-flex (the border box),
   .mud-input-root is the actual <input> or focusable <div tabindex=0> (MudSelect).
   Specificity note: our selectors are 0,2,0 or 0,3,0, vs MudBlazor's 0,1,0 — no !important
   needed on .mud-input itself. Only the inner padding needs it to beat Orbit.DesignSystem's
   .mud-input > input.mud-input-root rule at 0,2,1 + !important.
   Width note: MudBlazor.min.css loads AFTER this file, so mud-full-width alone is unreliable.
   We explicitly force .mud-input-control to 100% width here so the full chain is covered. */
.orbit-mud-field .mud-input-control {
    width: 100%;
}
.orbit-mud-field .mud-input {
    display: flex;           /* override inline-flex; 0,2,0 beats MudBlazor's 0,1,0 */
    font-family: inherit;
    font-size: 13px;
    line-height: 1.5;        /* override MudBlazor's 1.1876em; inner input inherits this for 1lh below */
    color: var(--fg-1);
    width: 100%;
    padding: 0.55rem 0.8rem; /* wrapper carries all padding — .mud-input-root is zeroed below */
    background: #fff;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    transition: border-color var(--dur-fast) var(--ease-std),
                box-shadow var(--dur-fast) var(--ease-std);
}
/* Zero MudBlazor's inner padding so the wrapper is the sole vertical sizing surface.
   height:1lh = 1 × computed line-height (1.5 × 13px = 19.5px), matching native .control's
   content area. Padding-only !important: beats Orbit.DesignSystem's 0,2,1 + !important rule. */
.orbit-mud-field .mud-input .mud-input-root {
    padding: 0 !important;
    height: 1lh;
}
.orbit-mud-field .mud-input:focus-within {
    border-color: rgb(var(--primary-rgb));
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.10);
}
.orbit-mud-field .mud-input-error .mud-input {
    border-color: rgb(var(--danger-rgb, 230 83 60));
    box-shadow: 0 0 0 3px rgba(var(--danger-rgb, 230 83 60), 0.10);
}
/* MudSelect does not accept Underline=false — suppress the Material underline via CSS. */
.orbit-mud-field .mud-input-underline::before,
.orbit-mud-field .mud-input-underline::after {
    display: none !important;
}

/* Checkbox — keep the Orbit primary color; label inherits control typography */
.orbit-mud-checkbox .mud-checkbox-input:checked ~ .mud-icon-root,
.orbit-mud-checkbox .mud-checked { color: rgb(var(--primary-rgb)) !important; }
