/*
 * Apofis admin look: glass panels, lime brand colour, turquoise accent.
 * Dark is the default, light is chosen from the user menu. Colours come from the
 * panel palette (AdminPanelProvider: LIME, GRAPHITE, info); this file adds what
 * Filament's own build has no setting for. The rules below are shared; the two
 * variable blocks decide how each mode looks. Loaded last.
 */

/* ---- Light mode values (default variables) ---- */
:root {
    --tv-lime: #c6ff3d;
    --tv-turquoise: #2de2e6;
    --tv-gradient: linear-gradient(120deg, var(--tv-lime) 0%, #7dffb0 55%, var(--tv-turquoise) 100%);
    --tv-radius: 1rem;

    /* A step darker than the white boxes so they stand out (2026-11-14). */
    --tv-bg: #e0e7e3;
    --tv-glow-a: rgb(45 226 230 / 0.16);
    --tv-glow-b: rgb(150 210 40 / 0.12);
    --tv-glass: rgb(255 255 255 / 0.84);
    --tv-glass-strong: rgb(255 255 255 / 0.96);
    --tv-line: rgb(15 35 25 / 0.1);
    --tv-line-strong: rgb(15 35 25 / 0.15);
    --tv-shadow: 0 16px 36px -24px rgb(20 50 30 / 0.35);
    --tv-shadow-strong: 0 24px 60px -24px rgb(20 50 30 / 0.4);
    --tv-login-glow: 0 20px 50px -24px rgb(20 60 30 / 0.35);
    --tv-bar: rgb(255 255 255 / 0.72);
    --tv-side: rgb(255 255 255 / 0.45);
    --tv-side-drawer: #f4f7f5;

    --tv-accent-text: #477a00;
    --tv-link: #0a868a;
    --tv-active-bg: rgb(15 35 25 / 0.055);
    --tv-active-edge: #5a9a00;
    --tv-active-ring: transparent;
    --tv-tab-active: rgb(15 35 25 / 0.06);
    --tv-row-hover: rgb(15 35 25 / 0.03);
    --tv-input: rgb(255 255 255 / 0.9);
    --tv-focus: #4f8f00;
    --tv-focus-halo: rgb(79 143 0 / 0.14);
    --tv-btn-gray: rgb(255 255 255 / 0.85);
    /* Orange buttons in light mode (2026-11-21): green ones blended into the green-grey page. */
    --tv-btn: linear-gradient(120deg, #ff9f43 0%, #ffb547 55%, #ffc94d 100%);
    --tv-btn-text: #3d1f00;
    --tv-btn-shadow: 0 0 0 1px rgb(200 100 0 / 0.3), 0 8px 20px -12px rgb(200 100 0 / 0.6);
    --tv-btn-shadow-hover: 0 0 0 1px rgb(200 100 0 / 0.45), 0 10px 24px -10px rgb(230 120 0 / 0.6);
    --tv-number: linear-gradient(120deg, #5c9c00, #0a9ca1);
    --tv-stat-edge: rgb(11 129 137 / 0.4);
    --tv-scroll: rgb(15 35 25 / 0.18);

    /* Titillium Web runs small: body text one step up (14 -> 15 px, small text 12 -> 13 px). */
    --text-sm: 0.9375rem;
    --text-sm--line-height: calc(1.35 / 0.9375);
    --text-xs: 0.8125rem;
    --text-xs--line-height: calc(1.1 / 0.8125);
}

/* ---- Dark mode values ---- */
.dark {
    --tv-bg: #0c100f;
    --tv-glow-a: rgb(45 226 230 / 0.10);
    --tv-glow-b: rgb(198 255 61 / 0.09);
    --tv-glass: rgb(34 42 39 / 0.74);
    --tv-glass-strong: rgb(30 37 34 / 0.92);
    --tv-line: rgb(255 255 255 / 0.10);
    --tv-line-strong: rgb(255 255 255 / 0.14);
    --tv-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.8);
    --tv-shadow-strong: 0 24px 60px -20px rgb(0 0 0 / 0.9);
    --tv-login-glow: 0 0 60px -20px rgb(198 255 61 / 0.35);
    --tv-bar: rgb(12 16 15 / 0.72);
    --tv-side: rgb(12 16 15 / 0.55);
    --tv-side-drawer: #111614;

    --tv-accent-text: var(--tv-lime);
    --tv-link: var(--tv-turquoise);
    --tv-active-bg: linear-gradient(90deg, rgb(198 255 61 / 0.16), rgb(45 226 230 / 0.06));
    --tv-active-edge: var(--tv-lime);
    --tv-active-ring: rgb(198 255 61 / 0.12);
    --tv-tab-active: rgb(198 255 61 / 0.12);
    --tv-row-hover: rgb(198 255 61 / 0.035);
    --tv-input: rgb(0 0 0 / 0.28);
    --tv-focus: var(--tv-lime);
    --tv-focus-halo: rgb(198 255 61 / 0.18);
    --tv-btn-gray: rgb(255 255 255 / 0.05);
    --tv-btn: var(--tv-gradient);
    --tv-btn-text: #08110a;
    --tv-btn-shadow: 0 0 0 1px rgb(198 255 61 / 0.25), 0 8px 24px -10px rgb(198 255 61 / 0.55);
    --tv-btn-shadow-hover: 0 0 0 1px rgb(198 255 61 / 0.4), 0 10px 30px -8px rgb(45 226 230 / 0.55);
    --tv-number: var(--tv-gradient);
    --tv-stat-edge: rgb(198 255 61 / 0.45);
    --tv-scroll: rgb(255 255 255 / 0.12);
}

/* ---- Background with a soft lime and turquoise glow ---- */
.fi-body {
    background-color: var(--tv-bg) !important;
    background-image:
        radial-gradient(60rem 40rem at 85% -10%, var(--tv-glow-a), transparent 60%),
        radial-gradient(50rem 36rem at -10% 110%, var(--tv-glow-b), transparent 60%);
    background-attachment: fixed;
}

/* ---- Glass surfaces ---- */
.fi-body .fi-section:not(.fi-section-not-contained),
.fi-body .fi-ta-ctn,
.fi-body .fi-wi-stats-overview-stat,
.fi-body .fi-simple-main,
.fi-body .fi-tabs:not(.fi-contained),
.fi-body .feedus-live-card {
    background-color: var(--tv-glass) !important;
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    backdrop-filter: blur(18px) saturate(140%);
    border-radius: var(--tv-radius);
    box-shadow: 0 0 0 1px var(--tv-line), var(--tv-shadow) !important;
}

/* Each blurred surface is its own stacking context, so a select list opened in one
   section would hide under the next one; the section being used comes first. */
.fi-body .fi-section:not(.fi-section-not-contained):focus-within,
.fi-body .fi-section:not(.fi-section-not-contained):has([aria-expanded="true"]) {
    position: relative;
    z-index: 20;
}

/* The live preview card (feedus-admin.css) has its own border; the glass ring replaces it. */
.fi-body .feedus-live-card { border-color: transparent; }

.fi-body .fi-dropdown-panel,
.fi-body .fi-modal-window,
.fi-body .fi-global-search-results-ctn {
    background-color: var(--tv-glass-strong) !important;
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    box-shadow: 0 0 0 1px var(--tv-line-strong), var(--tv-shadow-strong) !important;
}

.fi-body .fi-modal-window { border-radius: calc(var(--tv-radius) + 0.25rem); }

/* Login page: one floating glass card with a lime edge light. */
.fi-body .fi-simple-main {
    box-shadow: 0 0 0 1px var(--tv-line-strong), var(--tv-login-glow) !important;
}

/* ---- Topbar and sidebar ---- */
.fi-body .fi-topbar > nav,
.fi-body .fi-topbar {
    background-color: var(--tv-bar) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 var(--tv-line) !important;
}

.fi-body .fi-sidebar,
.fi-body .fi-sidebar-header {
    background-color: var(--tv-side) !important;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.fi-body .fi-sidebar { box-shadow: 1px 0 0 var(--tv-line); }

/* Below lg the sidebar opens as a drawer over Filament's dimmed backdrop; a
   see-through panel would pick up that grey, so the drawer is solid. */
@media (max-width: 1023.98px) {
    .fi-body .fi-sidebar,
    .fi-body .fi-sidebar-header {
        background-color: var(--tv-side-drawer) !important;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }

    .fi-body .fi-sidebar { box-shadow: 1px 0 0 var(--tv-line), var(--tv-shadow-strong); }
}
.fi-body .fi-sidebar-header { box-shadow: none !important; }

.fi-body .fi-sidebar-item-btn { border-radius: 0.7rem; }

.fi-body .fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: var(--tv-active-bg) !important;
    box-shadow: inset 2px 0 0 var(--tv-active-edge), 0 0 0 1px var(--tv-active-ring);
}

.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-body .fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: var(--tv-accent-text) !important;
}

.fi-body .fi-sidebar-group-label {
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-size: 0.68rem;
}

/* ---- Headings ---- */
.fi-body .fi-header-heading { letter-spacing: -0.02em; }

/* ---- Buttons: primary is a gradient (lime to turquoise in dark mode, orange in light) with dark text ---- */
/* Small radius like the element add buttons (2026-11-21). */
.fi-body .fi-btn { border-radius: 0.375rem; }

.fi-body .fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-link) {
    background: var(--tv-btn) !important;
    color: var(--tv-btn-text) !important;
    border: 0;
    box-shadow: var(--tv-btn-shadow);
    transition: filter 0.15s, box-shadow 0.15s;
}

