/* BlazorBlueprint design tokens (shadcn names) and the design language's tokens (docs/design-language.md).
   Light values sit on :root and dark values on html.dark, the class Blueprint's ThemeService puts on <html>.
   Everything else in the app reads these, so a colour changes here and nowhere else. Chart tokens are added when
   a consumer appears; --radius is owned by AddFleek in Program.cs because Blueprint writes it inline on <html>.
   Alert text colours (--alert-*-foreground) are left to Blueprint's defaults, which ship light and dark values.
   Variable reference: https://blazorblueprintui.com/docs/theming */
:root {
    --font-sans: "Roboto", "Helvetica", "Arial", sans-serif;

    --background: #f3f5f8;
    --foreground: #1d2433;
    --card: #ffffff;
    --card-foreground: #1d2433;
    --popover: var(--surface-raised);
    --popover-foreground: #1d2433;

    --primary: #1a6fcf;
    --primary-foreground: #ffffff;
    --secondary: #eef1f5;
    --secondary-foreground: #1d2433;
    --muted: #eef1f5;
    --muted-foreground: #667085;
    --accent: rgba(0, 0, 0, 0.06);
    --accent-foreground: #1d2433;
    --destructive: #f44336;
    --destructive-foreground: #ffffff;

    --border: #e3e7ed;
    --input: #c7ced9;
    --ring: var(--primary);

    --alert-success: #00c853;
    --alert-info: #2196f3;
    --alert-warning: #ff8324;
    --alert-danger: var(--destructive);

    --sidebar: #f8f9fb;
    --sidebar-foreground: #1d2433;
    --sidebar-accent: var(--accent);
}

html.dark {
    --background: #111318;
    --foreground: #e4e6eb;
    --card: #1c2027;
    --card-foreground: #e4e6eb;
    --popover-foreground: #e4e6eb;

    --primary: #5aa9f0;
    --primary-foreground: #0b1a2b;
    --secondary: #232831;
    --secondary-foreground: #e4e6eb;
    --muted: #232831;
    --muted-foreground: #98a2b3;
    --accent: rgba(255, 255, 255, 0.06);
    --accent-foreground: #e4e6eb;
    --destructive: #f64e62;

    --border: #2a303a;
    --input: #475061;

    --alert-success: #3dcb6c;
    --alert-info: #3299ff;

    --sidebar: #16191f;
    --sidebar-foreground: #e4e6eb;

    --surface-raised: color-mix(in srgb, var(--card) 94%, var(--foreground));
    --surface-section: color-mix(in srgb, var(--card) 96%, var(--foreground));
    --shadow-card: none;
    --shadow-raised: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-overlay: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 40px rgba(0, 0, 0, 0.5);
}

/* Tokens derived from the palette above, so they follow light and dark without a block of their own. */
:root {
    --alert-success-bg: color-mix(in srgb, var(--alert-success) 12%, var(--card));
    --alert-info-bg: color-mix(in srgb, var(--alert-info) 12%, var(--card));
    --alert-warning-bg: color-mix(in srgb, var(--alert-warning) 12%, var(--card));
    --alert-danger-bg: color-mix(in srgb, var(--alert-danger) 12%, var(--card));

    --sidebar-primary: var(--primary);
    --sidebar-primary-foreground: var(--primary-foreground);
    --sidebar-accent-foreground: var(--foreground);
    --sidebar-border: var(--border);
    --sidebar-ring: var(--primary);
    --sidebar-menu-button-active-bg: var(--tint-primary);
    --sidebar-menu-button-active-color: var(--primary);
    --sidebar-menu-button-active-font-weight: 600;

    --surface-page: var(--background);
    --surface-frame: var(--sidebar);
    --surface-card: var(--card);
    --surface-raised: var(--card);
    --surface-section: color-mix(in srgb, var(--card) 97%, var(--foreground));

    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-raised: 0 1px 3px rgba(16, 24, 40, 0.08), 0 4px 12px rgba(16, 24, 40, 0.06);
    --shadow-overlay: 0 12px 32px rgba(16, 24, 40, 0.16);

    --radius-card: 10px;
    --radius-control: 6px;

    --tint-primary: color-mix(in srgb, var(--primary) 12%, transparent);
    --tone-danger-bg: color-mix(in srgb, var(--alert-danger) 12%, var(--card));
    --tone-danger-fg: color-mix(in srgb, var(--alert-danger) 70%, var(--foreground));
    --tone-warning-bg: color-mix(in srgb, var(--alert-warning) 14%, var(--card));
    --tone-warning-fg: color-mix(in srgb, var(--alert-warning) 62%, var(--foreground));
    --tone-success-bg: color-mix(in srgb, var(--alert-success) 12%, var(--card));
    --tone-success-fg: color-mix(in srgb, var(--alert-success) 60%, var(--foreground));
    --tone-info-bg: color-mix(in srgb, var(--alert-info) 12%, var(--card));
    --tone-info-fg: color-mix(in srgb, var(--alert-info) 70%, var(--foreground));

    /* AppShell's header height (h-14). Page height calculations and the sticky referral mini-header measure from it. */
    --app-header-height: 56px;
}

