/**
 * Admin brand: logo + title inline. Filament wraps custom brand HTML in `.fi-logo`
 * with a fixed height (1.5rem), which stacks the title under the image without this.
 */
.fi-logo:has(.fi-admin-brand) {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    width: auto !important;
    height: auto !important;
    max-width: 100%;
}

.fi-admin-brand {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.fi-admin-brand-logo {
    display: block;
    height: 1.5rem;
    width: auto;
    max-width: 100%;
    flex-shrink: 0;
    object-fit: contain;
}

.fi-admin-brand-title {
    font-size: 0.875rem;
    line-height: 1.25rem;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/**
 * Filament admin: RTL fixes when `html[dir="rtl"]` (e.g. Persian `fa`).
 *
 * Table header toolbar (`packages/tables/resources/css/container.css`) gives the
 * second child `margin-inline-start: auto` so search / filter / column controls
 * sit on the outer edge. In RTL, `inline-start` is the physical right, so that
 * margin pushes the control group to the wrong side. Apply the same auto margin
 * to the first child instead and clear it from the second.
 */
[dir="rtl"] .fi-ta-header-toolbar > :nth-child(1) {
    margin-inline-start: auto !important;
}

/**
 * Toolbar search / filter / column group: clear the LTR `ms-auto` margin, then
 * shrink-wrap so icon buttons keep Filament’s pill background (a stretched flex
 * row can make controls look “flat”).
 */
[dir="rtl"] .fi-ta-header-toolbar > :nth-child(2) {
    margin-inline-start: unset !important;
    width: fit-content;
    max-width: 100%;
}

/**
 * LTR inputs in RTL admin (URLs, paths, slugs). Set `form.ltr: true` in module YAML;
 * make:module adds class `ltr` on the input and `ltr-field` on the field wrapper.
 */
[dir="rtl"] input.ltr,
[dir="rtl"] textarea.ltr {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}

[dir="rtl"] .ltr-field .fi-fo-field-wrp-hint,
[dir="rtl"] .ltr-field [class*="hint"] {
    direction: ltr;
    text-align: left;
    unicode-bidi: isolate;
}
