/*
 * Meannt admin: glass theme, light and dark.
 *   Light = pale blue canvas, white frosted cards, cyan > blue > violet accent.
 *   Dark  = deep purple canvas with violet and magenta washes, translucent cards.
 * Hover: lift, a glow that follows the mouse and a gradient edge (admin-glass.js sets --mx / --my).
 * Loaded after Filament's own styles; unlayered CSS wins over Filament's layers, so no !important.
 */

:root {
    color-scheme: light;
    --ink: #0f1b3d;
    --ink-2: #45507a;
    --ink-3: #6c779c;
    --bg: #f2f6fc;
    --bg-2: #e6edf8;
    --glass: rgba(255, 255, 255, 0.60);
    --glass-2: rgba(255, 255, 255, 0.84);
    --glass-solid: rgba(255, 255, 255, 0.97);
    --scrim: rgba(15, 27, 61, 0.38);
    --edge: rgba(255, 255, 255, 0.92);
    --line: rgba(37, 64, 140, 0.10);
    --line-2: rgba(37, 64, 140, 0.18);
    --a1: #2563eb;
    --a2: #7c3aed;
    --a3: #06b6d4;
    --grad: linear-gradient(120deg, #06b6d4, #2563eb 45%, #7c3aed);
    --row-hover: rgba(37, 99, 235, 0.07);
    --active-bg: rgba(37, 99, 235, 0.10);
    --active-ring: rgba(37, 99, 235, 0.22);
    --glow: rgba(37, 99, 235, 0.05);
    --spot: rgba(37, 99, 235, 0.035);
    --shadow: 0 18px 50px -26px rgba(30, 50, 110, 0.30), 0 2px 6px -2px rgba(30, 50, 110, 0.06);
    --shadow-hover: 0 26px 60px -26px rgba(37, 99, 235, 0.38), 0 2px 6px -2px rgba(30, 50, 110, 0.08);
    --radius: 20px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Crect x='24' y='24' width='24' height='24' rx='7' fill='none' stroke='%232563eb' stroke-opacity='.08' stroke-width='1.3'/%3E%3C/svg%3E");
}

.dark {
    color-scheme: dark;
    --ink: #f4f0ff;
    --ink-2: #c9bfe6;
    --ink-3: #9a8cc0;
    --bg: #150a2e;
    --bg-2: #1c0f3d;
    --glass: rgba(255, 255, 255, 0.07);
    --glass-2: rgba(255, 255, 255, 0.12);
    --glass-solid: rgba(34, 20, 68, 0.97);
    --scrim: rgba(8, 3, 22, 0.62);
    --edge: rgba(255, 255, 255, 0.14);
    --line: rgba(255, 255, 255, 0.08);
    --line-2: rgba(255, 255, 255, 0.16);
    --a1: #a78bfa;
    --a2: #e879f9;
    --a3: #818cf8;
    --grad: linear-gradient(120deg, #8b5cf6, #c026d3 60%, #ec4899);
    --row-hover: rgba(255, 255, 255, 0.06);
    --active-bg: rgba(167, 139, 250, 0.16);
    --active-ring: rgba(167, 139, 250, 0.35);
    --glow: rgba(167, 139, 250, 0.09);
    --spot: rgba(192, 132, 252, 0.07);
    --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.65), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    --shadow-hover: 0 28px 64px -26px rgba(168, 85, 247, 0.55), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
    --pattern: none;
}

/* ---------- Page background ---------- */
.fi-body {
    min-height: 100vh;
    color: var(--ink);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg);
    background-image: var(--pattern), linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
}

.dark .fi-body {
    background-image:
        radial-gradient(60rem 38rem at 4% 2%, rgba(124, 58, 237, 0.55), transparent 62%),
        radial-gradient(52rem 34rem at 62% 108%, rgba(190, 24, 140, 0.50), transparent 64%),
        radial-gradient(46rem 30rem at 102% 18%, rgba(37, 56, 160, 0.45), transparent 62%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
}

.fi-layout, .fi-main-ctn, .fi-main { background: transparent; }

/* Cursor spotlight (added by admin-glass.js) */
.admin-spotlight {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(260px circle at var(--sx, 50%) var(--sy, 30%), var(--spot), transparent 70%);
}

/* No z-index here: a stacking level on the layout would put the top bar above a popup's dimming layer. */
.fi-layout { position: relative; }

/* ---------- Headings use Sora ---------- */
.fi-header-heading,
.fi-section-header-heading,
.fi-simple-header-heading,
.fi-wi-stats-overview-stat-value,
.fi-modal-heading,
.meannt-welcome-greeting {
    font-family: 'Sora', 'Inter', system-ui, sans-serif;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.fi-wi-stats-overview-stat-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.fi-wi-stats-overview-stat-label, .fi-section-header-description, .fi-wi-stats-overview-stat-description { color: var(--ink-3); }

/* ---------- Glass surfaces ---------- */
.fi-section,
.fi-ta-ctn,
.fi-wi-stats-overview-stat {
    background: var(--glass);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    backdrop-filter: blur(18px) saturate(160%);
}

.fi-wi-chart, .fi-wi-table, .fi-wi-stats-overview { background: transparent; box-shadow: none; border: 0; }

/* ---------- Hover: lift, mouse-following glow, gradient edge ---------- */
.fi-section,
.fi-wi-stats-overview-stat,
.fi-ta-ctn {
    position: relative;
    isolation: isolate;
    transition: transform 0.45s var(--ease), background 0.35s, box-shadow 0.35s;
}

.fi-section::before,
.fi-wi-stats-overview-stat::before,
.fi-ta-ctn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
    background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 60%);
}

