/* ─── 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', 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

.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;
}

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

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

/* 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: 12px;
}

/* ─── Bottom-sheet dialogs ───────────────────────────────────────
   Chrome for BottomSheetDialogComponent (selection / picker dialogs),
   and the design system's single framing boundary: below 720px the
   dialog paper docks to the bottom edge as a sheet with a grab handle;
   from 720px up it renders as a centered dialog. The paper is already
   a flex column with a pinned title, a scrolling .mud-dialog-content
   and pinned .mud-dialog-actions, so the sheet only caps its height.
   Multi-step intake flows opt into the full-page mobile treatment via
   bm-sheet--page (opened with BottomSheetDialogComponent.PageOptions);
   plain sheets are unaffected by the page/wide modifiers. */
.bm-sheet-handle {
    display: none;
}

/* Header row: [back] [title/subtitle] [step dots] [close]. The dots
   wrap to their own full-width row on the sheet (order pushes them
   past the close X) and sit inline as pills on the centered dialog. */
.bm-sheet-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bm-sheet-titles {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-width: 0;
}

.bm-sheet-back {
    display: inline-flex;
    align-items: center;
    border: none;
    background: none;
    padding: 4px 6px 4px 0;
    color: var(--mud-palette-primary);
    font-weight: 600;
    font-size: 0.8125rem;
    line-height: 1;
}

.bm-sheet-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    order: 5;
    flex-basis: 100%;
}

.bm-sheet-dot {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background-color: var(--mud-palette-lines-default);
}

.bm-sheet-dot--on {
    background-color: var(--mud-palette-primary);
}

/* Pinned footer (FooterContent slot): note left, buttons right on the
   centered dialog; the sheet hides the note + desktop-only buttons and
   the primary action stretches full width. */
.bm-sheet-foot {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.bm-sheet-note {
    font-size: 0.78125rem;
    color: var(--mud-palette-text-secondary);
    margin-right: auto;
    min-width: 0;
}

@media (max-width: 719.98px) {
    .mud-dialog.bm-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        margin: 0;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: calc(var(--mud-default-borderradius) * 3) calc(var(--mud-default-borderradius) * 3) 0 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        animation: bm-sheet-in 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
    }

    .mud-dialog.bm-sheet .bm-sheet-title {
        position: relative;
        padding-top: 24px;
    }

    .mud-dialog.bm-sheet .bm-sheet-handle {
        display: block;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 4px;
        border-radius: 999px;
        background-color: var(--mud-palette-gray-light);
    }

    .mud-dialog.bm-sheet .bm-sheet-desktop-only,
    .mud-dialog.bm-sheet .bm-sheet-note {
        display: none;
    }

    .mud-dialog.bm-sheet .mud-dialog-actions {
        border-top: 1px solid var(--mud-palette-lines-default);
        padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .mud-dialog.bm-sheet .bm-sheet-foot > .mud-button-root {
        flex: 1 1 auto;
    }

    /* Page variant: edge-to-edge full height, no handle; the back label
       stacks above the title like a screen's top bar. */
    .mud-dialog.bm-sheet.bm-sheet--page {
        top: 0;
        max-height: none;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .mud-dialog.bm-sheet.bm-sheet--page .bm-sheet-title {
        padding-top: 12px;
    }

    .mud-dialog.bm-sheet.bm-sheet--page .bm-sheet-handle {
        display: none;
    }

    .mud-dialog.bm-sheet.bm-sheet--page .bm-sheet-back {
        flex-basis: 100%;
        justify-content: flex-start;
    }

    .mud-dialog.bm-sheet.bm-sheet--page .mud-dialog-content::after {
        content: "";
        position: sticky;
        bottom: 0;
        display: block;
        height: 42px;
        margin-top: -42px;
        background: linear-gradient(to bottom, transparent, var(--mud-palette-surface));
        pointer-events: none;
    }
}

@media (min-width: 720px) {
    .mud-dialog.bm-sheet .bm-sheet-mobile-only,
    .mud-dialog.bm-sheet .bm-sheet-back--mobile {
        display: none;
    }

    .bm-sheet-dots {
        order: 0;
        flex-basis: auto;
    }

    .bm-sheet-dot {
        flex: none;
        width: 7px;
        height: 7px;
    }

    .bm-sheet-dot--on {
        width: 18px;
    }

    /* Page-variant centered dialog: 640px (760 wide) at a stable 616px height
       (GSRWDialog) so the frame doesn't jump between steps, bordered chrome,
       screen-tint body so cards read against it. */
    .mud-dialog.bm-sheet--page {
        max-width: 640px;
        height: 616px;
        max-height: calc(100dvh - 48px);
    }

    .mud-dialog.bm-sheet--page.bm-sheet--wide {
        max-width: 760px;
    }

    .mud-dialog.bm-sheet--page .bm-sheet-title {
        border-bottom: 1px solid var(--mud-palette-lines-default);
    }

    .mud-dialog.bm-sheet--page .mud-dialog-content {
        background-color: var(--mud-palette-background);
    }

    .mud-dialog.bm-sheet--page .mud-dialog-actions {
        border-top: 1px solid var(--mud-palette-lines-default);
    }

    .mud-dialog.bm-sheet--page .bm-sheet-close {
        border: 1px solid var(--mud-palette-lines-default);
        border-radius: 8px;
    }

    .mud-dialog.bm-sheet--page .mud-dialog-content::after {
        content: "";
        position: sticky;
        bottom: 0;
        display: block;
        height: 42px;
        margin-top: -42px;
        background: linear-gradient(to bottom, transparent, var(--mud-palette-background));
        pointer-events: none;
    }
}

/* The page variant's sticky bottom-fade overlays the last 42px of the scroll
   run — keep the final element clear of it so short or fully-scrolled content
   is never washed out. */
.mud-dialog.bm-sheet--page .mud-dialog-content > :last-child {
    margin-bottom: 42px;
}

@keyframes bm-sheet-in {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* 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;
}
