/* Manrope (variable), self-hosted: latin-ext for Polish diacritics + latin */
@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Manrope';
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url('../fonts/manrope-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --fr-blue: #00BAD5;
    --fr-navy: #001C49;
    --fr-pale: #E2F6FA;
    --fr-green: #80EDA3;
    --fr-pink: #C04377;
    --fr-orange: #F5A858;
    --fr-yellow: #F2EC94;
}

html, body {
    font-family: 'Manrope', system-ui, sans-serif;
}

/* ---------- boot screen (before WASM starts) ---------- */
.boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: radial-gradient(1200px 600px at 70% 20%, #0a3d6b 0%, var(--fr-navy) 60%);
    color: #fff;
}

.boot-logo { width: 220px; height: 62px; animation: boot-pulse 1.8s ease-in-out infinite; }
.boot-title { font-weight: 800; font-size: 28px; letter-spacing: -0.02em; margin-top: 18px; }
.boot-sub { opacity: .7; font-size: 14px; }
.boot-bar { width: 280px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 10px; }
.boot-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--fr-blue), var(--fr-green)); border-radius: 4px; transition: width .2s; }
.boot-pct { font-size: 12px; opacity: .6; font-variant-numeric: tabular-nums; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, ""); }

@keyframes boot-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .75; transform: scale(.97); } }