.fi-body .fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-link) .fi-icon { color: var(--tv-btn-text) !important; }

.fi-body .fi-btn.fi-color-primary:not(.fi-outlined):not(.fi-link):hover {
    filter: brightness(1.05);
    box-shadow: var(--tv-btn-shadow-hover);
}

.fi-body .fi-btn.fi-color-gray:not(.fi-link) {
    background-color: var(--tv-btn-gray) !important;
    box-shadow: 0 0 0 1px var(--tv-line-strong) !important;
}

/* Links and link-style actions use the turquoise accent. */
.fi-body .fi-link.fi-color-primary,
.fi-body .fi-ta-text-item-label a,
.fi-body .fi-fo-field a,
.fi-body .fi-section a:not(.fi-btn):not(.fi-link) {
    color: var(--tv-link);
}

/* ---- Form fields ---- */
.fi-body .fi-input-wrp {
    background-color: var(--tv-input) !important;
    border-radius: 0.7rem;
}

.fi-body .fi-input-wrp:focus-within {
    --tw-ring-color: var(--tv-focus) !important;
    box-shadow: 0 0 0 1px var(--tv-focus), 0 0 0 4px var(--tv-focus-halo) !important;
}

/* ---- Tables ---- */
.fi-body .fi-ta-header-cell {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.7rem;
}