.fi-section::after,
.fi-wi-stats-overview-stat::after,
.fi-ta-ctn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1.25px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s;
    background: radial-gradient(170px circle at var(--mx, 50%) var(--my, 50%), var(--a3), var(--a2) 40%, transparent 70%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
}

.fi-section:hover::before, .fi-section:hover::after,
.fi-wi-stats-overview-stat:hover::before, .fi-wi-stats-overview-stat:hover::after,
.fi-ta-ctn:hover::before, .fi-ta-ctn:hover::after { opacity: 1; }

.fi-section:hover,
.fi-wi-stats-overview-stat:hover {
    transform: translateY(-5px);
    background: var(--glass-2);
    box-shadow: var(--shadow-hover);
}

/* Large containers stay still: tables, forms and dialogs */
.fi-ta-ctn:hover,
.fi-section:has(.fi-ta-ctn):hover,
.fi-section:has(form):hover,
.fi-modal-window:hover { transform: none; }

/* A section inside a section does not get its own frame */
.fi-section .fi-section { background: transparent; border-color: var(--line); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.fi-section .fi-section::before, .fi-section .fi-section::after { display: none; }
.fi-section .fi-section:hover { transform: none; }

/* Stats and table widgets wrap their content in a section: keep that wrapper invisible so only the
   stat boxes (or the table) carry the glass, and the heading reads as a plain title above them. */
.fi-wi-stats-overview .fi-section,
.fi-wi-table .fi-section {
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transform: none;
}

.fi-wi-stats-overview .fi-section::before, .fi-wi-stats-overview .fi-section::after,
.fi-wi-table .fi-section::before, .fi-wi-table .fi-section::after { display: none; }

.fi-wi-stats-overview .fi-section:hover,
.fi-wi-table .fi-section:hover { transform: none; background: transparent; box-shadow: none; }

.fi-wi-stats-overview .fi-section-header,
.fi-wi-table .fi-section-header { padding: 0 0 0.75rem; }

.fi-wi-stats-overview .fi-section-content-ctn,
.fi-wi-stats-overview .fi-section-content,
.fi-wi-table .fi-section-content-ctn,
.fi-wi-table .fi-section-content { padding: 0; background: transparent; }

.fi-wi-stats-overview .fi-section-header-heading { font-size: 1.05rem; }

/* Chart text and grid take the theme colours (Filament reads these helper elements for Chart.js). */
.fi-wi-chart-text-color { color: var(--ink-2); }
.fi-wi-chart-grid-color { color: var(--line-2); }

/* ---------- Compact stat cards ---------- */
.fi-wi-stats-overview-stat { padding: 0.85rem 1rem; }
.fi-wi-stats-overview-stat-content { gap: 0.15rem; }
.fi-wi-stats-overview-stat-value { font-size: 1.55rem; line-height: 1.15; }
.fi-wi-stats-overview-stat-label { font-size: 0.8rem; }
.fi-wi-stats-overview-stat-description { font-size: 0.75rem; }
.fi-wi-stats-overview-stat-chart { max-height: 2.5rem; opacity: 0.85; }

/* Popups (modals, dropdown menus) are nearly solid so the page behind never shows through the text,
   with a dimmed and blurred scrim behind them. */
.fi-modal-window,
.fi-dropdown-panel {
    background: var(--glass-solid);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-hover);
}

