/* Global MudBlazor design overrides — flat, bordered, rounded.
   Ported from the SignageServer design system. The intent is to give the
   whole app a consistent look without per-page styling: kill shadows, use
   1px divider borders for separation, round corners to 8px, and apply
   pill-style chrome to nav links and tabs. */

/* ── Base ── */
body {
    background-color: var(--mud-palette-background);
}

/* ── Kill all shadows ── */
.mud-button-root,
.mud-fab,
.mud-tooltip,
.mud-picker,
.mud-picker-container,
.mud-select,
.mud-alert,
.mud-expansion-panels,
.mud-expansion-panel,
.mud-card,
.mud-paper,
.mud-dialog,
.mud-popover-paper,
.mud-snackbar,
.mud-table,
.mud-drawer {
    box-shadow: none !important;
}

/* ── Consistent border radius ── */
.mud-paper,
.mud-card,
.mud-dialog,
.mud-alert,
.mud-expansion-panel,
.mud-popover-paper,
.mud-snackbar,
.mud-picker-container {
    border-radius: 8px !important;
}

/* ── Borders on containers (not nested children) ── */
.mud-paper.mud-elevation-1,
.mud-paper.mud-elevation-2,
.mud-paper.mud-elevation-3,
.mud-paper.mud-elevation-4 {
    border: 1px solid var(--mud-palette-divider);
}

/* Tables — only when they are the top-level container */
.mud-table:not(.mud-paper .mud-table) {
    border: 1px solid var(--mud-palette-divider);
    border-radius: 8px !important;
}

/* Tables inside paper — no extra border */
.mud-paper .mud-table {
    border: none;
}

/* Softer table row dividers */
.mud-table .mud-table-row td {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

.dark-mode .mud-table .mud-table-row td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}

.mud-table .mud-table-row:last-child td {
    border-bottom: none;
}

/* Table header — subtle separation */
.mud-table .mud-table-head th {
    border-bottom: 1px solid var(--mud-palette-divider);
}

/* Progress bar — match container rounding */
.mud-progress-linear {
    border-radius: 6px !important;
}

/* ── Layout ── */

/* AppBar — subtle bottom border + translucent blur */
.mud-appbar {
    border-bottom: 1px solid var(--mud-palette-divider) !important;
}

/* AppBar honors the org's AppbarBackground from the theme but renders at
   80% opacity with a backdrop blur for the translucent flat-design feel.
   color-mix lets us reuse the theme variable directly so customised
   branding flows through automatically (light + dark modes both). */
.appbar-blur {
    background-color: color-mix(in srgb,
    var(--mud-palette-appbar-background) 80%,
    transparent) !important;
    color: var(--mud-palette-appbar-text) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Drawer — no border by default. overflow-x:hidden prevents the
   horizontal scrollbar that otherwise appears when the vertical
   scrollbar's gutter eats ~16px from a nav-link sized at width:100%
   by MudBlazor. */
.mud-drawer {
    border-right: none !important;
    overflow-x: hidden;
}

/* Right (AI / conversation) drawer: subtle 1px divider on its inline-start
   edge so it reads as separated from the main canvas. inline-start
   automatically flips in RTL to stay on the side facing the content. */
.mud-drawer.mud-drawer-pos-right {
    border-inline-start: 1px solid var(--mud-palette-divider) !important;
}
/* ── Overlays ── */
.mud-dialog {
    border: 1px solid var(--mud-palette-divider);
}

.mud-popover-paper,
.mud-popover,
.mud-popover.mud-paper {
    border: 1px solid var(--mud-palette-divider) !important;
}

.mud-snackbar {
    border: 1px solid var(--mud-palette-divider);
}

.mud-tooltip {
    border: 1px solid var(--mud-palette-divider);
}

.mud-picker-container {
    border: 1px solid var(--mud-palette-divider);
}

/* ── Components ── */

/* Tabs — pill style like nav menu */
.mud-tabs-tabbar,
.mud-tabs-tabbar-inner,
.mud-tabs-header {
    border-bottom: none !important;
    background-color: transparent !important;
}

.mud-tab {
    border-radius: 8px !important;
    margin: 0;
    min-height: unset !important;
    padding: 8px 16px !important;
    text-transform: none !important;
    font-weight: 400;
    letter-spacing: normal !important;
    transition: background-color 0.15s;
}

.mud-tab.mud-tab-active {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.08) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
}

