/* ─── Design System: base-theme.css (mobile) ─────────────────────────
   Overrides MudBlazor defaults to match the BrandedMark design system.
   ─────────────────────────────────────────────────────────────────── */

:root {
    /* Mono family for IDs, dates, numeric counts, codes. Pair with
       --mud-typography-*-size for sizing. */
    --bm-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    /* The bm-tab-bar's own row, above the safe-area padding; a page under it clears this much. */
    --bm-tab-bar-height: 60px;
}

/* ─── Page gutters follow the theme's spacing scale ───────────────
   MudContainer's gutters are MudBlazor's own 16px / 24px (≥600px). They are re-pointed so page
   content stays aligned with the app bar and context bar, whose gutters read the same rungs. */
.mud-container--gutters {
    padding-left: var(--bm-spacing-lg);
    padding-right: var(--bm-spacing-lg);
}

@media (min-width: 600px) {
    .mud-container--gutters {
        padding-left: var(--bm-spacing-xl);
        padding-right: var(--bm-spacing-xl);
    }
}

.mud-button-outlined-default {
    border-color: var(--mud-palette-gray-light) !important;
}

/* Disable upper case for tabs. */
.mud-tab {
    text-transform: none !important;
}

/* ─── Chips: pill-shaped ─────────────────────────────────────── */
.mud-chip {
    border-radius: 999px !important;
    letter-spacing: -0.005em;
}

.mud-chip.mud-chip-size-small {
    height: 22px;
    font-size: 12px;
    font-weight: 500;
}

.mud-chip.mud-chip-size-medium {
    height: 26px;
    font-size: 12.5px;
    font-weight: 500;
}

/* Tooltip: repoint off the inverted gray-darker onto the Dark/DarkContrastText pair (dark mode contrast). */
.mud-tooltip.mud-tooltip-default {
    background-color: var(--mud-palette-dark);
    color: var(--mud-palette-dark-text);
}

.mud-tooltip.mud-tooltip-default.mud-tooltip-arrow::after {
    border-color: var(--mud-palette-dark) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) rgba(0, 0, 0, 0);
}

/* ─── Global search bar ──────────────────────────────────────── */
.app-search-bar .mud-input {
    height: 42px;
}

.app-search-bar.mud-input-control {
    background-color: var(--mud-palette-gray-lighter);
    margin-bottom: 5px;
    height: 42px;
    border-radius: var(--mud-default-borderradius);
}

.app-search-bar .mud-input.mud-input-outlined .mud-input-outlined-border {
    border: none;
    border-radius: var(--mud-default-borderradius);
}

.search-item-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ─── Select Components ──────────────────────────────────────── */
.bm-select {
    gap: 10px;
}

.bm-select > a {
    height: 45px;
    width: 80px;
    margin: 32px 0 0 0;
}

.bm-blob-img-td {
    width: 100%;
    display: inline-flex;
    justify-content: center;
}

/* ─── Sidebar / Drawer ──────────────────────────────────────────── */
.mud-drawer {
    border-right: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: none !important;
}

/* ─── App bar: flat, border-separated ───────────────────────────── */
.mud-appbar {
    box-shadow: none !important;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* ─── Presentation utilities ─────────────────────────────────────
       Lift inline `Style="cursor:…"` / `Style="opacity:…"` onto
       reusable classes so hover/focus pseudo-states stay reachable and
       MudBlazor theming is respected. Toggle via `Class="..."` rather
       than inline `Style`. Enforced by the
       blazor.inline-style-presentation semantic-review invariant. */
.bm-clickable {
    cursor: pointer;
}

/* An <a> wrapping a whole row: strips the link presentation so the row still looks like a row.
   Resets only — the element it sits on carries the padding and background. */
.bm-row-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* The same, for a link sitting inside a row rather than wrapping it, so no display change. */
.bm-inline-link {
    text-decoration: none;
    color: inherit;
}

.bm-row-link:focus-visible,
.bm-inline-link:focus-visible,
.bm-row-button:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
    border-radius: 12px;
}