.fi-body .fi-ta-row:hover > td { background-color: var(--tv-row-hover); }

/* ---- Badges ---- */
.fi-body .fi-badge { border-radius: 999px; }

/* ---- Tabs ---- */
.fi-body .fi-tabs-item.fi-active { background: var(--tv-tab-active) !important; }

.fi-body .fi-tabs-item.fi-active .fi-tabs-item-label,
.fi-body .fi-tabs-item.fi-active .fi-icon {
    color: var(--tv-accent-text) !important;
}

/* ---- Dashboard numbers and avatars ---- */
.fi-body .fi-wi-stats-overview-stat { position: relative; }

.fi-body .fi-wi-stats-overview-stat-value {
    background: var(--tv-number);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent !important;
    letter-spacing: -0.03em;
}

.fi-body .fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset: 0 1.25rem auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--tv-stat-edge), transparent);
}

.fi-body .fi-avatar {
    background: var(--tv-btn);
    color: var(--tv-btn-text);
}

/* ---- Map: popups and controls follow the mode; dark mode also darkens the tiles ---- */
.fi-body .leaflet-popup-content-wrapper,
.fi-body .leaflet-popup-tip {
    background: var(--tv-glass-strong);
    box-shadow: 0 0 0 1px var(--tv-line-strong), var(--tv-shadow);
}

.dark .leaflet-container { background: #0c100f; }

.dark .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(0.82) contrast(0.92) saturate(0.35);
}

.dark .leaflet-popup-content-wrapper { color: #e7ece9; }

.dark .leaflet-bar a {
    background: var(--tv-glass-strong);
    color: #e7ece9;
    border-color: var(--tv-line);
}

.dark .leaflet-control-attribution {
    background: rgb(12 16 15 / 0.7) !important;
    color: #9aa59f;
}

.fi-body .leaflet-control-attribution a { color: var(--tv-link); }

/* ---- Scrollbars ---- */
.fi-body ::-webkit-scrollbar { width: 10px; height: 10px; }
.fi-body ::-webkit-scrollbar-track { background: transparent; }
.fi-body ::-webkit-scrollbar-thumb {
    background: var(--tv-scroll);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.fi-body ::-webkit-scrollbar-thumb:hover { background-color: rgb(150 210 20 / 0.45); }
