/*
 * Custom admin panel theme for the Iya Alkhairi Outreach Portal.
 *
 * Plain static CSS, loaded via a renderHook in AdminPanelProvider -- no
 * build step (Vite/Tailwind) needed. Targets Filament v3's documented
 * "fi-*" class conventions. There is deliberately no light/dark toggle in
 * this panel (see AdminPanelProvider::panel()), so this file defines ONE
 * fixed theme -- no ".dark" variants anywhere.
 *
 * Technique used throughout: paint the brand gradient ONCE on the
 * outermost element of each region (top bar, sidebar, login card), then
 * make the inner container(s) Filament would otherwise paint its own
 * white/gray background on fully transparent -- rather than repainting the
 * same gradient on every nested element, which creates visible seams
 * between each element's box instead of one smooth surface. Real
 * interactive controls (inputs, buttons, dropdown panels, and anything
 * Filament itself marks as the active/current item) are always explicitly
 * excluded from these transparency resets, so they keep their own
 * legible, working appearance.
 */

:root {
    --iao-gradient: linear-gradient(120deg, #065f46 0%, #059669 55%, #10b981 100%);
    --iao-solid: #059669;
    --iao-ink: #065f46;
}

/* ================= Top bar ================= */

.fi-topbar {
    /* Radial highlight + linear gradient combined into ONE background
       (multiple comma-separated layers) rather than a separate ::before
       pseudo-element. A pseudo-element needs `overflow: hidden` on its
       parent to stay contained, and doing that on .fi-topbar/.fi-sidebar
       broke their internal scrolling (see the .fi-sidebar note below) --
       this gets the same visual depth with no overflow property at all. */
    background:
        radial-gradient(circle at 8% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
        var(--iao-gradient) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 2px 10px rgba(4, 120, 87, 0.25) !important;
}

.fi-topbar
    *:not(.fi-dropdown-panel):not(.fi-dropdown-panel *):not(input):not(.fi-input):not(.fi-badge):not(.fi-global-search-results-ctn):not(.fi-global-search-results-ctn *):not([data-fi-modal-id='database-notifications'] .fi-modal-window):not([data-fi-modal-id='database-notifications'] .fi-modal-window *):not([data-fi-modal-id='database-notifications'] .fi-modal-close-overlay) {
    background-color: transparent !important;
    background-image: none !important;
}

.fi-topbar-open-sidebar-btn,
.fi-topbar > nav > a,
.fi-topbar > nav > button,
.fi-topbar .fi-icon-btn:not(.fi-dropdown-panel *),
.fi-topbar .fi-icon-btn svg:not(.fi-dropdown-panel *) {
    color: #fff !important;
    position: relative;
    z-index: 1;
}

/*
 * Global search + notifications: force a solid, legible surface.
 *
 * Both open a floating panel of information-dense text (search results,
 * the notification list) near the top bar, and both are real DOM
 * descendants of .fi-topbar even though they render fixed-position over
 * the whole viewport. The wildcard reset above is meant to make Filament's
 * own plain white containers disappear into the gradient -- checked
 * against the actual installed Filament v3.2 markup (vendor/filament/...):
 *   - global search results panel -> .fi-global-search-results-ctn
 *     (NOT .fi-dropdown-panel -- that class is only used by the avatar/
 *     tenant "x-filament::dropdown" menus)
 *   - notifications panel -> Filament renders it as a slide-over
 *     .fi-modal-window (a modal, not a dropdown), dimmed by a
 *     .fi-modal-close-overlay backdrop, wrapped in a root element carrying
 *     data-fi-modal-id="database-notifications". That id is what scopes
 *     the rules below to ONLY this one modal -- .fi-modal-window is the
 *     class Filament uses for every modal/slide-over across the whole
 *     panel (edit forms, delete confirmations, etc.), so styling it
 *     unscoped would repaint every modal in the app, not just this one.
 * Both are now excluded from the wildcard transparency reset above (kept
 * excluded here purely for their own solid-surface styling), so they keep
 * their native white background instead of it being erased. The same
 * reset also has no exception for the unread notification badge -- a
 * small colored dot with no text of its own that depends entirely on its
 * own background-color to be visible -- so it was silently being erased
 * as well.
 */
.fi-dropdown-panel,
[role='listbox'],
.fi-global-search-results-ctn,
[data-fi-modal-id='database-notifications'] .fi-modal-window {
    background-color: rgba(255, 255, 255, 0.98) !important;
    color: #111827 !important;
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -4px rgba(0, 0, 0, 0.1) !important;
}

.fi-dropdown-panel *,
[role='listbox'] *,
.fi-global-search-results-ctn *,
[data-fi-modal-id='database-notifications'] .fi-modal-window * {
    color: inherit;
}

.fi-badge {
    background-color: #ef4444 !important;
    color: #fff !important;
}

/* The search input needs its own visible field surface -- without this it
   inherits the wildcard's forced transparency above and blends completely
   into the gradient, leaving no visible box to show where to type or read
   what's been typed. */
.fi-topbar input {
    background-color: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    border-radius: 0.5rem;
}

.fi-topbar input::placeholder {
    color: rgba(255, 255, 255, 0.75) !important;
}

/* ================= Sidebar: brand header + navigation menu ================= */

.fi-sidebar {
    /*
     * IMPORTANT: no `overflow` property here on purpose. The sidebar needs
     * to scroll its own contents independently of the main content area
     * (that's standard behaviour Filament relies on), and setting
     * `overflow: hidden` here -- which an earlier version of this file did,
     * to contain a decorative ::before pseudo-element -- broke that: the
     * browser fell back to scrolling the whole page instead, leaving the
     * sidebar's background looking cut off with blank space below it once
     * the page scrolled past the sidebar's own fixed-height box. The radial
     * highlight is done instead as a second background layer combined into
     * the same `background` property below, which needs no containment.
     */
    background:
        radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.16), transparent 55%),
        var(--iao-gradient) !important;
    box-shadow: 2px 0 10px rgba(4, 120, 87, 0.2) !important;
}

