/* Global site-wide styles for the Admin portal. Page/component-specific styles
   go under wwwroot/css/pages and wwwroot/css/components as those are built out
   in Phase 5 - nothing is ever inlined into .razor files. */

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* M3 buttons are pill-shaped (a signature trait of the Material 3 shape scale) - applied
   globally here rather than per-page, same as SpotlightAutos.Web's site.css. This portal
   starts on the M3 token system from day one instead of needing a second redesign pass
   like the Dealer Portal did. */
.mud-button-root {
    border-radius: var(--m3-shape-full);
}

/* Admin Portal app bar logo - the white/reversed logo variant, since the app bar
   background is navy in both light and dark palette (same as SpotlightAutos.Web). */
.app-bar-logo {
    height: 32px;
    display: block;
}

/* "Bold SaaS dashboard" pass, applied globally so every page picks it up without a
   per-page edit: Sora on every heading level (page titles, panel/card titles, dialog
   titles), and a gradient app bar instead of a flat fill. Card/table elevation itself
   stays on the M3 --m3-shadow-card token (see kpi-tile.css/admin-tables.css) rather than
   being redefined here. */
.mud-typography-h4,
.mud-typography-h5,
.mud-typography-h6 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.admin-appbar {
    background-image: var(--m3-gradient-hero);
}


/* Central error capture (SpotlightAutos.Shared.Diagnostics): the friendly message that replaces a page that threw, and the /Error page */
.app-error-boundary,
.app-error-page {
    max-width: 640px;
    margin: 48px auto;
    padding: 24px 28px;
    border: 1px solid var(--sa-line, rgba(127, 127, 127, 0.35));
    border-radius: 12px;
    background: var(--sa-surface, transparent);
}

.app-error-boundary h2,
.app-error-page h1 {
    margin-top: 0;
    font-size: 1.4rem;
}

.app-error-boundary__ref {
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(127, 127, 127, 0.18);
    font-size: 1.05rem;
    letter-spacing: 0.06em;
}

.app-error-boundary__button {
    margin-right: 16px;
    padding: 8px 18px;
    border: 1px solid currentColor;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.app-error-page__small {
    margin-bottom: 0;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Issues page (error capture): the facts list and the monospace stack trace boxes */
.issue-facts {
    display: grid;
    gap: 6px;
    margin: 0 0 12px;
}

.issue-facts > div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 12px;
}

.issue-facts dt {
    opacity: 0.7;
    font-size: 0.85rem;
}

.issue-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.issue-pre {
    max-height: 340px;
    overflow: auto;
    margin: 4px 0 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(127, 127, 127, 0.14);
    font-size: 0.78rem;
    white-space: pre;
}

/* Header actions (My Profile / Log out): the logout form must not add its own spacing inside the app bar */
.admin-appbar__logout {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

/* Words on a normal screen, icons only on a phone (works on static pages too, unlike MudHidden) */
.admin-appbar__narrow {
    display: none;
}

@media (max-width: 599.98px) {
    .admin-appbar__wide {
        display: none;
    }

    .admin-appbar__narrow {
        display: inline-flex;
    }
}


/* Insights dashboard (SpotlightAutos.Shared/UiShared/InsightsDashboard.razor) - colours come from the surrounding theme so it works light or dark */
.ins { display: block; }
.ins-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 16px; }
.ins-muted { opacity: 0.7; font-size: 0.85rem; }
.ins-h { margin: 28px 0 6px; font-size: 1.25rem; }
.ins-h3 { margin: 0 0 8px; font-size: 1rem; }
.ins-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.ins-kpi { padding: 14px 16px; border: 1px solid rgba(127, 127, 127, 0.35); border-radius: 10px; }
.ins-kpi--warn { border-color: #e0a100; }
.ins-kpi__label { font-size: 0.8rem; opacity: 0.75; }
.ins-kpi__value { font-size: 1.7rem; font-weight: 600; line-height: 1.2; }
.ins-kpi__note { font-size: 0.78rem; opacity: 0.7; }
.ins-funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; }
.ins-bar { display: grid; grid-template-columns: minmax(150px, 1.2fr) 2fr 56px 44px; align-items: center; gap: 8px; margin: 4px 0; font-size: 0.88rem; }
.ins-bar__track { height: 14px; border-radius: 7px; background: rgba(127, 127, 127, 0.2); overflow: hidden; }
.ins-bar__fill { height: 100%; border-radius: 7px; background: #3b82f6; }
.ins-bar__num { text-align: right; font-variant-numeric: tabular-nums; }
.ins-bar__step { opacity: 0.65; font-size: 0.78rem; }
.ins-scroll { overflow-x: auto; }
.ins-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ins-table th, .ins-table td { padding: 6px 10px; text-align: left; border-bottom: 1px solid rgba(127, 127, 127, 0.25); }
.ins-trend th, .ins-trend td { text-align: center; white-space: nowrap; }
.ins-trend tbody th { text-align: left; font-weight: 500; }
.ins-spark { display: flex; align-items: flex-end; justify-content: center; height: 34px; }
.ins-spark__bar { width: 14px; min-height: 2px; border-radius: 3px 3px 0 0; background: #3b82f6; }
.ins-spark__num { font-size: 0.72rem; opacity: 0.8; font-variant-numeric: tabular-nums; }
.ins-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.ins-card { padding: 14px 16px; border: 1px solid rgba(127, 127, 127, 0.35); border-radius: 10px; }
.ins-facts { margin: 0; display: grid; gap: 6px; }
.ins-facts > div { display: flex; justify-content: space-between; gap: 12px; }
.ins-facts dt { opacity: 0.75; }
.ins-facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.ins-warn { color: #d97706; font-weight: 600; }
.ins-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.ins-chip { padding: 4px 12px; border: 1px solid rgba(127, 127, 127, 0.5); border-radius: 999px; background: transparent; color: inherit; font: inherit; font-size: 0.82rem; cursor: pointer; }
.ins-chip--on { background: #3b82f6; border-color: #3b82f6; color: #fff; }
.ins-sev { padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; text-transform: uppercase; }
.ins-sev--high { background: #dc2626; color: #fff; }
.ins-sev--medium { background: #d97706; color: #fff; }
.ins-sev--low { background: rgba(127, 127, 127, 0.3); }
.ins-foot { margin-top: 28px; }