.mud-tab:hover:not(.mud-tab-active) {
    background-color: var(--mud-palette-action-default-hover, rgba(0,0,0,0.04)) !important;
}

.mud-tabs-tabbar .mud-tooltip-root.mud-tooltip-inline {
    margin: 4px 6px;
}

.mud-tabs-tabbar .mud-tooltip-root.mud-tooltip-inline:first-child {
    margin-left: 0;
}

.mud-tabs-tabbar .mud-tooltip-root.mud-tooltip-inline:last-of-type {
    margin-right: 0;
}

/* Hide the default slider */
.mud-tab-slider {
    display: none !important;
}

/* Chips */
.mud-chip {
    border: 1px solid var(--mud-palette-divider);
}

/* Alert */
.mud-alert {
    border: 1px solid var(--mud-palette-divider);
}

/* Card */
.mud-card {
    border: 1px solid var(--mud-palette-divider);
}

/* Expansion panels */
.mud-expansion-panels {
    border: 1px solid var(--mud-palette-divider);
}

.mud-expansion-panel {
    border-bottom: 1px solid var(--mud-palette-divider);
}

.mud-expansion-panel:last-child {
    border-bottom: none;
}

/* ── Nav menu ── */
.mud-nav-link {
    margin: 4px 8px;
    border-radius: 8px !important;
    transition: background-color 0.15s;
}

/* .mud-nav-link.active — MudBlazor's own highlight, set from Href matching.
   .mud-nav-item.active — section switchers (Project Preferences, Lookup Settings, …) whose links
   have no Href: the page passes Class="active", and MudBlazor puts a user Class on the
   .mud-nav-item wrapper, not on the .mud-nav-link inside it. */
.mud-nav-link.active,
.mud-nav-item.active > .mud-nav-link,
.mud-nav-item.active > .mud-nav-link:hover {
    background-color: rgba(var(--mud-palette-primary-rgb), 0.08) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
}

.mud-nav-link:hover:not(.active) {
    background-color: var(--mud-palette-action-default-hover, rgba(0,0,0,0.04)) !important;
}

/* ── Mobile responsiveness ── */
@media (max-width: 599px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
}

/* Responsive page headers */
.mud-typography-h3 {
    font-size: clamp(1.5rem, 4vw, 2.5rem) !important;
}

.mud-typography-h4 {
    font-size: clamp(1.3rem, 3.5vw, 2rem) !important;
}

.mud-typography-h5 {
    font-size: clamp(1.15rem, 3vw, 1.5rem) !important;
}

.mud-typography-h6 {
    font-size: clamp(1rem, 2.5vw, 1.25rem) !important;
}

/* Hide redundant table toolbar labels on mobile */
@media (max-width: 599px) {
    .mud-table-toolbar .mud-typography {
        display: none;
    }
}

/* ── Dark mode logo invert ── */
.dark-mode .appbar-logo,
.dark-mode .banner-image {
    filter: invert(1) brightness(2);
}

/* ── Nav-drawer-aware column collapse ─────────────────────────────────────
   The docked left drawer eats ~240px of content width, which pushes a wide
   table's trailing Actions column off-screen. MainLayout stamps .lcs-nav-open
   on its content wrapper while the drawer is open; columns tagged secondary
   collapse for the duration. Close the nav menu to get the full table back.

   Tag BOTH the header and the body cell, or the columns misalign:
     MudDataGrid  HeaderClass="lcs-col-secondary" CellClass="lcs-col-secondary"
     MudTable     <MudTh Class="..."> AND the matching <MudTd Class="...">

   !important because MudBlazor's responsive-stack rule
   `.mud-xs-table .mud-table-cell{display:flex}` has identical (0,2,0)
   specificity — without it we'd depend on <link> order in App.razor.
   Never tag a column in a table that declares <ColGroup> — <col> is positional.
   If a grid ever grows a footer, add FooterClass too: MudBlazor's FooterCell
   reads Column.FooterClass, not CellClass.
   Dialogs need no opt-out: MudDialogProvider renders outside MudMainContent,
   so a dialog never inherits .lcs-nav-open. */
.lcs-nav-open .lcs-col-secondary {
    display: none !important;
}
