/* =========================================================================
   GOOGLE WORKSPACE INSPIRED ERP DESIGN LAYOUT SYSTEM  (light + dark)
   Every colour comes from the MudBlazor theme (MudThemeProvider writes --mud-palette-* for the
   ACTIVE mode), so toggling dark mode restyles this file too. The fallbacks are the light values.
   ========================================================================= */

:root {
    --md-primary-blue: var(--mud-palette-primary, #1a73e8);
    --md-border-clean: var(--mud-palette-lines-default, #dadce0);
    --md-text-dark: var(--mud-palette-text-primary, #202124);
    --md-text-muted: var(--mud-palette-text-secondary, #5f6368);
    /* a quiet tint of the text colour over the surface: light grey in light mode, lighter charcoal in dark mode */
    --md-surface-gray: color-mix(in srgb, var(--mud-palette-surface, #ffffff) 94%, var(--md-text-dark));
    --md-nav-active: color-mix(in srgb, var(--md-primary-blue) 14%, transparent);
    /* black-based so the lift is visible on charcoal as well as white */
    --md-shadow: 0 1px 3px 0 color-mix(in srgb, #000 30%, transparent), 0 4px 8px 3px color-mix(in srgb, #000 15%, transparent);
    /* matches the Typography in MainLayout (Google Sans is used when installed, otherwise Roboto) */
    --md-font-family: 'Google Sans', 'Roboto', 'Segoe UI', Helvetica, Arial, sans-serif;
}

body {
    font-family: var(--md-font-family);
    color: var(--md-text-dark);
    background-color: var(--mud-palette-background, #ffffff);
    -webkit-font-smoothing: antialiased;
}

/* Sidebar Nav Customizations */
.mud-nav-link {
    font-family: var(--md-font-family) !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    letter-spacing: 0.25px;
    color: var(--md-text-muted) !important;
    border-radius: 0 24px 24px 0 !important;
    margin-right: 8px;
}

    .mud-nav-link.active {
        background-color: var(--md-nav-active) !important;
        color: var(--md-primary-blue) !important;
    }

    .mud-nav-link:hover:not(.active) {
        background-color: var(--md-surface-gray) !important;
        color: var(--md-text-dark) !important;
    }

/* App bar (the bar itself is also themed by MudThemeProvider; this only adds the Workspace look) */
.md-workspace-bar {
    background-color: var(--mud-palette-appbar-background, #ffffff) !important;
    color: var(--mud-palette-appbar-text, #202124) !important;
    border-bottom: 1px solid var(--md-border-clean) !important;
    box-shadow: none !important;
}

/* Account / workspace menu in the bar */
.kz-workspace-activator {
    cursor: pointer;
    border-radius: 24px;
    padding-right: 8px !important;
}

    .kz-workspace-activator:hover {
        background-color: var(--md-surface-gray);
    }

/* Data Table Standard Grid Layouts */
.mud-table-root {
    background-color: transparent !important; /* the Paper behind it supplies the surface colour in both modes */
}

.mud-table-head {
    background-color: var(--md-surface-gray) !important;
    border-bottom: 2px solid var(--md-border-clean) !important;
}

.mud-table-cell {
    font-family: var(--md-font-family) !important;
    color: inherit;
    border-bottom: 1px solid var(--md-border-clean) !important;
}

/* Interactive Floating Cards */
.md-dashboard-card {
    background-color: var(--mud-palette-surface, #ffffff);
    border: 1px solid var(--md-border-clean) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    transition: box-shadow 0.2s ease-in-out;
}

    .md-dashboard-card:hover {
        box-shadow: var(--md-shadow) !important;
    }

/* Report tables and figures: colours that stay readable in both themes */
.md-num {
    text-align: right;
}

.md-pos {
    font-weight: 700;
    color: var(--mud-palette-success);
}

.md-neg {
    color: var(--mud-palette-error);
}

.md-total-row td {
    background-color: var(--md-surface-gray);
    border-top: 2px solid var(--md-border-clean);
    font-weight: 700;
}

.md-total-row .md-total {
    color: var(--md-primary-blue);
}

/* Small screens: less side padding, and the account chip keeps its tap target */
@media (max-width: 600px) {
    .mud-main-content.px-6 { padding-left: 12px !important; padding-right: 12px !important; }
    .kz-workspace-activator { min-width: 44px; }

    /* App bar: one line. The name and business next to the avatar are hidden (MudStack's own d-flex used to beat d-none), and the title stays on one line. */
    .md-workspace-bar .mud-toolbar { flex-wrap: nowrap; padding-left: 4px; padding-right: 4px; }
    .md-workspace-bar .mud-typography { white-space: nowrap; }
    .md-workspace-bar .mud-typography-h6 { font-size: 1.05rem; margin-left: 4px !important; }
    .kz-workspace-activator .d-none.d-sm-flex { display: none !important; }

    /* Rows of buttons, switches and filters wrap instead of pushing the page wider than the screen.
       (MudStack renders as d-flex flex-row / flex-column, not as a mud-stack class.) A title block beside a button group takes its own line when they do not fit. */
    .mud-main-content .d-flex.flex-row { flex-wrap: wrap; }
    .mud-main-content .d-flex.flex-row.justify-space-between > .d-flex.flex-column { flex: 1 1 220px; min-width: 0; }

    /* Big headings and numbers a phone can hold */
    .mud-main-content .mud-typography-h4 { font-size: 1.6rem; line-height: 1.25; }
    .mud-main-content .mud-typography-h5 { font-size: 1.3rem; }

    /* Tables and wide forms scroll inside their own box, never the whole page */
    .mud-main-content .mud-table-container, .mud-main-content .mud-simple-table { overflow-x: auto; }
    .mud-dialog { margin: 8px; max-width: calc(100vw - 16px) !important; }
}

/* Tablets: a little less padding and the page title no larger than it needs to be */
@media (min-width: 601px) and (max-width: 960px) {
    .mud-main-content.px-6 { padding-left: 16px !important; padding-right: 16px !important; }
    .mud-main-content .d-flex.flex-row { flex-wrap: wrap; }
}

/* Phones and tablets: a field in a row keeps a readable width and the row wraps, instead of squeezing a date down to "11/22" */
@media (max-width: 960px) {
    .mud-main-content .d-flex.flex-row > .mud-input-control { min-width: 160px; }
}

/* Tabs: a little air between the tab bar and what is under it */
.mud-tabs-panels { padding-top: 12px; }

/* Phones: the page content gets the full width (the layout adds 24px each side, which is a tenth of a 390px screen) */
@media (max-width: 600px) {
    .mud-main-content.px-6 { padding-left: 8px !important; padding-right: 8px !important; }
    .mud-main-content .mud-container { padding-left: 0; padding-right: 0; }
}