.fi-modal-close-overlay {
    background: var(--scrim);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

/* Popups sit in the middle of the screen (Filament's default leaves them in the upper third) and are no wider than a form needs.
   The default width class is 4xl (56 rem), far too wide for two or three fields; wider popups ask for their own larger class. */
.fi-modal > .fi-modal-window-ctn { grid-template-rows: 1fr auto 1fr; }

.fi-modal > .fi-modal-window-ctn > .fi-modal-window.fi-width-4xl { max-width: 32rem; }

/* Centred popups keep their buttons side by side in the middle (Filament's default stacks them full width). */
.fi-modal > .fi-modal-window-ctn > .fi-modal-window .fi-modal-footer.fi-align-center .fi-modal-footer-actions {
    flex-direction: row-reverse;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
}

.fi-modal > .fi-modal-window-ctn > .fi-modal-window .fi-modal-footer.fi-align-center .fi-btn {
    min-height: 2.5rem;
    margin: 0;
}

/* The sign-in and set-up card has NO backdrop-filter, transform or filter: any of those would turn this card
   into the containing block of a modal's fixed overlay and trap the popup inside it. */
.fi-simple-main {
    background: var(--glass-2);
    border: 1px solid var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* A section that holds a popup must not lift or blur either, for the same reason. */
.fi-section:has(.fi-modal),
.fi-section:has(.fi-modal):hover {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    transform: none;
}

/* ---------- Sidebar and top bar ---------- */
.fi-sidebar,
.fi-main-sidebar {
    background: var(--glass);
    border-right: 1px solid var(--edge);
    -webkit-backdrop-filter: blur(22px) saturate(170%);
    backdrop-filter: blur(22px) saturate(170%);
    box-shadow: none;
}

.dark .fi-sidebar, .dark .fi-main-sidebar { background: rgba(21, 10, 46, 0.55); }

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

.fi-topbar, .fi-topbar-ctn {
    background: var(--glass-2);
    border-bottom: 1px solid var(--edge);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    backdrop-filter: blur(20px) saturate(170%);
    box-shadow: none;
}

.dark .fi-topbar, .dark .fi-topbar-ctn { background: rgba(21, 10, 46, 0.6); }

.fi-sidebar-group-label { color: var(--ink-3); letter-spacing: 0.06em; }

.fi-sidebar-item-btn, .fi-sidebar-group-btn {
    border-radius: 99px;
    color: var(--ink-2);
    transition: color 0.3s, background 0.3s, padding 0.3s var(--ease);
}

.fi-sidebar-item-btn:hover { background: var(--row-hover); color: var(--ink); }

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn,
.fi-sidebar-item-btn[aria-current='page'] {
    color: var(--a1);
    background: var(--active-bg);
    box-shadow: inset 0 0 0 1px var(--active-ring);
}

/* ---------- Tables ---------- */
.fi-ta-ctn { overflow: hidden; }
.fi-ta-header-cell { background: var(--row-hover); color: var(--ink-2); }
.fi-ta-row { transition: background 0.25s, box-shadow 0.25s; }
.fi-ta-row:hover { background: var(--row-hover); box-shadow: inset 3px 0 0 var(--a1); }
.fi-ta-text, .fi-ta-cell { color: var(--ink); }

/* ---------- Buttons ---------- */
.fi-btn { transition: transform 0.4s var(--ease), box-shadow 0.4s, filter 0.3s; position: relative; overflow: hidden; }
.fi-btn:hover { transform: translateY(-2px); }
.fi-btn:active { transform: none; }

/* Primary buttons: accent gradient with a light sweep on hover */
.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-btn-outlined) {
    background-image: var(--grad);
    background-color: transparent;
    color: #fff;
    border: 0;
    box-shadow: 0 10px 26px -10px var(--a1);
}

.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-btn-outlined)::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.4), transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.8s var(--ease);
    pointer-events: none;
}

.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-btn-outlined):hover {
    box-shadow: 0 18px 36px -12px var(--a1), 0 0 26px var(--glow);
    filter: saturate(1.1);
}

.fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-btn-outlined):hover::after { transform: translateX(120%); }

/* ---------- Inputs ---------- */
.fi-input-wrp {
    background: var(--glass-2);
    border-radius: 14px;
    transition: box-shadow 0.3s, background 0.3s;
}

.fi-input-wrp:focus-within { box-shadow: 0 0 0 4px var(--glow), 0 8px 24px -12px var(--a1); }
.fi-input-wrp-label, .fi-fo-field-label-content { color: var(--ink-2); }

.fi-badge { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.fi-modal-window, .fi-dropdown-panel { box-shadow: var(--shadow-hover); }

/* ---------- Dashboard welcome card ---------- */
.meannt-welcome { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.meannt-welcome-greeting { font-size: 1.5rem; font-weight: 700; }
.meannt-welcome-role { color: var(--ink-3); font-size: 0.9rem; margin-top: 0.1rem; }
.meannt-welcome-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.meannt-chip {
    padding: 0.4rem 0.9rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--a1);
    border: 1px solid var(--active-ring);
    background: var(--glass-2);
    transition: transform 0.4s var(--ease), box-shadow 0.4s, border-color 0.3s;
}

.meannt-chip:hover { transform: translateY(-3px); border-color: var(--a3); box-shadow: 0 0 0 4px var(--glow), 0 10px 24px -12px var(--a1); }

/* ---------- Sign-in page ---------- */
.fi-simple-layout { background: transparent; }
.fi-simple-main { padding: 2.25rem; }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .fi-section, .fi-ta-ctn, .fi-wi-stats-overview-stat,
    .fi-sidebar, .fi-topbar { background: var(--glass-2); }
}

@media (prefers-reduced-motion: reduce) {
    .admin-spotlight { display: none; }
    .fi-section, .fi-wi-stats-overview-stat, .fi-btn, .fi-ta-row, .fi-sidebar-item-btn, .meannt-chip { transition: none; }
    .fi-section:hover, .fi-wi-stats-overview-stat:hover, .fi-btn:hover, .meannt-chip:hover { transform: none; }
}
