/* Admin specific adjustments only */

.fi-panel-admin .fi-main-ctn,
body:has(.fi-sidebar) .fi-main-ctn {
    width: 100%;
}

.fi-panel-admin .fi-wi-stats-overview-stats-ctn {
    gap: 1rem !important;
}

.fi-panel-admin .fi-ta-ctn,
.fi-panel-admin .fi-section {
    overflow: hidden;
}

.fi-panel-admin .fi-header-actions {
    gap: .75rem !important;
}

/* ==========================================================
   AI AUTO ADMIN V6.4.3 — GLOBAL FILAMENT DROPDOWN FIX
   Fixes Select / MultiSelect dropdowns being clipped or covered
   inside Content Recipe Admin and other Filament admin forms.
   ========================================================== */

/*
 * Filament dropdown panels need to escape Section / Grid / Field wrappers.
 * Some existing theme rules use overflow:hidden for rounded cards, which
 * clips the floating options list.
 */
.fi-main,
.fi-page,
.fi-page-content,
.fi-section,
.fi-section-content-ctn,
.fi-section-content,
.fi-fo-component-ctn,
.fi-fo-grid,
.fi-grid,
.fi-fo-field-wrp,
.fi-input-wrp,
.fi-select-input,
[data-field-wrapper],
[data-field-wrapper] > div {
    overflow: visible !important;
}

/*
 * Keep dropdown / listbox above neighboring sections, cards and fields.
 * Include common Filament / Alpine / Floating UI structures.
 */
.fi-dropdown,
.fi-dropdown-panel,
.fi-fo-select-options-ctn,
.fi-select-dropdown,
[role="listbox"],
[data-floating-ui-portal],
[data-popper-placement],
[data-headlessui-portal],
[data-radix-popper-content-wrapper] {
    z-index: 99999 !important;
}

/*
 * A focused Select field and its field wrapper should establish a high
 * stacking context while the user is interacting with it.
 */
.fi-fo-field-wrp:focus-within,
.fi-input-wrp:focus-within,
.fi-select-input:focus-within,
[data-field-wrapper]:focus-within {
    position: relative;
    z-index: 5000 !important;
}

/*
 * Dropdown options should remain clickable even when visually overlapping
 * the next Filament section.
 */
.fi-dropdown-panel,
.fi-fo-select-options-ctn,
[role="listbox"] {
    pointer-events: auto !important;
    max-height: min(22rem, 55vh);
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/*
 * Prevent a following Section from painting above an open dropdown.
 * Normal sections stay at the base stacking level.
 */
.fi-section {
    position: relative;
    z-index: 1;
}

.fi-section:has(.fi-fo-field-wrp:focus-within),
.fi-section:has(.fi-input-wrp:focus-within),
.fi-section:has([role="listbox"]) {
    z-index: 4000 !important;
}

/*
 * Compatibility fallback for browsers / Filament markup where :has()
 * does not participate as expected.
 */
.fi-fo-field-wrp:focus-within .fi-dropdown-panel,
.fi-fo-field-wrp:focus-within .fi-fo-select-options-ctn,
.fi-input-wrp:focus-within [role="listbox"] {
    position: relative;
    z-index: 99999 !important;
}