.fi-sidebar-header,
.fi-sidebar-nav {
    background: transparent !important;
}

/*
 * Neutralize any inner container's own background, EXCEPT: dropdown
 * panels (their own popup menus), the nav item buttons/links themselves
 * (and anything inside them), so whatever Filament natively does to mark
 * hover/active state is left completely alone rather than getting wiped
 * out by this reset -- and so the hover/active rules further down (which
 * target plain <a> tags as a robust fallback, in case the exact class
 * Filament uses isn't what this file guesses) never lose a specificity
 * fight against this broader reset.
 */
.fi-sidebar *:not(.fi-dropdown-panel):not(.fi-dropdown-panel *):not(.fi-sidebar-item-button):not(.fi-sidebar-item-button *):not(a):not(a *) {
    background-color: transparent !important;
    background-image: none !important;
}

.fi-sidebar,
.fi-sidebar-header,
.fi-sidebar-group-label,
.fi-sidebar-item-label,
.fi-sidebar-item-icon,
.fi-sidebar-item-button,
.fi-logo {
    color: #fff !important;
}

.fi-sidebar-item-icon svg {
    color: #fff !important;
}

/* App name/logo: all caps, letter-spaced, centered. */
.fi-logo,
.fi-sidebar-header {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}

.fi-sidebar-header {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center;
}

.fi-sidebar-header > *,
.fi-logo {
    width: 100%;
    text-align: center;
    justify-content: center;
}

/*
 * Menu items: transparent by default. Hover AND the current/active page
 * both get the same translucent highlight, so there's exactly one
 * interaction state to reason about.
 *
 * Two overlapping rule sets on purpose: one keyed off Filament's own class
 * ("fi-sidebar-item-button"), and one keyed off plain <a> tags inside the
 * nav -- since every sidebar link is certainly an <a> regardless of
 * whatever class Filament happens to add to it. If the class name guess
 * is right, both rules agree. If it's wrong, the <a>-based rule still
 * works, so hovering/the current page is never left with zero feedback.
 */