/* Below 768px the sidebar is a sheet used by touch, so its rows grow to a 44px target; desktop keeps its density. */
@media (max-width: 767px) {
    :root {
        --sidebar-menu-button-height: 44px;
        --sidebar-sub-button-height: 40px;
    }
}

/* Sidebar group labels read as section headings, not items. data-sidebar is Blueprint's documented hook. */
.bb-scope [data-sidebar="group-label"] {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    font-size: 0.6875rem;
    color: var(--muted-foreground);
}

/* BbCardHeader stacks its children with space-y-1.5. Laid out as a row (flex-row), that bottom margin lifts every
   child but the last off the shared centre line, so a title and its actions never quite align. */
.bb-scope .bb\:space-y-1\.5:is(.flex-row, .fk\:flex-row) > * {
    margin-block: 0;
}

/* A Positive lab result is a finding, so its chosen radio takes the danger tone (LabResultRadioGroup).
   Blueprint fills a checked radio from --primary, so re-pointing the token recolours border, fill and ring. */
.bb-scope .lab-result-positive [role="radio"][aria-checked="true"] {
    --primary: var(--tone-danger-fg);
    --ring: var(--tone-danger-fg);
}

/* An organ recovery card carries its organ's colour (OrganScope) as a ribbon: the true colour as a top edge and a
   swatch beside the title, so pages are told apart at a glance, and a light wash behind the header. The wash is
   mixed with the card surface so it follows light and dark mode. */
.bb-scope .organ-tint > .bb\:bg-card {
    border-block-start: 6px solid var(--organ-color);
}

.bb-scope .organ-tint > .bb\:bg-card > div:first-child {
    background-color: color-mix(in srgb, var(--organ-color) 14%, var(--card));
    border-start-start-radius: inherit;
    border-start-end-radius: inherit;
    margin-block-end: 1.5rem;
}

.bb-scope .organ-tint .organ-swatch {
    display: inline-block;
    inline-size: 0.875rem;
    block-size: 0.875rem;
    margin-inline-end: 0.625rem;
    vertical-align: -0.05em;
    border-radius: 4px;
    background-color: var(--organ-color);
    box-shadow: 0 0 0 1px rgb(0 0 0 / 0.12);
}

/* Globals Blueprint's components assume (shadcn convention). They live in the base layer so app.css keeps
   precedence over them. */
@layer base {
    * {
        border-color: var(--border);
    }

    body {
        background-color: var(--background);
        color: var(--foreground);
    }
}

/* Unacknowledged confidential alerts open in a dialog that must hide the referral behind it, so its overlay
   blurs the page. BbDialogProvider's overlay carries no hook of its own;
   the dialog body's data attribute picks it out while that dialog is open. */
body:has([data-confidential-alerts]) .bb\:fixed.bb\:inset-0.bb\:z-50 {
    backdrop-filter: blur(10px);
}

/* The Candidacy Dashboard's tables and schedule hold many rows, each with person and shift pickers. A
   data-candidacy-compact wrapper shrinks those pickers' triggers from Blueprint's h-10 px-3 so a row stays one line
   of text tall, and keeps a long name on that line rather than wrapping it out of the trigger. */
.bb-scope [data-candidacy-compact] button[role="combobox"] {
    height: 1.75rem;
    padding-inline: 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
}