/* De-emphasised text / icons (captions, secondary metadata). */
.bm-muted {
    opacity: 0.6;
}

/* Decorative / watermark icons sitting behind content. */
.bm-faint {
    opacity: 0.2;
}

/* Elements only meaningful on touch devices (phones/tablets) — e.g. "Take photo"
   camera-capture buttons, where desktop browsers ignore the `capture` attribute and the
   button would just duplicate the file picker. Hidden when the primary pointer is a
   mouse/trackpad (fine) or absent (none). */
@media (pointer: fine), (pointer: none) {
    .bm-touch-only {
        display: none !important;
    }
}

/* Inverse of bm-touch-only: elements replaced by a touch-specific variant on phones/tablets
   (e.g. the picker-only button a camera-primary layout supersedes). */
@media (pointer: coarse) {
    .bm-pointer-only {
        display: none !important;
    }
}

/* Selected-row highlight for picker tables (person/company search panels). Applied to the
   row via MudTable's RowClassFunc; overrides striped/hover cell backgrounds. */
.bm-row-selected td {
    background-color: var(--mud-palette-primary-lighten) !important;
}

/* Semibold weight for section headings / table cell titles (replaces inline
   Style="font-weight:600"). */
.bm-semibold {
    font-weight: 600;
}

/* Monospace for IDs, serials, codes, dates (pair with Typo.caption). */
.bm-mono {
    font-family: var(--bm-mono);
}

/* Tonal surface (tenant cards, summary panels): soft gray fill with rounded
   corners. Pair with MudPaper Elevation="0". */
.bm-tonal {
    background-color: var(--mud-palette-background-gray);
    border-radius: 8px;
}

/* Rounder bm-tonal variant for footer / hero cards. */
.bm-tonal-lg {
    border-radius: var(--bm-radius-lg);
}

/* ─── Bottom tab bar ─────────────────────────────────────────────
   Icon + label slots pinned to the bottom edge (the account nav below 720px, BRA-647). Each slot is
   the full height of the bar, label high in it: iPhone Safari's minimised address bar takes a tap near
   the bottom edge for itself. Outlined at rest, filled on a tinted pill when lit. */
.bm-tab-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    /* The shell bar's layer: under the chat sheet (800) and every dialog. */
    z-index: 700;
    display: flex;
    background: var(--mud-palette-surface);
    border-top: 1px solid var(--mud-palette-lines-default);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bm-tab {
    flex: 1 1 0;
    min-width: 0;
    height: var(--bm-tab-bar-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px 0;
    border: none;
    background: none;
    color: var(--mud-palette-text-secondary);
    font: inherit;
    font-size: 0.71875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.bm-tab:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: -2px;
}

.bm-tab-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 28px;
    border-radius: 14px;
}

.bm-tab-label {
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bm-tab--active {
    color: var(--bm-ink-primary);
    font-weight: 600;
}

.bm-tab--active .bm-tab-pill {
    background-color: var(--mud-palette-primary-hover);
    color: var(--mud-palette-primary);
}

/* Fixed-width inline filter inputs in list/grid toolbars. */
.bm-search-field {
    min-width: 200px;
    max-width: 320px;
}

.bm-filter-select {
    min-width: 180px;
    max-width: 280px;
}

.bm-filter-select-sm {
    max-width: 140px;
}

/* Preserve newlines/whitespace in rendered text (e.g. AI answer suggestions). */
.bm-prewrap {
    white-space: pre-wrap;
}

/* ─── Page heading focus ─────────────────────────────────────────
   FocusOnNavigate (Routes.razor) moves focus to the page's h1 so a screen reader announces the new
   page, giving it tabindex="-1". Chrome now draws a focus ring for that script focus. The heading can't be
   tabbed to, so the ring only ever marks a page load. */
h1[tabindex="-1"]:focus {
    outline: none;
}