.fi-sidebar-item-button,
.fi-sidebar-nav a {
    background-color: transparent !important;
    border-radius: 0.5rem;
    border-inline-start: 3px solid transparent;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.fi-sidebar-item-button:hover,
.fi-sidebar-nav a:hover {
    background-color: rgba(255, 255, 255, 0.14) !important;
    color: #fff !important;
}

/*
 * The active/current page gets its OWN, stronger treatment -- a left
 * accent bar, a bolder fill, an inset ring, and bold text -- so it reads
 * as clearly different from a plain hover instead of the two states
 * looking identical (which was the actual complaint: on a page you're
 * already on, nothing in the menu told you where you were).
 *
 * IMPORTANT: checked against the actual installed Filament v3.2 markup
 * (vendor/filament/filament/resources/views/components/sidebar/item.blade.php)
 * -- Filament puts the "fi-active" class on the <li class="fi-sidebar-item">
 * wrapper, NOT on the <a>/button inside it, and it never renders
 * aria-current="page" at all. The original ".fi-sidebar-item-button.fi-active"
 * / "[aria-current='page']" selectors below therefore never matched
 * anything -- the current page never got highlighted. The
 * ".fi-sidebar-item.fi-active .fi-sidebar-item-button" rule (li.fi-active,
 * descendant button) is the one that actually fires; the old selectors are
 * kept alongside it as a harmless fallback in case a future Filament
 * version moves the class back onto the link itself.
 */
.fi-sidebar-item.fi-active .fi-sidebar-item-button,
.fi-sidebar-item-button.fi-active,
.fi-sidebar-item-button[aria-current='page'],
.fi-sidebar-nav a.fi-active,
.fi-sidebar-nav a[aria-current='page'] {
    background-color: rgba(255, 255, 255, 0.26) !important;
    border-inline-start-color: #fff !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.fi-sidebar-item.fi-active .fi-sidebar-item-button .fi-sidebar-item-icon,
.fi-sidebar-item-button.fi-active .fi-sidebar-item-icon,
.fi-sidebar-item-button[aria-current='page'] .fi-sidebar-item-icon,
.fi-sidebar-nav a.fi-active .fi-sidebar-item-icon,
.fi-sidebar-nav a[aria-current='page'] .fi-sidebar-item-icon {
    color: #fff !important;
    opacity: 1 !important;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-button .fi-sidebar-item-label {
    color: #fff !important;
}

/* ================= Main content area ================= */

/* A soft neutral backdrop instead of stark white, and gentle, consistent
   card shadows -- small, low-risk touches that make the content area feel
   considered rather than default. */
.fi-main {
    background-color: #f7faf9 !important;
}

.fi-section,
.fi-wi,
.fi-ta-ctn,
.fi-modal-window {
    border-radius: 0.75rem !important;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 4px 12px rgba(15, 23, 42, 0.06) !important;
}

/* ================= Login page ================= */

/*
 * .fi-simple-layout is the full-page wrapper Filament centers the login
 * card in (it replaces Filament's default flat bg-gray-50 page
 * background). The brand gradient is layered as a tint OVER the same
 * hero photo already used on the public welcome page (resources/views/
 * welcome.blade.php) -- same technique there: gradient first, image last,
 * comma-separated in one `background` shorthand so the color overlay sits
 * on top of the photo and text stays readable no matter what the photo
 * looks like. Two blurred color blobs (::before/::after) sit above that
 * for extra depth, and `position: relative` on this element is what lets
 * the "Back to home" button (login-home-button.blade.php, injected via
 * SIMPLE_PAGE_START) position itself in the corner without disturbing the
 * centered card layout.
 */
.fi-simple-layout {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(16, 185, 129, 0.35), transparent 45%),
        radial-gradient(circle at 85% 80%, rgba(6, 95, 70, 0.45), transparent 50%),
        linear-gradient(135deg, rgba(2, 44, 34, 0.88) 0%, rgba(6, 95, 70, 0.82) 45%, rgba(5, 150, 105, 0.78) 100%),
        url('../images/hero-bg.jpg') !important;
    background-size: cover, cover, cover, cover;
    background-position: center, center, center, center;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
}

.fi-simple-layout::before,
.fi-simple-layout::after {
    content: '';
    position: absolute;
    border-radius: 9999px;
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

.fi-simple-layout::before {
    width: 26rem;
    height: 26rem;
    top: -8rem;
    left: -6rem;
    background: rgba(16, 185, 129, 0.45);
}

.fi-simple-layout::after {
    width: 30rem;
    height: 30rem;
    bottom: -10rem;
    right: -8rem;
    background: rgba(4, 120, 87, 0.5);
}

.fi-simple-layout > * {
    position: relative;
    z-index: 1;
}

/*
 * The sign-in card itself: frosted glass over the page background above,
 * rather than the previous solid gradient fill -- a translucent surface
 * plus backdrop-filter: blur is what actually reads as "glassmorphism"
 * (a solid color card, no matter how nicely shaded, doesn't). The soft
 * radial highlight in ::before is kept for extra depth on top of the
 * glass. -webkit-backdrop-filter is included for Safari.
 */
.fi-simple-main {
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.14) !important;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 1.25rem;
    box-shadow:
        0 25px 50px -12px rgba(2, 44, 34, 0.55),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset !important;
}

.fi-simple-main::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% -10%, rgba(255, 255, 255, 0.20), transparent 55%),
        radial-gradient(circle at 110% 110%, rgba(0, 0, 0, 0.12), transparent 60%);
}