#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- app shell ---------- */
.froneri-logo { display: block; }
.appbar-logo { width: 118px; height: 33px; color: var(--fr-blue); }
.appbar-divider { width: 1px; height: 28px; background: rgba(255,255,255,.18); margin: 0 18px; }
.appbar-title { font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.appbar-sub { font-size: 12px; opacity: .65; }

.mud-drawer .mud-nav-link { border-radius: 10px; margin: 2px 10px; width: auto; font-weight: 600; }
.mud-drawer .mud-nav-link.active { background: rgba(0, 186, 213, .14); color: var(--fr-blue); }
.mud-drawer .mud-nav-link.active .mud-nav-link-icon { color: var(--fr-blue); }

.page { padding: 24px 28px 40px; max-width: 1680px; margin: 0 auto; }

.footer { text-align: center; font-size: 12px; opacity: .55; padding: 8px 0 24px; }
.footer b { font-weight: 700; }

/* ---------- hero ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 28px 32px;
    color: #fff;
    background: linear-gradient(120deg, var(--fr-navy) 0%, #033a73 45%, #0090b0 100%);
    box-shadow: 0 10px 30px rgba(0, 28, 73, .18);
}
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 4px; }
.hero p { opacity: .8; margin: 0; max-width: 720px; }
.hero .eyebrow { text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: .12em; color: var(--fr-green); }
.hero-bubble { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .22; animation: float 9s ease-in-out infinite; }
.hero-bubble.b1 { width: 260px; height: 260px; right: -60px; top: -90px; background: var(--fr-blue); }
.hero-bubble.b2 { width: 140px; height: 140px; right: 220px; bottom: -70px; background: var(--fr-green); animation-delay: -3s; }
.hero-bubble.b3 { width: 70px; height: 70px; right: 140px; top: 30px; background: var(--fr-pink); animation-delay: -6s; }
.hero-stats { display: flex; gap: 36px; margin-top: 18px; flex-wrap: wrap; }
.hero-stats div b { display: block; font-size: 22px; font-weight: 800; }
.hero-stats div span { font-size: 12px; opacity: .7; }

@keyframes float { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(14px) } }

/* ---------- cards ---------- */
.card {
    border-radius: 16px !important;
    padding: 18px 20px;
    height: 100%;
    transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 8px 28px rgba(0, 28, 73, .10) !important; }
.card-title { font-weight: 800; font-size: 16px; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; opacity: .65; }

.kpi { position: relative; overflow: hidden; }
.kpi-label { font-size: 12.5px; font-weight: 600; opacity: .7; padding-right: 44px; min-height: 34px; }
.kpi-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 4px; }
.kpi-delta { font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 2px; border-radius: 20px; padding: 1px 8px; }
.kpi-delta.up { color: #08780a; background: rgba(12, 163, 12, .12); }
.kpi-delta.down { color: #b42f2f; background: rgba(208, 59, 59, .12); }
.mud-theme-dark .kpi-delta.up { color: #52d452; }
.mud-theme-dark .kpi-delta.down { color: #f07a7a; }
.kpi-spark { margin: 6px -20px -18px; }
.kpi-icon { position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }

/* filter bar */
.filterbar { border-radius: 16px !important; padding: 10px 16px; position: sticky; top: 72px; z-index: 5; backdrop-filter: blur(10px); }
.filterbar .mud-input-control { margin-top: 0; }
.filterbar-sentinel { height: 0; }
.filterbar-compact { display: none; }
.filterbar-summary { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Narrow screens: once pinned under the app bar the bar collapses to one line; the toggle expands it */
@media (max-width: 959.98px) {
    .filterbar { top: 64px; }
    .filterbar.stuck { padding: 6px 8px 6px 14px; box-shadow: 0 6px 18px rgba(0, 28, 73, .14) !important; }
    .filterbar.stuck .filterbar-compact { display: flex; align-items: center; gap: 10px; }
    .filterbar.stuck:not(.open) .filterbar-body { display: none !important; }
    .filterbar.stuck .filterbar-icon { display: none; }
    .filterbar.stuck.open .filterbar-body { margin-top: 10px; padding-bottom: 6px; max-height: calc(100vh - 170px); overflow-y: auto; }
}

/* live ticker */
.ticker-item { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--mud-palette-lines-default); animation: slidein .5s ease-out; }
.ticker-item:last-child { border-bottom: 0; }
.ticker-time { font-size: 11.5px; opacity: .55; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ticker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fr-green); box-shadow: 0 0 0 4px rgba(128, 237, 163, .25); animation: pulse 1.6s infinite; display: inline-block; }
@keyframes slidein { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(128, 237, 163, .35); } 50% { box-shadow: 0 0 0 7px rgba(128, 237, 163, 0); } }

/* map */
.pl-map path { stroke: var(--mud-palette-surface); stroke-width: 1.5; cursor: pointer; transition: fill .6s ease, opacity .2s, filter .2s; }
.pl-map path:hover { filter: brightness(1.12) drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.pl-map path.dim { opacity: .28; }
.pl-map text { font-size: 11px; font-weight: 700; pointer-events: none; paint-order: stroke; stroke-width: 3px; }
.map-legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; opacity: .8; }
.map-legend .ramp { height: 8px; width: 180px; border-radius: 4px; }
.map-tip { position: absolute; pointer-events: none; padding: 8px 12px; border-radius: 10px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.18); z-index: 3; min-width: 170px; }

/* insights */
.insight { border-left: 4px solid transparent; }
.insight.risk { border-left-color: #d03b3b; }
.insight.opportunity { border-left-color: #0ca30c; }
.insight.anomaly { border-left-color: #fab219; }
.insight-impact { font-weight: 800; font-size: 18px; }
.insight-action { border-radius: 10px; padding: 10px 12px; font-size: 13px; background: rgba(0, 186, 213, .08); }

.num { font-variant-numeric: tabular-nums; }
.bar-cell { display: flex; align-items: center; gap: 8px; }
.bar-cell .bar { height: 6px; border-radius: 3px; background: var(--fr-blue); transition: width .6s ease; }

.apexcharts-tooltip { box-shadow: 0 6px 20px rgba(0,0,0,.14) !important; border-radius: 10px !important; }
.apexcharts-legend-text { font-family: 'Manrope', system-ui, sans-serif !important; }
h1:focus { outline: none; }

/* custom funnel (ordinal ramp, dark -> light) */
.funnel-row { display: grid; grid-template-columns: 1fr; margin-bottom: 10px; }
.funnel-bar { height: 30px; border-radius: 6px; display: flex; align-items: center; padding: 0 10px; font-weight: 800; font-size: 13px; transform-origin: left; animation: grow .9s cubic-bezier(.2,.8,.2,1) both; font-variant-numeric: tabular-nums; }
.funnel-label { font-size: 12.5px; margin-top: 3px; }
@keyframes grow { from { transform: scaleX(0); opacity: .3; } to { transform: scaleX(1); opacity: 1; } }
