/* Topbar: full-width search area (legacy-style layout) */
.fi-topbar nav {
    width: 100%;
}

.fi-topbar nav > .ms-auto {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-inline-start: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
}

/* Livewire root around GlobalSearch — must grow or the field stays narrow */
.fi-topbar nav > .ms-auto > div:has(.fi-global-search) {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    align-items: center !important;
}

.fi-topbar .fi-global-search {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: flex !important;
    align-items: center !important;
}

.fi-topbar .fi-global-search > div,
.fi-topbar .fi-global-search .sm\:relative {
    width: 100% !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

.fi-topbar .fi-global-search-field {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 auto !important;
}

.fi-topbar .fi-global-search-field .fi-input-wrp {
    width: 100% !important;
    max-width: none !important;
}

.fi-topbar .fi-global-search-field .fi-input-wrp-input,
.fi-topbar .fi-global-search-field input[type='search'] {
    width: 100% !important;
    max-width: none !important;
}

.fi-topbar .admin-topbar-tools,
.fi-topbar .admin-alerts-bell,
.fi-topbar .fi-user-menu,
.fi-topbar .fi-topbar-item {
    flex-shrink: 0 !important;
}

.admin-topbar-tools {
    display: flex;
    flex-shrink: 0;
    align-items: center;
}

.admin-language-switch {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0.5rem;
}

.admin-language-switch a {
    display: inline-flex;
    align-items: center;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-language-switch a.is-active {
    background-color: #5d5abf;
    color: #fff;
}

.admin-language-switch a.is-inactive {
    color: #4b5563;
}

.admin-language-switch a.is-inactive:hover {
    background-color: #f3f4f6;
}

.dark .admin-language-switch a.is-inactive {
    color: #d1d5db;
}

.dark .admin-language-switch a.is-inactive:hover {
    background-color: #1f2937;
}

@media (min-width: 1024px) {
    .fi-topbar nav > .ms-auto {
        padding-inline-start: 0.5rem;
    }
}

/* Notifications dropdown (width via CSS — Livewire views are outside Filament Tailwind scan) */
.admin-alerts-bell {
    position: relative;
    margin-right: 0.5rem;
}

.admin-alerts-dropdown {
    position: absolute;
    right: 0;
    z-index: 50;
    margin-top: 0.5rem;
    width: 28rem !important;
    min-width: 24rem !important;
    max-width: min(28rem, calc(100vw - 2rem)) !important;
    border-radius: 0.5rem;
    border: 1px solid #c7d2fe;
    background-color: #fff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.dark .admin-alerts-dropdown {
    border-color: #4338ca;
    background-color: #111827;
}

.admin-alerts-dropdown-header {
    border-bottom: 1px solid #c7d2fe;
    padding: 0.75rem 1rem;
}

.dark .admin-alerts-dropdown-header {
    border-bottom-color: #4338ca;
}

.admin-alerts-dropdown-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
}

.dark .admin-alerts-dropdown-header h3 {
    color: #fff;
}

.admin-alerts-panel {
    width: 100%;
    max-height: 20rem;
    overflow-y: auto;
    padding: 1rem;
}

.admin-alerts-panel > * + * {
    margin-top: 0.75rem;
}

.admin-alerts-folios {
    width: 100%;
}

.admin-alerts-folios-value {
    word-break: break-word;
}

.admin-alerts-bell-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    border-radius: 0.375rem;
    padding: 0.5rem;
    color: #4b5563;
    transition: background-color 0.15s ease;
}

.admin-alerts-bell-btn:hover {
    background-color: #f3f4f6;
}

.dark .admin-alerts-bell-btn {
    color: #d1d5db;
}

.dark .admin-alerts-bell-btn:hover {
    background-color: #1f2937;
}

.admin-alerts-badge {
    position: absolute;
    top: -0.125rem;
    right: -0.125rem;
    display: inline-flex;
    min-height: 1rem;
    min-width: 1rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: #ef4444;
    padding: 0 0.25rem;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
}