.fi-simple-main > div,
.fi-simple-main section,
.fi-simple-header {
    background: transparent !important;
    position: relative;
    z-index: 1;
}

/* Every remaining text element in the card (headings, field labels,
   helper text, "remember me", "forgot password?") reads white -- not just
   specific tags, since Filament often wraps the visible text in a nested
   <span> carrying its own explicit dark-text class that would otherwise
   win over a color set only on the outer <label>/<a>. Actual form
   controls and the submit button are excluded on purpose. */
.fi-simple-main,
.fi-simple-main *:not(input):not(select):not(textarea):not(button):not(button *):not(.fi-input):not(.fi-input *) {
    color: #fff !important;
    position: relative;
    z-index: 1;
}

.fi-simple-main a {
    font-weight: 600;
    text-decoration: none;
}

.fi-simple-main a:hover {
    text-decoration: underline;
}

/* A crisp, high-contrast call to action instead of a same-color button
   blending into the card -- keyed off type="submit" rather than a
   Filament class name, so it doesn't depend on guessing their markup. */
.fi-simple-main button[type='submit'] {
    background-color: #ffffff !important;
    color: var(--iao-solid) !important;
    border: none !important;
    font-weight: 700 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18) !important;
    position: relative;
    z-index: 1;
}

.fi-simple-main button[type='submit']:hover {
    background-color: #ecfdf5 !important;
}

/* ---------- Visible "Log out" button injected into the topbar ---------- */

.fi-topbar-logout-form {
    display: inline-flex;
    align-items: center;
    margin-inline-start: 0.5rem;
    position: relative;
    z-index: 1;
}

.fi-topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.fi-topbar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.fi-topbar-logout-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .fi-topbar-logout-label {
        display: none;
    }
}

/* ---------- "Back to home" button on the login page ---------- */

/*
 * IMPORTANT: SIMPLE_PAGE_START (where login-home-button.blade.php is
 * injected -- see AdminPanelProvider) renders INSIDE
 * <x-filament-panels::page.simple>'s root .fi-simple-page div, which is
 * itself inside <main class="fi-simple-main"> -- the glass CARD -- not
 * inside the full-page .fi-simple-layout background wrapper as an earlier
 * version of this file assumed (checked against the actual installed
 * Filament v3.2 markup: vendor/filament/filament/resources/views/
 * components/page/simple.blade.php and .../layout/simple.blade.php).
 *
 * `position: absolute` therefore anchored this button to .fi-simple-main
 * (the nearest positioned ancestor), landing it top-left OF THE CARD --
 * directly on top of the panel logo/heading rendered right after it in the
 * same .fi-simple-page div. `position: fixed` anchors it to the viewport
 * instead, regardless of where it sits in the DOM, so it floats in the
 * page's actual top-left corner and never touches the card's own content.
 *
 * !important on position/z-index here is required, not decorative: this
 * div is also matched by the ".fi-simple-main *" white-text wildcard
 * rule above (it's a plain, unexcluded descendant), which sets its own
 * non-important `position: relative` -- and that rule's selector
 * specificity is far higher than this single class, so without
 * !important the cascade would silently pick the wildcard's `relative`
 * over this rule's `fixed` regardless of the two rules' order in the
 * file, undoing this fix.
 */
.fi-login-home-btn-ctn {
    position: fixed !important;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 20 !important;
}

.fi-login-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(10px);
    color: #fff !important;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none !important;
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: background-color 0.15s ease;
}

.fi-login-home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fi-login-home-btn-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .fi-login-home-btn-ctn {
        top: 1rem;
        left: 1rem;
    }
}
